FFmpeg: libavcodec/vvc/ps.c Source File
Go to the documentation of this file. 1 /*
2 * VVC parameter set parser
3 *
4 * Copyright (C) 2023 Nuo Mi
5 * Copyright (C) 2022 Xu Mu
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 #include <stdbool.h>
24
34
36 {
39
40 switch (
sps->bit_depth) {
41 case 8:
46 break;
47 case 10:
52 break;
53 case 12:
58 break;
59 default:
61 "The following bit-depths are currently specified: 8, 10, 12 bits, "
62 "chroma_format_idc is %d, depth is %d\n",
63 r->sps_chroma_format_idc,
sps->bit_depth);
65 }
66
70
71 sps->hshift[0] =
sps->vshift[0] = 0;
72 sps->hshift[2] =
sps->hshift[1] =
desc->log2_chroma_w;
73 sps->vshift[2] =
sps->vshift[1] =
desc->log2_chroma_h;
74
75 sps->pixel_shift =
sps->bit_depth > 8;
76
77 return 0;
78 }
79
81 {
83
84 sps->bit_depth =
r->sps_bitdepth_minus8 + 8;
85 sps->qp_bd_offset = 6 * (
sps->bit_depth - 8);
86 sps->log2_transform_range =
87 r->sps_extended_precision_flag ?
FFMAX(15,
FFMIN(20,
sps->bit_depth + 6)) : 15;
89 }
90
92 {
94 const int num_qp_tables =
r->sps_same_qp_table_for_chroma_flag ?
95 1 : (
r->sps_joint_cbcr_enabled_flag ? 3 : 2);
96
97 for (
int i = 0;
i < num_qp_tables;
i++) {
98 int num_points_in_qp_table;
101 int off =
sps->qp_bd_offset;
102
103 num_points_in_qp_table =
r->sps_num_points_in_qp_table_minus1[
i] + 1;
104
105 qp_out[0] = qp_in[0] =
r->sps_qp_table_start_minus26[
i] + 26;
106 for (int j = 0; j < num_points_in_qp_table; j++ ) {
107 const uint8_t delta_qp_out = (
r->sps_delta_qp_in_val_minus1[
i][j] ^
r->sps_delta_qp_diff_val[
i][j]);
108 delta_qp_in[j] =
r->sps_delta_qp_in_val_minus1[
i][j] + 1;
109 // Note: we cannot check qp_{in,out}[j+1] here as qp_*[j] + delta_qp_*
110 // may not fit in an 8-bit signed integer.
111 if (qp_in[j] + delta_qp_in[j] > 63 || qp_out[j] + delta_qp_out > 63)
113 qp_in[j+1] = qp_in[j] + delta_qp_in[j];
114 qp_out[j+1] = qp_out[j] + delta_qp_out;
115 }
116 sps->chroma_qp_table[
i][qp_in[0] + off] = qp_out[0];
117 for (int k = qp_in[0] - 1 + off; k >= 0; k--)
118 sps->chroma_qp_table[
i][k] =
av_clip(
sps->chroma_qp_table[
i][k+1]-1, -off, 63);
119
120 for (int j = 0; j < num_points_in_qp_table; j++) {
121 int sh = delta_qp_in[j] >> 1;
122 for (int k = qp_in[j] + 1 + off, m = 1; k <= qp_in[j+1] + off; k++, m++) {
123 sps->chroma_qp_table[
i][k] =
sps->chroma_qp_table[
i][qp_in[j] + off] +
124 ((qp_out[j+1] - qp_out[j]) * m + sh) / delta_qp_in[j];
125 }
126 }
127 for (int k = qp_in[num_points_in_qp_table] + 1 + off; k <= 63 + off; k++)
128 sps->chroma_qp_table[
i][k] =
av_clip(
sps->chroma_qp_table[
i][k-1] + 1, -
sps->qp_bd_offset, 63);
129 }
130 if (
r->sps_same_qp_table_for_chroma_flag) {
131 memcpy(&
sps->chroma_qp_table[1], &
sps->chroma_qp_table[0],
sizeof(
sps->chroma_qp_table[0]));
132 memcpy(&
sps->chroma_qp_table[2], &
sps->chroma_qp_table[0],
sizeof(
sps->chroma_qp_table[0]));
133 }
134
135 return 0;
136 }
137
139 {
140 sps->max_pic_order_cnt_lsb = 1 << (
sps->r->sps_log2_max_pic_order_cnt_lsb_minus4 + 4);
141 }
142
144 {
146
147 sps->max_num_merge_cand = 6 -
r->sps_six_minus_max_num_merge_cand;
148 sps->max_num_ibc_merge_cand = 6 -
r->sps_six_minus_max_num_ibc_merge_cand;
149
150 if (
sps->r->sps_gpm_enabled_flag) {
151 sps->max_num_gpm_merge_cand = 2;
152 if (
sps->max_num_merge_cand >= 3)
153 sps->max_num_gpm_merge_cand =
sps->max_num_merge_cand -
r->sps_max_num_merge_cand_minus_max_num_gpm_cand;
154 }
155
156 sps->log2_parallel_merge_level =
r->sps_log2_parallel_merge_level_minus2 + 2;
157 }
158
160 {
162
163 sps->ctb_log2_size_y =
r->sps_log2_ctu_size_minus5 + 5;
164 sps->ctb_size_y = 1 <<
sps->ctb_log2_size_y;
165 sps->min_cb_log2_size_y =
r->sps_log2_min_luma_coding_block_size_minus2 + 2;
166 sps->min_cb_size_y = 1 <<
sps->min_cb_log2_size_y;
167 sps->max_tb_size_y = 1 << (
r->sps_max_luma_transform_size_64_flag ? 6 : 5);
168 sps->max_ts_size = 1 << (
r->sps_log2_transform_skip_max_size_minus2 + 2);
169 }
170
172 {
174
175 if (
r->sps_ladf_enabled_flag) {
176 sps->num_ladf_intervals =
r->sps_num_ladf_intervals_minus2 + 2;
177 sps->ladf_interval_lower_bound[0] = 0;
178 for (
int i = 0;
i <
sps->num_ladf_intervals - 1;
i++) {
179 sps->ladf_interval_lower_bound[
i + 1] =
180 sps->ladf_interval_lower_bound[
i] +
r->sps_ladf_delta_threshold_minus1[
i] + 1;
181 }
182 }
183 }
184
185 #define EXTENDED_SAR 255
187 {
194 } else {
196 }
197 }
199
205
206 // Set invalid values to "unspecified"
213 } else {
218 }
219 }
220
221
223 {
225
226 c->has_b_frames = !!
r->sps_dpb_params.dpb_max_num_reorder_pics[
r->sps_max_sublayers_minus1];
227 if (
r->sps_vui_parameters_present_flag)
229 }
230
232 {
235
243 if (
r->sps_chroma_format_idc != 0) {
247 }
249
250 return 0;
251 }
252
254 {
257 }
258
260 {
263
266
268
272
274
278 }
279
281 {
285
286 if (is_clvss) {
288 }
289
290 if (old_sps) {
291 if (old_sps->
r == rsps || !memcmp(old_sps->
r, rsps,
sizeof(*old_sps->
r))) {
293 return 0;
296 }
297
301
305
306 return 0;
307 }
308
310 {
311 pps->chroma_qp_offset[
CB - 1] =
pps->r->pps_cb_qp_offset;
312 pps->chroma_qp_offset[
CR - 1] =
pps->r->pps_cr_qp_offset;
313 pps->chroma_qp_offset[
JCBCR - 1]=
pps->r->pps_joint_cbcr_qp_offset_value;
314 for (
int i = 0;
i < 6;
i++) {
315 pps->chroma_qp_offset_list[
i][
CB - 1] =
pps->r->pps_cb_qp_offset_list[
i];
316 pps->chroma_qp_offset_list[
i][
CR - 1] =
pps->r->pps_cr_qp_offset_list[
i];
317 pps->chroma_qp_offset_list[
i][
JCBCR - 1]=
pps->r->pps_joint_cbcr_qp_offset_list[
i];
318 }
319 }
320
322 {
324
325 pps->width =
r->pps_pic_width_in_luma_samples;
326 pps->height =
r->pps_pic_height_in_luma_samples;
327
330 pps->ctb_count =
pps->ctb_width *
pps->ctb_height;
331
332 pps->min_cb_width =
pps->width >>
sps->min_cb_log2_size_y;
333 pps->min_cb_height =
pps->height >>
sps->min_cb_log2_size_y;
334
339
344 }
345
347 {
349
354 if (!
pps->col_bd || !
pps->row_bd || !
pps->ctb_to_col_bd || !
pps->ctb_to_row_bd)
356
357 for (
int i = 0, j = 0;
i <
r->num_tile_columns;
i++) {
359 j +=
r->col_width_val[
i];
360 for (
int k =
pps->col_bd[
i]; k < j; k++)
361 pps->ctb_to_col_bd[k] =
pps->col_bd[
i];
362 }
363 pps->col_bd[
r->num_tile_columns] =
pps->ctb_to_col_bd[
pps->ctb_width] =
pps->ctb_width;
364
365 for (
int i = 0, j = 0;
i <
r->num_tile_rows;
i++) {
367 j +=
r->row_height_val[
i];
368 for (
int k =
pps->row_bd[
i]; k < j; k++)
369 pps->ctb_to_row_bd[k] =
pps->row_bd[
i];
370 }
371 pps->row_bd[
r->num_tile_rows] =
pps->ctb_to_row_bd[
pps->ctb_height] =
pps->ctb_height;
372
373 return 0;
374 }
375
376
378 {
379 if (
r->pps_tile_idx_delta_present_flag) {
380 tile_idx +=
r->pps_tile_idx_delta_val[
i];
381 } else {
382 tile_idx +=
r->pps_slice_width_in_tiles_minus1[
i] + 1;
383 if (tile_idx %
r->num_tile_columns == 0)
384 tile_idx += (
r->pps_slice_height_in_tiles_minus1[
i]) *
r->num_tile_columns;
385 }
386 return tile_idx;
387 }
388
390 {
391 *tile_x = tile_idx %
pps->r->num_tile_columns;
392 *tile_y = tile_idx /
pps->r->num_tile_columns;
393 }
394
395 static void ctu_xy(
int *rx,
int *ry,
const int tile_x,
const int tile_y,
const VVCPPS *
pps)
396 {
397 *rx =
pps->col_bd[tile_x];
398 *ry =
pps->row_bd[tile_y];
399 }
400
402 {
403 return pps->ctb_width * ry + rx;
404 }
405
407 const int w,
const int h)
408 {
409 int start = *off;
410 for (
int y = 0; y <
h; y++) {
411 for (
int x = 0; x <
w; x++) {
412 if (*off >=
pps->ctb_count)
414 pps->ctb_addr_in_slice[*off] =
ctu_rs(rx + x, ry + y,
pps);
415 (*off)++;
416 }
417 }
418 return *off - start;
419 }
420
422 {
423 pps->num_ctus_in_slice[0] = 0;
424 for (
int j = 0; j <
pps->r->num_tile_rows; j++) {
425 for (
int i = 0;
i <
pps->r->num_tile_columns;
i++) {
427 pps->col_bd[
i],
pps->row_bd[j],
428 pps->r->col_width_val[
i],
pps->r->row_height_val[j]);
431 pps->num_ctus_in_slice[0] +=
ret;
432 }
433 }
434
435 return 0;
436 }
437
438 static void subpic_tiles(
int *tile_x,
int *tile_y,
int *tile_x_end,
int *tile_y_end,
440 {
441 const int rx =
sps->r->sps_subpic_ctu_top_left_x[
i];
442 const int ry =
sps->r->sps_subpic_ctu_top_left_y[
i];
443
444 *tile_x = *tile_y = 0;
445
446 while (
pps->col_bd[*tile_x] < rx)
447 (*tile_x)++;
448
449 while (
pps->row_bd[*tile_y] < ry)
450 (*tile_y)++;
451
452 *tile_x_end = (*tile_x);
453 *tile_y_end = (*tile_y);
454
455 while (
pps->col_bd[*tile_x_end] < rx +
sps->r->sps_subpic_width_minus1[
i] + 1)
456 (*tile_x_end)++;
457
458 while (
pps->row_bd[*tile_y_end] < ry +
sps->r->sps_subpic_height_minus1[
i] + 1)
459 (*tile_y_end)++;
460 }
461
463 {
465 sps->r->sps_subpic_ctu_top_left_x[
i],
sps->r->sps_subpic_ctu_top_left_y[
i],
466 sps->r->sps_subpic_width_minus1[
i] + 1,
sps->r->sps_subpic_height_minus1[
i] + 1);
469
470 pps->num_ctus_in_slice[
i] =
ret;
471 return 0;
472 }
473
475 const int i,
int *off)
476 {
477 for (int ty = tile_y; ty < y_end; ty++) {
478 for (int tx = tile_x; tx < x_end; tx++) {
480 pps->col_bd[tx],
pps->row_bd[ty],
481 pps->r->col_width_val[tx],
pps->r->row_height_val[ty]);
484
485 pps->num_ctus_in_slice[
i] +=
ret;
486 }
487 }
488 return 0;
489 }
490
492 {
493 int tx, ty, x_end, y_end;
494
495 pps->slice_start_offset[
i] = *off;
496 pps->num_ctus_in_slice[
i] = 0;
497
499 if (ty + 1 == y_end &&
sps->r->sps_subpic_height_minus1[
i] + 1 <
pps->r->row_height_val[ty])
501 else
503 }
504
506 {
508
509 if (!
sps->r->sps_subpic_info_present_flag) {
513 } else {
514 for (
int i = 0;
i <
pps->r->pps_num_slices_in_pic_minus1 + 1;
i++) {
518 }
519 }
520 return 0;
521 }
522
524 {
526 int rx, ry, ctu_y_end, tile_x, tile_y;
527
530 ctu_y_end = ry +
r->row_height_val[tile_y];
531 while (ry < ctu_y_end) {
533 pps->slice_start_offset[
i] = *off;
535 r->col_width_val[tile_x],
r->slice_height_in_ctus[
i]);
538 pps->num_ctus_in_slice[
i] =
ret;
539 ry +=
r->slice_height_in_ctus[
i++];
540 }
543 }
544
546 {
548 int rx, ry, tile_x, tile_y;
549
551 pps->slice_start_offset[
i] = *off;
552 pps->num_ctus_in_slice[
i] = 0;
553 for (
int ty = tile_y; ty <= tile_y +
r->pps_slice_height_in_tiles_minus1[
i]; ty++) {
554 for (
int tx = tile_x; tx <= tile_x +
r->pps_slice_width_in_tiles_minus1[
i]; tx++) {
556 const int idx = ty *
r->num_tile_columns + tx;
557 if (tile_in_slice[idx])
559 tile_in_slice[idx] = true;
562 r->col_width_val[tx],
r->row_height_val[ty]);
565 pps->num_ctus_in_slice[
i] +=
ret;
566 }
567 }
568
569 return 0;
570 }
571
573 {
576 int tile_idx = 0, off = 0,
ret;
577
578 if (
r->pps_single_slice_per_subpic_flag) {
580 }
581
582 for (
int i = 0;
i <
r->pps_num_slices_in_pic_minus1 + 1;
i++) {
583 if (!
r->pps_slice_width_in_tiles_minus1[
i] &&
584 !
r->pps_slice_height_in_tiles_minus1[
i]) {
585 if (tile_in_slice[tile_idx])
587 tile_in_slice[tile_idx] = true;
592 } else {
596 }
598 }
599
600 for (
int i = 0;
i <
r->num_tiles_in_pic;
i++) {
601 if (!tile_in_slice[
i])
603 }
604
605 return 0;
606 }
607
609 {
611 int rx, ry, off = 0;
612
613 for (
int tile_y = 0; tile_y <
r->num_tile_rows; tile_y++) {
614 for (
int tile_x = 0; tile_x <
r->num_tile_columns; tile_x++) {
620 }
621 }
622
623 return 0;
624 }
625
627 {
629
631 if (!
pps->ctb_addr_in_slice)
633
634 if (
pps->r->pps_rect_slice_flag)
636
640
641 return 0;
642 }
643
645 {
647
648 if (
r->pps_ref_wraparound_enabled_flag)
649 pps->ref_wraparound_offset = (
pps->width /
sps->min_cb_size_y) -
r->pps_pic_width_minus_wraparound_offset;
650 }
651
653 {
661 } else {
662 pps->subpic_x[
i] = 0;
663 pps->subpic_y[
i] = 0;
664 pps->subpic_width[
i] =
pps->width;
665 pps->subpic_height[
i] =
pps->height;
666 }
667 }
668 }
669
671 {
673
676
680
684
687
688 return 0;
689 }
690
692 {
694
696
702 }
703
705 {
708
711
713
717
719
723 }
724
726 {
732
733 if (old_pps && old_pps->
r == rpps)
734 return 0;
735
739
742
744 }
745
747 {
752
753 if (!rpps)
755
756 if (!rsps)
758
762
764 // CTU > 128 are reserved in vvc spec v3
767 }
768
772
773 return 0;
774 }
775
776 #define WEIGHT_TABLE(x) \
777 w->nb_weights[L##x] = r->num_weights_l##x; \
778 for (int i = 0; i < w->nb_weights[L##x]; i++) { \
779 w->weight_flag[L##x][LUMA][i] = r->luma_weight_l##x##_flag[i]; \
780 w->weight_flag[L##x][CHROMA][i] = r->chroma_weight_l##x##_flag[i]; \
781 w->weight[L##x][LUMA][i] = denom[LUMA] + r->delta_luma_weight_l##x[i]; \
782 w->offset[L##x][LUMA][i] = r->luma_offset_l##x[i]; \
783 for (int j = CB; j <= CR; j++) { \
784 w->weight[L##x][j][i] = denom[CHROMA] + r->delta_chroma_weight_l##x[i][j - 1]; \
785 w->offset[L##x][j][i] = 128 + r->delta_chroma_offset_l##x[i][j - 1]; \
786 w->offset[L##x][j][i] -= (128 * w->weight[L##x][j][i]) >> w->log2_denom[CHROMA]; \
787 w->offset[L##x][j][i] = av_clip_intp2(w->offset[L##x][j][i], 7); \
788 } \
789 } \
790
792 {
793 int denom[2];
794
795 w->log2_denom[
LUMA] =
r->luma_log2_weight_denom;
796 w->log2_denom[
CHROMA] =
w->log2_denom[
LUMA] +
r->delta_chroma_log2_weight_denom;
801 }
802
803 // 8.3.1 Decoding process for picture order count
805 {
806 const int max_poc_lsb = 1 << (
sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4);
807 const int prev_poc_lsb = poc_tid0 % max_poc_lsb;
808 const int prev_poc_msb = poc_tid0 - prev_poc_lsb;
809 const int poc_lsb =
ph->ph_pic_order_cnt_lsb;
810 int poc_msb;
811
812 if (
ph->ph_poc_msb_cycle_present_flag) {
813 poc_msb =
ph->ph_poc_msb_cycle_val * max_poc_lsb;
814 } else if (is_clvss) {
815 poc_msb = 0;
816 } else {
817 if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2)
818 poc_msb = prev_poc_msb + max_poc_lsb;
819 else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2)
820 poc_msb = prev_poc_msb - max_poc_lsb;
821 else
822 poc_msb = prev_poc_msb;
823 }
824
825 return poc_msb + poc_lsb;
826 }
827
829 uint16_t *pivot1, uint16_t *pivot2, uint16_t *
scale_coeff,
const int idx,
const int max)
830 {
831 const int lut_sample =
834 }
835
836 //8.8.2.2 Inverse mapping process for a luma sample
838 {
843 const int off = 1 << (
shift - 1);
848 int i, delta_crs, sum_cw = 0;
851
852 if (!rlmcs)
854
857
858 memset(cw, 0, sizeof(cw));
859 for (
int i = lmcs->
min_bin_idx; i <= lmcs->max_bin_idx;
i++) {
862 }
865
867
870 input_pivot[
i] =
i * org_cw;
878 inv_scale_coeff[
i] = 0;
880 } else {
881 const int cw_plus_d = cw[
i] + delta_crs;
882 if (cw_plus_d < (org_cw >> 3) || cw_plus_d > ((org_cw << 3) - 1))
884 inv_scale_coeff[
i] = org_cw * (1 << 11) / cw[
i];
886 }
887 }
888
889 //derive lmcs_fwd_lut
896 else
898
899 }
900
901 //derive lmcs_inv_lut
904 uint16_t inv_sample;
905 while (i <= lmcs->max_bin_idx &&
sample >= lmcs->
pivot[
i + 1])
908
910 inv_scale_coeff,
i,
max);
911
914 else
916 }
917
918 return 0;
919 }
920
922 {
923 if (
sps->sps_affine_enabled_flag)
924 return 5 -
sps->sps_five_minus_max_num_subblock_merge_cand;
925 return sps->sps_sbtmvp_enabled_flag &&
ph->ph_temporal_mvp_enabled_flag;
926 }
927
928 static int ph_vb_pos(uint16_t *vbs, uint8_t *num_vbs,
const uint16_t *pos_minus_1,
const uint8_t num_pos, uint16_t
max,
const int ctb_size_y)
929 {
931 for (
int i = 0;
i < num_pos;
i++) {
932 if (pos_minus_1[
i] >
max)
934
935 vbs[
i] = (pos_minus_1[
i] + 1) << 3;
936
937 // The distance between any two vertical virtual boundaries shall be greater than or equal to CtbSizeY luma samples
938 if (
i && vbs[
i] < vbs[
i - 1] + ctb_size_y)
940 }
941 *num_vbs = num_pos;
942
943 return 0;
944 }
945
946 #define VBF(f) (sps->sps_virtual_boundaries_present_flag ? sps->sps_##f : ph->r->ph_##f)
947 #define VBFS(c, d) VBF(virtual_boundary_pos_##c##_minus1), VBF(num_##d##_virtual_boundaries)
948
950 {
951 const int ctb_size_y = 1 << (
sps->sps_log2_ctu_size_minus5 + 5);
953
954 if (!
sps->sps_virtual_boundaries_enabled_flag)
955 return 0;
956
960
961 ret =
ph_vb_pos(
ph->vb_pos_y, &
ph->num_hor_vbs,
VBFS(y, hor),
pps->pps_pic_height_in_luma_samples, ctb_size_y);
964
965 return 0;
966 }
967
969 {
972
974
975 if (
pps->pps_wp_info_in_ph_flag)
977
981
982 return 0;
983 }
984
986 const int poc_tid0, const int is_clvss)
987 {
992
998
999 return 0;
1000 }
1001
1004 {
1009
1012
1013 if (!rpps)
1015
1018
1022
1023 if (
ph->ph_explicit_scaling_list_enabled_flag)
1025
1026 if (
ph->ph_lmcs_enabled_flag) {
1030 }
1031
1034
1035 return 0;
1036 }
1037
1039 {
1041 s->no_output_before_recovery_flag = 1;
1043 s->no_output_before_recovery_flag =
s->last_eos;
1044 }
1045
1047 {
1048 if (
s->no_output_before_recovery_flag) {
1050 s->gdr_recovery_point_poc =
ph->poc +
ph->r->ph_recovery_poc_cnt;
1053 }
1054 }
1055
1057 {
1062 int is_clvss;
1063
1066
1070
1074 }
1075
1077 {
1084 }
1085
1087 {
1098 }
1099
1101 const uint8_t *
abs,
const uint8_t *sign,
const int size)
1102 {
1103 for (
int i = 0;
i <
size;
i++)
1105 }
1106
1108 const uint8_t *mapped_abs, const uint8_t *sign)
1109 {
1111 int c = mapped_abs[
i];
1113 c = (1 - 2 * sign[
i]) * (1 << (
c - 1));
1115 }
1116 }
1117
1119 {
1120 if (!
aps->alf_luma_filter_signal_flag)
1121 return;
1122
1124 const int ref =
aps->alf_luma_coeff_delta_idx[
i];
1125 const uint8_t *
abs =
aps->alf_luma_coeff_abs[
ref];
1126 const uint8_t *sign =
aps->alf_luma_coeff_sign[
ref];
1127
1131 }
1132 }
1133
1135 {
1136 if (!
aps->alf_chroma_filter_signal_flag)
1137 return;
1138
1141 const uint8_t *
abs =
aps->alf_chroma_coeff_abs[
i];
1142 const uint8_t *sign =
aps->alf_chroma_coeff_sign[
i];
1143
1147 }
1148 }
1149
1151 {
1153 {
aps->alf_cc_cb_mapped_coeff_abs,
aps->alf_cc_cr_mapped_coeff_abs };
1155 {
aps->alf_cc_cb_coeff_sign,
aps->alf_cc_cr_coeff_sign };
1156 const int signaled[] = {
aps->alf_cc_cb_filter_signal_flag,
aps->alf_cc_cr_filter_signal_flag};
1157
1160
1161 for (int idx = 0; idx < 2; idx++) {
1162 if (signaled[idx]) {
1165 }
1166 }
1167 }
1168
1170 {
1174 }
1175
1177 {
1179
1181 }
1182
1184 {
1188
1193
1194 return 0;
1195 }
1196
1198 {
1200 }
1201
1203 {
1205 }
1206
1207 // 7.4.3.20 Scaling list data semantics
1209 {
1210 for (
int id = 0;
id <
SL_MAX_ID;
id++) {
1212 const int log2_size =
av_log2(matrix_size);
1213 const int list_size = matrix_size * matrix_size;
1215 const uint8_t *
pred;
1218
1220 if (!
aps->scaling_list_copy_mode_flag[
id]) {
1221 int next_coef = 0;
1222
1225
1226 for (
int i = 0;
i < list_size;
i++) {
1229
1231 next_coef +=
aps->scaling_list_delta_coef[
id][
i];
1233 }
1234 }
1235 }
1236
1237 //dc
1239 if (!
aps->scaling_list_copy_mode_flag[
id] && !
aps->scaling_list_pred_mode_flag[
id]) {
1241 }
else if (!
aps->scaling_list_pred_id_delta[
id]) {
1243 } else {
1244 const int ref_id =
id -
aps->scaling_list_pred_id_delta[
id];
1247 else
1249 }
1251 }
1252
1253 //ac
1255 if (!
aps->scaling_list_copy_mode_flag[
id] && !
aps->scaling_list_pred_mode_flag[
id])
1257 else if (!
aps->scaling_list_pred_id_delta[
id])
1259 else
1261 for (
int i = 0;
i < list_size;
i++) {
1264 const int off = y * matrix_size + x;
1266 }
1267 }
1268 }
1269
1271 {
1273 if (!sl)
1275
1279
1280 return 0;
1281 }
1282
1284 {
1287
1290
1291 switch (
aps->aps_params_type) {
1294 break;
1297 break;
1300 break;
1301 }
1302
1304 }
1305
1307 {
1309 return 0;
1310
1313 if (!alf_aps_luma)
1315 }
1316
1319 if (!alf_aps_chroma)
1321 }
1322
1326 if (!alf_aps_cc_cr)
1328 }
1331 if (!alf_aps_cc_cr)
1333 }
1334 }
1335
1336 return 0;
1337 }
1338
1340 {
1342
1343 if (
pps->r->pps_rect_slice_flag) {
1344 int pic_level_slice_idx = slice_address;
1346 pic_level_slice_idx +=
pps->r->num_slices_in_subpic[j];
1349 } else {
1350 int tile_x = slice_address %
pps->r->num_tile_columns;
1351 int tile_y = slice_address /
pps->r->num_tile_columns;
1352 const int slice_start_ctb =
pps->row_bd[tile_y] *
pps->ctb_width +
pps->col_bd[tile_x] *
pps->r->row_height_val[tile_y];
1353
1355
1358 tile_x = tile_idx %
pps->r->num_tile_columns;
1359 tile_y = tile_idx /
pps->r->num_tile_columns;
1361 }
1362 }
1363
1366
1367 return 0;
1368 }
1369
1371 {
1372 const int init_qp =
pps->pps_init_qp_minus26 + 26;
1373
1374 if (!
pps->pps_qp_delta_info_in_ph_flag)
1376 else
1378 }
1379
1381 {
1383
1384 if (!
pps->pps_wp_info_in_ph_flag &&
1385 ((
pps->pps_weighted_pred_flag &&
IS_P(rsh)) ||
1386 (
pps->pps_weighted_bipred_flag &&
IS_B(rsh))))
1388 }
1389
1391 {
1393
1394 if (!
r->sh_deblocking_filter_disabled_flag) {
1401 }
1402 }
1403
1405 {
1406 const int min_cb_log2_size_y =
sps->sps_log2_min_luma_coding_block_size_minus2 + 2;
1407 int min_qt_log2_size_y[2];
1408
1410 min_qt_log2_size_y[
LUMA] = (min_cb_log2_size_y +
ph->ph_log2_diff_min_qt_min_cb_intra_slice_luma);
1411 min_qt_log2_size_y[
CHROMA] = (min_cb_log2_size_y +
ph->ph_log2_diff_min_qt_min_cb_intra_slice_chroma);
1412
1413 sh->
max_bt_size[
LUMA] = 1 << (min_qt_log2_size_y[
LUMA] +
ph->ph_log2_diff_max_bt_min_qt_intra_slice_luma);
1415
1416 sh->
max_tt_size[
LUMA] = 1 << (min_qt_log2_size_y[
LUMA] +
ph->ph_log2_diff_max_tt_min_qt_intra_slice_luma);
1418
1421
1424 } else {
1426 min_qt_log2_size_y[
i] = (min_cb_log2_size_y +
ph->ph_log2_diff_min_qt_min_cb_inter_slice);
1427 sh->
max_bt_size[
i] = 1 << (min_qt_log2_size_y[
i] +
ph->ph_log2_diff_max_bt_min_qt_inter_slice);
1428 sh->
max_tt_size[
i] = 1 << (min_qt_log2_size_y[
i] +
ph->ph_log2_diff_max_tt_min_qt_inter_slice);
1430 }
1431
1434 }
1435
1438 }
1439
1441 {
1442 if (
sps->sps_entry_point_offsets_present_flag) {
1448 if (
pps->ctb_to_row_bd[ctb_addr_y] !=
pps->ctb_to_row_bd[pre_ctb_addr_y] ||
1449 pps->ctb_to_col_bd[ctb_addr_x] !=
pps->ctb_to_col_bd[pre_ctb_addr_x] ||
1450 (ctb_addr_y != pre_ctb_addr_y &&
sps->sps_entropy_coding_sync_enabled_flag)) {
1452 }
1453 }
1454 }
1455 }
1456
1458 {
1463
1475
1476 return 0;
1477 }
1478
1480 {
1482
1483 if (!fps->
sps || !fps->
pps)
1485
1487
1491
1492 return 0;
1493 }
uint8_t vui_colour_primaries
static int sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
uint16_t sps_subpic_height_minus1[VVC_MAX_SLICES]
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t cu_qp_delta_subdiv
CuQpDeltaSubdiv.
void * content_ref
If content is reference counted, a RefStruct reference backing content.
uint32_t num_ctus_in_curr_slice
NumCtusInCurrSlice.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint8_t sps_log2_ctu_size_minus5
int ff_vvc_decode_frame_ps(struct VVCFrameContext *fc, struct VVCContext *s)
uint8_t vui_aspect_ratio_info_present_flag
uint32_t entry_point_start_ctu[VVC_MAX_ENTRY_POINTS]
entry point start in ctu_addr
const H266RawPPS * r
RefStruct reference.
#define SL_MAX_MATRIX_SIZE
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
RefStruct is an API for creating reference-counted objects with minimal overhead.
uint8_t cu_chroma_qp_offset_subdiv
CuChromaQpOffsetSubdiv.
static void alf_derive(VVCALF *alf, const H266RawAPS *aps)
#define LMCS_MAX_BIN_SIZE
static av_always_inline int scale_coeff(const TransformBlock *tb, int coeff, const int scale, const int scale_m, const int log2_transform_range)
static int FUNC() ph(CodedBitstreamContext *ctx, RWContext *rw, H266RawPH *current)
@ AVCOL_RANGE_JPEG
Full range content.
uint16_t sps_subpic_ctu_top_left_y[VVC_MAX_SLICES]
static int aps_decode_scaling(const VVCScalingList **scaling, const H266RawAPS *aps)
uint8_t lmcs_delta_abs_crs
uint8_t sps_ccalf_enabled_flag
static void sh_qp_y(VVCSH *sh, const H266RawPPS *pps, const H266RawPictureHeader *ph)
#define AV_PIX_FMT_YUV420P10
const H266RawSliceHeader * r
RefStruct reference.
static int pps_single_slice_per_subpic(VVCPPS *pps, const VVCSPS *sps, int *off)
static int sps_chroma_qp_table(VVCSPS *sps)
static void pps_subpic(VVCPPS *pps, const VVCSPS *sps)
static int decode_ph(VVCFrameParamSets *fps, const H266RawPictureHeader *rph, void *rph_ref, const int poc_tid0, const int is_clvss)
static int pps_add_ctus(VVCPPS *pps, int *off, const int rx, const int ry, const int w, const int h)
uint8_t pps_seq_parameter_set_id
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
uint8_t lmcs_delta_max_bin_idx
static const VVCPPS * pps_alloc(const H266RawPPS *rpps, const VVCSPS *sps)
uint8_t num_chroma_filters
Coded bitstream unit structure.
static int sps_derive(VVCSPS *sps, AVCodecContext *c)
static void sh_inter(VVCSH *sh, const H266RawSPS *sps, const H266RawPPS *pps)
static int decode_pps(VVCParamSets *ps, const H266RawPPS *rpps)
uint16_t chroma_scale_coeff[LMCS_MAX_BIN_SIZE]
static int pps_subpic_one_or_more_tiles_slice(VVCPPS *pps, const int tile_x, const int tile_y, const int x_end, const int y_end, const int i, int *off)
const VVCSPS * sps
RefStruct reference.
const char * av_color_space_name(enum AVColorSpace space)
#define ALF_NUM_COEFF_CHROMA
static int pps_slice_map(VVCPPS *pps, const VVCSPS *sps)
uint16_t sps_subpic_width_minus1[VVC_MAX_SLICES]
int ff_vvc_decode_sh(VVCSH *sh, const VVCFrameParamSets *fps, const CodedBitstreamUnit *unit)
const VVCPPS * pps_list[VVC_MAX_PPS_COUNT]
RefStruct reference.
static int derive_matrix_size(const int id)
int16_t cc_coeff[2][ALF_NUM_FILTERS_CC][ALF_NUM_COEFF_CC]
const VVCScalingList * sl
RefStruct reference.
@ VVC_MAX_POINTS_IN_QP_TABLE
const uint8_t ff_vvc_scaling_pred_16[8 *8]
void ff_vvc_frame_ps_free(VVCFrameParamSets *fps)
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
uint8_t chroma_clip_idx[ALF_NUM_FILTERS_CHROMA][ALF_NUM_COEFF_CHROMA]
#define GDR_SET_RECOVERED(s)
#define AV_PIX_FMT_YUV444P10
static void sps_ladf(VVCSPS *sps)
void * ph_ref
RefStruct reference backing referred-to PH above.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint16_t lmcs_delta_abs_cw[16]
#define FF_ARRAY_ELEMS(a)
H266RawPictureHeader * ph
uint8_t vui_full_range_flag
uint8_t sps_seq_parameter_set_id
#define AV_CEIL_RSHIFT(a, b)
#define fc(width, name, range_min, range_max)
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
static int decode_ps(VVCParamSets *ps, AVCodecContext *c, const SliceContext *sc, int is_clvss)
static int ph_vb(VVCPH *ph, const H266RawSPS *sps, const H266RawPPS *pps)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
const VVCSPS * sps_list[VVC_MAX_SPS_COUNT]
RefStruct reference.
#define AV_PIX_FMT_GRAY10
static void pred_weight_table(PredWeightTable *w, const H266RawPredWeightTable *r)
static int FUNC() aps(CodedBitstreamContext *ctx, RWContext *rw, H266RawAPS *current, int prefix)
static void pps_free(AVRefStructOpaque opaque, void *obj)
static int decode_frame_ps(VVCFrameParamSets *fps, const VVCParamSets *ps, const SliceContext *sc, const int poc_tid0, const int is_clvss, const VVCContext *s)
static void alf_coeff_cc(int16_t *coeff, const uint8_t *mapped_abs, const uint8_t *sign)
static int pps_subpic_slice(VVCPPS *pps, const VVCSPS *sps, const int i, int *off)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_always_inline uint16_t lmcs_derive_lut_sample(uint16_t sample, uint16_t *pivot1, uint16_t *pivot2, uint16_t *scale_coeff, const int idx, const int max)
uint8_t pps_pic_parameter_set_id
Rational number (pair of numerator and denominator).
const VVCALF * alf_list[VVC_MAX_ALF_COUNT]
RefStruct reference.
uint8_t lmcs_delta_sign_cw_flag[16]
static int ph_max_num_subblock_merge_cand(const H266RawSPS *sps, const H266RawPictureHeader *ph)
static int is_luma_list(const int id)
static void sh_partition_constraints(VVCSH *sh, const H266RawSPS *sps, const H266RawPictureHeader *ph)
uint8_t max_tt_size[2]
MaxTtSizeY, MaxTtSizeC.
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
static void sps_vui(AVCodecContext *c, const H266RawVUI *vui)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
const VVCScalingList * scaling_list[VVC_MAX_SL_COUNT]
RefStruct reference.
#define AV_PIX_FMT_YUV422P10
static int ph_vb_pos(uint16_t *vbs, uint8_t *num_vbs, const uint16_t *pos_minus_1, const uint8_t num_pos, uint16_t max, const int ctb_size_y)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
const int ff_vvc_scaling_list0[8 *8]
static void alf_free(AVRefStructOpaque unused, void *obj)
static void decode_recovery_poc(VVCContext *s, const VVCPH *ph)
const H266RawPictureHeader * r
static void sps_partition_constraints(VVCSPS *sps)
const uint8_t ff_vvc_diag_scan_y[5][5][16 *16]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int16_t luma_coeff[ALF_NUM_FILTERS_LUMA][ALF_NUM_COEFF_LUMA]
static void pps_ref_wraparound_offset(VVCPPS *pps, const VVCSPS *sps)
const VVCPPS * pps
RefStruct reference.
uint8_t vui_transfer_characteristics
static void sps_export_stream_params(AVCodecContext *c, const VVCSPS *sps)
uint8_t max_mtt_depth[2]
MaxMttDepthY, MaxMttDepthC.
uint16_t sps_subpic_ctu_top_left_x[VVC_MAX_SLICES]
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
union VVCLMCS::@334 fwd_lut
static int shift(int a, int b)
static void subpic_tiles(int *tile_x, int *tile_y, int *tile_x_end, int *tile_y_end, const VVCSPS *sps, const VVCPPS *pps, const int i)
#define AV_PIX_FMT_YUV422P12
static int aps_decode_alf(const VVCALF **alf, const H266RawAPS *aps)
#define AV_PIX_FMT_YUV444P12
static int ctu_rs(const int rx, const int ry, const VVCPPS *pps)
void * ref
RefStruct reference, backing slice data.
static int sh_derive(VVCSH *sh, const VVCFrameParamSets *fps)
static int next_tile_idx(int tile_idx, const int i, const H266RawPPS *r)
static void alf_coeff(int16_t *coeff, const uint8_t *abs, const uint8_t *sign, const int size)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
const uint32_t * ctb_addr_in_curr_slice
CtbAddrInCurrSlice.
uint8_t scaling_matrix_dc_rec[SL_MAX_ID - SL_START_16x16]
ScalingMatrixDcRec[refId − 14].
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
uint16_t pivot[LMCS_MAX_BIN_SIZE+1]
static int lmcs_derive_lut(VVCLMCS *lmcs, const H266RawAPS *rlmcs, const H266RawSPS *sps)
static void pps_chroma_qp_offset(VVCPPS *pps)
static int pps_derive(VVCPPS *pps, const VVCSPS *sps)
H266RawPPS * pps
RefStruct reference to referred-to PPS.
#define i(width, name, range_min, range_max)
static int sps_bit_depth(VVCSPS *sps, void *log_ctx)
const uint8_t ff_vvc_diag_scan_x[5][5][16 *16]
static int sh_alf_aps(const VVCSH *sh, const VVCFrameParamSets *fps)
static void scaling_derive(VVCScalingList *sl, const H266RawAPS *aps)
static int pps_single_slice_picture(VVCPPS *pps, int *off)
static int pps_no_rect_slice(VVCPPS *pps)
static const VVCSPS * sps_alloc(const H266RawSPS *rsps, AVCodecContext *c)
void * rref
RefStruct reference, backing ph above.
int ff_vvc_decode_aps(VVCParamSets *ps, const CodedBitstreamUnit *unit)
uint16_t u16[LMCS_MAX_LUT_SIZE]
for high bit-depth
static int ph_compute_poc(const H266RawPictureHeader *ph, const H266RawSPS *sps, const int poc_tid0, const int is_clvss)
const AVRational ff_h2645_pixel_aspect[]
static int pps_rect_slice(VVCPPS *pps, const VVCSPS *sps)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
void * av_calloc(size_t nmemb, size_t size)
#define GDR_IS_RECOVERED(s)
static int decode_sps(VVCParamSets *ps, AVCodecContext *c, const H266RawSPS *rsps, int is_clvss)
uint8_t lmcs_delta_sign_crs_flag
static void decode_recovery_flag(VVCContext *s)
static void pps_width_height(VVCPPS *pps, const VVCSPS *sps)
void ff_vvc_ps_uninit(VVCParamSets *ps)
static const float pred[4]
#define ALF_NUM_COEFF_LUMA
static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off)
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
uint8_t vui_colour_description_present_flag
#define AV_PIX_FMT_YUV420P12
main external API structure.
uint8_t vui_matrix_coeffs
void av_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
const VVCALF * alf_list[VVC_MAX_ALF_COUNT]
RefStruct reference.
int8_t slice_qp_y
SliceQpY.
uint16_t sps_num_subpics_minus1
static void ctu_xy(int *rx, int *ry, const int tile_x, const int tile_y, const VVCPPS *pps)
static int ref[MAX_W *MAX_W]
static int FUNC() scaling_list(CodedBitstreamContext *ctx, RWContext *rw, H264RawScalingList *current, int size_of_scaling_list)
static void alf_luma(VVCALF *alf, const H266RawAPS *aps)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
uint8_t u8[LMCS_MAX_LUT_SIZE]
static int ph_derive(VVCPH *ph, const H266RawSPS *sps, const H266RawPPS *pps, const int poc_tid0, const int is_clvss)
uint8_t vui_aspect_ratio_idc
static int pps_subpic_less_than_one_tile_slice(VVCPPS *pps, const VVCSPS *sps, const int i, const int tx, const int ty, int *off)
static void alf_cc(VVCALF *alf, const H266RawAPS *aps)
static int pps_bd(VVCPPS *pps)
H266RawSPS * sps
RefStruct reference to referred-to SPS.
union VVCLMCS::@334 inv_lut
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
uint8_t luma_clip_idx[ALF_NUM_FILTERS_LUMA][ALF_NUM_COEFF_LUMA]
static int pps_multi_tiles_slice(VVCPPS *pps, const int tile_idx, const int i, int *off, bool *tile_in_slice)
static void tile_xy(int *tile_x, int *tile_y, const int tile_idx, const VVCPPS *pps)
uint8_t max_bt_size[2]
MaxBtSizeY, MaxBtSizeC.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
unsigned int sps_id
seq_parameter_set_id
static void sps_poc(VVCSPS *sps)
const H266RawSPS * r
RefStruct reference.
uint8_t num_cc_filters[2]
alf_cc_cb_filters_signalled_minus1 + 1, alf_cc_cr_filters_signalled_minus1 + 1
static void sps_free(AVRefStructOpaque opaque, void *obj)
#define ALF_NUM_FILTERS_LUMA
static const double coeff[2][5]
uint8_t min_qt_size[2]
MinQtSizeY, MinQtSizeC.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void sps_inter(VVCSPS *sps)
static void sh_deblock_offsets(VVCSH *sh)
#define AV_PIX_FMT_GRAY12
#define LMCS_MAX_BIT_DEPTH
static void alf_chroma(VVCALF *alf, const H266RawAPS *aps)
static void sh_entry_points(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
int16_t chroma_coeff[ALF_NUM_FILTERS_CHROMA][ALF_NUM_COEFF_CHROMA]
uint8_t sps_subpic_treated_as_pic_flag[VVC_MAX_SLICES]
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
static int sps_map_pixel_format(VVCSPS *sps, void *log_ctx)
const H266RawAPS * lmcs_list[VVC_MAX_LMCS_COUNT]
RefStruct reference.
const uint8_t ff_vvc_scaling_pred_8[8 *8]
#define MIN_TU_LOG2
MinTbLog2SizeY.
uint8_t scaling_matrix_rec[SL_MAX_ID][SL_MAX_MATRIX_SIZE *SL_MAX_MATRIX_SIZE]
ScalingMatrixRec.
Generated on Tue Nov 18 2025 19:22:15 for FFmpeg by
doxygen
1.8.17