On Thu, Jul 23, 2020 at 10:41:11PM +0530, gautamr...@gmail.com wrote: > From: Gautam Ramakrishnan <gautamr...@gmail.com> > > This patch adds support for PPM marker for JPEG2000 > decoder. It allows the samples p1_03.j2k and p1_05.j2k > to be decoded. > --- > libavcodec/jpeg2000dec.c | 107 +++++++++++++++++++++++++++++++++++---- > 1 file changed, 97 insertions(+), 10 deletions(-) [...] > @@ -929,6 +936,31 @@ static int get_plt(Jpeg2000DecoderContext *s, int n) > return 0; > } > > +static int get_ppm(Jpeg2000DecoderContext *s, int n) > +{ > + void *new; > + > + if (n < 3) { > + av_log(s->avctx, AV_LOG_ERROR, "Invalid length for PPM data.\n"); > + return AVERROR_INVALIDDATA; > + } > + bytestream2_get_byte(&s->g); //Zppm is skipped and not used > + new = av_realloc(s->packed_headers, > + s->packed_headers_size + n - 3); > + if (new) { > + s->packed_headers = new; > + } else > + return AVERROR(ENOMEM); > + s->has_ppm = 1; > + memset(&s->packed_headers_stream, 0, sizeof(s->packed_headers_stream)); > + memcpy(s->packed_headers + s->packed_headers_size, > + s->g.buffer, n - 3); > + s->packed_headers_size += n - 3; > + bytestream2_skip(&s->g, n - 3);
bytestream2_get_buffer() should be simpler thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact
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".