mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
h264: move intra_pcm_ptr into the per-slice context
This commit is contained in:
parent
95eb35f305
commit
b063582e0c
@ -374,6 +374,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.
|
||||
@ -468,7 +469,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 coeffecient 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
|
||||
|
@ -2031,7 +2031,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);
|
||||
|
@ -770,7 +770,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;
|
||||
|
@ -104,7 +104,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
|
||||
const int bit_depth = h->sps.bit_depth_luma;
|
||||
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++) {
|
||||
@ -139,7 +139,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 < block_h; i++) {
|
||||
@ -147,8 +147,8 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
|
||||
memset(dest_cr + i * uvlinesize, 128, 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);
|
||||
@ -326,7 +326,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++) {
|
||||
@ -338,7 +338,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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user