diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-23 21:04:06 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-23 21:25:09 +0200 |
commit | 2cb4d516549526b5e17e941f6d2375a2c501ade6 (patch) | |
tree | f472c62e0b34c2faaa955d51874cddb6be759910 /libavcodec | |
parent | 7e15df7551cf45ad1d3e39d20fdc8d6c651d4705 (diff) | |
parent | d04c5293ce88927ad359ca276e287bfa63c2329d (diff) | |
download | ffmpeg-2cb4d516549526b5e17e941f6d2375a2c501ade6.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
v410dec: Implement explode mode support
zerocodec: fix direct rendering.
wav: init st to NULL to avoid a false-positive warning.
wavpack: set bits_per_raw_sample for S32 samples to properly identify 24-bit
h264: refactor NAL decode loop
RTMPTE protocol support
RTMPE protocol support
rtmp: Add ff_rtmp_calc_digest_pos()
rtmp: Rename rtmp_calc_digest to ff_rtmp_calc_digest and make it global
swscale: add missing HAVE_INLINE_ASM check.
lavfi: place x86 inline assembly under HAVE_INLINE_ASM.
vc1: Add a test for interlaced field pictures
swscale: Mark all init functions as av_cold
swscale: x86: Drop pointless _mmx suffix from filenames
lavf: use conditional notation for default codec in muxer declarations.
swscale: place inline assembly bilinear scaler under HAVE_INLINE_ASM.
dsputil: ppc: cosmetics: pretty-print
dsputil: x86: add SHUFFLE_MASK_W macro
configure: respect CC_O setting in check_cc
Conflicts:
Changelog
configure
libavcodec/v410dec.c
libavcodec/zerocodec.c
libavformat/asfenc.c
libavformat/version.h
libswscale/utils.c
libswscale/x86/swscale.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264.c | 42 | ||||
-rw-r--r-- | libavcodec/ppc/fmtconvert_altivec.c | 126 | ||||
-rw-r--r-- | libavcodec/v410dec.c | 7 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_yasm.asm | 2 | ||||
-rw-r--r-- | libavcodec/zerocodec.c | 2 |
5 files changed, 97 insertions, 82 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 0d3289458a..fdfc221ccd 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -188,42 +188,50 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, src++; length--; +#define STARTCODE_TEST \ + if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ + if (src[i + 2] != 3) { \ + /* startcode, so we must be past the end */ \ + length = i; \ + } \ + break; \ + } #if HAVE_FAST_UNALIGNED +#define FIND_FIRST_ZERO \ + if (i > 0 && !src[i]) \ + i--; \ + while (src[i]) \ + i++ #if HAVE_FAST_64BIT -#define RS 7 for (i = 0; i + 1 < length; i += 9) { if (!((~AV_RN64A(src + i) & (AV_RN64A(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) + continue; + FIND_FIRST_ZERO; + STARTCODE_TEST; + i -= 7; + } #else -#define RS 3 for (i = 0; i + 1 < length; i += 5) { if (!((~AV_RN32A(src + i) & (AV_RN32A(src + i) - 0x01000101U)) & 0x80008080U)) -#endif continue; - if (i > 0 && !src[i]) - i--; - while (src[i]) - i++; + FIND_FIRST_ZERO; + STARTCODE_TEST; + i -= 3; + } +#endif #else -#define RS 0 for (i = 0; i + 1 < length; i += 2) { if (src[i]) continue; if (i > 0 && src[i - 1] == 0) i--; -#endif - if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { - if (src[i + 2] != 3) { - /* startcode, so we must be past the end */ - length = i; - } - break; - } - i -= RS; + STARTCODE_TEST; } +#endif // use second escape buffer for inter data bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c index 6f24199023..1e1a3b6865 100644 --- a/libavcodec/ppc/fmtconvert_altivec.c +++ b/libavcodec/ppc/fmtconvert_altivec.c @@ -23,7 +23,8 @@ #include "libavutil/ppc/util_altivec.h" #include "dsputil_altivec.h" -static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) +static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, + float mul, int len) { union { vector float v; @@ -36,7 +37,7 @@ static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul_u.s[0] = mul; mul_v = vec_splat(mul_u.v, 0); - for(i=0; i<len; i+=8) { + for (i = 0; i < len; i += 8) { src1 = vec_ctf(vec_ld(0, src+i), 0); src2 = vec_ctf(vec_ld(16, src+i), 0); dst1 = vec_madd(src1, mul_v, zero); @@ -47,8 +48,7 @@ static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float } -static vector signed short -float_to_int16_one_altivec(const float *src) +static vector signed short float_to_int16_one_altivec(const float *src) { vector float s0 = vec_ld(0, src); vector float s1 = vec_ld(16, src); @@ -62,80 +62,82 @@ static void float_to_int16_altivec(int16_t *dst, const float *src, long len) int i; vector signed short d0, d1, d; vector unsigned char align; - if(((long)dst)&15) //FIXME - for(i=0; i<len-7; i+=8) { - d0 = vec_ld(0, dst+i); - d = float_to_int16_one_altivec(src+i); - d1 = vec_ld(15, dst+i); - d1 = vec_perm(d1, d0, vec_lvsl(0,dst+i)); - align = vec_lvsr(0, dst+i); - d0 = vec_perm(d1, d, align); - d1 = vec_perm(d, d1, align); - vec_st(d0, 0, dst+i); - vec_st(d1,15, dst+i); - } - else - for(i=0; i<len-7; i+=8) { - d = float_to_int16_one_altivec(src+i); - vec_st(d, 0, dst+i); + if (((long)dst) & 15) { //FIXME + for (i = 0; i < len - 7; i += 8) { + d0 = vec_ld(0, dst+i); + d = float_to_int16_one_altivec(src + i); + d1 = vec_ld(15, dst+i); + d1 = vec_perm(d1, d0, vec_lvsl(0, dst + i)); + align = vec_lvsr(0, dst + i); + d0 = vec_perm(d1, d, align); + d1 = vec_perm(d, d1, align); + vec_st(d0, 0, dst + i); + vec_st(d1, 15, dst + i); + } + } else { + for (i = 0; i < len - 7; i += 8) { + d = float_to_int16_one_altivec(src + i); + vec_st(d, 0, dst + i); + } } } -static void -float_to_int16_interleave_altivec(int16_t *dst, const float **src, - long len, int channels) +static void float_to_int16_interleave_altivec(int16_t *dst, const float **src, + long len, int channels) { int i; vector signed short d0, d1, d2, c0, c1, t0, t1; vector unsigned char align; - if(channels == 1) + + if (channels == 1) float_to_int16_altivec(dst, src[0], len); - else + else { if (channels == 2) { - if(((long)dst)&15) - for(i=0; i<len-7; i+=8) { - d0 = vec_ld(0, dst + i); - t0 = float_to_int16_one_altivec(src[0] + i); - d1 = vec_ld(31, dst + i); - t1 = float_to_int16_one_altivec(src[1] + i); - c0 = vec_mergeh(t0, t1); - c1 = vec_mergel(t0, t1); - d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i)); - align = vec_lvsr(0, dst + i); - d0 = vec_perm(d2, c0, align); - d1 = vec_perm(c0, c1, align); - vec_st(d0, 0, dst + i); - d0 = vec_perm(c1, d2, align); - vec_st(d1, 15, dst + i); - vec_st(d0, 31, dst + i); - dst+=8; - } - else - for(i=0; i<len-7; i+=8) { - t0 = float_to_int16_one_altivec(src[0] + i); - t1 = float_to_int16_one_altivec(src[1] + i); - d0 = vec_mergeh(t0, t1); - d1 = vec_mergel(t0, t1); - vec_st(d0, 0, dst + i); - vec_st(d1, 16, dst + i); - dst+=8; - } - } else { - DECLARE_ALIGNED(16, int16_t, tmp)[len]; - int c, j; - for (c = 0; c < channels; c++) { - float_to_int16_altivec(tmp, src[c], len); - for (i = 0, j = c; i < len; i++, j+=channels) { - dst[j] = tmp[i]; + if (((long)dst) & 15) { + for (i = 0; i < len - 7; i += 8) { + d0 = vec_ld(0, dst + i); + t0 = float_to_int16_one_altivec(src[0] + i); + d1 = vec_ld(31, dst + i); + t1 = float_to_int16_one_altivec(src[1] + i); + c0 = vec_mergeh(t0, t1); + c1 = vec_mergel(t0, t1); + d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i)); + align = vec_lvsr(0, dst + i); + d0 = vec_perm(d2, c0, align); + d1 = vec_perm(c0, c1, align); + vec_st(d0, 0, dst + i); + d0 = vec_perm(c1, d2, align); + vec_st(d1, 15, dst + i); + vec_st(d0, 31, dst + i); + dst += 8; + } + } else { + for (i = 0; i < len - 7; i += 8) { + t0 = float_to_int16_one_altivec(src[0] + i); + t1 = float_to_int16_one_altivec(src[1] + i); + d0 = vec_mergeh(t0, t1); + d1 = vec_mergel(t0, t1); + vec_st(d0, 0, dst + i); + vec_st(d1, 16, dst + i); + dst += 8; + } + } + } else { + DECLARE_ALIGNED(16, int16_t, tmp)[len]; + int c, j; + for (c = 0; c < channels; c++) { + float_to_int16_altivec(tmp, src[c], len); + for (i = 0, j = c; i < len; i++, j+=channels) + dst[j] = tmp[i]; } } - } + } } void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx) { c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; - if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { c->float_to_int16 = float_to_int16_altivec; c->float_to_int16_interleave = float_to_int16_interleave_altivec; } diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c index 10d73057af..34e397979c 100644 --- a/libavcodec/v410dec.c +++ b/libavcodec/v410dec.c @@ -29,7 +29,12 @@ static av_cold int v410_decode_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; if (avctx->width & 1) { - av_log(avctx, AV_LOG_WARNING, "v410 requires width to be even.\n"); + if (avctx->err_recognition & AV_EF_EXPLODE) { + av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even, continuing anyway.\n"); + return AVERROR_INVALIDDATA; + } else { + av_log(avctx, AV_LOG_WARNING, "v410 requires width to be even.\n"); + } } avctx->coded_frame = avcodec_alloc_frame(); diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index 2c3b6cc2bb..d2e5439e61 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -28,7 +28,7 @@ pb_zzzzzzzz77777777: times 8 db -1 pb_7: times 8 db 7 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 -pb_revwords: db 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1 +pb_revwords: SHUFFLE_MASK_W 7, 6, 5, 4, 3, 2, 1, 0 pd_16384: times 4 dd 16384 pb_bswap32: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 1b1f0be8fa..6581706765 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -94,7 +94,7 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, if (prev_pic->data[0]) avctx->release_buffer(avctx, prev_pic); - *data_size = sizeof(AVFrame); + *data_size = sizeof(AVFrame); *(AVFrame *)data = *pic; /* Store the previous frame for use later. |