[JPEG 2000] Add support for resetContextProbabilities (bug 1731483)

This commit is contained in:
Jeff Muizelaar 2022-02-26 12:27:39 +01:00 committed by Jonas Jenwald
parent 4157d771c0
commit 9b9609a6d8
4 changed files with 19 additions and 5 deletions

View File

@ -337,9 +337,6 @@ class JpxImage {
if (cod.selectiveArithmeticCodingBypass) {
unsupported.push("selectiveArithmeticCodingBypass");
}
if (cod.resetContextProbabilities) {
unsupported.push("resetContextProbabilities");
}
if (cod.terminationOnEachCodingPass) {
unsupported.push("terminationOnEachCodingPass");
}
@ -1290,7 +1287,8 @@ function copyCoefficients(
delta,
mb,
reversible,
segmentationSymbolUsed
segmentationSymbolUsed,
resetContextProbabilities
) {
const x0 = subband.tbx0;
const y0 = subband.tby0;
@ -1356,6 +1354,11 @@ function copyCoefficients(
}
break;
}
if (resetContextProbabilities) {
bitModel.reset();
}
currentCodingpassType = (currentCodingpassType + 1) % 3;
}
@ -1404,6 +1407,8 @@ function transformTile(context, tile, c) {
const scalarExpounded = quantizationParameters.scalarExpounded;
const guardBits = quantizationParameters.guardBits;
const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
const resetContextProbabilities =
codingStyleParameters.resetContextProbabilities;
const precision = context.components[c].precision;
const reversible = codingStyleParameters.reversibleTransformation;
@ -1455,7 +1460,8 @@ function transformTile(context, tile, c) {
delta,
mb,
reversible,
segmentationSymbolUsed
segmentationSymbolUsed,
resetContextProbabilities
);
}
subbandCoefficients.push({

View File

@ -303,6 +303,7 @@
!issue14117.pdf
!issue5070.pdf
!issue5238.pdf
!jp2k-resetprob.pdf
!issue5244.pdf
!issue5291.pdf
!issue4398.pdf

Binary file not shown.

View File

@ -4922,6 +4922,13 @@
"rounds": 1,
"type": "eq"
},
{ "id": "jpx-resetContextProbabilities",
"file": "pdfs/jp2k-resetprob.pdf",
"md5": "fc9fb23e0a08d985b70cfb32fa9e9ca1",
"rounds": 1,
"type": "eq",
"about": "Fixes one part of bug 1731483."
},
{ "id": "bug1140761",
"file": "pdfs/bug1140761.pdf",
"md5": "b74eced7634d4f248dc6265f8225d432",