This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new 498aabf  PDFBOX-6263: set capacity + optimize inner loop
498aabf is described below

commit 498aabfd2e489e190707cafbadabcc9f51aacce0
Author: Tilman Hausherr <[email protected]>
AuthorDate: Sun Sep 13 20:11:45 2026 +0200

    PDFBOX-6263: set capacity + optimize inner loop
---
 .../java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java 
b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
index b226084..d819bb4 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
@@ -549,13 +549,13 @@ public class SymbolDictionary implements Dictionary
             final int[] newSymbolsWidths)
     {
 
+        sbSymbols.ensureCapacity(amountOfDecodedSymbols);
+        int startColumn = 0;
         for (int i = heightClassFirstSymbol; i < amountOfDecodedSymbols; i++)
         {
-            int startColumn = 0;
-
-            for (int j = heightClassFirstSymbol; j <= i - 1; j++)
+            if (i > heightClassFirstSymbol)
             {
-                startColumn += newSymbolsWidths[j];
+                startColumn += newSymbolsWidths[i - 1];
             }
 
             final Rectangle roi = new Rectangle(startColumn, 0, 
newSymbolsWidths[i],

Reply via email to