diff mbox series

[FFmpeg-devel,3/3] libavcodec/jpeg2000: fix precinct coordinate calculation

Message ID 20200411064009.5321-3-gautamramk@gmail.com
State Accepted
Commit 995d937827dda228e68eeffca10feeea32463cf7
Headers show
Series [FFmpeg-devel,1/3] libavcodec/jpeg2000: fix cblk decode error check
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Gautam Ramakrishnan April 11, 2020, 6:40 a.m. UTC
From: Gautam Ramakrishnan <gautamramk@gmail.com>

The calculation of precinct boundaries has been
fixed. The precinct boundaries were calculated
as an offset to the band boundary, but must
instead be calculated as an offset from the
reslevel. This patch fixes #4669 and #4679.
---
 libavcodec/jpeg2000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer April 11, 2020, 4:23 p.m. UTC | #1
On Sat, Apr 11, 2020 at 12:10:09PM +0530, gautamramk@gmail.com wrote:
> From: Gautam Ramakrishnan <gautamramk@gmail.com>
> 
> The calculation of precinct boundaries has been
> fixed. The precinct boundaries were calculated
> as an offset to the band boundary, but must
> instead be calculated as an offset from the
> reslevel. This patch fixes #4669 and #4679.
> ---
>  libavcodec/jpeg2000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 3f50bf9fb3..73206d17f3 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -276,11 +276,11 @@  static int init_prec(Jpeg2000Band *band,
     /* TODO: Verify with previous count of codeblocks per band */
 
     /* Compute P_x0 */
-    prec->coord[0][0] = ((band->coord[0][0] >> log2_band_prec_width) + precno % reslevel->num_precincts_x) *
+    prec->coord[0][0] = ((reslevel->coord[0][0] >> reslevel->log2_prec_width) + precno % reslevel->num_precincts_x) *
                         (1 << log2_band_prec_width);
 
     /* Compute P_y0 */
-    prec->coord[1][0] = ((band->coord[1][0] >> log2_band_prec_height) + precno / reslevel->num_precincts_x) *
+    prec->coord[1][0] = ((reslevel->coord[1][0] >> reslevel->log2_prec_height) + precno / reslevel->num_precincts_x) *
                         (1 << log2_band_prec_height);
 
     /* Compute P_x1 */