[FFmpeg-cvslog] vc-1: Add platform-specific start code search routine to VC1DSPContext.

Ben Avison git at videolan.org
Tue Aug 5 13:14:49 CEST 2014


ffmpeg | branch: master | Ben Avison <bavison at riscosopen.org> | Mon Jul 21 14:53:08 2014 +0100| [adf8227cf4e7b4fccb2ad88e1e09b6dc00dd00ed] | committer: Luca Barbato

vc-1: Add platform-specific start code search routine to VC1DSPContext.

Initialise VC1DSPContext for parser as well as for decoder.
Note, the VC-1 code doesn't actually use the function pointer yet.

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=adf8227cf4e7b4fccb2ad88e1e09b6dc00dd00ed
---

 configure                        |    4 ++--
 libavcodec/Makefile              |    2 +-
 libavcodec/arm/vc1dsp_init_arm.c |    3 +++
 libavcodec/vc1.c                 |    2 ++
 libavcodec/vc1dec.c              |    1 -
 libavcodec/vc1dsp.c              |    3 +++
 libavcodec/vc1dsp.h              |    8 ++++++++
 7 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 4fc1e6a..b2eb0c8 100755
--- a/configure
+++ b/configure
@@ -1885,7 +1885,7 @@ twinvq_decoder_select="mdct lsp sinewin"
 utvideo_decoder_select="bswapdsp"
 utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
 vble_decoder_select="huffyuvdsp"
-vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp"
+vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp startcode"
 vc1image_decoder_select="vc1_decoder"
 vorbis_decoder_select="mdct"
 vorbis_encoder_select="mdct"
@@ -1963,7 +1963,7 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 h264_parser_select="h264_decoder"
 mpegvideo_parser_select="mpegvideo"
 mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
-vc1_parser_select="mpegvideo"
+vc1_parser_select="mpegvideo startcode"
 
 # external libraries
 libfaac_encoder_deps="libfaac"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7d19e6e..d59bd1c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -674,7 +674,7 @@ OBJS-$(CONFIG_PNM_PARSER)              += pnm_parser.o pnm.o
 OBJS-$(CONFIG_RV30_PARSER)             += rv34_parser.o
 OBJS-$(CONFIG_RV40_PARSER)             += rv34_parser.o
 OBJS-$(CONFIG_TAK_PARSER)              += tak_parser.o tak.o
-OBJS-$(CONFIG_VC1_PARSER)              += vc1_parser.o vc1.o vc1data.o \
+OBJS-$(CONFIG_VC1_PARSER)              += vc1_parser.o vc1.o vc1data.o vc1dsp.o \
                                           msmpeg4.o msmpeg4data.o mpeg4video.o \
                                           h263.o
 OBJS-$(CONFIG_VORBIS_PARSER)           += vorbis_parser.o xiph.o
diff --git a/libavcodec/arm/vc1dsp_init_arm.c b/libavcodec/arm/vc1dsp_init_arm.c
index 6d4eb79..a6a97c8 100644
--- a/libavcodec/arm/vc1dsp_init_arm.c
+++ b/libavcodec/arm/vc1dsp_init_arm.c
@@ -20,6 +20,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/arm/cpu.h"
+#include "libavcodec/arm/startcode.h"
 #include "libavcodec/vc1dsp.h"
 #include "vc1dsp.h"
 
@@ -27,6 +28,8 @@ av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp)
 {
     int cpu_flags = av_get_cpu_flags();
 
+    if (have_setend(cpu_flags))
+        dsp->startcode_find_candidate = ff_startcode_find_candidate_armv6;
     if (have_neon(cpu_flags))
         ff_vc1dsp_init_neon(dsp);
 }
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 1978b08..cef0fe6 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -1688,5 +1688,7 @@ av_cold int ff_vc1_init_common(VC1Context *v)
     v->pq      = -1;
     v->mvrange = 0; /* 7.1.1.18, p80 */
 
+    ff_vc1dsp_init(&v->vc1dsp);
+
     return 0;
 }
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index c83bb4f..f7f6a9f 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5629,7 +5629,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     ff_blockdsp_init(&s->bdsp, avctx);
     ff_h264chroma_init(&v->h264chroma, 8);
     ff_qpeldsp_init(&s->qdsp);
-    ff_vc1dsp_init(&v->vc1dsp);
 
     if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) {
         int count = 0;
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index 3b92eb2..a193dd7 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -29,6 +29,7 @@
 #include "h264chroma.h"
 #include "qpeldsp.h"
 #include "vc1dsp.h"
+#include "startcode.h"
 
 /* Apply overlap transform to horizontal edge */
 static void vc1_v_overlap_c(uint8_t *src, int stride)
@@ -948,6 +949,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext *dsp)
     dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c;
 #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */
 
+    dsp->startcode_find_candidate = ff_startcode_find_candidate_c;
+
     if (ARCH_AARCH64)
         ff_vc1dsp_init_aarch64(dsp);
     if (ARCH_ARM)
diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h
index 7de6a3d..682f682 100644
--- a/libavcodec/vc1dsp.h
+++ b/libavcodec/vc1dsp.h
@@ -71,6 +71,14 @@ typedef struct VC1DSPContext {
     void (*sprite_v_double_twoscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1,
                                                    const uint8_t *src2a, const uint8_t *src2b, int offset2,
                                      int alpha, int width);
+
+    /**
+     * Search buf from the start for up to size bytes. Return the index
+     * of a zero byte, or >= size if not found. Ideally, use lookahead
+     * to filter out any zero bytes that are known to not be followed by
+     * one or more further zero bytes and a one byte.
+     */
+    int (*startcode_find_candidate)(const uint8_t *buf, int size);
 } VC1DSPContext;
 
 void ff_vc1dsp_init(VC1DSPContext* c);



More information about the ffmpeg-cvslog mailing list