mirror of https://git.videolan.org/git/ffmpeg.git
Merge commit '330ad1f6a53a37dec228cb424ca57e1268fafc64'
* commit '330ad1f6a53a37dec228cb424ca57e1268fafc64': h264_ps: K&R formatting cosmetics Conflicts: libavcodec/h264_ps.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
e853cf5325
|
@ -69,61 +69,42 @@ static const AVRational pixel_aspect[17]={
|
|||
QP(39, d), QP(39, d), QP(39, d), QP(39, d)
|
||||
|
||||
const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM + 1] = {
|
||||
{
|
||||
CHROMA_QP_TABLE_END(8)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(9)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
{ CHROMA_QP_TABLE_END(8) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(9) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11,
|
||||
CHROMA_QP_TABLE_END(10)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(10) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11,
|
||||
12,13,14,15, 16, 17,
|
||||
CHROMA_QP_TABLE_END(11)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(11) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11,
|
||||
12,13,14,15, 16, 17,
|
||||
18,19,20,21, 22, 23,
|
||||
CHROMA_QP_TABLE_END(12)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(12) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11,
|
||||
12,13,14,15, 16, 17,
|
||||
18,19,20,21, 22, 23,
|
||||
24,25,26,27, 28, 29,
|
||||
CHROMA_QP_TABLE_END(13)
|
||||
},
|
||||
{
|
||||
0, 1, 2, 3, 4, 5,
|
||||
CHROMA_QP_TABLE_END(13) },
|
||||
{ 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 11,
|
||||
12,13,14,15, 16, 17,
|
||||
18,19,20,21, 22, 23,
|
||||
24,25,26,27, 28, 29,
|
||||
30,31,32,33, 34, 35,
|
||||
CHROMA_QP_TABLE_END(14)
|
||||
},
|
||||
CHROMA_QP_TABLE_END(14) },
|
||||
};
|
||||
|
||||
static const uint8_t default_scaling4[2][16] = {
|
||||
{ 6,13,20,28,
|
||||
13,20,28,32,
|
||||
20,28,32,37,
|
||||
28,32,37,42
|
||||
},{
|
||||
10,14,20,24,
|
||||
14,20,24,27,
|
||||
20,24,27,30,
|
||||
24,27,30,34
|
||||
}};
|
||||
{ 6, 13, 20, 28, 13, 20, 28, 32,
|
||||
20, 28, 32, 37, 28, 32, 37, 42 },
|
||||
{ 10, 14, 20, 24, 14, 20, 24, 27,
|
||||
20, 24, 27, 30, 24, 27, 30, 34 }
|
||||
};
|
||||
|
||||
static const uint8_t default_scaling8[2][64] = {
|
||||
{ 6, 10, 13, 16, 18, 23, 25, 27,
|
||||
|
@ -133,19 +114,19 @@ static const uint8_t default_scaling8[2][64]={
|
|||
18, 23, 25, 27, 29, 31, 33, 36,
|
||||
23, 25, 27, 29, 31, 33, 36, 38,
|
||||
25, 27, 29, 31, 33, 36, 38, 40,
|
||||
27,29,31,33,36,38,40,42
|
||||
},{
|
||||
9,13,15,17,19,21,22,24,
|
||||
27, 29, 31, 33, 36, 38, 40, 42 },
|
||||
{ 9, 13, 15, 17, 19, 21, 22, 24,
|
||||
13, 13, 17, 19, 21, 22, 24, 25,
|
||||
15, 17, 19, 21, 22, 24, 25, 27,
|
||||
17, 19, 21, 22, 24, 25, 27, 28,
|
||||
19, 21, 22, 24, 25, 27, 28, 30,
|
||||
21, 22, 24, 25, 27, 28, 30, 32,
|
||||
22, 24, 25, 27, 28, 30, 32, 33,
|
||||
24,25,27,28,30,32,33,35
|
||||
}};
|
||||
24, 25, 27, 28, 30, 32, 33, 35 }
|
||||
};
|
||||
|
||||
static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
|
||||
static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
|
||||
{
|
||||
int cpb_count, i;
|
||||
cpb_count = get_ue_golomb_31(&h->gb) + 1;
|
||||
|
||||
|
@ -169,7 +150,8 @@ static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
||||
static inline int decode_vui_parameters(H264Context *h, SPS *sps)
|
||||
{
|
||||
int aspect_ratio_info_present_flag;
|
||||
unsigned int aspect_ratio_idc;
|
||||
|
||||
|
@ -191,9 +173,8 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
sps->sar.den = 0;
|
||||
}
|
||||
|
||||
if(get_bits1(&h->gb)){ /* overscan_info_present_flag */
|
||||
if (get_bits1(&h->gb)) /* overscan_info_present_flag */
|
||||
get_bits1(&h->gb); /* overscan_appropriate_flag */
|
||||
}
|
||||
|
||||
sps->video_signal_type_present_flag = get_bits1(&h->gb);
|
||||
if (sps->video_signal_type_present_flag) {
|
||||
|
@ -214,8 +195,10 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
}
|
||||
}
|
||||
|
||||
if(get_bits1(&h->gb)){ /* chroma_location_info_present_flag */
|
||||
h->avctx->chroma_sample_location = get_ue_golomb(&h->gb)+1; /* chroma_sample_location_type_top_field */
|
||||
/* chroma_location_info_present_flag */
|
||||
if (get_bits1(&h->gb)) {
|
||||
/* chroma_sample_location_type_top_field */
|
||||
h->avctx->chroma_sample_location = get_ue_golomb(&h->gb) + 1;
|
||||
get_ue_golomb(&h->gb); /* chroma_sample_location_type_bottom_field */
|
||||
}
|
||||
|
||||
|
@ -229,7 +212,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
sps->num_units_in_tick = get_bits_long(&h->gb, 32);
|
||||
sps->time_scale = get_bits_long(&h->gb, 32);
|
||||
if (!sps->num_units_in_tick || !sps->time_scale) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n",
|
||||
sps->time_scale, sps->num_units_in_tick);
|
||||
return -1;
|
||||
}
|
||||
sps->fixed_frame_rate_flag = get_bits1(&h->gb);
|
||||
|
@ -243,7 +228,8 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
if (sps->vcl_hrd_parameters_present_flag)
|
||||
if (decode_hrd_parameters(h, sps) < 0)
|
||||
return -1;
|
||||
if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
|
||||
if (sps->nal_hrd_parameters_present_flag ||
|
||||
sps->vcl_hrd_parameters_present_flag)
|
||||
get_bits1(&h->gb); /* low_delay_hrd_flag */
|
||||
sps->pic_struct_present_flag = get_bits1(&h->gb);
|
||||
if (!get_bits_left(&h->gb))
|
||||
|
@ -263,14 +249,17 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
sps->bitstream_restriction_flag = 0;
|
||||
}
|
||||
|
||||
if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
|
||||
av_log(h->avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
|
||||
if (sps->num_reorder_frames > 16U
|
||||
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"illegal num_reorder_frames %d\n", sps->num_reorder_frames);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (get_bits_left(&h->gb) < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&h->gb));
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Overread VUI by %d bits\n", -get_bits_left(&h->gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
@ -278,7 +267,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||
}
|
||||
|
||||
static void decode_scaling_list(H264Context *h, uint8_t *factors, int size,
|
||||
const uint8_t *jvt_list, const uint8_t *fallback_list){
|
||||
const uint8_t *jvt_list,
|
||||
const uint8_t *fallback_list)
|
||||
{
|
||||
int i, last = 8, next = 8;
|
||||
const uint8_t *scan = size == 16 ? zigzag_scan : ff_zigzag_direct;
|
||||
if (!get_bits1(&h->gb)) /* matrix not written, we use the predicted one */
|
||||
|
@ -295,8 +286,11 @@ static void decode_scaling_list(H264Context *h, uint8_t *factors, int size,
|
|||
}
|
||||
}
|
||||
|
||||
static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_sps,
|
||||
uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64]){
|
||||
static void decode_scaling_matrices(H264Context *h, SPS *sps,
|
||||
PPS *pps, int is_sps,
|
||||
uint8_t(*scaling_matrix4)[16],
|
||||
uint8_t(*scaling_matrix8)[64])
|
||||
{
|
||||
int fallback_sps = !is_sps && sps->scaling_matrix_present;
|
||||
const uint8_t *fallback[4] = {
|
||||
fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
|
||||
|
@ -325,7 +319,8 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
|
|||
}
|
||||
}
|
||||
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h){
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
{
|
||||
int profile_idc, level_idc, constraint_set_flags = 0;
|
||||
unsigned int sps_id;
|
||||
int i, log2_max_frame_num_minus4;
|
||||
|
@ -368,7 +363,9 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
sps->profile_idc == 128 || sps->profile_idc == 144) {
|
||||
sps->chroma_format_idc = get_ue_golomb_31(&h->gb);
|
||||
if (sps->chroma_format_idc > 3U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "chroma_format_idc %d is illegal\n", sps->chroma_format_idc);
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"chroma_format_idc %d is illegal\n",
|
||||
sps->chroma_format_idc);
|
||||
goto fail;
|
||||
} else if (sps->chroma_format_idc == 3) {
|
||||
sps->residual_color_transform_flag = get_bits1(&h->gb);
|
||||
|
@ -385,7 +382,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
goto fail;
|
||||
}
|
||||
sps->transform_bypass = get_bits1(&h->gb);
|
||||
decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
|
||||
decode_scaling_matrices(h, sps, NULL, 1,
|
||||
sps->scaling_matrix4, sps->scaling_matrix8);
|
||||
} else {
|
||||
sps->chroma_format_idc = 1;
|
||||
sps->bit_depth_luma = 8;
|
||||
|
@ -417,8 +415,10 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
sps->offset_for_top_to_bottom_field = get_se_golomb(&h->gb);
|
||||
sps->poc_cycle_length = get_ue_golomb(&h->gb);
|
||||
|
||||
if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
|
||||
av_log(h->avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
|
||||
if ((unsigned)sps->poc_cycle_length >=
|
||||
FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"poc_cycle_length overflow %u\n", sps->poc_cycle_length);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -432,15 +432,18 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
sps->ref_frame_count = get_ue_golomb_31(&h->gb);
|
||||
if (h->avctx->codec_tag == MKTAG('S', 'M', 'V', '2'))
|
||||
sps->ref_frame_count = FFMAX(2, sps->ref_frame_count);
|
||||
if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count > 16U){
|
||||
if (sps->ref_frame_count > MAX_PICTURE_COUNT - 2 ||
|
||||
sps->ref_frame_count > 16U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "too many reference frames\n");
|
||||
goto fail;
|
||||
}
|
||||
sps->gaps_in_frame_num_allowed_flag = get_bits1(&h->gb);
|
||||
sps->mb_width = get_ue_golomb(&h->gb) + 1;
|
||||
sps->mb_height = get_ue_golomb(&h->gb) + 1;
|
||||
if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
|
||||
av_image_check_size(16*sps->mb_width, 16*sps->mb_height, 0, h->avctx)){
|
||||
if ((unsigned)sps->mb_width >= INT_MAX / 16 ||
|
||||
(unsigned)sps->mb_height >= INT_MAX / 16 ||
|
||||
av_image_check_size(16 * sps->mb_width,
|
||||
16 * sps->mb_height, 0, h->avctx)) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
|
||||
goto fail;
|
||||
}
|
||||
|
@ -455,7 +458,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
|
||||
#ifndef ALLOW_INTERLACE
|
||||
if (sps->mb_aff)
|
||||
av_log(h->avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n");
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"MBAFF support not included; enable it at compile-time.\n");
|
||||
#endif
|
||||
sps->crop = get_bits1(&h->gb);
|
||||
if (sps->crop) {
|
||||
|
@ -468,8 +472,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
|
||||
if (h->avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG, "discarding sps cropping, original "
|
||||
"values are l:%u r:%u t:%u b:%u\n", crop_left, crop_right,
|
||||
crop_top, crop_bottom);
|
||||
"values are l:%u r:%u t:%u b:%u\n",
|
||||
crop_left, crop_right, crop_top, crop_bottom);
|
||||
|
||||
sps->crop_left =
|
||||
sps->crop_right =
|
||||
|
@ -477,14 +481,16 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
sps->crop_bottom = 0;
|
||||
} else {
|
||||
int vsub = (sps->chroma_format_idc == 1) ? 1 : 0;
|
||||
int hsub = (sps->chroma_format_idc == 1 || sps->chroma_format_idc == 2) ? 1 : 0;
|
||||
int hsub = (sps->chroma_format_idc == 1 ||
|
||||
sps->chroma_format_idc == 2) ? 1 : 0;
|
||||
int step_x = 1 << hsub;
|
||||
int step_y = (2 - sps->frame_mbs_only_flag) << vsub;
|
||||
|
||||
if (crop_left & (0x1F >> (sps->bit_depth_luma > 8)) &&
|
||||
!(h->avctx->flags & CODEC_FLAG_UNALIGNED)) {
|
||||
crop_left &= ~(0x1F >> (sps->bit_depth_luma > 8));
|
||||
av_log(h->avctx, AV_LOG_WARNING, "Reducing left cropping to %d "
|
||||
av_log(h->avctx, AV_LOG_WARNING,
|
||||
"Reducing left cropping to %d "
|
||||
"chroma samples to preserve alignment.\n",
|
||||
crop_left);
|
||||
}
|
||||
|
@ -509,7 +515,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
sps->crop_left =
|
||||
sps->crop_right =
|
||||
sps->crop_top =
|
||||
sps->crop_bottom= 0;
|
||||
sps->crop_bottom =
|
||||
sps->crop = 0;
|
||||
}
|
||||
|
||||
|
@ -523,7 +529,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
|
||||
if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
static const char csp[4][5] = { "Gray", "420", "422", "444" };
|
||||
av_log(h->avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d b%d reo:%d\n",
|
||||
av_log(h->avctx, AV_LOG_DEBUG,
|
||||
"sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d b%d reo:%d\n",
|
||||
sps_id, sps->profile_idc, sps->level_idc,
|
||||
sps->poc_type,
|
||||
sps->ref_frame_count,
|
||||
|
@ -546,18 +553,19 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||
h->sps_buffers[sps_id] = sps;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_free(sps);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
build_qp_table(PPS *pps, int t, int index, const int depth)
|
||||
static void build_qp_table(PPS *pps, int t, int index, const int depth)
|
||||
{
|
||||
int i;
|
||||
const int max_qp = 51 + 6 * (depth - 8);
|
||||
for (i = 0; i < max_qp + 1; i++)
|
||||
pps->chroma_qp_table[t][i] = ff_h264_chroma_qp[depth-8][av_clip(i + index, 0, max_qp)];
|
||||
pps->chroma_qp_table[t][i] =
|
||||
ff_h264_chroma_qp[depth - 8][av_clip(i + index, 0, max_qp)];
|
||||
}
|
||||
|
||||
static int more_rbsp_data_in_pps(H264Context *h, PPS *pps)
|
||||
|
@ -575,7 +583,8 @@ static int more_rbsp_data_in_pps(H264Context *h, PPS *pps)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
||||
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
|
||||
{
|
||||
unsigned int pps_id = get_ue_golomb(&h->gb);
|
||||
PPS *pps;
|
||||
SPS *sps;
|
||||
|
@ -591,17 +600,22 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
if (pps == NULL)
|
||||
return -1;
|
||||
pps->sps_id = get_ue_golomb_31(&h->gb);
|
||||
if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){
|
||||
if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
|
||||
h->sps_buffers[pps->sps_id] == NULL) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "sps_id out of range\n");
|
||||
goto fail;
|
||||
}
|
||||
sps = h->sps_buffers[pps->sps_id];
|
||||
qp_bd_offset = 6 * (sps->bit_depth_luma - 8);
|
||||
if (sps->bit_depth_luma > 14) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Invalid luma bit depth=%d\n", sps->bit_depth_luma);
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Invalid luma bit depth=%d\n",
|
||||
sps->bit_depth_luma);
|
||||
goto fail;
|
||||
} else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d\n", sps->bit_depth_luma);
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Unimplemented luma bit depth=%d\n",
|
||||
sps->bit_depth_luma);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -620,8 +634,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
break;
|
||||
case 2:
|
||||
#if 0
|
||||
| for( i = 0; i < num_slice_groups_minus1; i++ ) | | |
|
||||
|{ | | |
|
||||
| for (i = 0; i < num_slice_groups_minus1; i++) { | | |
|
||||
| top_left_mb[i] |1 |ue(v) |
|
||||
| bottom_right_mb[i] |1 |ue(v) |
|
||||
| } | | |
|
||||
|
@ -638,8 +651,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
case 6:
|
||||
#if 0
|
||||
| slice_group_id_cnt_minus1 |1 |ue(v) |
|
||||
| for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | |
|
||||
|) | | |
|
||||
| for (i = 0; i <= slice_group_id_cnt_minus1; i++)| | |
|
||||
| slice_group_id[i] |1 |u(v) |
|
||||
#endif
|
||||
break;
|
||||
|
@ -662,15 +674,20 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
pps->redundant_pic_cnt_present = get_bits1(&h->gb);
|
||||
|
||||
pps->transform_8x8_mode = 0;
|
||||
h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit
|
||||
memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4));
|
||||
memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8));
|
||||
// contents of sps/pps can change even if id doesn't, so reinit
|
||||
h->dequant_coeff_pps = -1;
|
||||
memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4,
|
||||
sizeof(pps->scaling_matrix4));
|
||||
memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8,
|
||||
sizeof(pps->scaling_matrix8));
|
||||
|
||||
bits_left = bit_length - get_bits_count(&h->gb);
|
||||
if (bits_left > 0 && more_rbsp_data_in_pps(h, pps)) {
|
||||
pps->transform_8x8_mode = get_bits1(&h->gb);
|
||||
decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);
|
||||
pps->chroma_qp_index_offset[1]= get_se_golomb(&h->gb); //second_chroma_qp_index_offset
|
||||
decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0,
|
||||
pps->scaling_matrix4, pps->scaling_matrix8);
|
||||
// second_chroma_qp_index_offset
|
||||
pps->chroma_qp_index_offset[1] = get_se_golomb(&h->gb);
|
||||
} else {
|
||||
pps->chroma_qp_index_offset[1] = pps->chroma_qp_index_offset[0];
|
||||
}
|
||||
|
@ -681,7 +698,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
pps->chroma_qp_diff = 1;
|
||||
|
||||
if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",
|
||||
av_log(h->avctx, AV_LOG_DEBUG,
|
||||
"pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",
|
||||
pps_id, pps->sps_id,
|
||||
pps->cabac ? "CABAC" : "CAVLC",
|
||||
pps->slice_group_count,
|
||||
|
@ -691,13 +709,13 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
|
|||
pps->deblocking_filter_parameters_present ? "LPAR" : "",
|
||||
pps->constrained_intra_pred ? "CONSTR" : "",
|
||||
pps->redundant_pic_cnt_present ? "REDU" : "",
|
||||
pps->transform_8x8_mode ? "8x8DCT" : ""
|
||||
);
|
||||
pps->transform_8x8_mode ? "8x8DCT" : "");
|
||||
}
|
||||
|
||||
av_free(h->pps_buffers[pps_id]);
|
||||
h->pps_buffers[pps_id] = pps;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_free(pps);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue