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

Function get_current_frame

libavcodec/av1dec.c:1213–1274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211}
1212
1213static int get_current_frame(AVCodecContext *avctx)
1214{
1215 AV1DecContext *s = avctx->priv_data;
1216 int ret;
1217
1218 av1_frame_unref(&s->cur_frame);
1219
1220 s->cur_frame.header_ref = av_refstruct_ref(s->header_ref);
1221
1222 s->cur_frame.raw_frame_header = s->raw_frame_header;
1223
1224 ret = init_tile_data(s);
1225 if (ret < 0) {
1226 av_log(avctx, AV_LOG_ERROR, "Failed to init tile data.\n");
1227 return ret;
1228 }
1229
1230 if ((avctx->skip_frame >= AVDISCARD_NONINTRA &&
1231 (s->raw_frame_header->frame_type != AV1_FRAME_KEY &&
1232 s->raw_frame_header->frame_type != AV1_FRAME_INTRA_ONLY)) ||
1233 (avctx->skip_frame >= AVDISCARD_NONKEY &&
1234 s->raw_frame_header->frame_type != AV1_FRAME_KEY) ||
1235 avctx->skip_frame >= AVDISCARD_ALL)
1236 return 0;
1237
1238 if (s->pix_fmt == AV_PIX_FMT_NONE) {
1239 ret = get_pixel_format(avctx);
1240 if (ret < 0) {
1241 av_log(avctx, AV_LOG_ERROR, "Failed to get pixel format.\n");
1242 return ret;
1243 }
1244
1245 if (!ret && FF_HW_HAS_CB(avctx, decode_params)) {
1246 ret = FF_HW_CALL(avctx, decode_params, AV1_OBU_SEQUENCE_HEADER,
1247 s->seq_data_ref->data, s->seq_data_ref->size);
1248 if (ret < 0) {
1249 av_log(avctx, AV_LOG_ERROR, "HW accel decode params fail.\n");
1250 return ret;
1251 }
1252 }
1253 }
1254
1255 ret = av1_frame_alloc(avctx, &s->cur_frame);
1256 if (ret < 0) {
1257 av_log(avctx, AV_LOG_ERROR,
1258 "Failed to allocate space for current frame.\n");
1259 return ret;
1260 }
1261
1262 global_motion_params(s);
1263 skip_mode_params(s);
1264 coded_lossless_param(s);
1265 order_hint_info(s);
1266 load_grain_params(s);
1267
1268 s->cur_frame.force_integer_mv =
1269 s->raw_frame_header->force_integer_mv ||
1270 s->raw_frame_header->frame_type == AV1_FRAME_KEY ||

Callers 1

Calls 11

av1_frame_unrefFunction · 0.85
av_refstruct_refFunction · 0.85
init_tile_dataFunction · 0.85
av_logFunction · 0.85
av1_frame_allocFunction · 0.85
global_motion_paramsFunction · 0.85
skip_mode_paramsFunction · 0.85
coded_lossless_paramFunction · 0.85
order_hint_infoFunction · 0.85
load_grain_paramsFunction · 0.85
get_pixel_formatFunction · 0.70

Tested by

no test coverage detected