Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 60341200B97 for ; Sun, 9 Oct 2016 14:02:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5EBB9160ADA; Sun, 9 Oct 2016 12:02:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 710E3160AC3 for ; Sun, 9 Oct 2016 14:02:22 +0200 (CEST) Received: (qmail 86310 invoked by uid 500); 9 Oct 2016 12:02:21 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 86298 invoked by uid 99); 9 Oct 2016 12:02:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Oct 2016 12:02:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7791218062B for ; Sun, 9 Oct 2016 12:02:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.679 X-Spam-Level: X-Spam-Status: No, score=0.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id wYKbNacuZ4UN for ; Sun, 9 Oct 2016 12:02:19 +0000 (UTC) Received: from mail-yb0-f182.google.com (mail-yb0-f182.google.com [209.85.213.182]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 530F75F307 for ; Sun, 9 Oct 2016 12:02:19 +0000 (UTC) Received: by mail-yb0-f182.google.com with SMTP id e2so29734904ybi.1 for ; Sun, 09 Oct 2016 05:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=jney2IDuzjIPVLEvDXwtQvR3DcS7wAF0NNAazSqaxdk=; b=wuYQflz6ry6RhAuGtFwWWdd3LW2wNmCXLEp301EiczxZdnr066JIztf0QxGuExX+xs Da4Lw307UtUhSUWG5mG4uiwS0UtxROEQyBoZe0KnbuZfQfoIGOcI/nFDFwQK6hVB75tP YFUe9AwIWWCoAX2wzd1gAHu6OKJmS0pnwX3zHSEIGZPJG/oqv0exwX7ShW1taBOEtxMH xFoOTFSK2/coPSW4SJuO+Cc4oI8uN/XAwST2xdhURQiFPq01rQX9BGUPiU6PbalaERiw DMQklTDutkluifTlBQBPHfOCS8PKrW83TfgGY4zpvBZfJR+nVGngR1omMDO2ObKF7GdR bPpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=jney2IDuzjIPVLEvDXwtQvR3DcS7wAF0NNAazSqaxdk=; b=j8kuhLYVpgXbQUazq40SB9yjgnGO4oT1sHPigd0nnP1zC3uvGhkEfGNxB9GubKtfaW Z4LwMYZ2gL7KGJ3oM2GctQDGLJXnF0q3MmYcWr5LIJdhfiIcv4okRhN7SVY4KjEuWphp NswL9seFXztonAeaLC/WkdCDdoBDpZqV+6LoMdvV3otruHoqdQ/MxucpVlsGK0ybLh9o V1punpIPlVGsZDrZbvcJUgdULgAhG+jq3SaYJ3CyKZiocSNI3IDcy/fa6GiMNUuoCo0x wEeE4wABRdf8gJko2sWwoRAHOkPMDOxwFraN8DTru2D8+2C+oYGGj1c4mrxYn2zWGuRB umaA== X-Gm-Message-State: AA6/9Rk1LehBVLz42DudbXT4TiR0FGtiJag9cGNZW68S4C1o3YRtuRSWh5A5bUgfkP+B/h9yv28VvWkqRY42Yg== X-Received: by 10.37.217.133 with SMTP id q127mr22527320ybg.23.1476014532766; Sun, 09 Oct 2016 05:02:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.93.195 with HTTP; Sun, 9 Oct 2016 05:02:12 -0700 (PDT) In-Reply-To: References: <20161009104652.02FCD3A0218@svn01-us-west.apache.org> From: sebb Date: Sun, 9 Oct 2016 13:02:12 +0100 Message-ID: Subject: Re: svn commit: r1763958 - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg: decoder/JpegDecoder.java segments/DhtSegment.java To: Commons Developers List Content-Type: text/plain; charset=UTF-8 archived-at: Sun, 09 Oct 2016 12:02:23 -0000 On 9 October 2016 at 12:53, sebb wrote: > On 9 October 2016 at 12:46, Benedikt Ritter wrote: >> Hello, >> >> schrieb am So., 9. Okt. 2016 um 12:46 Uhr: >> >>> Author: sebb >>> Date: Sun Oct 9 10:46:51 2016 >>> New Revision: 1763958 >>> >>> URL: http://svn.apache.org/viewvc?rev=1763958&view=rev >>> Log: >>> Simplify code and avoid exposing mutable array unnecessarily >>> >>> Modified: >>> >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java >>> >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java >>> >>> Modified: >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java >>> URL: >>> http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java?rev=1763958&r1=1763957&r2=1763958&view=diff >>> >>> ============================================================================== >>> --- >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java >>> (original) >>> +++ >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java >>> Sun Oct 9 10:46:51 2016 >>> @@ -423,13 +423,13 @@ public class JpegDecoder extends BinaryF >>> // "DECODE", section F.2.2.3, figure F.16, page 109 of T.81 >>> int i = 1; >>> int code = is.nextBit(); >>> - while (code > huffmanTable.getMaxCode()[i]) { >>> + while (code > huffmanTable.getMaxCode(i)) { >>> i++; >>> code = (code << 1) | is.nextBit(); >>> } >>> - int j = huffmanTable.getValPtr()[i]; >>> - j += code - huffmanTable.getMinCode()[i]; >>> - return huffmanTable.getHuffVal()[j]; >>> + int j = huffmanTable.getValPtr(i); >>> + j += code - huffmanTable.getMinCode(i); >>> + return huffmanTable.getHuffVal(j); >>> } >>> >>> public BufferedImage decode(final ByteSource byteSource) throws >>> IOException, >>> >>> Modified: >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java >>> URL: >>> http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java?rev=1763958&r1=1763957&r2=1763958&view=diff >>> >>> ============================================================================== >>> --- >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java >>> (original) >>> +++ >>> commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java >>> Sun Oct 9 10:46:51 2016 >>> @@ -32,7 +32,7 @@ public class DhtSegment extends Segment >>> // to avoid subtractions by one later when indexing them >>> public final int tableClass; >>> public final int destinationIdentifier; >>> - private final int[] bits; // 1-based >>> + private final int[] bits; // 1-based TODO UNUSED? >>> private final int[] huffVal; // 0-based >>> >>> // derived properties: >>> @@ -115,32 +115,32 @@ public class DhtSegment extends Segment >>> >>> } >>> >>> - public int[] getBits() { >>> - return bits; >>> - } >>> +// public int[] getBits() { UNUSED >>> +// return bits; >>> +// } >>> >> >> if the code is unused, I think we should delete it. >> > > Well yes, but if the code may be used via reflection, how can we tell? Or in other cases, it looks as tho' the code is only partially complete, so may be needed later. It's not always easy to tell why the code is currently unused. >>> >>> - public int[] getHuffVal() { >>> - return huffVal; >>> + public int getHuffVal(int i) { >>> + return huffVal[i]; >>> } >>> >>> - public int[] getHuffSize() { >>> - return huffSize; >>> - } >>> +// public int[] getHuffSize() { UNUSED >>> +// return huffSize; >>> +// } >>> >>> - public int[] getHuffCode() { >>> - return huffCode; >>> - } >>> +// public int[] getHuffCode() { UNUSED >>> +// return huffCode; >>> +// } >>> >>> - public int[] getMinCode() { >>> - return minCode; >>> + public int getMinCode(int i) { >>> + return minCode[i]; >>> } >>> >>> - public int[] getMaxCode() { >>> - return maxCode; >>> + public int getMaxCode(int i) { >>> + return maxCode[i]; >>> } >>> >>> - public int[] getValPtr() { >>> - return valPtr; >>> + public int getValPtr(int i) { >>> + return valPtr[i]; >>> } >>> } >>> >>> >>> >>> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org