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

Function hw_base_encode_clear_old

libavcodec/hw_base_encode.c:358–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358static int hw_base_encode_clear_old(AVCodecContext *avctx, FFHWBaseEncodeContext *ctx)
359{
360 FFHWBaseEncodePicture *pic, *prev, *next;
361
362 av_assert0(ctx->pic_start);
363
364 // Remove direct references once each picture is complete.
365 for (pic = ctx->pic_start; pic; pic = pic->next) {
366 if (pic->encode_complete && pic->next)
367 hw_base_encode_remove_refs(pic, 0);
368 }
369
370 // Remove indirect references once a picture has no direct references.
371 for (pic = ctx->pic_start; pic; pic = pic->next) {
372 if (pic->encode_complete && pic->ref_count[0] == 0)
373 hw_base_encode_remove_refs(pic, 1);
374 }
375
376 // Clear out all complete pictures with no remaining references.
377 prev = NULL;
378 for (pic = ctx->pic_start; pic; pic = next) {
379 next = pic->next;
380 if (pic->encode_complete && pic->ref_count[1] == 0) {
381 av_assert0(pic->ref_removed[0] && pic->ref_removed[1]);
382 if (prev)
383 prev->next = next;
384 else
385 ctx->pic_start = next;
386 ctx->op->free(avctx, pic);
387 base_encode_pic_free(pic);
388 } else {
389 prev = pic;
390 }
391 }
392
393 return 0;
394}
395
396static int hw_base_encode_check_frame(FFHWBaseEncodeContext *ctx,
397 const AVFrame *frame)

Callers 1

Calls 2

base_encode_pic_freeFunction · 0.85

Tested by

no test coverage detected