[FFmpeg-devel] [PATCH]Implement max_lowres

Carl Eugen Hoyos cehoyos
Tue Jul 6 00:01:26 CEST 2010


Hi!

On Monday 05 July 2010 04:40:59 pm Michael Niedermayer wrote:

> > First version attached. Is there an API-change or Changelog entry needed?
> > Note that this should not be held back because of the obvious
> > regressions: ffmpeg -lowres is currently broken for default configure
> > anyway;-)

> i dont think mpeg1/2 are the only that support lowres

As I said, this should currently be no reason to delay this patch.

> [...]>      if(avctx->codec->init){
> 
> > +        if(avctx->codec->max_lowres < avctx->lowres){
> > +            av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres
> > supported by the decoder is %d\n", +                  
> > avctx->codec->max_lowres);
> > +        goto free_and_end;
> > +        }
> 
> indent..

New version attached. libopenjpeg always crashes for me with lowres>0.

Please comment, Carl Eugen
-------------- next part --------------
Index: libavcodec/rv10.c
===================================================================
--- libavcodec/rv10.c	(revision 24054)
+++ libavcodec/rv10.c	(working copy)
@@ -716,6 +716,7 @@
     rv10_decode_end,
     rv10_decode_frame,
     CODEC_CAP_DR1,
+    .max_lowres = 3,
     .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
     .pix_fmts= ff_pixfmt_list_420,
 };
@@ -731,6 +732,7 @@
     rv10_decode_frame,
     CODEC_CAP_DR1 | CODEC_CAP_DELAY,
     .flush= ff_mpeg_flush,
+    .max_lowres = 3,
     .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
     .pix_fmts= ff_pixfmt_list_420,
 };
Index: libavcodec/mjpegdec.c
===================================================================
--- libavcodec/mjpegdec.c	(revision 24054)
+++ libavcodec/mjpegdec.c	(working copy)
@@ -1542,6 +1542,7 @@
     ff_mjpeg_decode_frame,
     CODEC_CAP_DR1,
     NULL,
+    .max_lowres = 8,
     .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
 };
 
@@ -1556,5 +1557,6 @@
     ff_mjpeg_decode_frame,
     CODEC_CAP_DR1,
     NULL,
+    .max_lowres = 3,
     .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
 };
Index: libavcodec/mpeg12.c
===================================================================
--- libavcodec/mpeg12.c	(revision 24054)
+++ libavcodec/mpeg12.c	(working copy)
@@ -2511,6 +2511,7 @@
     mpeg_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush= flush,
+    .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
 };
 
@@ -2525,6 +2526,7 @@
     mpeg_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush= flush,
+    .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
 };
 
@@ -2540,6 +2542,7 @@
     mpeg_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush= flush,
+    .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
 };
 
Index: libavcodec/h263dec.c
===================================================================
--- libavcodec/h263dec.c	(revision 24054)
+++ libavcodec/h263dec.c	(working copy)
@@ -738,6 +738,7 @@
     ff_h263_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush= ff_mpeg_flush,
+    .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
     .pix_fmts= ff_hwaccel_pixfmt_list_420,
 };
Index: libavcodec/mpeg4videodec.c
===================================================================
--- libavcodec/mpeg4videodec.c	(revision 24054)
+++ libavcodec/mpeg4videodec.c	(working copy)
@@ -2245,6 +2245,7 @@
     ff_h263_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush= ff_mpeg_flush,
+    .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
     .pix_fmts= ff_hwaccel_pixfmt_list_420,
 };
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h	(revision 24054)
+++ libavcodec/avcodec.h	(working copy)
@@ -30,8 +30,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 79
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MINOR 80
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
@@ -2713,6 +2713,7 @@
     const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
     const enum SampleFormat *sample_fmts;   ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
     const int64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
+    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
 } AVCodec;
 
 /**
Index: libavcodec/dv.c
===================================================================
--- libavcodec/dv.c	(revision 24054)
+++ libavcodec/dv.c	(working copy)
@@ -1304,6 +1304,7 @@
     dvvideo_decode_frame,
     CODEC_CAP_DR1,
     NULL,
+    .max_lowres = 3,
     .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
 };
 #endif
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c	(revision 24054)
+++ libavcodec/utils.c	(working copy)
@@ -513,6 +513,12 @@
     }
     avctx->frame_number = 0;
     if(avctx->codec->init){
+        if(avctx->codec->max_lowres < avctx->lowres){
+            av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
+                   avctx->codec->max_lowres);
+            goto free_and_end;
+        }
+
         ret = avctx->codec->init(avctx);
         if (ret < 0) {
             goto free_and_end;



More information about the ffmpeg-devel mailing list