vc-1: Add platform-specific start code search routine to VC1DSPContext.
authorBen Avison <bavison@riscosopen.org>
Wed, 16 Apr 2014 00:51:32 +0000 (01:51 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 25 Apr 2014 00:36:11 +0000 (02:36 +0200)
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: Michael Niedermayer <michaelni@gmx.at>
libavcodec/Makefile
libavcodec/arm/Makefile
libavcodec/arm/vc1dsp_init_arm.c
libavcodec/vc1.c
libavcodec/vc1dec.c
libavcodec/vc1dsp.c
libavcodec/vc1dsp.h

index c4ddc8e..d6ed5e2 100644 (file)
@@ -458,7 +458,7 @@ OBJS-$(CONFIG_VB_DECODER)              += vb.o
 OBJS-$(CONFIG_VBLE_DECODER)            += vble.o
 OBJS-$(CONFIG_VC1_DECODER)             += vc1dec.o vc1.o vc1data.o vc1dsp.o \
                                           msmpeg4dec.o msmpeg4.o msmpeg4data.o \
-                                          wmv2dsp.o
+                                          wmv2dsp.o startcode.o
 OBJS-$(CONFIG_VCR1_DECODER)            += vcr1.o
 OBJS-$(CONFIG_VMDAUDIO_DECODER)        += vmdav.o
 OBJS-$(CONFIG_VMDVIDEO_DECODER)        += vmdav.o
@@ -781,9 +781,9 @@ 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
+                                          h263.o startcode.o
 OBJS-$(CONFIG_VORBIS_PARSER)           += vorbis_parser.o xiph.o
 OBJS-$(CONFIG_VP3_PARSER)              += vp3_parser.o
 OBJS-$(CONFIG_VP8_PARSER)              += vp8_parser.o
index 4c7e7d2..1b21906 100644 (file)
@@ -57,6 +57,8 @@ ARMV6-OBJS-$(CONFIG_HPELDSP)           += arm/hpeldsp_init_armv6.o      \
 ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP)      += arm/mpegaudiodsp_fixed_armv6.o
 
 ARMV6-OBJS-$(CONFIG_MLP_DECODER)       += arm/mlpdsp_armv6.o
+ARMV6-OBJS-$(CONFIG_VC1_DECODER)       += arm/startcode_armv6.o
+ARMV6-OBJS-$(CONFIG_VC1_PARSER)        += arm/startcode_armv6.o
 ARMV6-OBJS-$(CONFIG_VP7_DECODER)       += arm/vp8_armv6.o               \
                                           arm/vp8dsp_init_armv6.o       \
                                           arm/vp8dsp_armv6.o
index 47d4126..4a84848 100644 (file)
 #include "libavcodec/vc1dsp.h"
 #include "vc1dsp.h"
 
+int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size);
+
 av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp)
 {
     int cpu_flags = av_get_cpu_flags();
 
+    if (have_armv6(cpu_flags))
+        dsp->vc1_find_start_code_candidate = ff_startcode_find_candidate_armv6;
     if (have_neon(cpu_flags))
         ff_vc1dsp_init_neon(dsp);
 }
index adf4ca5..89fa7ff 100644 (file)
@@ -1706,5 +1706,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;
 }
index d5e8a37..132ae76 100644 (file)
@@ -5625,7 +5625,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     ff_vc1_decode_end(avctx);
 
     ff_h264chroma_init(&v->h264chroma, 8);
-    ff_vc1dsp_init(&v->vc1dsp);
 
     if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) {
         int count = 0;
index acc3aea..787a6a6 100644 (file)
@@ -32,6 +32,7 @@
 #include "h264chroma.h"
 #include "rnd_avg.h"
 #include "vc1dsp.h"
+#include "startcode.h"
 
 /* Apply overlap transform to horizontal edge */
 static void vc1_v_overlap_c(uint8_t *src, int stride)
@@ -1024,6 +1025,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->vc1_find_start_code_candidate = ff_startcode_find_candidate_c;
+
     if (ARCH_AARCH64)
         ff_vc1dsp_init_aarch64(dsp);
     if (ARCH_ARM)
index 7cf6135..aa5b6d3 100644 (file)
@@ -73,6 +73,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 (*vc1_find_start_code_candidate)(const uint8_t *buf, int size);
 } VC1DSPContext;
 
 void ff_vc1dsp_init(VC1DSPContext* c);