diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-24 14:01:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-24 14:01:36 +0200 |
commit | 5555d2075a26fc778fb8145473100e94d80a00c8 (patch) | |
tree | 95d4f5649f7c2410d814b18c7bbe868c82b83cbe /libavcodec | |
parent | f3b8096bc0e7df9e45db1023d6e6e7bff177d0c4 (diff) | |
parent | ceb754d041f5f6327fd9195a5f43575af9516daa (diff) | |
download | ffmpeg-5555d2075a26fc778fb8145473100e94d80a00c8.tar.gz |
Merge commit 'ceb754d041f5f6327fd9195a5f43575af9516daa'
* commit 'ceb754d041f5f6327fd9195a5f43575af9516daa':
lzo: Use AV_COPY*U macros where appropriate
prepare 9_beta2 release
dsputil: Replace AV_WNxx(AV_RNxx()) combinations by AV_COPYxxU
intreadwrite: Add AV_COPYxxU macros for copying to/from unaligned addresses
dxtory: Replace AV_WN16A(AV_RN16A()) combination by AV_COPY16
mp3: properly forward mp_decode_frame errors
Conflicts:
RELEASE
libavcodec/mpegaudiodec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dsputil.h | 20 | ||||
-rw-r--r-- | libavcodec/dxtory.c | 4 | ||||
-rw-r--r-- | libavcodec/mpegaudiodec.c | 32 |
3 files changed, 26 insertions, 30 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index ad09a0cd43..ecd425964d 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -674,7 +674,7 @@ static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN16(dst , AV_RN16(src )); + AV_COPY16U(dst, src); dst+=dstStride; src+=srcStride; } @@ -685,7 +685,7 @@ static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN32(dst , AV_RN32(src )); + AV_COPY32U(dst, src); dst+=dstStride; src+=srcStride; } @@ -696,8 +696,7 @@ static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN32(dst , AV_RN32(src )); - AV_WN32(dst+4 , AV_RN32(src+4 )); + AV_COPY64U(dst, src); dst+=dstStride; src+=srcStride; } @@ -708,8 +707,7 @@ static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN32(dst , AV_RN32(src )); - AV_WN32(dst+4 , AV_RN32(src+4 )); + AV_COPY64U(dst, src); dst[8]= src[8]; dst+=dstStride; src+=srcStride; @@ -721,10 +719,7 @@ static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN32(dst , AV_RN32(src )); - AV_WN32(dst+4 , AV_RN32(src+4 )); - AV_WN32(dst+8 , AV_RN32(src+8 )); - AV_WN32(dst+12, AV_RN32(src+12)); + AV_COPY128U(dst, src); dst+=dstStride; src+=srcStride; } @@ -735,10 +730,7 @@ static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int i; for(i=0; i<h; i++) { - AV_WN32(dst , AV_RN32(src )); - AV_WN32(dst+4 , AV_RN32(src+4 )); - AV_WN32(dst+8 , AV_RN32(src+8 )); - AV_WN32(dst+12, AV_RN32(src+12)); + AV_COPY128U(dst, src); dst[16]= src[16]; dst+=dstStride; src+=srcStride; diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c index f741078092..da43c47003 100644 --- a/libavcodec/dxtory.c +++ b/libavcodec/dxtory.c @@ -70,8 +70,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, V = pic->data[2]; for (h = 0; h < avctx->height; h += 2) { for (w = 0; w < avctx->width; w += 2) { - AV_WN16A(Y1 + w, AV_RN16A(src)); - AV_WN16A(Y2 + w, AV_RN16A(src + 2)); + AV_COPY16(Y1 + w, src); + AV_COPY16(Y2 + w, src + 2); U[w >> 1] = src[4] + 0x80; V[w >> 1] = src[5] + 0x80; src += 6; diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index b010af6b3e..f0256f31c1 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1654,7 +1654,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, int buf_size = avpkt->size; MPADecodeContext *s = avctx->priv_data; uint32_t header; - int out_size; + int ret; while(buf_size && !*buf){ buf++; @@ -1693,21 +1693,22 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, buf_size= s->frame_size; } - out_size = mp_decode_frame(s, NULL, buf, buf_size); - if (out_size >= 0) { + ret = mp_decode_frame(s, NULL, buf, buf_size); + if (ret >= 0) { *got_frame_ptr = 1; *(AVFrame *)data = s->frame; avctx->sample_rate = s->sample_rate; //FIXME maybe move the other codec info stuff from above here too } else { av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); - /* Only return an error if the bad frame makes up the whole packet. - If there is more data in the packet, just consume the bad frame - instead of returning an error, which would discard the whole - packet. */ + /* Only return an error if the bad frame makes up the whole packet or + * the error is related to buffer management. + * If there is more data in the packet, just consume the bad frame + * instead of returning an error, which would discard the whole + * packet. */ *got_frame_ptr = 0; - if (buf_size == avpkt->size) - return out_size; + if (buf_size == avpkt->size || ret != AVERROR_INVALIDDATA) + return ret; } s->frame_size = 0; return buf_size; @@ -1732,7 +1733,7 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data, int buf_size = avpkt->size; MPADecodeContext *s = avctx->priv_data; uint32_t header; - int len; + int len, ret; int av_unused out_size; len = buf_size; @@ -1764,10 +1765,10 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data, s->frame_size = len; - out_size = mp_decode_frame(s, NULL, buf, buf_size); - if (out_size < 0) { + ret = mp_decode_frame(s, NULL, buf, buf_size); + if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); - return AVERROR_INVALIDDATA; + return ret; } *got_frame_ptr = 1; @@ -1972,7 +1973,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data, } ch += m->nb_channels; - out_size += mp_decode_frame(m, outptr, buf, fsize); + if ((ret = mp_decode_frame(m, outptr, buf, fsize)) < 0) + return ret; + + out_size += ret; buf += fsize; len -= fsize; |