PR #26406 opened by luoye-cpu
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26406
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26406.patch

## Summary

Add `sparse_pocs`, a decoder-private option listing the picture order counts to 
decode, and `frame_dependencies`, a read-only array with the POCs the most 
recently decoded picture depends on. Together they let a caller compute the 
dependency closure of a target picture and reconstruct only those pictures.

Implemented for the native HEVC and VVC decoders.

## Behaviour

- With `sparse_pocs` unset the decoders are byte identical to before.
- Skipped pictures are discarded before reconstruction by reusing the existing 
per-picture skip state: no DPB entry is allocated, no slice data is parsed and 
nothing is submitted to a hardware accelerator.
- `frame_dependencies` is exported after the reference list of a picture is 
built, so a caller can build the dependency graph in decode order.
- HEVC requires single-threaded decoding (`-threads 1`); frame threading is 
rejected with `AVERROR(EINVAL)`. The VVC decoder does not use frame threading.

## Edge cases

- POC is unique only inside one coded video sequence. The options are 
documented as single-CVS, and the reset at IDR/BLA pictures is called out.
- HEVC enhancement layers are ignored.
- Decoders that drive the CUVID parser directly (`*_cuvid`) cannot support this 
and are documented as such.

## FATE

- `fate-ffmpeg-sparse_pocs-hevc` uses `hevc/dv84.mov`, compares the sparse run 
against a full decode filtered to the same pictures with framecrc, and asserts 
exactly 7 decoded pictures.
- `fate-ffmpeg-sparse_pocs-vvc` uses `vvc-conformance/10b422_L_5.bit`, compares 
the per-picture hashes (the sparse run renumbers output timestamps) and asserts 
exactly 5 decoded pictures.
- Both fail on master, where the option is unknown.

The samples are already in fate-suite; no new samples are needed.

## Verification

- dv84 (100 pictures, B-pyramid): closure mean 6.34 pictures; target 50 needs 7 
and target 99 needs 4. Every emitted picture is byte identical to the full 
decode; 100/100 targets pass.
- VVC 10b422_L_5 (17 pictures): closures of 4-6 pictures, byte identical.
- The gain depends on the reference structure: large for deep B-pyramid GOPs, 
small for low-delay streams. This change only provides the mechanism; computing 
the closure is up to the caller.

## Related work

`AVDISCARD_NONREF` already lets a decoder discard non-reference pictures; this 
adds a finer, caller-defined selection on top of it.



>From 6bf9424143f0921040433ad181db96a638271da5 Mon Sep 17 00:00:00 2001
From: luoye-cpu <[email protected]>
Date: Sat, 28 Nov 2026 00:18:44 +0800
Subject: [PATCH] avcodec/hevc, vvc: add dependency-closure sparse decoding

Add "sparse_pocs", a decoder-private list of picture order counts to
decode, and "frame_dependencies", a read-only array with the POCs the
last decoded picture depends on. Together they let a caller compute the
dependency closure of a target picture and reconstruct only those
pictures.

Skipped pictures are discarded before reconstruction by reusing the
existing per-picture skip state, so no DPB entry is allocated, no slice
is parsed and nothing is submitted to a hardware accelerator. With the
option unset decoding is byte identical to before.

The HEVC decoder requires single-threaded decoding; the VVC decoder does
not use frame threading.
---
 doc/decoders.texi         |  43 ++++++++++++++++
 libavcodec/hevc/hevcdec.c |  84 +++++++++++++++++++++++++++++++
 libavcodec/hevc/hevcdec.h |   8 +++
 libavcodec/vvc/dec.c      | 103 ++++++++++++++++++++++++++++++++++++++
 libavcodec/vvc/dec.h      |  12 +++++
 tests/fate/ffmpeg.mak     |  36 +++++++++++++
 6 files changed, 286 insertions(+)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 76b4c813dcd..e01f01fd26d 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -96,6 +96,49 @@ the traversal supports. Every other picture is decoded in 
tile scan order as
 before. With slice threading, a picture whose tiles are all carried in one
 slice is still decoded tile-parallel, whatever this option is set to.
 
