mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
h264: make it possible to compile without error_resilience.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
fd464d4d01
commit
d4e649cca6
6
configure
vendored
6
configure
vendored
@ -1656,7 +1656,7 @@ mdct_select="fft"
|
|||||||
rdft_select="fft"
|
rdft_select="fft"
|
||||||
mpegaudio_select="mpegaudiodsp"
|
mpegaudio_select="mpegaudiodsp"
|
||||||
mpegaudiodsp_select="dct"
|
mpegaudiodsp_select="dct"
|
||||||
mpegvideo_select="videodsp"
|
mpegvideo_select="error_resilience videodsp"
|
||||||
mpegvideoenc_select="mpegvideo"
|
mpegvideoenc_select="mpegvideo"
|
||||||
|
|
||||||
# decoders / encoders
|
# decoders / encoders
|
||||||
@ -1707,7 +1707,7 @@ h263_decoder_select="error_resilience h263_parser mpegvideo"
|
|||||||
h263_encoder_select="aandcttables error_resilience mpegvideoenc"
|
h263_encoder_select="aandcttables error_resilience mpegvideoenc"
|
||||||
h263i_decoder_select="h263_decoder"
|
h263i_decoder_select="h263_decoder"
|
||||||
h263p_encoder_select="h263_encoder"
|
h263p_encoder_select="h263_encoder"
|
||||||
h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
||||||
huffyuv_encoder_select="huffman"
|
huffyuv_encoder_select="huffman"
|
||||||
iac_decoder_select="fft mdct sinewin"
|
iac_decoder_select="fft mdct sinewin"
|
||||||
imc_decoder_select="fft mdct sinewin"
|
imc_decoder_select="fft mdct sinewin"
|
||||||
@ -1868,7 +1868,7 @@ wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
|
|||||||
wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
|
wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
|
||||||
|
|
||||||
# parsers
|
# parsers
|
||||||
h264_parser_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
||||||
mpeg4video_parser_select="error_resilience mpegvideo"
|
mpeg4video_parser_select="error_resilience mpegvideo"
|
||||||
mpegvideo_parser_select="error_resilience mpegvideo"
|
mpegvideo_parser_select="error_resilience mpegvideo"
|
||||||
vc1_parser_select="error_resilience mpegvideo"
|
vc1_parser_select="error_resilience mpegvideo"
|
||||||
|
@ -1270,6 +1270,7 @@ static int context_init(H264Context *h)
|
|||||||
h->ref_cache[1][scan8[7] + 1] =
|
h->ref_cache[1][scan8[7] + 1] =
|
||||||
h->ref_cache[1][scan8[13] + 1] = PART_NOT_AVAILABLE;
|
h->ref_cache[1][scan8[13] + 1] = PART_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
/* init ER */
|
/* init ER */
|
||||||
er->avctx = h->avctx;
|
er->avctx = h->avctx;
|
||||||
er->dsp = &h->dsp;
|
er->dsp = &h->dsp;
|
||||||
@ -1309,6 +1310,7 @@ static int context_init(H264Context *h)
|
|||||||
er->dc_val[2] = er->dc_val[1] + c_size;
|
er->dc_val[2] = er->dc_val[1] + c_size;
|
||||||
for (i = 0; i < yc_size; i++)
|
for (i = 0; i < yc_size; i++)
|
||||||
h->dc_val_base[i] = 1024;
|
h->dc_val_base[i] = 1024;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1339,9 +1341,11 @@ static av_cold void common_init(H264Context *h)
|
|||||||
|
|
||||||
h->dequant_coeff_pps = -1;
|
h->dequant_coeff_pps = -1;
|
||||||
|
|
||||||
h->dsp.dct_bits = 16;
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
/* needed so that IDCT permutation is known early */
|
h->dsp.dct_bits = 16;
|
||||||
ff_dsputil_init(&h->dsp, h->avctx);
|
/* needed so that IDCT permutation is known early */
|
||||||
|
ff_dsputil_init(&h->dsp, h->avctx);
|
||||||
|
}
|
||||||
ff_videodsp_init(&h->vdsp, 8);
|
ff_videodsp_init(&h->vdsp, 8);
|
||||||
|
|
||||||
memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
|
memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
|
||||||
@ -1765,9 +1769,11 @@ int ff_h264_frame_start(H264Context *h)
|
|||||||
h->cur_pic = *h->cur_pic_ptr;
|
h->cur_pic = *h->cur_pic_ptr;
|
||||||
h->cur_pic.f.extended_data = h->cur_pic.f.data;
|
h->cur_pic.f.extended_data = h->cur_pic.f.data;
|
||||||
|
|
||||||
ff_er_frame_start(&h->er);
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
h->er.last_pic =
|
ff_er_frame_start(&h->er);
|
||||||
h->er.next_pic = NULL;
|
h->er.last_pic =
|
||||||
|
h->er.next_pic = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
assert(h->linesize && h->uvlinesize);
|
assert(h->linesize && h->uvlinesize);
|
||||||
|
|
||||||
@ -2777,7 +2783,8 @@ static int field_end(H264Context *h, int in_setup)
|
|||||||
* past end by one (callers fault) and resync_mb_y != 0
|
* past end by one (callers fault) and resync_mb_y != 0
|
||||||
* causes problems for the first MB line, too.
|
* causes problems for the first MB line, too.
|
||||||
*/
|
*/
|
||||||
if (!FIELD_PICTURE && h->current_slice && !h->sps.new) {
|
if (CONFIG_ERROR_RESILIENCE &&
|
||||||
|
!FIELD_PICTURE && h->current_slice && !h->sps.new) {
|
||||||
h->er.cur_pic = h->cur_pic_ptr;
|
h->er.cur_pic = h->cur_pic_ptr;
|
||||||
ff_er_frame_end(&h->er);
|
ff_er_frame_end(&h->er);
|
||||||
}
|
}
|
||||||
@ -2880,8 +2887,10 @@ static int h264_set_parameter_from_sps(H264Context *h)
|
|||||||
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
|
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
|
||||||
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
|
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
|
||||||
h->sps.chroma_format_idc);
|
h->sps.chroma_format_idc);
|
||||||
h->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
ff_dsputil_init(&h->dsp, h->avctx);
|
h->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
|
||||||
|
ff_dsputil_init(&h->dsp, h->avctx);
|
||||||
|
}
|
||||||
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
|
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
|
||||||
} else {
|
} else {
|
||||||
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
|
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
|
||||||
@ -3043,7 +3052,9 @@ static int h264_slice_header_init(H264Context *h, int reinit)
|
|||||||
H264Context *c;
|
H264Context *c;
|
||||||
c = h->thread_context[i] = av_mallocz(sizeof(H264Context));
|
c = h->thread_context[i] = av_mallocz(sizeof(H264Context));
|
||||||
c->avctx = h->avctx;
|
c->avctx = h->avctx;
|
||||||
c->dsp = h->dsp;
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
|
c->dsp = h->dsp;
|
||||||
|
}
|
||||||
c->vdsp = h->vdsp;
|
c->vdsp = h->vdsp;
|
||||||
c->h264dsp = h->h264dsp;
|
c->h264dsp = h->h264dsp;
|
||||||
c->h264qpel = h->h264qpel;
|
c->h264qpel = h->h264qpel;
|
||||||
@ -4152,10 +4163,12 @@ static void decode_finish_row(H264Context *h)
|
|||||||
static void er_add_slice(H264Context *h, int startx, int starty,
|
static void er_add_slice(H264Context *h, int startx, int starty,
|
||||||
int endx, int endy, int status)
|
int endx, int endy, int status)
|
||||||
{
|
{
|
||||||
ERContext *er = &h->er;
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
|
ERContext *er = &h->er;
|
||||||
|
|
||||||
er->ref_count = h->ref_count[0];
|
er->ref_count = h->ref_count[0];
|
||||||
ff_er_add_slice(er, startx, starty, endx, endy, status);
|
ff_er_add_slice(er, startx, starty, endx, endy, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||||
@ -4344,7 +4357,9 @@ static int execute_decode_slices(H264Context *h, int context_count)
|
|||||||
av_assert0(context_count > 0);
|
av_assert0(context_count > 0);
|
||||||
for (i = 1; i < context_count; i++) {
|
for (i = 1; i < context_count; i++) {
|
||||||
hx = h->thread_context[i];
|
hx = h->thread_context[i];
|
||||||
hx->er.error_count = 0;
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
|
hx->er.error_count = 0;
|
||||||
|
}
|
||||||
hx->x264_build = h->x264_build;
|
hx->x264_build = h->x264_build;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4357,8 +4372,10 @@ static int execute_decode_slices(H264Context *h, int context_count)
|
|||||||
h->mb_y = hx->mb_y;
|
h->mb_y = hx->mb_y;
|
||||||
h->droppable = hx->droppable;
|
h->droppable = hx->droppable;
|
||||||
h->picture_structure = hx->picture_structure;
|
h->picture_structure = hx->picture_structure;
|
||||||
for (i = 1; i < context_count; i++)
|
if (CONFIG_ERROR_RESILIENCE) {
|
||||||
h->er.error_count += h->thread_context[i]->er.error_count;
|
for (i = 1; i < context_count; i++)
|
||||||
|
h->er.error_count += h->thread_context[i]->er.error_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -256,7 +256,6 @@ typedef struct MMCO {
|
|||||||
*/
|
*/
|
||||||
typedef struct H264Context {
|
typedef struct H264Context {
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
DSPContext dsp;
|
|
||||||
VideoDSPContext vdsp;
|
VideoDSPContext vdsp;
|
||||||
H264DSPContext h264dsp;
|
H264DSPContext h264dsp;
|
||||||
H264ChromaContext h264chroma;
|
H264ChromaContext h264chroma;
|
||||||
@ -264,6 +263,7 @@ typedef struct H264Context {
|
|||||||
MotionEstContext me;
|
MotionEstContext me;
|
||||||
ParseContext parse_context;
|
ParseContext parse_context;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
|
DSPContext dsp;
|
||||||
ERContext er;
|
ERContext er;
|
||||||
|
|
||||||
Picture *DPB;
|
Picture *DPB;
|
||||||
|
Loading…
Reference in New Issue
Block a user