@ -1507,7 +1507,8 @@ int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
h - > is_avc = 1 ;
h - > is_avc = 1 ;
if ( size < 7 ) {
if ( size < 7 ) {
av_log ( avctx , AV_LOG_ERROR , " avcC too short \n " ) ;
av_log ( avctx , AV_LOG_ERROR ,
" avcC %d too short \n " , size ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
/* sps and pps in the avcC always have length coded with 2 bytes,
/* sps and pps in the avcC always have length coded with 2 bytes,
@ -1820,7 +1821,7 @@ static int decode_update_thread_context(AVCodecContext *dst,
ret = ff_h264_alloc_tables ( h ) ;
ret = ff_h264_alloc_tables ( h ) ;
if ( ret < 0 ) {
if ( ret < 0 ) {
av_log ( dst , AV_LOG_ERROR , " Could not allocate memory for h264 \n " ) ;
av_log ( dst , AV_LOG_ERROR , " Could not allocate memory \n " ) ;
return ret ;
return ret ;
}
}
ret = context_init ( h ) ;
ret = context_init ( h ) ;
@ -3143,7 +3144,7 @@ static int h264_set_parameter_from_sps(H264Context *h)
ff_dsputil_init ( & h - > dsp , h - > avctx ) ;
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 " ,
h - > sps . bit_depth_luma ) ;
h - > sps . bit_depth_luma ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
@ -3227,7 +3228,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
break ;
break ;
default :
default :
av_log ( h - > avctx , AV_LOG_ERROR ,
av_log ( h - > avctx , AV_LOG_ERROR ,
" Unsupported bit depth: %d \n " , h - > sps . bit_depth_luma ) ;
" Unsupported bit depth %d \n " , h - > sps . bit_depth_luma ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
}
}
@ -3300,8 +3301,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
init_scan_tables ( h ) ;
init_scan_tables ( h ) ;
ret = ff_h264_alloc_tables ( h ) ;
ret = ff_h264_alloc_tables ( h ) ;
if ( ret < 0 ) {
if ( ret < 0 ) {
av_log ( h - > avctx , AV_LOG_ERROR ,
av_log ( h - > avctx , AV_LOG_ERROR , " Could not allocate memory \n " ) ;
" Could not allocate memory for h264 \n " ) ;
return ret ;
return ret ;
}
}
@ -3311,7 +3311,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
max_slices = FFMIN ( MAX_THREADS , h - > mb_height ) ;
max_slices = FFMIN ( MAX_THREADS , h - > mb_height ) ;
else
else
max_slices = MAX_THREADS ;
max_slices = MAX_THREADS ;
av_log ( h - > avctx , AV_LOG_WARNING , " too many threads/slices ( %d) , "
av_log ( h - > avctx , AV_LOG_WARNING , " too many threads/slices %d, "
" reducing to %d \n " , nb_slices , max_slices ) ;
" reducing to %d \n " , nb_slices , max_slices ) ;
nb_slices = max_slices ;
nb_slices = max_slices ;
}
}
@ -3474,7 +3474,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
slice_type = get_ue_golomb_31 ( & h - > gb ) ;
slice_type = get_ue_golomb_31 ( & h - > gb ) ;
if ( slice_type > 9 ) {
if ( slice_type > 9 ) {
av_log ( h - > avctx , AV_LOG_ERROR ,
av_log ( h - > avctx , AV_LOG_ERROR ,
" slice type too large (%d) at %d %d \n " ,
" slice type %d too large at %d %d \n " ,
slice_type , h - > mb_x , h - > mb_y ) ;
slice_type , h - > mb_x , h - > mb_y ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
@ -3499,7 +3499,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
pps_id = get_ue_golomb ( & h - > gb ) ;
pps_id = get_ue_golomb ( & h - > gb ) ;
if ( pps_id > = MAX_PPS_COUNT ) {
if ( pps_id > = MAX_PPS_COUNT ) {
av_log ( h - > avctx , AV_LOG_ERROR , " pps_id %d out of range \n " , pps_id ) ;
av_log ( h - > avctx , AV_LOG_ERROR , " pps_id %u out of range \n " , pps_id ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
if ( ! h0 - > pps_buffers [ pps_id ] ) {
if ( ! h0 - > pps_buffers [ pps_id ] ) {
@ -3674,7 +3674,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
} else if ( ! h0 - > cur_pic_ptr ) {
} else if ( ! h0 - > cur_pic_ptr ) {
av_log ( h - > avctx , AV_LOG_ERROR ,
av_log ( h - > avctx , AV_LOG_ERROR ,
" unset cur_pic_ptr on %d. slice \n " ,
" unset cur_pic_ptr on slice %d \n " ,
h0 - > current_slice + 1 ) ;
h0 - > current_slice + 1 ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
@ -3974,7 +3974,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
if ( h - > slice_type_nos ! = AV_PICTURE_TYPE_I & & h - > pps . cabac ) {
if ( h - > slice_type_nos ! = AV_PICTURE_TYPE_I & & h - > pps . cabac ) {
tmp = get_ue_golomb_31 ( & h - > gb ) ;
tmp = get_ue_golomb_31 ( & h - > gb ) ;
if ( tmp > 2 ) {
if ( tmp > 2 ) {
av_log ( h - > avctx , AV_LOG_ERROR , " cabac_init_idc overflow \n " ) ;
av_log ( h - > avctx , AV_LOG_ERROR , " cabac_init_idc %u overflow \n " , tmp ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
}
h - > cabac_init_idc = tmp ;
h - > cabac_init_idc = tmp ;
@ -4573,7 +4573,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
av_log ( h - > avctx , AV_LOG_DEBUG , " bytestream overread %td \n " , h - > cabac . bytestream_end - h - > cabac . bytestream ) ;
av_log ( h - > avctx , AV_LOG_DEBUG , " bytestream overread %td \n " , h - > cabac . bytestream_end - h - > cabac . bytestream ) ;
if ( ret < 0 | | h - > cabac . bytestream > h - > cabac . bytestream_end + 4 ) {
if ( ret < 0 | | h - > cabac . bytestream > h - > cabac . bytestream_end + 4 ) {
av_log ( h - > avctx , AV_LOG_ERROR ,
av_log ( h - > avctx , AV_LOG_ERROR ,
" error while decoding MB %d %d, bytestream ( %td) \n " ,
" error while decoding MB %d %d, bytestream %td \n " ,
h - > mb_x , h - > mb_y ,
h - > mb_x , h - > mb_y ,
h - > cabac . bytestream_end - h - > cabac . bytestream ) ;
h - > cabac . bytestream_end - h - > cabac . bytestream ) ;
er_add_slice ( h , h - > resync_mb_x , h - > resync_mb_y , h - > mb_x ,
er_add_slice ( h , h - > resync_mb_x , h - > resync_mb_y , h - > mb_x ,