[FFmpeg-devel] [PATCH] jpeg2000: use of lowres parameter from avcodec.h
Wolfgang Woehl
tito at online.de
Mon Apr 29 13:52:19 CEST 2013
Nicolas, can I bother you with asking how to apply this patch from email?
When I save this from "--- a/libavcodec/jpeg2000dec.c upto and excluding the sig and in the top dir of git repo run
$ patch -p0 < nicolas-jpeg2000dec-lowres.patch
I get
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/libavcodec/jpeg2000dec.c
|+++ b/libavcodec/jpeg2000dec.c
--------------------------
File to patch:
Ok, -pLevel alway throws me off. When I specify the file I get
patching file libavcodec/jpeg2000dec.c
patch: **** malformed patch at line 10: } Jpeg2000DecoderContext;
I could of course also display some patience. But I guess you know how it is. I'm excited as this is pretty huge functionality in my book.
Wolfgang
On 29.04.2013, at 11:15, Nicolas Bertrand <nicoinattendu at gmail.com> wrote:
> Suppression of lowres decoder option as it no more needed.
> ---
> libavcodec/jpeg2000dec.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 20e5c9c..c1bd772 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -86,9 +86,6 @@ typedef struct Jpeg2000DecoderContext {
> int16_t curtileno;
> Jpeg2000Tile *tile;
>
> - /*options parameters*/
> - int16_t lowres;
> - int16_t reduction_factor;
> } Jpeg2000DecoderContext;
>
> /* get_bits functions for JPEG2000 packet bitstream
> @@ -205,9 +202,9 @@ static int get_siz(Jpeg2000DecoderContext *s)
>
> /* compute image size with reduction factor */
> s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,
> - s->reduction_factor);
> + s->avctx->lowres);
> s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
> - s->reduction_factor);
> + s->avctx->lowres);
>
> switch (s->avctx->profile) {
> case FF_PROFILE_JPEG2000_DCINEMA_2K:
> @@ -254,10 +251,10 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
> c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution levels - 1
>
> /* compute number of resolution levels to decode */
> - if (c->nreslevels < s->reduction_factor)
> + if (c->nreslevels < s->avctx->lowres)
> c->nreslevels2decode = 1;
> else
> - c->nreslevels2decode = c->nreslevels - s->reduction_factor;
> + c->nreslevels2decode = c->nreslevels - s->avctx->lowres;
>
> c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width
> c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height
> @@ -1252,8 +1249,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
> s->buf_end = s->buf_start + avpkt->size;
> s->curtileno = 0; // TODO: only one tile in DCI JP2K. to implement for more tiles
>
> - // reduction factor, i.e number of resolution levels to skip
> - s->reduction_factor = s->lowres;
>
> ff_jpeg2000_init_tier1_luts();
>
> @@ -1301,12 +1296,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
> #define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
> #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
>
> -static const AVOption options[] = {
> - { "lowres", "Lower the decoding resolution by a power of two",
> - OFFSET(lowres), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },
> - { NULL },
> -};
> -
> static const AVProfile profiles[] = {
> { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, "JPEG 2000 codestream restriction 0" },
> { FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, "JPEG 2000 codestream restriction 1" },
> @@ -1319,7 +1308,6 @@ static const AVProfile profiles[] = {
> static const AVClass class = {
> .class_name = "jpeg2000",
> .item_name = av_default_item_name,
> - .option = options,
> .version = LIBAVUTIL_VERSION_INT,
> };
>
> @@ -1330,6 +1318,7 @@ AVCodec ff_jpeg2000_decoder = {
> .id = AV_CODEC_ID_JPEG2000,
> .capabilities = CODEC_CAP_FRAME_THREADS,
> .priv_data_size = sizeof(Jpeg2000DecoderContext),
> + .max_lowres = 31,
> .decode = jpeg2000_decode_frame,
> .priv_class = &class,
> .pix_fmts = (enum PixelFormat[]) { AV_PIX_FMT_XYZ12,
> --
> 1.7.9.5
More information about the ffmpeg-devel
mailing list