+@item sparse_pocs
+Specify a list of @code{pic_order_cnt} values of the pictures that should be
+decoded. Pictures whose POC is not in the list are discarded before
+reconstruction, which makes it possible to decode only the dependency closure
+of a target picture. The list must contain all pictures the target depends on,
+and applies to a single coded video sequence only, as POC values are reset at
+IDR and BLA pictures. The option requires single-threaded decoding
+(@code{-threads 1} in the command line tool), works both with the native 
decoder
+and with hardware acceleration through the hwaccel API, and is ignored for
+enhancement layers. Decoders that drive the CUVID parser directly (for example
+@code{hevc_cuvid}) do not support it, since that parser cannot skip a picture.
+
+@item frame_dependencies
+An array of @code{pic_order_cnt} values of the pictures that the most recently
+decoded picture depends on. It is meant to be read by the caller to construct
+the dependency graph of a coded video sequence, from which the dependency
+closure of a target picture - the value to pass to @option{sparse_pocs} - can 
be
+computed.
+
+@end table
+
+@section vvc
+Versatile Video Coding (ITU-T H.266 or ISO/IEC 23090-3) decoder.
+
+@subsection Options
+
+@table @option
+
+@item sparse_pocs
+Specify a list of @code{pic_order_cnt} values of the pictures that should be
+decoded. Pictures whose POC is not in the list are discarded before
+reconstruction, which makes it possible to decode only the dependency closure
+of a target picture. The list must contain all pictures the target depends on,
+and applies to a single coded video sequence only, as POC values are reset at
+IDR and BLA pictures. The option is only applied by the native decoder.
+
+@item frame_dependencies
+An array of @code{pic_order_cnt} values of the pictures that the most recently
+decoded picture depends on. It is meant to be read by the caller to construct
+the dependency graph of a coded video sequence, from which the dependency
+closure of a target picture - the value to pass to @option{sparse_pocs} - can 
be
+computed.
+
 @end table
 
 @section rawvideo
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 3bee36ef2fb..084091b96a8 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -4081,6 +4081,58 @@ static int is_prev_tid0_pic(const HEVCContext *s)
            s->nal_unit_type != HEVC_NAL_RASL_R;
 }
 
+static int hevc_sparse_has_poc(const HEVCContext *s, int poc)
+{
+    for (unsigned i = 0; i < s->nb_sparse_pocs; i++)
+        if (s->sparse_pocs[i] == poc)
+            return 1;
+    return 0;
+}
+
+/* Export the reference POCs of the current picture in RPS iteration order so
+ * that callers can build the dependency graph. A picture may appear in more
+ * than one RPS list, hence the deduplication. Failures never affect decoding. 
*/
+static void hevc_export_dependencies(HEVCContext *s)
+{
+    static const enum RPSType lists[] = { ST_CURR_BEF, ST_CURR_AFT, LT_CURR };
+    int pocs[FF_ARRAY_ELEMS(lists) * HEVC_MAX_REFS];
+    unsigned nb = 0;
+
+    av_freep(&s->frame_dependencies);
+    s->nb_frame_dependencies = 0;
+
+    for (unsigned t = 0; t < FF_ARRAY_ELEMS(lists); t++) {
+        const RefPicList *rps = &s->rps[lists[t]];
+
+        for (int i = 0; i < rps->nb_refs; i++) {
+            int poc, seen = 0;
+
+            if (!rps->ref[i])
+                continue;
+            poc = rps->ref[i]->poc;
+
+            for (unsigned j = 0; j < nb; j++)
+                if (pocs[j] == poc) {
+                    seen = 1;
+                    break;
+                }
+            if (!seen)
+                pocs[nb++] = poc;
+        }
+    }
+
+    if (!nb)
+        return;
+
+
+    s->frame_dependencies = av_malloc_array(nb, 
sizeof(*s->frame_dependencies));
+    if (!s->frame_dependencies)
+        return;
+
+    memcpy(s->frame_dependencies, pocs, nb * sizeof(*pocs));
+    s->nb_frame_dependencies = nb;
+}
+
 static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
                             unsigned nal_idx)
 {
@@ -4218,6 +4270,9 @@ static int hevc_frame_start(HEVCContext *s, 
HEVCLayerContext *l,
         goto fail;
     }
 
+    if (s->nuh_layer_id == 0)
+        hevc_export_dependencies(s);
+
     if (IS_IRAP(s))
         s->cur_frame->f->flags |= AV_FRAME_FLAG_KEY;
     else
@@ -4437,6 +4492,18 @@ static int decode_slice(HEVCContext *s, unsigned 
nal_idx, GetBitContext *gb)
         return ret;
     }
 
