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
13241324 int idx_y, int idx_cb, int idx_cr, int inp_length)
13251325 {
13261326 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;
13281328
13291329 part_num_y = 1 << pps->cm_y_part_num_log2;
13301330
@@ -1346,10 +1346,9 @@ static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_dept · 15 unmodified lines
13461346 if (coded_res_flag)
13471347 for (int c = 0; c < 3; c++) {
13481348 res_coeff_q = get_ue_golomb_long(gb);
1349− bit_depth_cm_input_y = 8 + pps->luma_bit_depth_cm_input_minus8;
1350− bit_depth_cm_output_y = 8 + pps->luma_bit_depth_cm_output_minus8;
1351− cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y - bit_depth_cm_output_y -
1352− pps->cm_res_quant_bits - (pps->cm_delta_flc_bits_minus1 + 1));
1349+ cm_res_bits = FFMAX(0, 10 + pps->luma_bit_depth_cm_input -
1350+ pps->luma_bit_depth_cm_output -
1351+ pps->cm_res_quant_bits - pps->cm_delta_flc_bits);
13531352 res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0;
13541353 if (res_coeff_q || res_coeff_r)
13551354 skip_bits1(gb);
@@ -1367,13 +1366,13 @@ static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps) · 11 unmodified lines
13671366 pps->cm_octant_depth = get_bits(gb, 2);
13681367 pps->cm_y_part_num_log2 = get_bits(gb, 2);
13691368
1370− pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
1371− pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
1372− pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
1373− pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
1369+ pps->luma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
1370+ pps->chroma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
1371+ pps->luma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
1372+ pps->chroma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
13741373
13751374 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;
13771376
13781377 if (pps->cm_octant_depth == 1) {
13791378 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
14151414
14161415 pps->resample_phase_set_present_flag[i] = get_bits1(gb);
14171416 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);
1419− pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
1420− pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
1421− pps->phase_ver_chroma_plus8[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);
1418+ pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_31(gb);
1419+ pps->phase_hor_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
1420+ pps->phase_ver_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
14221421 }
14231422 }
14241423
libavcodec/hevc_ps.h+9−9
@@ -327,21 +327,21 @@ typedef struct HEVCPPS { · 326 unmodified lines
327327 int16_t ref_region_right_offset[64];
328328 int16_t ref_region_bottom_offset[64];
329329 uint8_t resample_phase_set_present_flag[64];
330− uint16_t phase_hor_luma[64];
331− uint16_t phase_ver_luma[64];
332− uint16_t phase_hor_chroma_plus8[64];
333− uint16_t phase_ver_chroma_plus8[64];
330+ uint8_t phase_hor_luma[64];
331+ uint8_t phase_ver_luma[64];
332+ int8_t phase_hor_chroma[64];
333+ int8_t phase_ver_chroma[64];
334334 uint8_t colour_mapping_enabled_flag;
335335 uint16_t num_cm_ref_layers_minus1;
336336 uint8_t cm_ref_layer_id[63];
337337 uint8_t cm_octant_depth;
338338 uint8_t cm_y_part_num_log2;
339− uint16_t luma_bit_depth_cm_input_minus8;
340− uint16_t chroma_bit_depth_cm_input_minus8;
341− uint16_t luma_bit_depth_cm_output_minus8;
342− uint16_t chroma_bit_depth_cm_output_minus8;
339+ uint8_t luma_bit_depth_cm_input;
340+ uint8_t chroma_bit_depth_cm_input;
341+ uint8_t luma_bit_depth_cm_output;
342+ uint8_t chroma_bit_depth_cm_output;
343343 uint8_t cm_res_quant_bits;
344− uint8_t cm_delta_flc_bits_minus1;
344+ uint8_t cm_delta_flc_bits;
345345 int8_t cm_adapt_threshold_u_delta;
346346 int8_t cm_adapt_threshold_v_delta;
347347

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