]> git.sesse.net Git - ffmpeg/commitdiff
lavc: Split out ff_hwaccel_pixfmt_list_420[] over individual codecs
authorRonald S. Bultje <rsbultje@gmail.com>
Mon, 18 Feb 2013 16:15:52 +0000 (08:15 -0800)
committerMartin Storsjö <martin@martin.st>
Wed, 6 Mar 2013 19:18:50 +0000 (21:18 +0200)
Not all hwaccels implement all codecs, so using one single list for
multiple such codecs means some codecs will be represented in the list,
even though they don't actually handle that codec. Copying specific
lists in each codec fixes that.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/h263.h
libavcodec/h263dec.c
libavcodec/h264.c
libavcodec/mpeg12.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/vc1dec.c

index e1e0dd7ded03f02ddb2000b462686ce6d94df2df..dec660eaa2a242e0bb1f9e9fd8a7e9023131be33 100644 (file)
@@ -64,6 +64,8 @@ extern uint8_t ff_mba_length[7];
 
 extern uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
 
+extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[];
+
 
 int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code);
 av_const int ff_h263_aspect_to_info(AVRational aspect);
index 663fe90244f700e4d82ec1fbdb41f421c6d3e4eb..9714632006e86b90d3123ef3770fd2263d2a6bd5 100644 (file)
@@ -738,6 +738,17 @@ av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
     return (ret && (avctx->err_recognition & AV_EF_EXPLODE))?ret:get_consumed_bytes(s, buf_size);
 }
 
+const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_VAAPI
+    AV_PIX_FMT_VAAPI_VLD,
+#endif
+#if CONFIG_VDPAU
+    AV_PIX_FMT_VDPAU,
+#endif
+    AV_PIX_FMT_YUV420P,
+    AV_PIX_FMT_NONE
+};
+
 AVCodec ff_h263_decoder = {
     .name           = "h263",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -750,5 +761,5 @@ AVCodec ff_h263_decoder = {
                       CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
     .flush          = ff_mpeg_flush,
     .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,
+    .pix_fmts       = ff_h263_hwaccel_pixfmt_list_420,
 };
index 0b22613bdfa9ceb0290f48a6b0c3ba4b44b08cd6..aa2b1a7910dc8a52ff21dfd5bfa8e708adc7e57a 100644 (file)
@@ -61,6 +61,23 @@ static const uint8_t div6[QP_MAX_NUM + 1] = {
     7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
 };
 
+static const enum AVPixelFormat h264_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_H264_DXVA2_HWACCEL
+    AV_PIX_FMT_DXVA2_VLD,
+#endif
+#if CONFIG_H264_VAAPI_HWACCEL
+    AV_PIX_FMT_VAAPI_VLD,
+#endif
+#if CONFIG_H264_VDA_HWACCEL
+    AV_PIX_FMT_VDA_VLD,
+#endif
+#if CONFIG_H264_VDPAU_HWACCEL
+    AV_PIX_FMT_VDPAU,
+#endif
+    AV_PIX_FMT_YUV420P,
+    AV_PIX_FMT_NONE
+};
+
 static const enum AVPixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = {
 #if CONFIG_H264_DXVA2_HWACCEL
     AV_PIX_FMT_DXVA2_VLD,
@@ -2823,7 +2840,7 @@ static enum PixelFormat get_pixel_format(H264Context *h)
                                         h->avctx->codec->pix_fmts :
                                         h->avctx->color_range == AVCOL_RANGE_JPEG ?
                                         hwaccel_pixfmt_list_h264_jpeg_420 :
-                                        ff_hwaccel_pixfmt_list_420);
+                                        h264_hwaccel_pixfmt_list_420);
         }
         break;
     default:
index 4df51a22a9ea5309fd5d88ce2d53303ee99efa4d..8aa31222b32d10739c05b3cd0f00fbc46c0ff586 100644 (file)
@@ -1176,6 +1176,20 @@ static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
     AV_PIX_FMT_XVMC_MPEG2_MC,
     AV_PIX_FMT_NONE };
 
