vc-1: Add platform-specific start code search routine to VC1DSPContext.
authorBen Avison <bavison@riscosopen.org>
Mon, 21 Jul 2014 13:53:08 +0000 (14:53 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 4 Aug 2014 20:22:54 +0000 (22:22 +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: Luca Barbato <lu_zero@gentoo.org>
configure
libavcodec/Makefile
libavcodec/arm/vc1dsp_init_arm.c
libavcodec/vc1.c
libavcodec/vc1dec.c
libavcodec/vc1dsp.c
libavcodec/vc1dsp.h

index 4fc1e6a..b2eb0c8 100755 (executable)
--- 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"
index 7d19e6e..d59bd1c 100644 (file)
@@ -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
index 6d4eb79..a6a97c8 100644 (file)
@@ -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);
 }
index 1978b08..cef0fe6 100644 (file)
@@ -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;
 }
index c83bb4f..f7f6a9f 100644 (file)
@@ -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;
index 3b92eb2..a193dd7 100644 (file)
@@ -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)
index 7de6a3d..682f682 100644 (file)
@@ -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);