FFmpeg
Loading...
Searching...
No Matches
cbs_vp8_syntax_template.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
20 CBSVP8BoolCodingRW *bool_coding_rw,
22{
23 bc_f(1, update_segment_map);
24 bc_f(1, update_segment_feature_data);
25
26 if (current->update_segment_feature_data) {
27 bc_f(1, segment_feature_mode);
28 // quantizer
29 for (int i = 0; i < 4; i++) {
30 bc_b(segment_qp_update[i]);
31 if (current->segment_qp_update[i])
32 bc_ss(7, segment_qp[i], 1, i);
33 }
34 // loop filter
35 for (int i = 0; i < 4; i++) {
36 bc_b(segment_loop_filter_level_update[i]);
37 if (current->segment_loop_filter_level_update[i])
38 bc_ss(6, segment_loop_filter_level[i], 1, i);
39 }
40 }
41
42 if (current->update_segment_map) {
43 for (int i = 0; i < 3; i++) {
44 bc_b(segment_probs_update[i]);
45 if (current->segment_probs_update[i])
46 bc_fs(8, segment_probs[i], 1, i);
47 }
48 }
49
50 return 0;
51}
52
54 CBSVP8BoolCodingRW *bool_coding_rw,
56{
57 bc_f(1, mode_ref_lf_delta_enable);
58 if (current->mode_ref_lf_delta_enable) {
59 bc_b(mode_ref_lf_delta_update);
60 if (current->mode_ref_lf_delta_update) {
61 // ref_lf_deltas
62 for (int i = 0; i < 4; i++) {
63 bc_b(ref_lf_deltas_update[i]);
64 if (current->ref_lf_deltas_update[i])
65 bc_ss(6, ref_lf_deltas[i], 1, i);
66 }
67 // mode_lf_deltas
68 for (int i = 0; i < 4; i++) {
69 bc_b(mode_lf_deltas_update[i]);
70 if (current->mode_lf_deltas_update[i])
71 bc_ss(6, mode_lf_deltas[i], 1, i);
72 }
73 }
74 }
75
76 return 0;
77}
78
80 CBSVP8BoolCodingRW *bool_coding_rw,
82{
83 bc_f(7, base_qindex);
84
85 bc_b(y1dc_delta_q_present);
86 if (current->y1dc_delta_q_present)
87 bc_s(4, y1dc_delta_q);
88
89 bc_b(y2dc_delta_q_present);
90 if (current->y2dc_delta_q_present)
91 bc_s(4, y2dc_delta_q);
92
93 bc_b(y2ac_delta_q_present);
94 if (current->y2ac_delta_q_present)
95 bc_s(4, y2ac_delta_q);
96
97 bc_b(uvdc_delta_q_present);
98 if (current->uvdc_delta_q_present)
99 bc_s(4, uvdc_delta_q);
100
101 bc_b(uvac_delta_q_present);
102 if (current->uvac_delta_q_present)
103 bc_s(4, uvac_delta_q);
104
105 return 0;
106}
107
109 CBSVP8BoolCodingRW *bool_coding_rw,
111{
112 for (int i = 0; i < 4; ++i) {
113 for (int j = 0; j < 8; ++j) {
114 for (int k = 0; k < 3; ++k) {
115 for (int l = 0; l < 11; ++l) {
117 coeff_prob_update[i][j][k][l]);
118 if (current->coeff_prob_update[i][j][k][l])
119 bc_fs(8, coeff_prob[i][j][k][l], 4, i, j, k, l);
120 }
121 }
122 }
123 }
124
125 return 0;
126}
127
129 CBSVP8BoolCodingRW *bool_coding_rw,
131{
132 for (int i = 0; i < 2; ++i) {
133 for (int j = 0; j < 19; ++j) {
134 bc_b(mv_prob_update[i][j]);
135 if (current->mv_prob_update[i][j])
136 bc_fs(7, mv_prob[i][j], 2, i, j);
137 }
138 }
139
140 return 0;
141}
142
145{
146 f(1, frame_type);
147 f(3, profile);
148 f(1, show_frame);
149 f(19, first_partition_length_in_bytes);
150
151 if (current->frame_type == VP8_KEY_FRAME) {
152 fixed(8, start_code_0, VP8_START_CODE_0);
153 fixed(8, start_code_1, VP8_START_CODE_1);
154 fixed(8, start_code_2, VP8_START_CODE_2);
155
156 f(14, width);
157 f(2, horizontal_scale);
158 f(14, height);
159 f(2, vertical_scale);
160 }
161
162 return 0;
163}
164
166 CBSVP8BoolCodingRW *bool_coding_rw,
168{
169 if (current->frame_type == VP8_KEY_FRAME) {
170 bc_f(1, color_space);
171 bc_f(1, clamping_type);
172 }
173
174 bc_f(1, segmentation_enable);
175 if (current->segmentation_enable)
176 CHECK(FUNC(update_segmentation)(ctx, bool_coding_rw, current));
177
178 bc_f(1, loop_filter_type);
179 bc_f(6, loop_filter_level);
180 bc_f(3, loop_filter_sharpness);
181
182 CHECK(FUNC(mode_ref_lf_deltas)(ctx, bool_coding_rw, current));
183
184 bc_f(2, log2_token_partitions);
185
186 CHECK(FUNC(quantization_params)(ctx, bool_coding_rw, current));
187
188 if (current->frame_type != VP8_KEY_FRAME) {
189 bc_f(1, refresh_golden_frame);
190 bc_f(1, refresh_alternate_frame);
191 if (!current->refresh_golden_frame)
192 bc_f(2, copy_buffer_to_golden);
193 if (!current->refresh_alternate_frame)
194 bc_f(2, copy_buffer_to_alternate);
195 bc_f(1, ref_frame_sign_bias_golden);
196 bc_f(1, ref_frame_sign_bias_alternate);
197 }
198 bc_f(1, refresh_entropy_probs);
199 if (current->frame_type != VP8_KEY_FRAME)
200 bc_f(1, refresh_last_frame);
201
202 CHECK(FUNC(update_token_probs)(ctx, bool_coding_rw, current));
203
204 bc_f(1, mb_no_skip_coeff);
205 if (current->mb_no_skip_coeff)
206 bc_f(8, prob_skip_false);
207
208 if (current->frame_type != VP8_KEY_FRAME) {
209 bc_f(8, prob_intra);
210 bc_f(8, prob_last);
211 bc_f(8, prob_golden);
212
213 // intra_16x16_prob
214 bc_b(intra_16x16_prob_update);
215 if (current->intra_16x16_prob_update)
216 for (int i = 0; i < 4; i++)
217 bc_fs(8, intra_16x16_prob[i], 1, i);
218
219 // intra_chroma_prob
220 bc_b(intra_chrome_prob_update);
221 if (current->intra_chrome_prob_update)
222 for (int i = 0; i < 3; i++)
223 bc_fs(8, intra_chrome_prob[i], 1, i);
224
225 CHECK(FUNC(update_mv_probs)(ctx, bool_coding_rw, current));
226 }
227
228 return 0;
229}
230
233{
234 HEADER("Frame");
235
236 CHECK(FUNC(frame_tag)(ctx, rw, &current->header));
237
238 return 0;
239}
240
242 CBSVP8BoolCodingRW *bool_coding_rw,
244{
245 CHECK(FUNC(frame_header)(ctx, bool_coding_rw, &current->header));
246
247 return 0;
248}
#define FUNC(a)
static int FUNC quantization_params(CodedBitstreamContext *ctx, RWContext *rw, AV1RawFrameHeader *current)
static int FUNC uncompressed_header(CodedBitstreamContext *ctx, RWContext *rw, AV1RawFrameHeader *current)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define RWContext
Definition cbs_h264.c:93
#define bc_b(name)
Definition cbs_vp8.c:247
#define bc_s(width, name)
Definition cbs_vp8.c:240
#define bc_b_prob(prob, name)
Definition cbs_vp8.c:248
#define f(width, name)
Definition cbs_vp8.c:236
#define bc_ss(width, name, subs,...)
Definition cbs_vp8.c:243
#define bc_fs(width, name, subs,...)
Definition cbs_vp8.c:241
#define CBSVP8BoolCodingRW
Definition cbs_vp8.c:253
const uint8_t ff_vp8_token_update_probs[4][8][3][11]
Definition vp8data.c:43
#define bc_f(width, name)
Definition cbs_vp8.c:239
@ VP8_START_CODE_0
Definition cbs_vp8.h:28
@ VP8_START_CODE_2
Definition cbs_vp8.h:30
@ VP8_START_CODE_1
Definition cbs_vp8.h:29
@ VP8_KEY_FRAME
Definition cbs_vp8.h:34
static int FUNC mode_ref_lf_deltas(CodedBitstreamContext *ctx, CBSVP8BoolCodingRW *bool_coding_rw, VP8RawFrameHeader *current)
static int FUNC update_token_probs(CodedBitstreamContext *ctx, CBSVP8BoolCodingRW *bool_coding_rw, VP8RawFrameHeader *current)
static int FUNC compressed_header(CodedBitstreamContext *ctx, CBSVP8BoolCodingRW *bool_coding_rw, VP8RawFrame *current)
static int FUNC update_segmentation(CodedBitstreamContext *ctx, CBSVP8BoolCodingRW *bool_coding_rw, VP8RawFrameHeader *current)
static int FUNC update_mv_probs(CodedBitstreamContext *ctx, CBSVP8BoolCodingRW *bool_coding_rw, VP8RawFrameHeader *current)
static int FUNC frame_tag(CodedBitstreamContext *ctx, RWContext *rw, VP8RawFrameHeader *current)
static struct @111144215057303131116103221376075045141373005341 current
static void show_frame(AVTextFormatContext *tfc, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
Definition ffprobe.c:1509
frame_type
#define fixed(width, name, value)
Definition cbs_apv.c:75
#define CHECK(call)
Definition cbs_apv.c:59
#define HEADER(name)
Definition cbs_apv.c:55
int profile
Definition mxfenc.c:2299
Context structure for coded bitstream operations.
Definition cbs.h:226
static AVFormatContext * ctx
Definition movenc.c:49
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89