[SCM] libav/experimental: Approved hunks for VAAPI / our new shiny hwaccel API by Gwenole Beauchesne gbeauchesne splitted desktop com

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:39:17 UTC 2013


The following commit has been merged in the experimental branch:
commit c269cf68a0d1579f41e082288072e3f182ef2b5f
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Mon Feb 23 13:35:52 2009 +0000

    Approved hunks for VAAPI / our new shiny hwaccel API
    by Gwenole Beauchesne gbeauchesne splitted desktop com
    
    Originally committed as revision 17539 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 824153b..84e1bee 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -57,6 +57,7 @@ typedef struct PixFmtInfo {
     uint8_t color_type;      /**< color type (see FF_COLOR_xxx constants) */
     uint8_t pixel_type;      /**< pixel storage type (see FF_PIXEL_xxx constants) */
     uint8_t is_alpha : 1;    /**< true if alpha can be specified */
+    uint8_t is_hwaccel : 1;  /**< true if this is an HW accelerated format */
     uint8_t x_chroma_shift;  /**< X chroma subsampling factor is 2 ^ shift */
     uint8_t y_chroma_shift;  /**< Y chroma subsampling factor is 2 ^ shift */
     uint8_t depth;           /**< bit depth of the color components */
@@ -279,24 +280,31 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
     },
     [PIX_FMT_XVMC_MPEG2_MC] = {
         .name = "xvmcmc",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_XVMC_MPEG2_IDCT] = {
         .name = "xvmcidct",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_VDPAU_MPEG1] = {
         .name = "vdpau_mpeg1",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_VDPAU_MPEG2] = {
         .name = "vdpau_mpeg2",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_VDPAU_H264] = {
         .name = "vdpau_h264",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_VDPAU_WMV3] = {
         .name = "vdpau_wmv3",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_VDPAU_VC1] = {
         .name = "vdpau_vc1",
+        .is_hwaccel = 1,
     },
     [PIX_FMT_UYYVYY411] = {
         .name = "uyyvyy411",
@@ -459,6 +467,11 @@ void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt)
     }
 }
 
+int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
+{
+    return pix_fmt_info[pix_fmt].is_hwaccel;
+}
+
 int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
     int i;
 
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3438582..10e4632 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -26,6 +26,7 @@
  */
 
 //#define DEBUG
+#include "internal.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
@@ -1303,6 +1304,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
         avctx->pix_fmt = mpeg_get_pixelformat(avctx);
         //until then pix_fmt may be changed right after codec init
         if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
+            avctx->hwaccel ||
             s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
             if( avctx->idct_algo == FF_IDCT_AUTO )
                 avctx->idct_algo = FF_IDCT_SIMPLE;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e367874..168fbac 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -955,7 +955,8 @@ void MPV_frame_end(MpegEncContext *s)
     //just to make sure that all data is rendered.
     if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
         ff_xvmc_field_end(s);
-    }else if(!(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+    }else if(!s->avctx->hwaccel
+       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
        && s->unrestricted_mv
        && s->current_picture.reference
        && !s->intra_only
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 215029d..2ae5ce4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -391,7 +391,9 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v
     return 0;
 }
 
-enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt){
+enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt){
+    while (*fmt != PIX_FMT_NONE && ff_is_hwaccel_pix_fmt(*fmt))
+        ++fmt;
     return fmt[0];
 }
 
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index cda1f42..96139a8 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -25,6 +25,7 @@
  * VC-1 and WMV3 decoder
  *
  */
+#include "internal.h"
 #include "dsputil.h"
 #include "avcodec.h"
 #include "mpegvideo.h"

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list