[FFmpeg-devel] [PATCH v4 2/2] libavcodec/jpeg2000dec: Support for PPM marker
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 24 22:18:54 EEST 2020
On Thu, Jul 23, 2020 at 10:41:11PM +0530, gautamramk at gmail.com wrote:
> From: Gautam Ramakrishnan <gautamramk at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200724/5fb86e35/attachment.sig>
More information about the ffmpeg-devel
mailing list