summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_ps.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-04-17 10:30:28 -0300
committerJames Almer <jamrial@gmail.com>2023-04-20 09:53:30 -0300
commit0760528af2cfd4dfa9eb23788a308183bd68acf3 (patch)
treecda07b6df61d20d4e158b0067bd72beb6b1a8de2 /libavcodec/hevc_ps.c
parentab0f3f7fbf5e97752ba8d72ed0eddb61aaded787 (diff)
downloadffmpeg-0760528af2cfd4dfa9eb23788a308183bd68acf3.tar.gz
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. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r--libavcodec/hevc_ps.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 69d5504ce1..7401ea23f5 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1324,7 +1324,7 @@ static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_dept
int idx_y, int idx_cb, int idx_cr, int inp_length)
{
unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q, res_coeff_r;
- int bit_depth_cm_input_y, bit_depth_cm_output_y, cm_res_bits;
+ int cm_res_bits;
part_num_y = 1 << pps->cm_y_part_num_log2;
@@ -1346,10 +1346,9 @@ static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_dept
if (coded_res_flag)
for (int c = 0; c < 3; c++) {
res_coeff_q = get_ue_golomb_long(gb);
- bit_depth_cm_input_y = 8 + pps->luma_bit_depth_cm_input_minus8;
- bit_depth_cm_output_y = 8 + pps->luma_bit_depth_cm_output_minus8;
- cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y - bit_depth_cm_output_y -
- pps->cm_res_quant_bits - (pps->cm_delta_flc_bits_minus1 + 1));
+ cm_res_bits = FFMAX(0, 10 + pps->luma_bit_depth_cm_input -
+ pps->luma_bit_depth_cm_output -
+ pps->cm_res_quant_bits - pps->cm_delta_flc_bits);
res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0;
if (res_coeff_q || res_coeff_r)
skip_bits1(gb);
@@ -1367,13 +1366,13 @@ static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps)
pps->cm_octant_depth = get_bits(gb, 2);
pps->cm_y_part_num_log2 = get_bits(gb, 2);
- pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
- pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
- pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
- pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
+ pps->luma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
+ pps->chroma_bit_depth_cm_input = get_ue_golomb(gb) + 8;
+ pps->luma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
+ pps->chroma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
pps->cm_res_quant_bits = get_bits(gb, 2);
- pps->cm_delta_flc_bits_minus1 = get_bits(gb, 2);
+ pps->cm_delta_flc_bits = get_bits(gb, 2) + 1;
if (pps->cm_octant_depth == 1) {
pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb);
@@ -1415,10 +1414,10 @@ static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx,
pps->resample_phase_set_present_flag[i] = get_bits1(gb);
if (pps->resample_phase_set_present_flag[i]) {
- pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
- pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
- pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
- pps->phase_ver_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
+ pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_31(gb);
+ pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_31(gb);
+ pps->phase_hor_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
+ pps->phase_ver_chroma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb(gb) - 8;
}
}