31 16, 16, 16, 16, 17, 18, 21, 24,
32 16, 16, 16, 16, 17, 19, 22, 25,
33 16, 16, 17, 18, 20, 22, 25, 29,
34 16, 16, 18, 21, 24, 27, 31, 36,
35 17, 17, 20, 24, 30, 35, 41, 47,
36 18, 19, 22, 27, 35, 44, 54, 65,
37 21, 22, 25, 31, 41, 54, 70, 88,
38 24, 25, 29, 36, 47, 65, 88, 115
42 16, 16, 16, 16, 17, 18, 20, 24,
43 16, 16, 16, 17, 18, 20, 24, 25,
44 16, 16, 17, 18, 20, 24, 25, 28,
45 16, 17, 18, 20, 24, 25, 28, 33,
46 17, 18, 20, 24, 25, 28, 33, 41,
47 18, 20, 24, 25, 28, 33, 41, 54,
48 20, 24, 25, 28, 33, 41, 54, 71,
49 24, 25, 28, 33, 41, 54, 71, 91
73 const HEVCSPS *sps,
int is_slice_header)
91 unsigned abs_delta_rps;
95 if (is_slice_header) {
99 "Invalid value of delta_idx in slice header RPS: %d > %d.\n",
109 if (abs_delta_rps < 1 || abs_delta_rps > 32768) {
111 "Invalid value of abs_delta_rps: %d\n",
115 delta_rps = (1 - (delta_rps_sign << 1)) * abs_delta_rps;
122 if (used || use_delta_flag) {
123 if (i < rps_ridx->num_delta_pocs)
124 delta_poc = delta_rps + rps_ridx->
delta_poc[i];
126 delta_poc = delta_rps;
144 for (k = i - 1; k >= 0; k--) {
146 if (delta_poc < tmp) {
170 unsigned int prev, nb_positive_pics;
190 for (i = 0; i < nb_positive_pics; i++) {
225 for (i = 0; i < 32; i++)
252 for (i = 0; i < max_num_sub_layers - 1; i++) {
257 if (max_num_sub_layers - 1> 0)
258 for (i = max_num_sub_layers - 1; i < 8; i++)
260 for (i = 0; i < max_num_sub_layers - 1; i++) {
264 "PTL information for sublayer %i too short\n", i);
270 "Not enough data for sublayer %i level_idc\n", i);
281 int subpic_params_present)
286 for (i = 0; i < nb_cpb; i++) {
290 if (subpic_params_present) {
302 int nal_params_present = 0, vcl_params_present = 0;
303 int subpic_params_present = 0;
306 if (common_inf_present) {
310 if (nal_params_present || vcl_params_present) {
313 if (subpic_params_present) {
323 if (subpic_params_present)
332 for (i = 0; i < max_sublayers; i++) {
334 unsigned int nb_cpb = 1;
347 if (nb_cpb < 1 || nb_cpb > 32) {
353 if (nal_params_present)
355 if (vcl_params_present)
445 int common_inf_present = 1;
475 int sar_present, alt = 0;
483 vui->
sar = vui_sar[sar_idx];
484 else if (sar_idx == 255) {
489 "Unknown SAR index: %u.\n", sar_idx);
534 memcpy(&backup, gb,
sizeof(backup));
546 "discarding vui default display window, "
547 "original values are l:%u r:%u t:%u b:%u\n",
567 "Strange VUI timing information, retrying...\n");
570 memcpy(gb, &backup,
sizeof(backup));
604 for (matrixId = 0; matrixId < 6; matrixId++) {
606 memset(sl->
sl[0][matrixId], 16, 16);
607 sl->
sl_dc[0][matrixId] = 16;
608 sl->
sl_dc[1][matrixId] = 16;
633 uint8_t scaling_list_pred_mode_flag;
634 int32_t scaling_list_dc_coef[2][6];
635 int size_id, matrix_id, pos;
638 for (size_id = 0; size_id < 4; size_id++)
639 for (matrix_id = 0; matrix_id < 6; matrix_id += ((size_id == 3) ? 3 : 1)) {
640 scaling_list_pred_mode_flag =
get_bits1(gb);
641 if (!scaling_list_pred_mode_flag) {
647 if (matrix_id < delta) {
649 "Invalid delta in scaling list data: %d.\n", delta);
653 memcpy(sl->
sl[size_id][matrix_id],
654 sl->
sl[size_id][matrix_id - delta],
655 size_id > 0 ? 64 : 16);
657 sl->
sl_dc[size_id - 2][matrix_id] = sl->
sl_dc[size_id - 2][matrix_id -
delta];
660 int next_coef, coef_num;
661 int32_t scaling_list_delta_coef;
664 coef_num =
FFMIN(64, 1 << (4 + (size_id << 1)));
666 scaling_list_dc_coef[size_id - 2][matrix_id] =
get_se_golomb(gb) + 8;
667 next_coef = scaling_list_dc_coef[size_id - 2][matrix_id];
668 sl->
sl_dc[size_id - 2][matrix_id] = next_coef;
670 for (i = 0; i < coef_num; i++) {
679 next_coef = (next_coef + scaling_list_delta_coef + 256) % 256;
680 sl->
sl[size_id][matrix_id][pos] = next_coef;
686 for (i = 0; i < 64; i++) {
687 sl->
sl[3][1][i] = sl->
sl[2][1][i];
688 sl->
sl[3][2][i] = sl->
sl[2][2][i];
689 sl->
sl[3][4][i] = sl->
sl[2][4][i];
690 sl->
sl[3][5][i] = sl->
sl[2][5][i];
707 unsigned int sps_id = 0;
708 int log2_diff_max_min_transform_block_size;
709 int bit_depth_chroma,
start, vui_present, sublayer_ordering_info;
785 "discarding sps conformance window, "
786 "original values are l:%u r:%u t:%u b:%u\n",
802 if (bit_depth_chroma != sps->
bit_depth) {
804 "Luma bit depth (%d) is different from chroma bit depth (%d), "
805 "this is unsupported.\n",
834 "4:2:0, 4:2:2, 4:4:4 supports are currently specified for 8, 10 and 12 bits.\n");
883 if (!sublayer_ordering_info) {
884 for (i = 0; i <
start; i++) {
929 "PCM bit depth (%d) is greater than normal bit depth (%d)\n",
973 int sps_extension_flag[1];
974 for (i = 0; i < 1; i++)
977 if (sps_extension_flag[0]) {
978 int extended_precision_processing_flag;
979 int high_precision_offsets_enabled_flag;
980 int cabac_bypass_alignment_enabled_flag;
988 extended_precision_processing_flag =
get_bits1(gb);
989 if (extended_precision_processing_flag)
991 "extended_precision_processing_flag not yet implemented\n");
994 high_precision_offsets_enabled_flag =
get_bits1(gb);
995 if (high_precision_offsets_enabled_flag)
997 "high_precision_offsets_enabled_flag not yet implemented\n");
1001 cabac_bypass_alignment_enabled_flag =
get_bits1(gb);
1002 if (cabac_bypass_alignment_enabled_flag)
1004 "cabac_bypass_alignment_enabled_flag not yet implemented\n");
1017 "chroma samples to preserve alignment.\n",
1032 "Displaying the whole video surface.\n");
1080 "max transform block size out of range: %d\n",
1093 "Parsed SPS: id %d; coded wxh: %dx%d; "
1094 "cropped wxh: %dx%d; pix_fmt: %s.\n",
1160 "chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n");
1167 "cb_qp_offset_list not tested yet.\n");
1172 "cb_qp_offset_list not tested yet.\n");
1186 int pic_area_in_ctbs;
1187 int log2_diff_ctb_min_tb_size;
1188 int i, j, x,
y, ctb_addr_rs, tile_id;
1190 unsigned int pps_id = 0;
1378 int pps_range_extensions_flag =
get_bits1(gb);
1445 for (ctb_addr_rs = 0; ctb_addr_rs < pic_area_in_ctbs; ctb_addr_rs++) {
1446 int tb_x = ctb_addr_rs % sps->
ctb_width;
1447 int tb_y = ctb_addr_rs / sps->
ctb_width;
1453 if (tb_x < pps->col_bd[i + 1]) {
1460 if (tb_y < pps->row_bd[i + 1]) {
1466 for (i = 0; i < tile_x; i++)
1468 for (i = 0; i < tile_y; i++)
1472 tb_x - pps->
col_bd[tile_x];
1480 for (y = pps->
row_bd[j]; y < pps->row_bd[j + 1]; y++)
1481 for (x = pps->
col_bd[i]; x < pps->col_bd[i + 1]; x++)
1496 for (y = 0; y < sps->
tb_mask+2; y++) {
1500 for (y = 0; y < sps->
tb_mask+1; y++) {
1501 for (x = 0; x < sps->
tb_mask+1; x++) {
1502 int tb_x = x >> log2_diff_ctb_min_tb_size;
1503 int tb_y = y >> log2_diff_ctb_min_tb_size;
1504 int ctb_addr_rs = sps->
ctb_width * tb_y + tb_x;
1506 (log2_diff_ctb_min_tb_size * 2);
1507 for (i = 0; i < log2_diff_ctb_min_tb_size; i++) {
1509 val += (m & x ? m * m : 0) + (m & y ? 2 * m * m : 0);