1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'b063582e0c4f775a8ba377488bd085595e0e7fae'

* commit 'b063582e0c4f775a8ba377488bd085595e0e7fae':
  h264: move intra_pcm_ptr into the per-slice context

Conflicts:
	libavcodec/h264.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-21 15:25:31 +01:00
commit 35a788d953
5 changed files with 10 additions and 10 deletions

View File

@ -411,6 +411,7 @@ typedef struct H264SliceContext {
* according to picture reordering in slice header */
int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
const uint8_t *intra_pcm_ptr;
/**
* non zero coeff count cache.
@ -511,7 +512,6 @@ typedef struct H264Context {
GetBitContext *intra_gb_ptr;
GetBitContext *inter_gb_ptr;
const uint8_t *intra_pcm_ptr;
DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; ///< as a dct coefficient is int32_t in high depth, we need to reserve twice the space.
DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
int16_t mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb

View File

@ -2034,7 +2034,7 @@ decode_intra_mb:
// The pixels are stored in the same order as levels in h->mb array.
if ((int) (h->cabac.bytestream_end - ptr) < mb_size)
return -1;
h->intra_pcm_ptr = ptr;
sl->intra_pcm_ptr = ptr;
ptr += mb_size;
ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);

View File

@ -778,7 +778,7 @@ decode_intra_mb:
h->sps.bit_depth_luma;
// We assume these blocks are very rare so we do not optimize it.
h->intra_pcm_ptr = align_get_bits(&h->gb);
sl->intra_pcm_ptr = align_get_bits(&h->gb);
if (get_bits_left(&h->gb) < mb_size) {
av_log(h->avctx, AV_LOG_ERROR, "Not enough data for an intra PCM block.\n");
return AVERROR_INVALIDDATA;

View File

@ -104,7 +104,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
if (PIXEL_SHIFT) {
int j;
GetBitContext gb;
init_get_bits(&gb, h->intra_pcm_ptr,
init_get_bits(&gb, sl->intra_pcm_ptr,
ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
for (i = 0; i < 16; i++) {
@ -136,7 +136,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
}
} else {
for (i = 0; i < 16; i++)
memcpy(dest_y + i * linesize, h->intra_pcm_ptr + i * 16, 16);
memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);
if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
if (!h->sps.chroma_format_idc) {
for (i = 0; i < 8; i++) {
@ -144,8 +144,8 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8);
}
} else {
const uint8_t *src_cb = h->intra_pcm_ptr + 256;
const uint8_t *src_cr = h->intra_pcm_ptr + 256 + block_h * 8;
const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
for (i = 0; i < block_h; i++) {
memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
@ -323,7 +323,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
if (PIXEL_SHIFT) {
const int bit_depth = h->sps.bit_depth_luma;
GetBitContext gb;
init_get_bits(&gb, h->intra_pcm_ptr, 768 * bit_depth);
init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth);
for (p = 0; p < plane_count; p++)
for (i = 0; i < 16; i++) {
@ -335,7 +335,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
for (p = 0; p < plane_count; p++)
for (i = 0; i < 16; i++)
memcpy(dest[p] + i * linesize,
h->intra_pcm_ptr + p * 256 + i * 16, 16);
sl->intra_pcm_ptr + p * 256 + i * 16, 16);
}
} else {
if (IS_INTRA(mb_type)) {

View File

@ -534,7 +534,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
av_freep(&h->rbsp_buffer[0]);
av_freep(&h->rbsp_buffer[1]);
ff_h264_unref_picture(h, &h->last_pic_for_ec);
memcpy(h, h1, offsetof(H264Context, intra_pcm_ptr));
memcpy(h, h1, offsetof(H264Context, mb));
memcpy(&h->cabac, &h1->cabac,
sizeof(H264Context) - offsetof(H264Context, cabac));
av_assert0((void*)&h->cabac == &h->mb_padding + 1);