Browse code

Add lowres support to the libopenjpeg wrapper. Fixes issue 1097.

Originally committed as revision 18955 to svn://svn.ffmpeg.org/ffmpeg/trunk

Jai Menon authored on 2009/05/27 02:04:28
Showing 1 changed files
... ...
@@ -89,6 +89,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
89 89
     }
90 90
     opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
91 91
 
92
+    ctx->dec_params.cp_reduce = avctx->lowres;
92 93
     // Tie decoder with decoding parameters
93 94
     opj_setup_decoder(dec, &ctx->dec_params);
94 95
     stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
... ...
@@ -106,8 +107,8 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
106 106
         opj_destroy_decompress(dec);
107 107
         return -1;
108 108
     }
109
-    width  = image->comps[0].w;
110
-    height = image->comps[0].h;
109
+    width  = image->comps[0].w << avctx->lowres;
110
+    height = image->comps[0].h << avctx->lowres;
111 111
     if(avcodec_check_dimensions(avctx, width, height) < 0) {
112 112
         av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
113 113
         goto done;