History

avcodec/hevc_ps: use get_ue_golomb() for some PPS multilayer extension fields

Also remove the _plus* and _minus* parts of some of these to be in line with other similar fields in the decoder.

James Almer committed 3 years ago

Commit 07605281 parent ab0f3f72 files · +22 −23Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/hevc_ps.c +13 −14
  2. libavcodec/hevc_ps.h +9 −9
libavcodec/hevc_ps.c+13−14
@@ -1324,7 +1324,7 @@ static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_dept · 1323 unmodified lines
1324 int idx_y, int idx_cb, int idx_cr, int inp_length)1324 int idx_y, int idx_cb, int idx_cr, int inp_length)
1325{1325{
1326 unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q, res_coeff_r;1326 unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q, res_coeff_r;
1327 int bit_depth_cm_input_y, bit_depth_cm_output_y, cm_res_bits;1327 int cm_res_bits;
1328 1328
1329 part_num_y = 1 << pps->cm_y_part_num_log2;1329 part_num_y = 1 << pps->cm_y_part_num_log2;
1330 1330
@@ -1346,10 +1346,9 @@ static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_dept · 15 unmodified lines
1346 if (coded_res_flag)1346 if (coded_res_flag)
1347 for (int c = 0; c < 3; c++) {1347 for (int c = 0; c < 3; c++) {
1348 res_coeff_q = get_ue_golomb_long(gb);1348 res_coeff_q = get_ue_golomb_long(gb);
1349 bit_depth_cm_input_y = 8 + pps->luma_bit_depth_cm_input_minus8;1349 cm_res_bits = FFMAX(0, 10 + pps->luma_bit_depth_cm_input -
1350 bit_depth_cm_output_y = 8 + pps->luma_bit_depth_cm_output_minus8;1350 pps->luma_bit_depth_cm_output -
1351 cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y - bit_depth_cm_output_y -1351 pps->cm_res_quant_bits - pps->cm_delta_flc_bits);
1352 pps->cm_res_quant_bits - (pps->cm_delta_flc_bits_minus1 + 1));
1353 res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0;1352 res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0;
1354 if (res_coeff_q || res_coeff_r)1353 if (res_coeff_q || res_coeff_r)
1355 skip_bits1(gb);1354 skip_bits1(gb);
@@ -1367,13 +1366,13 @@ static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps) · 11 unmodified lines
1367 pps->cm_octant_depth = get_bits(gb, 2);1366 pps->cm_octant_depth = get_bits(gb, 2);
1368 pps->cm_y_part_num_log2 = get_bits(gb, 2);1367 pps->cm_y_part_num_log2 = get_bits(gb, 2);
1369 1368
1370 pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);1369 pps->luma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
1371 pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);1370 pps->chroma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
1372 pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);1371 pps->luma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
1373 pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);1372 pps->chroma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
1374 1373
1375 pps->cm_res_quant_bits = get_bits(gb, 2);1374 pps->cm_res_quant_bits = get_bits(gb, 2);
1376 pps->cm_delta_flc_bits_minus1 = get_bits(gb, 2);1375 pps->cm_delta_flc_bits = get_bits(gb, 2) + 1;
1377 1376
1378 if (pps->cm_octant_depth == 1) {1377 if (pps->cm_octant_depth == 1) {
1379 pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb);1378 pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb);
@@ -1415,10 +1414,10 @@ static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx, · 35 unmodified lines
1415 1414
1416 pps->resample_phase_set_present_flag[i] = get_bits1(gb);1415 pps->resample_phase_set_present_flag[i] = get_bits1(gb);
1417 if (pps->resample_phase_set_present_flag[i]) {1416 if (pps->resample_phase_set_present_flag[i]) {
1418 pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);1417 pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_31(gb);
1419 pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);1418 pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_31(gb);
1420 pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);1419 pps->phase_hor_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
1421 pps->phase_ver_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);1420 pps->phase_ver_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
1422 }1421 }
1423 }1422 }
1424 1423
libavcodec/hevc_ps.h+9−9
@@ -327,21 +327,21 @@ typedef struct HEVCPPS { · 326 unmodified lines
327 int16_t ref_region_right_offset[64];327 int16_t ref_region_right_offset[64];
328 int16_t ref_region_bottom_offset[64];328 int16_t ref_region_bottom_offset[64];
329 uint8_t resample_phase_set_present_flag[64];329 uint8_t resample_phase_set_present_flag[64];
330 uint16_t phase_hor_luma[64];330 uint8_t phase_hor_luma[64];
331 uint16_t phase_ver_luma[64];331 uint8_t phase_ver_luma[64];
332 uint16_t phase_hor_chroma_plus8[64];332 int8_t phase_hor_chroma[64];
333 uint16_t phase_ver_chroma_plus8[64];333 int8_t phase_ver_chroma[64];
334 uint8_t colour_mapping_enabled_flag;334 uint8_t colour_mapping_enabled_flag;
335 uint16_t num_cm_ref_layers_minus1;335 uint16_t num_cm_ref_layers_minus1;
336 uint8_t cm_ref_layer_id[63];336 uint8_t cm_ref_layer_id[63];
337 uint8_t cm_octant_depth;337 uint8_t cm_octant_depth;
338 uint8_t cm_y_part_num_log2;338 uint8_t cm_y_part_num_log2;
339 uint16_t luma_bit_depth_cm_input_minus8;339 uint8_t luma_bit_depth_cm_input;
340 uint16_t chroma_bit_depth_cm_input_minus8;340 uint8_t chroma_bit_depth_cm_input;
341 uint16_t luma_bit_depth_cm_output_minus8;341 uint8_t luma_bit_depth_cm_output;
342 uint16_t chroma_bit_depth_cm_output_minus8;342 uint8_t chroma_bit_depth_cm_output;
343 uint8_t cm_res_quant_bits;343 uint8_t cm_res_quant_bits;
344 uint8_t cm_delta_flc_bits_minus1;344 uint8_t cm_delta_flc_bits;
345 int8_t cm_adapt_threshold_u_delta;345 int8_t cm_adapt_threshold_u_delta;
346 int8_t cm_adapt_threshold_v_delta;346 int8_t cm_adapt_threshold_v_delta;
347 347

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t