From be40d6cc2bc99ef90954c85f2bc77f95944ba723 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sat, 9 Mar 2013 16:47:38 +0100 Subject: [PATCH 1/3] rawdec: fix a typo -- || instead of | Signed-off-by: Anton Khirnov --- libavcodec/rawdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 59a6dd676d..0a76e4d383 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -98,7 +98,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) return AVERROR(EINVAL); } - if (desc->flags & (PIX_FMT_PAL || PIX_FMT_PSEUDOPAL)) { + if (desc->flags & (PIX_FMT_PAL | PIX_FMT_PSEUDOPAL)) { context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) return AVERROR(ENOMEM); From 0fe4b48540613127f7eed13769e989662cb74eef Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 26 Aug 2012 05:44:46 +0200 Subject: [PATCH 2/3] cabac: remove unused argument of ff_init_cabac_states() Signed-off-by: Anton Khirnov --- libavcodec/cabac.c | 3 ++- libavcodec/cabac.h | 2 +- libavcodec/h264.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c index 02d2911e85..6ba9303dc1 100644 --- a/libavcodec/cabac.c +++ b/libavcodec/cabac.c @@ -136,7 +136,8 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){ c->range= 0x1FE; } -void ff_init_cabac_states(CABACContext *c){ +void ff_init_cabac_states(void) +{ int i, j; for(i=0; i<64; i++){ diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h index 1f1c943262..04495a6fe6 100644 --- a/libavcodec/cabac.h +++ b/libavcodec/cabac.h @@ -51,6 +51,6 @@ typedef struct CABACContext{ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size); void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size); -void ff_init_cabac_states(CABACContext *c); +void ff_init_cabac_states(void); #endif /* AVCODEC_CABAC_H */ diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 472fa475aa..5308fc3e7d 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4111,7 +4111,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) align_get_bits(&h->gb); /* init cabac */ - ff_init_cabac_states(&h->cabac); + ff_init_cabac_states(); ff_init_cabac_decoder(&h->cabac, h->gb.buffer + get_bits_count(&h->gb) / 8, (get_bits_left(&h->gb) + 7) / 8); From 5b3c1aecb253828d09fa9825c5a4aed97badf086 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Sat, 22 Sep 2012 01:43:16 +0200 Subject: [PATCH 3/3] hqdn3d: Fix out of array read in LOWPASS CC:libav-stable@libav.org Signed-off-by: Anton Khirnov --- libavfilter/vf_hqdn3d.c | 8 ++++---- libavfilter/x86/vf_hqdn3d.asm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index 50e904b940..eb0ea6519a 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -37,10 +37,10 @@ #include "vf_hqdn3d.h" #define LUT_BITS (depth==16 ? 8 : 4) -#define RIGHTSHIFT(a,b) (((a)+(((1<<(b))-1)>>1))>>(b)) -#define LOAD(x) ((depth==8 ? src[x] : AV_RN16A(src+(x)*2)) << (16-depth)) -#define STORE(x,val) (depth==8 ? dst[x] = RIGHTSHIFT(val, 16-depth)\ - : AV_WN16A(dst+(x)*2, RIGHTSHIFT(val, 16-depth))) +#define LOAD(x) (((depth == 8 ? src[x] : AV_RN16A(src + (x) * 2)) << (16 - depth))\ + + (((1 << (16 - depth)) - 1) >> 1)) +#define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \ + AV_WN16A(dst + (x) * 2, (val) >> (16 - depth))) av_always_inline static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth) diff --git a/libavfilter/x86/vf_hqdn3d.asm b/libavfilter/x86/vf_hqdn3d.asm index dee2c96131..02632a1f09 100644 --- a/libavfilter/x86/vf_hqdn3d.asm +++ b/libavfilter/x86/vf_hqdn3d.asm @@ -39,6 +39,7 @@ SECTION .text %endif %if %3 != 16 shl %1, 16-%3 + add %1, (1<<(15-%3))-1 %endif %endmacro @@ -86,7 +87,6 @@ ALIGN 16 mov [frameantq+xq*2], t0w movifnidn dstq, dstmp %if %1 != 16 - add t0d, (1<<(15-%1))-1 shr t0d, 16-%1 ; could eliminate this by storing from t0h, but only with some contraints on register allocation %endif %if %1 == 8