Re: [FFmpeg-devel] [PATCH v2 3/4] libavcodec/jpeg2000 Fix RPCL Progression order check

2020-07-16 Thread Michael Niedermayer
On Tue, Jul 14, 2020 at 10:13:15PM +0530, gautamr...@gmail.com wrote:
> From: Gautam Ramakrishnan 
> 
> The RPCL progression order check was incomplete. This
> patch completes the check. Tested on p1_07.j2k.
> ---
>  libavcodec/jpeg2000dec.c | 18 --
>  1 file changed, 12 insertions(+), 6 deletions(-)

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 3/4] libavcodec/jpeg2000 Fix RPCL Progression order check

2020-07-14 Thread gautamramk
From: Gautam Ramakrishnan 

The RPCL progression order check was incomplete. This
patch completes the check. Tested on p1_07.j2k.
---
 libavcodec/jpeg2000dec.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index adaac192e9..5ea6fd0b9a 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1395,22 +1395,28 @@ static int 
jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2
 uint8_t reducedresno = codsty->nreslevels - 1 
-reslevelno; //  ==> N_L - r
 Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;
 unsigned prcx, prcy;
+int trx0, try0;
 
-int xc = x / s->cdx[compno];
-int yc = y / s->cdy[compno];
+if (!s->cdx[compno] || !s->cdy[compno])
+return AVERROR_INVALIDDATA;
+
+trx0 = ff_jpeg2000_ceildiv(tile->coord[0][0], 
s->cdx[compno] << reducedresno);
+try0 = ff_jpeg2000_ceildiv(tile->coord[1][0], 
s->cdy[compno] << reducedresno);
 
 if (reslevelno >= codsty->nreslevels)
 continue;
 
-if (yc % (1LL << (rlevel->log2_prec_height + 
reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
+if (!(y % ((uint64_t)s->cdy[compno] << 
(rlevel->log2_prec_height + reducedresno)) == 0 ||
+ (y == tile->coord[1][0] && (try0 << reducedresno) 
% (1U << (reducedresno + rlevel->log2_prec_height)
 continue;
 
-if (xc % (1LL << (rlevel->log2_prec_width + 
reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
+if (!(x % ((uint64_t)s->cdx[compno] << 
(rlevel->log2_prec_width + reducedresno)) == 0 ||
+ (x == tile->coord[0][0] && (trx0 << reducedresno) 
% (1U << (reducedresno + rlevel->log2_prec_width)
 continue;
 
 // check if a precinct exists
-prcx   = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> 
rlevel->log2_prec_width;
-prcy   = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> 
rlevel->log2_prec_height;
+prcx   = ff_jpeg2000_ceildiv(x, s->cdx[compno] << 
reducedresno) >> rlevel->log2_prec_width;
+prcy   = ff_jpeg2000_ceildiv(y, s->cdy[compno] << 
reducedresno) >> rlevel->log2_prec_height;
 prcx  -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], 
reducedresno) >> rlevel->log2_prec_width;
 prcy  -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], 
reducedresno) >> rlevel->log2_prec_height;
 
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".