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);
530 memcpy(&backup, gb,
sizeof(backup));
542 "discarding vui default display window, "
543 "original values are l:%u r:%u t:%u b:%u\n",
563 "Strange VUI timing information, retrying...\n");
566 memcpy(gb, &backup,
sizeof(backup));
600 for (matrixId = 0; matrixId < 6; matrixId++) {
602 memset(sl->
sl[0][matrixId], 16, 16);
603 sl->
sl_dc[0][matrixId] = 16;
604 sl->
sl_dc[1][matrixId] = 16;
629 uint8_t scaling_list_pred_mode_flag;
630 int32_t scaling_list_dc_coef[2][6];
631 int size_id, matrix_id, pos;
634 for (size_id = 0; size_id < 4; size_id++)
635 for (matrix_id = 0; matrix_id < 6; matrix_id += ((size_id == 3) ? 3 : 1)) {
636 scaling_list_pred_mode_flag =
get_bits1(gb);
637 if (!scaling_list_pred_mode_flag) {
643 if (matrix_id < delta) {
645 "Invalid delta in scaling list data: %d.\n", delta);
649 memcpy(sl->
sl[size_id][matrix_id],
650 sl->
sl[size_id][matrix_id - delta],
651 size_id > 0 ? 64 : 16);
653 sl->
sl_dc[size_id - 2][matrix_id] = sl->
sl_dc[size_id - 2][matrix_id -
delta];
656 int next_coef, coef_num;
657 int32_t scaling_list_delta_coef;
660 coef_num =
FFMIN(64, 1 << (4 + (size_id << 1)));
662 scaling_list_dc_coef[size_id - 2][matrix_id] =
get_se_golomb(gb) + 8;
663 next_coef = scaling_list_dc_coef[size_id - 2][matrix_id];
664 sl->
sl_dc[size_id - 2][matrix_id] = next_coef;
666 for (i = 0; i < coef_num; i++) {
675 next_coef = (next_coef + scaling_list_delta_coef + 256) % 256;
676 sl->
sl[size_id][matrix_id][pos] = next_coef;
682 for (i = 0; i < 64; i++) {
683 sl->
sl[3][1][i] = sl->
sl[2][1][i];
684 sl->
sl[3][2][i] = sl->
sl[2][2][i];
685 sl->
sl[3][4][i] = sl->
sl[2][4][i];
686 sl->
sl[3][5][i] = sl->
sl[2][5][i];
703 unsigned int sps_id = 0;
704 int log2_diff_max_min_transform_block_size;
705 int bit_depth_chroma,
start, vui_present, sublayer_ordering_info;
781 "discarding sps conformance window, "
782 "original values are l:%u r:%u t:%u b:%u\n",
798 if (bit_depth_chroma != sps->
bit_depth) {
800 "Luma bit depth (%d) is different from chroma bit depth (%d), "
801 "this is unsupported.\n",
830 "4:2:0, 4:2:2, 4:4:4 supports are currently specified for 8, 10 and 12 bits.\n");
879 if (!sublayer_ordering_info) {
880 for (i = 0; i <
start; i++) {
925 "PCM bit depth (%d) is greater than normal bit depth (%d)\n",
964 int sps_extension_flag[1];
965 for (i = 0; i < 1; i++)
968 if (sps_extension_flag[0]) {
969 int extended_precision_processing_flag;
970 int high_precision_offsets_enabled_flag;
971 int cabac_bypass_alignment_enabled_flag;
979 extended_precision_processing_flag =
get_bits1(gb);
980 if (extended_precision_processing_flag)
982 "extended_precision_processing_flag not yet implemented\n");
985 high_precision_offsets_enabled_flag =
get_bits1(gb);
986 if (high_precision_offsets_enabled_flag)
988 "high_precision_offsets_enabled_flag not yet implemented\n");
992 cabac_bypass_alignment_enabled_flag =
get_bits1(gb);
993 if (cabac_bypass_alignment_enabled_flag)
995 "cabac_bypass_alignment_enabled_flag not yet implemented\n");
1008 "chroma samples to preserve alignment.\n",
1023 "Displaying the whole video surface.\n");
1073 "max transform block size out of range: %d\n",
1086 "Parsed SPS: id %d; coded wxh: %dx%d; "
1087 "cropped wxh: %dx%d; pix_fmt: %s.\n",
1153 "chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n");
1160 "cb_qp_offset_list not tested yet.\n");
1165 "cb_qp_offset_list not tested yet.\n");
1179 int pic_area_in_ctbs;
1180 int log2_diff_ctb_min_tb_size;
1181 int i, j, x,
y, ctb_addr_rs, tile_id;
1183 unsigned int pps_id = 0;
1371 int pps_range_extensions_flag =
get_bits1(gb);
1437 for (ctb_addr_rs = 0; ctb_addr_rs < pic_area_in_ctbs; ctb_addr_rs++) {
1438 int tb_x = ctb_addr_rs % sps->
ctb_width;
1439 int tb_y = ctb_addr_rs / sps->
ctb_width;
1445 if (tb_x < pps->col_bd[i + 1]) {
1452 if (tb_y < pps->row_bd[i + 1]) {
1458 for (i = 0; i < tile_x; i++)
1460 for (i = 0; i < tile_y; i++)
1464 tb_x - pps->
col_bd[tile_x];
1472 for (y = pps->
row_bd[j]; y < pps->row_bd[j + 1]; y++)
1473 for (x = pps->
col_bd[i]; x < pps->col_bd[i + 1]; x++)
1488 for (y = 0; y < sps->
tb_mask+2; y++) {
1492 for (y = 0; y < sps->
tb_mask+1; y++) {
1493 for (x = 0; x < sps->
tb_mask+1; x++) {
1494 int tb_x = x >> log2_diff_ctb_min_tb_size;
1495 int tb_y = y >> log2_diff_ctb_min_tb_size;
1496 int ctb_addr_rs = sps->
ctb_width * tb_y + tb_x;
1498 (log2_diff_ctb_min_tb_size * 2);
1499 for (i = 0; i < log2_diff_ctb_min_tb_size; i++) {
1501 val += (m & x ? m * m : 0) + (m & y ? 2 * m * m : 0);