+static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_MPEG2_DXVA2_HWACCEL
+    AV_PIX_FMT_DXVA2_VLD,
+#endif
+#if CONFIG_MPEG2_VAAPI_HWACCEL
+    AV_PIX_FMT_VAAPI_VLD,
+#endif
+#if CONFIG_MPEG1_VDPAU_HWACCEL | CONFIG_MPEG2_VDPAU_HWACCEL
+    AV_PIX_FMT_VDPAU,
+#endif
+    AV_PIX_FMT_YUV420P,
+    AV_PIX_FMT_NONE
+};
+
 static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
 {
     Mpeg1Context *s1 = avctx->priv_data;
@@ -1190,7 +1204,7 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
             return AV_PIX_FMT_VDPAU_MPEG2;
     } else {
         if (s->chroma_format <  2)
-            return avctx->get_format(avctx, ff_hwaccel_pixfmt_list_420);
+            return avctx->get_format(avctx, mpeg12_hwaccel_pixfmt_list_420);
         else if (s->chroma_format == 2)
             return AV_PIX_FMT_YUV422P;
         else
index ebc74a74b6bca701ca96580ed734aa35df983495..3f889932d20d6b0b9dd47dbb81c8cca9ab6ed970 100644 (file)
@@ -2270,7 +2270,7 @@ AVCodec ff_mpeg4_decoder = {
                              CODEC_CAP_FRAME_THREADS,
     .flush                 = ff_mpeg_flush,
     .long_name             = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
-    .pix_fmts              = ff_hwaccel_pixfmt_list_420,
+    .pix_fmts              = ff_h263_hwaccel_pixfmt_list_420,
     .profiles              = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
     .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context),
 };
index 08d4cbbf8f11376b79012781abbfc451cd66506d..96cb6a7ae51264d345488b417079b50a88df8137 100644 (file)
@@ -130,23 +130,6 @@ const enum AVPixelFormat ff_pixfmt_list_420[] = {
     AV_PIX_FMT_NONE
 };
 
-const enum AVPixelFormat ff_hwaccel_pixfmt_list_420[] = {
-#if CONFIG_DXVA2
-    AV_PIX_FMT_DXVA2_VLD,
-#endif
-#if CONFIG_VAAPI
-    AV_PIX_FMT_VAAPI_VLD,
-#endif
-#if CONFIG_VDA
-    AV_PIX_FMT_VDA_VLD,
-#endif
-#if CONFIG_VDPAU
-    AV_PIX_FMT_VDPAU,
-#endif
-    AV_PIX_FMT_YUV420P,
-    AV_PIX_FMT_NONE
-};
-
 static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
                               int (*mv)[2][4][2],
                               int mb_x, int mb_y, int mb_intra, int mb_skipped)
index cd11ecd92c15a0a790e00450a5bce56cda344973..7e031db821e0264848882d0fbd1a380e3fe13d1d 100644 (file)
@@ -802,7 +802,6 @@ void ff_MPV_motion(MpegEncContext *s,
 int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared);
 
 extern const enum AVPixelFormat ff_pixfmt_list_420[];
-extern const enum AVPixelFormat ff_hwaccel_pixfmt_list_420[];
 
 /**
  * permute block according to permuatation.
index 403bac8fffcfd0eecb84218e65ca505f94644652..6a76b1dc066f49f8fa88ed434af64c0db0863ff2 100644 (file)
@@ -5687,6 +5687,20 @@ static const AVProfile profiles[] = {
     { FF_PROFILE_UNKNOWN },
 };
 
+static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_DXVA2
+    AV_PIX_FMT_DXVA2_VLD,
+#endif
+#if CONFIG_VAAPI
+    AV_PIX_FMT_VAAPI_VLD,
+#endif
+#if CONFIG_VDPAU
+    AV_PIX_FMT_VDPAU,
+#endif
+    AV_PIX_FMT_YUV420P,
+    AV_PIX_FMT_NONE
+};
+
 AVCodec ff_vc1_decoder = {
     .name           = "vc1",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -5698,7 +5712,7 @@ AVCodec ff_vc1_decoder = {
     .flush          = ff_mpeg_flush,
     .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
     .long_name      = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
-    .pix_fmts       = ff_hwaccel_pixfmt_list_420,
+    .pix_fmts       = vc1_hwaccel_pixfmt_list_420,
     .profiles       = NULL_IF_CONFIG_SMALL(profiles)
 };
 
@@ -5714,7 +5728,7 @@ AVCodec ff_wmv3_decoder = {
     .flush          = ff_mpeg_flush,
     .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
-    .pix_fmts       = ff_hwaccel_pixfmt_list_420,
+    .pix_fmts       = vc1_hwaccel_pixfmt_list_420,
     .profiles       = NULL_IF_CONFIG_SMALL(profiles)
 };
 #endif