summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-05 22:26:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-05 22:26:50 +0200
commit2c5a2958e961c25434a54c832a04139525f661da (patch)
tree7fba548115bae83f10089b8c9b5ff77ee9f14224 /libavcodec/h264.c
parent3e4b5e68c1589590736fce62c0e677c4632f965b (diff)
parent0becb07842b57ea225ddf0726de33b5f8e669297 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: h264: Factorize declaration of mb_sizes array. vsrc_buffer: when no frame is available, return an error instead of segfaulting. configure: add dl to frei0r extralibs. dsputil x86: use SSE float instruction instead of SSE2 integer equivalent dsputil x86: remove deprecated parameter from scalarproduct_int16 prototype vp8dsp x86: perform rounding shift with a single instruction fate: add BMP tests. swscale: handle complete dimensions for monoblack/white. aacenc: Mark deinterleave_input_samples argument as const. vf_unsharp: Mark readonly variable as const. h264: fix 4:2:2 PCM-macroblocks decoding Conflicts: configure libavcodec/h264.h libavcodec/x86/dsputil_mmx.c libavfilter/vf_unsharp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index fc612905ab..b909600b3e 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -48,6 +48,8 @@
// #undef NDEBUG
#include <assert.h>
+const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 };
+
static const uint8_t rem6[QP_MAX_NUM + 1] = {
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
@@ -2126,7 +2128,8 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple,
if (pixel_shift) {
int j;
GetBitContext gb;
- init_get_bits(&gb, (uint8_t *)h->mb, 384 * bit_depth);
+ init_get_bits(&gb, (uint8_t *)h->mb,
+ ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
for (i = 0; i < 16; i++) {
uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
@@ -2157,7 +2160,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple,
}
} else {
for (i = 0; i < 16; i++)
- memcpy(dest_y + i * linesize, h->mb + i * 8, 16);
+ memcpy(dest_y + i * linesize, (uint8_t *)h->mb + i * 16, 16);
if (simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < 8; i++) {
@@ -2165,9 +2168,11 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple,
memset(dest_cr + i*uvlinesize, 1 << (bit_depth - 1), 8);
}
} else {
+ uint8_t *src_cb = (uint8_t *)h->mb + 256;
+ uint8_t *src_cr = (uint8_t *)h->mb + 256 + block_h * 8;
for (i = 0; i < block_h; i++) {
- memcpy(dest_cb + i * uvlinesize, h->mb + 128 + i * 4, 8);
- memcpy(dest_cr + i * uvlinesize, h->mb + 160 + i * 4, 8);
+ memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
+ memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
}
}
}
@@ -2358,7 +2363,8 @@ static av_always_inline void hl_decode_mb_444_internal(H264Context *h,
} else {
for (p = 0; p < plane_count; p++)
for (i = 0; i < 16; i++)
- memcpy(dest[p] + i * linesize, h->mb + p * 128 + i * 8, 16);
+ memcpy(dest[p] + i * linesize,
+ (uint8_t *)h->mb + p * 256 + i * 16, 16);
}
} else {
if (IS_INTRA(mb_type)) {