MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / global_motion_params

Function global_motion_params

libavcodec/av1dec.c:211–258  ·  view source on GitHub ↗

* update gm type/params, since cbs already implemented part of this function, * so we don't need to full implement spec. */

Source from the content-addressed store, hash-verified

209* so we don't need to full implement spec.
210*/
211static void global_motion_params(AV1DecContext *s)
212{
213 const AV1RawFrameHeader *header = s->raw_frame_header;
214 int type, ref;
215
216 for (ref = AV1_REF_FRAME_LAST; ref <= AV1_REF_FRAME_ALTREF; ref++) {
217 s->cur_frame.gm_type[ref] = AV1_WARP_MODEL_IDENTITY;
218 for (int i = 0; i < 6; i++)
219 s->cur_frame.gm_params[ref][i] = (i % 3 == 2) ?
220 1 << AV1_WARPEDMODEL_PREC_BITS : 0;
221 }
222 if (header->frame_type == AV1_FRAME_KEY ||
223 header->frame_type == AV1_FRAME_INTRA_ONLY)
224 return;
225
226 for (ref = AV1_REF_FRAME_LAST; ref <= AV1_REF_FRAME_ALTREF; ref++) {
227 if (header->is_global[ref]) {
228 if (header->is_rot_zoom[ref]) {
229 type = AV1_WARP_MODEL_ROTZOOM;
230 } else {
231 type = header->is_translation[ref] ? AV1_WARP_MODEL_TRANSLATION
232 : AV1_WARP_MODEL_AFFINE;
233 }
234 } else {
235 type = AV1_WARP_MODEL_IDENTITY;
236 }
237 s->cur_frame.gm_type[ref] = type;
238
239 if (type >= AV1_WARP_MODEL_ROTZOOM) {
240 read_global_param(s, type, ref, 2);
241 read_global_param(s, type, ref, 3);
242 if (type == AV1_WARP_MODEL_AFFINE) {
243 read_global_param(s, type, ref, 4);
244 read_global_param(s, type, ref, 5);
245 } else {
246 s->cur_frame.gm_params[ref][4] = -s->cur_frame.gm_params[ref][3];
247 s->cur_frame.gm_params[ref][5] = s->cur_frame.gm_params[ref][2];
248 }
249 }
250 if (type >= AV1_WARP_MODEL_TRANSLATION) {
251 read_global_param(s, type, ref, 0);
252 read_global_param(s, type, ref, 1);
253 }
254 if (type <= AV1_WARP_MODEL_AFFINE) {
255 s->cur_frame.gm_invalid[ref] = !get_shear_params_valid(s, ref);
256 }
257 }
258}
259
260static int get_relative_dist(const AV1RawSequenceHeader *seq,
261 unsigned int a, unsigned int b)

Callers 1

get_current_frameFunction · 0.85

Calls 2

read_global_paramFunction · 0.85
get_shear_params_validFunction · 0.85

Tested by

no test coverage detected