diff options
author | Ben Avison <bavison@riscosopen.org> | 2014-04-16 01:51:32 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-25 02:36:11 +0200 |
commit | 9d8ecdd8ca6d248e7439e8fdf255e39eda14e0f2 (patch) | |
tree | e35abe072bfeb91f77ac48c51eb3bd69d9773aed | |
parent | 270cede3f3772117454a14b620803d731036942d (diff) | |
download | ffmpeg-9d8ecdd8ca6d248e7439e8fdf255e39eda14e0f2.tar.gz |
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: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/Makefile | 6 | ||||
-rw-r--r-- | libavcodec/arm/Makefile | 2 | ||||
-rw-r--r-- | libavcodec/arm/vc1dsp_init_arm.c | 4 | ||||
-rw-r--r-- | libavcodec/vc1.c | 2 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 1 | ||||
-rw-r--r-- | libavcodec/vc1dsp.c | 3 | ||||
-rw-r--r-- | libavcodec/vc1dsp.h | 8 |
7 files changed, 22 insertions, 4 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index c4ddc8e18a..d6ed5e2c02 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -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 diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 4c7e7d2dbe..1b21906fa6 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -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 diff --git a/libavcodec/arm/vc1dsp_init_arm.c b/libavcodec/arm/vc1dsp_init_arm.c index 47d412674b..4a84848463 100644 --- a/libavcodec/arm/vc1dsp_init_arm.c +++ b/libavcodec/arm/vc1dsp_init_arm.c @@ -23,10 +23,14 @@ #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); } diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index adf4ca50c5..89fa7ffdff 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -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; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index d5e8a37d78..132ae76523 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -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; diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index acc3aea42b..787a6a6398 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -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) diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h index 7cf613597c..aa5b6d34fd 100644 --- a/libavcodec/vc1dsp.h +++ b/libavcodec/vc1dsp.h @@ -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); |