You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit '404a416d4b1fcbf9db5569481d8181f296c01ea9'
* commit '404a416d4b1fcbf9db5569481d8181f296c01ea9': h264: remove some remnants of data partitioning Conflicts: libavcodec/h264.c libavcodec/h264_slice.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -238,7 +238,6 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
|
|||||||
{
|
{
|
||||||
int i, si, di;
|
int i, si, di;
|
||||||
uint8_t *dst;
|
uint8_t *dst;
|
||||||
int bufidx;
|
|
||||||
|
|
||||||
// src[0]&0x80; // forbidden bit
|
// src[0]&0x80; // forbidden bit
|
||||||
h->nal_ref_idc = src[0] >> 5;
|
h->nal_ref_idc = src[0] >> 5;
|
||||||
@@ -294,11 +293,8 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// use second escape buffer for inter data
|
av_fast_padded_malloc(&h->rbsp_buffer, &h->rbsp_buffer_size, length+MAX_MBPAIR_SIZE);
|
||||||
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0;
|
dst = h->rbsp_buffer;
|
||||||
|
|
||||||
av_fast_padded_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+MAX_MBPAIR_SIZE);
|
|
||||||
dst = h->rbsp_buffer[bufidx];
|
|
||||||
|
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -417,10 +413,8 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
|
|||||||
av_freep(&hx->er.mbskip_table);
|
av_freep(&hx->er.mbskip_table);
|
||||||
|
|
||||||
if (free_rbsp) {
|
if (free_rbsp) {
|
||||||
av_freep(&hx->rbsp_buffer[1]);
|
av_freep(&hx->rbsp_buffer);
|
||||||
av_freep(&hx->rbsp_buffer[0]);
|
hx->rbsp_buffer_size = 0;
|
||||||
hx->rbsp_buffer_size[0] = 0;
|
|
||||||
hx->rbsp_buffer_size[1] = 0;
|
|
||||||
}
|
}
|
||||||
if (i)
|
if (i)
|
||||||
av_freep(&h->thread_context[i]);
|
av_freep(&h->thread_context[i]);
|
||||||
@@ -754,10 +748,8 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
|
|||||||
h->slice_ctx[i].h264 = h;
|
h->slice_ctx[i].h264 = h;
|
||||||
|
|
||||||
h->avctx = avctx;
|
h->avctx = avctx;
|
||||||
h->rbsp_buffer[0] = NULL;
|
h->rbsp_buffer = NULL;
|
||||||
h->rbsp_buffer[1] = NULL;
|
h->rbsp_buffer_size = 0;
|
||||||
h->rbsp_buffer_size[0] = 0;
|
|
||||||
h->rbsp_buffer_size[1] = 0;
|
|
||||||
h->context_initialized = 0;
|
h->context_initialized = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1577,8 +1569,6 @@ again:
|
|||||||
h->has_recovery_point = 1;
|
h->has_recovery_point = 1;
|
||||||
case NAL_SLICE:
|
case NAL_SLICE:
|
||||||
init_get_bits(&hx->gb, ptr, bit_length);
|
init_get_bits(&hx->gb, ptr, bit_length);
|
||||||
hx->intra_gb_ptr =
|
|
||||||
hx->inter_gb_ptr = &hx->gb;
|
|
||||||
|
|
||||||
if ((err = ff_h264_decode_slice_header(hx, sl, h)))
|
if ((err = ff_h264_decode_slice_header(hx, sl, h)))
|
||||||
break;
|
break;
|
||||||
|
@@ -543,12 +543,6 @@ typedef struct H264Context {
|
|||||||
|
|
||||||
uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
|
uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
|
||||||
|
|
||||||
// data partitioning
|
|
||||||
GetBitContext intra_gb;
|
|
||||||
GetBitContext inter_gb;
|
|
||||||
GetBitContext *intra_gb_ptr;
|
|
||||||
GetBitContext *inter_gb_ptr;
|
|
||||||
|
|
||||||
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
|
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
|
||||||
uint16_t *cbp_table;
|
uint16_t *cbp_table;
|
||||||
|
|
||||||
@@ -582,8 +576,8 @@ typedef struct H264Context {
|
|||||||
|
|
||||||
int nal_ref_idc;
|
int nal_ref_idc;
|
||||||
int nal_unit_type;
|
int nal_unit_type;
|
||||||
uint8_t *rbsp_buffer[2];
|
uint8_t *rbsp_buffer;
|
||||||
unsigned int rbsp_buffer_size[2];
|
unsigned int rbsp_buffer_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to parse AVC variant of h264
|
* Used to parse AVC variant of h264
|
||||||
|
@@ -643,7 +643,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
|
|||||||
AV_ZERO128(sl->mb_luma_dc[p]+8);
|
AV_ZERO128(sl->mb_luma_dc[p]+8);
|
||||||
AV_ZERO128(sl->mb_luma_dc[p]+16);
|
AV_ZERO128(sl->mb_luma_dc[p]+16);
|
||||||
AV_ZERO128(sl->mb_luma_dc[p]+24);
|
AV_ZERO128(sl->mb_luma_dc[p]+24);
|
||||||
if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX+p, scan, NULL, 16) < 0){
|
if (decode_residual(h, sl, gb, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX + p, scan, NULL, 16) < 0) {
|
||||||
return -1; //FIXME continue if partitioned and other return -1 too
|
return -1; //FIXME continue if partitioned and other return -1 too
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
|
|||||||
for(i8x8=0; i8x8<4; i8x8++){
|
for(i8x8=0; i8x8<4; i8x8++){
|
||||||
for(i4x4=0; i4x4<4; i4x4++){
|
for(i4x4=0; i4x4<4; i4x4++){
|
||||||
const int index= i4x4 + 4*i8x8 + p*16;
|
const int index= i4x4 + 4*i8x8 + p*16;
|
||||||
if( decode_residual(h, sl, h->intra_gb_ptr, sl->mb + (16*index << pixel_shift),
|
if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift),
|
||||||
index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){
|
index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1096,7 +1096,7 @@ decode_intra_mb:
|
|||||||
int i4x4, i8x8, chroma_idx;
|
int i4x4, i8x8, chroma_idx;
|
||||||
int dquant;
|
int dquant;
|
||||||
int ret;
|
int ret;
|
||||||
GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
|
GetBitContext *gb = &h->gb;
|
||||||
const uint8_t *scan, *scan8x8;
|
const uint8_t *scan, *scan8x8;
|
||||||
const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
|
const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
|
||||||
|
|
||||||
|
@@ -531,8 +531,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
|
|||||||
for (i = 0; i < MAX_PPS_COUNT; i++)
|
for (i = 0; i < MAX_PPS_COUNT; i++)
|
||||||
av_freep(h->pps_buffers + i);
|
av_freep(h->pps_buffers + i);
|
||||||
|
|
||||||
av_freep(&h->rbsp_buffer[0]);
|
av_freep(&h->rbsp_buffer);
|
||||||
av_freep(&h->rbsp_buffer[1]);
|
|
||||||
ff_h264_unref_picture(h, &h->last_pic_for_ec);
|
ff_h264_unref_picture(h, &h->last_pic_for_ec);
|
||||||
memcpy(h, h1, sizeof(H264Context));
|
memcpy(h, h1, sizeof(H264Context));
|
||||||
|
|
||||||
@@ -566,10 +565,8 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
|
|||||||
h->list_counts = NULL;
|
h->list_counts = NULL;
|
||||||
h->mb2b_xy = NULL;
|
h->mb2b_xy = NULL;
|
||||||
h->mb2br_xy = NULL;
|
h->mb2br_xy = NULL;
|
||||||
for (i = 0; i < 2; i++) {
|
h->rbsp_buffer = NULL;
|
||||||
h->rbsp_buffer[i] = NULL;
|
h->rbsp_buffer_size = 0;
|
||||||
h->rbsp_buffer_size[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h1->context_initialized) {
|
if (h1->context_initialized) {
|
||||||
h->context_initialized = 0;
|
h->context_initialized = 0;
|
||||||
|
Reference in New Issue
Block a user