+    if (s->nb_sparse_pocs && s->nuh_layer_id == 0 &&
+        !hevc_sparse_has_poc(s, s->sh.poc)) {
+        if (s->sh.first_slice_in_pic_flag) {
+            s->skipping_frame = 1;
+            /* 8.3.1: a skipped picture can still be prevTid0Pic */
+            if (is_prev_tid0_pic(s))
+                s->poc_tid0 = s->sh.poc;
+            av_log(s->avctx, AV_LOG_DEBUG, "sparse_pocs: skipping poc=%d\n", 
s->sh.poc);
+        }
+        return 0;
+    }
+
     if ((s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == 
HEVC_SLICE_B) ||
         (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != 
HEVC_SLICE_I) ||
         (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s)) ||
@@ -4948,6 +5015,9 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
     av_freep(&s->tile_streams);
     av_freep(&s->substreams);
 
+    av_freep(&s->frame_dependencies);
+    s->nb_frame_dependencies = 0;
+
     ff_h2645_packet_uninit(&s->pkt);
 
     ff_hevc_reset_sei(&s->sei);
@@ -5149,6 +5219,12 @@ static av_cold int hevc_decode_init(AVCodecContext 
*avctx)
     if (ret < 0)
         return ret;
 
+    if (s->nb_sparse_pocs > 0 && (avctx->active_thread_type & 
FF_THREAD_FRAME)) {
+        av_log(avctx, AV_LOG_ERROR,
+               "sparse_pocs cannot be used with frame threading; use -threads 
1\n");
+        return AVERROR(EINVAL);
+    }
+
     s->sei.picture_timing.picture_struct = 0;
     s->eos = 1;
 
@@ -5201,6 +5277,14 @@ static const AVOption options[] = {
     { "tile_interleave", "Decode tiled pictures in CTB row order to keep frame 
threading overlapped "
         "(-1: auto, 0: off, 1: force)", OFFSET(tile_interleave),
         AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, PAR },
+    { "sparse_pocs", "POC values of the pictures to decode; all other pictures 
are skipped "
+        "before reconstruction", .offset = OFFSET(sparse_pocs),
+        .type = AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY,
+        .min = INT_MIN, .max = INT_MAX, .flags = PAR },
+    { "frame_dependencies", "POC values of the pictures the last decoded 
picture depends on; "
+        "exported to build the dependency graph", .offset = 
OFFSET(frame_dependencies),
+        .type = AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY,
+        .flags = PAR | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
     { "strict-displaywin", "strictly apply default display window size", 
OFFSET(apply_defdispwin),
         AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, PAR },
     { "view_ids", "Array of view IDs that should be decoded and output; a 
single -1 to decode all views",
diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h
index 13e7540c55f..6fea66bbf7a 100644
--- a/libavcodec/hevc/hevcdec.h
+++ b/libavcodec/hevc/hevcdec.h
@@ -663,6 +663,14 @@ typedef struct HEVCContext {
     unsigned nb_substreams;
 
     int tile_interleave;
+
+    // POCs of the pictures to decode; empty means decode everything
+    int      *sparse_pocs;
+    unsigned  nb_sparse_pocs;
+
+    // POCs of the pictures the last decoded picture depends on; exported 
read-only
+    int      *frame_dependencies;
+    unsigned  nb_frame_dependencies;
 } HEVCContext;
 
 /**
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index b2dcc853ac5..5eed66eaf2c 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -32,6 +32,7 @@
 #include "libavcodec/thread.h"
 #include "libavutil/cpu.h"
 #include "libavutil/mem.h"
+#include "libavutil/opt.h"
 #include "libavutil/thread.h"
 #include "libavutil/film_grain_params.h"
 
@@ -800,6 +801,52 @@ static int check_film_grain(VVCContext *s, VVCFrameContext 
*fc)
     return 0;
 }
 
+static int vvc_sparse_has_poc(const VVCContext *s, int poc)
+{
+    for (unsigned i = 0; i < s->nb_sparse_pocs; i++)
+        if (s->sparse_pocs[i] == poc)
+            return 1;
+    return 0;
+}
+
+/* Export the reference POCs of the current picture in RPL order so that
+ * callers can build the dependency graph. A picture may appear in both the L0
+ * and the L1 list, hence the deduplication. Failures never affect decoding. */
+static void vvc_export_dependencies(VVCContext *s, const SliceContext *sc)
+{
+    int pocs[2 * VVC_MAX_REF_ENTRIES];
+    unsigned nb = 0;
+
+    av_freep(&s->frame_dependencies);
+    s->nb_frame_dependencies = 0;
+
+    for (int lx = L0; lx <= L1; lx++) {
+        const RefPicList *rpl = sc->rpl + lx;
+
+        for (int i = 0; i < rpl->nb_refs; i++) {
+            const int poc = rpl->refs[i].poc;
+            unsigned j;
+
+            for (j = 0; j < nb; j++)
+                if (pocs[j] == poc)
+                    break;
+            if (j == nb)
+                pocs[nb++] = poc;
+        }
+    }
+
+    if (!nb)
+        return;
+
+
+    s->frame_dependencies = av_malloc_array(nb, 
sizeof(*s->frame_dependencies));
+    if (!s->frame_dependencies)
+        return;
+
+    memcpy(s->frame_dependencies, pocs, nb * sizeof(*pocs));
+    s->nb_frame_dependencies = nb;
+}
+
 static int frame_start(VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
 {
     const VVCPH *ph                 = &fc->ps.ph;
@@ -838,6 +885,8 @@ static int frame_start(VVCContext *s, VVCFrameContext *fc, 
SliceContext *sc)
     if ((ret = ff_vvc_frame_rpl(s, fc, sc)) < 0)
         goto fail;
 
+    vvc_export_dependencies(s, sc);
+
     if ((ret = ff_vvc_frame_thread_init(fc)) < 0)
         goto fail;
     return 0;
@@ -953,6 +1002,11 @@ static int decode_slice(VVCContext *s, VVCFrameContext 
*fc, AVBufferRef *buf_ref
     SliceContext *sc;
     const int is_first_slice = !fc->nb_slices;
 
+    // the first slice of this picture was skipped, drop the remaining slices:
+    // the frame context has no reference picture for them
+    if (s->skipping_frame)
+        return 0;
+
     if (fc->nb_slices >= VVC_MAX_SLICES)
         return AVERROR_INVALIDDATA;
 
@@ -968,6 +1022,17 @@ static int decode_slice(VVCContext *s, VVCFrameContext 
*fc, AVBufferRef *buf_ref
         ret = frame_setup(fc, s);
         if (ret < 0)
             return ret;
+
+        if (s->nb_sparse_pocs && !vvc_sparse_has_poc(s, fc->ps.ph.poc)) {
+            s->skipping_frame = 1;
+            /* 8.3.1: a skipped picture can still be prevTid0Pic */
+            if (!s->temporal_id && !fc->ps.ph.r->ph_non_ref_pic_flag &&
+                !(IS_RASL(s) || IS_RADL(s)))
+                s->poc_tid0 = fc->ps.ph.poc;
+            av_log(s->avctx, AV_LOG_DEBUG, "sparse_pocs: skipping poc=%d\n",
+                   fc->ps.ph.poc);
+            return 0;
+        }
     } else {
         const H266RawSlice *first = fc->slices[0]->ref;
         const H266RawSlice *slice = sc->ref;
@@ -1064,6 +1129,7 @@ static int decode_nal_units(VVCContext *s, 
VVCFrameContext *fc, AVPacket *avpkt)
     s->last_eos = s->eos;
     s->eos = 0;
     fc->ref = NULL;
+    s->skipping_frame = 0;
 
     ff_cbs_fragment_reset(frame);
     ret = ff_cbs_read_packet(s->cbc, frame, avpkt);
@@ -1253,6 +1319,7 @@ static av_cold void vvc_decode_flush(AVCodecContext 
*avctx)
     s->ps.sps_id_used = 0;
 
     s->eos = 1;
+    s->skipping_frame = 0;
 }
 
 static av_cold int vvc_decode_free(AVCodecContext *avctx)
@@ -1268,6 +1335,10 @@ static av_cold int vvc_decode_free(AVCodecContext *avctx)
         av_free(s->fcs);
     }
     ff_h274_hash_freep(&s->hash_ctx);
+
+    av_freep(&s->frame_dependencies);
+    s->nb_frame_dependencies = 0;
+
     ff_vvc_ps_uninit(&s->ps);
     ff_cbs_close(&s->cbc);
 
@@ -1291,6 +1362,15 @@ static av_cold int vvc_decode_init(AVCodecContext *avctx)
 
     s->avctx = avctx;
 
+    /* VVC advertises AV_CODEC_CAP_OTHER_THREADS, not 
AV_CODEC_CAP_FRAME_THREADS,
+     * so ff_thread_init() never sets FF_THREAD_FRAME here and this cannot
+     * trigger today; keep the invariant explicit for future threading work. */
+    if (s->nb_sparse_pocs > 0 && (avctx->active_thread_type & 
FF_THREAD_FRAME)) {
+        av_log(avctx, AV_LOG_ERROR,
+               "sparse_pocs cannot be used with frame threading; use -threads 
1\n");
+        return AVERROR(EINVAL);
+    }
+
     ret = ff_cbs_init(&s->cbc, AV_CODEC_ID_VVC, avctx);
     if (ret)
         return ret;
@@ -1326,11 +1406,34 @@ static av_cold int vvc_decode_init(AVCodecContext 
*avctx)
     return 0;
 }
 
+#define OFFSET(x) offsetof(VVCContext, x)
+#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
+
+static const AVOption options[] = {
+    { "sparse_pocs", "POC values of the pictures to decode; all other pictures 
are skipped "
+        "before reconstruction", .offset = OFFSET(sparse_pocs),
+        .type = AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY,
+        .min = INT_MIN, .max = INT_MAX, .flags = PAR },
+    { "frame_dependencies", "POC values of the pictures the last decoded 
picture depends on; "
+        "exported to build the dependency graph", .offset = 
OFFSET(frame_dependencies),
+        .type = AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY,
+        .flags = PAR | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
+    { NULL },
+};
+
+static const AVClass vvc_decoder_class = {
+    .class_name = "VVC decoder",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 const FFCodec ff_vvc_decoder = {
     .p.name         = "vvc",
     .p.long_name    = NULL_IF_CONFIG_SMALL("VVC (Versatile Video Coding)"),
     .p.type         = AVMEDIA_TYPE_VIDEO,
     .p.id           = AV_CODEC_ID_VVC,
+    .p.priv_class   = &vvc_decoder_class,
     .priv_data_size = sizeof(VVCContext),
     .init           = vvc_decode_init,
     .close          = vvc_decode_free,
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 7ea88c19f45..0d8b41d273f 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -217,6 +217,7 @@ typedef struct VVCFrameContext {
 } VVCFrameContext;
 
 typedef struct VVCContext {
+    const AVClass *av_class;      ///< must be first (priv_class assertion)
     struct AVCodecContext *avctx;
 
     CodedBitstreamContext *cbc;
@@ -251,6 +252,17 @@ typedef struct VVCContext {
     int nb_delayed;         ///< delayed frames
 
     H274HashContext *hash_ctx;
+
+    // POCs of the pictures to decode; empty means decode everything
+    int      *sparse_pocs;
+    unsigned  nb_sparse_pocs;
+
+    // POCs of the pictures the last decoded picture depends on; exported 
read-only
+    int      *frame_dependencies;
+    unsigned  nb_frame_dependencies;
+
+    // the current picture is being skipped by sparse_pocs
+    int skipping_frame;
 }  VVCContext ;
 
 #endif /* AVCODEC_VVC_DEC_H */
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 96252410a61..205dbdd46e9 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -573,3 +573,39 @@ fate-ffmpeg-mjpeg-444-qns: CMD = framecrc -cpuflags 0 -f 
lavfi -i "testsrc2=s=32
 # alpha merging
 fate-ffmpeg-heif-merge-alpha: CMD = framecrc -auto_conversion_filters -i 
$(TARGET_SAMPLES)/heif/alpha.heic
 FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MOV, HEVC, HEVC_PARSER SCALE_FILTER) += 
fate-ffmpeg-heif-merge-alpha
+# HEVC dependency closure: decoding only the POCs the target picture needs must
+# reproduce the pictures a full decode yields for the same display order, byte 
for
+# byte, and must reconstruct exactly those seven pictures rather than merely 
fewer.
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MOV, HEVC, HEVC_PARSER) += 
fate-ffmpeg-sparse_pocs-hevc
+fate-ffmpeg-sparse_pocs-hevc: CMP = null
+fate-ffmpeg-sparse_pocs-hevc: CMD = \
+    crcref=tests/data/fate/ffmpeg-sparse_pocs-hevc-ref.crc; \
+    crcsparse=tests/data/fate/ffmpeg-sparse_pocs-hevc-sparse.crc; \
+    dbgsparse=tests/data/fate/ffmpeg-sparse_pocs-hevc-dbgsparse.log; \
+    cleanfiles="$$cleanfiles $$crcref $$crcsparse $$dbgsparse"; \
+    ffmpeg -threads 1 -i $(TARGET_SAMPLES)/hevc/dv84.mov -map 0:v:0 \
+        -vf 
"select=eq(n\,32)+eq(n\,36)+eq(n\,40)+eq(n\,44)+eq(n\,48)+eq(n\,50)+eq(n\,52)" \
+        -f framecrc - > $$crcref && \
+    ffmpeg -threads 1 -sparse_pocs 32,36,40,44,48,50,52 -i 
$(TARGET_SAMPLES)/hevc/dv84.mov -map 0:v:0 -f framecrc - > $$crcsparse && \
+    ffmpeg -debug_ts -threads 1 -sparse_pocs 32,36,40,44,48,50,52 -i 
$(TARGET_SAMPLES)/hevc/dv84.mov -map 0:v:0 -f null - 2> $$dbgsparse && \
+    { cmp -s $$crcref $$crcsparse || { echo "-sparse_pocs output differs from 
the filtered full decode"; false; }; } && \
+    { nb_sparse=`grep -c "decoder ->" $$dbgsparse`; \
+      test $$nb_sparse -eq 7 || { echo "-sparse_pocs decoded $$nb_sparse 
pictures, expected 7"; false; }; }
+
+# VVC dependency closure: same property as the HEVC case above, compared on the
+# per-picture hashes because the sparse run renumbers output timestamps.
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, VVC, VVC, VVC_PARSER) += 
fate-ffmpeg-sparse_pocs-vvc
+fate-ffmpeg-sparse_pocs-vvc: CMP = null
+fate-ffmpeg-sparse_pocs-vvc: CMD = \
+    md5ref=tests/data/fate/ffmpeg-sparse_pocs-vvc-ref.md5; \
+    md5sparse=tests/data/fate/ffmpeg-sparse_pocs-vvc-sparse.md5; \
+    dbgsparse=tests/data/fate/ffmpeg-sparse_pocs-vvc-dbgsparse.log; \
+    cleanfiles="$$cleanfiles $$md5ref $$md5sparse $$dbgsparse"; \
+    ffmpeg -i $(TARGET_SAMPLES)/vvc-conformance/10b422_L_5.bit -map 0:v:0 \
+        -vf "select=eq(n\,0)+eq(n\,8)+eq(n\,12)+eq(n\,14)+eq(n\,16)" \
+        -f framemd5 - | grep -v "^#" | cut -d, -f6 > $$md5ref && \
+    ffmpeg -sparse_pocs 0,8,12,14,16 -i 
$(TARGET_SAMPLES)/vvc-conformance/10b422_L_5.bit -map 0:v:0 -f framemd5 - | 
grep -v "^#" | cut -d, -f6 > $$md5sparse && \
+    ffmpeg -debug_ts -sparse_pocs 0,8,12,14,16 -i 
$(TARGET_SAMPLES)/vvc-conformance/10b422_L_5.bit -map 0:v:0 -f null - 2> 
$$dbgsparse && \
+    { cmp -s $$md5ref $$md5sparse || { echo "-sparse_pocs output differs from 
the filtered full decode"; false; }; } && \
+    { nb_sparse=`grep -c "decoder ->" $$dbgsparse`; \
+      test $$nb_sparse -eq 5 || { echo "-sparse_pocs decoded $$nb_sparse 
pictures, expected 5"; false; }; }
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to