diff mbox series

[FFmpeg-devel,6/6] fate/cbs: add tests for discard_units

Message ID tencent_E5AE2E3995C2FDB4B8685E01F96B0A7D1A0A@qq.com
State New
Headers show
Series [FFmpeg-devel,1/6] avcodec/cbs: add API to discard units by AVDiscard | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Zhao Zhili May 17, 2023, 9:23 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

---
 tests/fate/cbs.mak                       | 28 ++++++++++
 tests/ref/fate/cbs-h264-discard-bidir    | 37 +++++++++++++
 tests/ref/fate/cbs-h264-discard-nonintra |  8 +++
 tests/ref/fate/cbs-h264-discard-nonkey   |  3 ++
 tests/ref/fate/cbs-h264-discard-nonref   | 67 ++++++++++++++++++++++++
 tests/ref/fate/cbs-hevc-discard-bidir    |  3 ++
 tests/ref/fate/cbs-hevc-discard-nonintra |  3 ++
 tests/ref/fate/cbs-hevc-discard-nonkey   |  3 ++
 tests/ref/fate/cbs-hevc-discard-nonref   | 26 +++++++++
 9 files changed, 178 insertions(+)
 create mode 100644 tests/ref/fate/cbs-h264-discard-bidir
 create mode 100644 tests/ref/fate/cbs-h264-discard-nonintra
 create mode 100644 tests/ref/fate/cbs-h264-discard-nonkey
 create mode 100644 tests/ref/fate/cbs-h264-discard-nonref
 create mode 100644 tests/ref/fate/cbs-hevc-discard-bidir
 create mode 100644 tests/ref/fate/cbs-hevc-discard-nonintra
 create mode 100644 tests/ref/fate/cbs-hevc-discard-nonkey
 create mode 100644 tests/ref/fate/cbs-hevc-discard-nonref

+format|filename=cbs-hevc-discard-nonref.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=1.720000|size=48625|bit_rate=226162|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2mp41|tag:encoder=Lavf60.5.100

Comments

Zhao Zhili May 18, 2023, 1:33 p.m. UTC | #1
On Thu, 2023-05-18 at 05:23 +0800, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> ---
>  tests/fate/cbs.mak                       | 28 ++++++++++
>  tests/ref/fate/cbs-h264-discard-bidir    | 37 +++++++++++++
>  tests/ref/fate/cbs-h264-discard-nonintra |  8 +++
>  tests/ref/fate/cbs-h264-discard-nonkey   |  3 ++
>  tests/ref/fate/cbs-h264-discard-nonref   | 67
> ++++++++++++++++++++++++
>  tests/ref/fate/cbs-hevc-discard-bidir    |  3 ++
>  tests/ref/fate/cbs-hevc-discard-nonintra |  3 ++
>  tests/ref/fate/cbs-hevc-discard-nonkey   |  3 ++
>  tests/ref/fate/cbs-hevc-discard-nonref   | 26 +++++++++
>  9 files changed, 178 insertions(+)
>  create mode 100644 tests/ref/fate/cbs-h264-discard-bidir
>  create mode 100644 tests/ref/fate/cbs-h264-discard-nonintra
>  create mode 100644 tests/ref/fate/cbs-h264-discard-nonkey
>  create mode 100644 tests/ref/fate/cbs-h264-discard-nonref
>  create mode 100644 tests/ref/fate/cbs-hevc-discard-bidir
>  create mode 100644 tests/ref/fate/cbs-hevc-discard-nonintra
>  create mode 100644 tests/ref/fate/cbs-hevc-discard-nonkey
>  create mode 100644 tests/ref/fate/cbs-hevc-discard-nonref

It looks like patchwork cannot handle the patch due to the fate
reference files, I think. How to format the patch to workaround the
limitation?

https://patchwork.ffmpeg.org/project/ffmpeg/patch/tencent_E5AE2E3995C2FDB4B8685E01F96B0A7D1A0A@qq.com/

The patch has been added as attachment of this email.
diff mbox series

Patch

diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak
index a93e58ea9f..3d1ccf3897 100644
--- a/tests/fate/cbs.mak
+++ b/tests/fate/cbs.mak
@@ -12,6 +12,19 @@  FATE_CBS_$(1) += fate-cbs-$(1)-$(2)
 fate-cbs-$(1)-$(2): CMD = md5 -c:v $(3) -i $(TARGET_SAMPLES)/$(4) -c:v copy -y -bsf:v $(1)_metadata -f $(5)
 endef
 
+define FATE_CBS_DISCARD_TEST
+# (codec, discard_type, sample_file, output_format, dep)
+FATE_CBS_$(1)_DISCARD += fate-cbs-$(1)-discard-$(2)
+
+tests/data/fate/cbs-$(1)-discard-$2.$(4): TAG = GEN
+tests/data/fate/cbs-$(1)-discard-$2.$(4): ffmpeg$(PROGSSUF)$(EXESUF) $(5) | tests/data
+	$(M)$(TARGET_EXEC) $(TARGET_PATH)/ffmpeg$(PROGSSUF)$(EXESUF) -nostdin \
+		-i $(3) -c:v copy -an -bsf:v filter_units=discard=$(2) \
+	-f $(4) $(TARGET_PATH)/tests/data/fate/cbs-$(1)-discard-$(2).$(4) -y 2>/dev/null
+fate-cbs-$(1)-discard-$2: ffprobe tests/data/fate/cbs-$(1)-discard-$(2).$(4)
+fate-cbs-$(1)-discard-$2: CMD = ffprobe_demux $(TARGET_PATH)/tests/data/fate/cbs-$(1)-discard-$(2).$(4)
+endef
+
 # AV1 read/write
 
 FATE_CBS_AV1_CONFORMANCE_SAMPLES = \
@@ -67,6 +80,13 @@  $(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call FATE_CBS_TEST,h264,$(basename
 
 FATE_CBS_H264-$(call FATE_CBS_DEPS, H264, H264, H264, H264, H264) = $(FATE_CBS_h264)
 
+$(eval $(call FATE_CBS_DISCARD_TEST,h264,nonref,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
+$(eval $(call FATE_CBS_DISCARD_TEST,h264,bidir,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
+$(eval $(call FATE_CBS_DISCARD_TEST,h264,nonintra,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
+$(eval $(call FATE_CBS_DISCARD_TEST,h264,nonkey,$(TARGET_SAMPLES)/h264/interlaced_crop.mp4,mp4))
+
+FATE_CBS_H264-$(call ALLYES, MP4_MUXER, H264_PARSER, FILTER_UNITS_BSF, H264_MUXER) += $(FATE_CBS_h264_DISCARD)
+
 
 FATE_H264_REDUNDANT_PPS-$(call REMUX, H264, MOV_DEMUXER H264_REDUNDANT_PPS_BSF   \
                                       H264_DECODER H264_PARSER RAWVIDEO_ENCODER) \
@@ -133,6 +153,14 @@  FATE_CBS_HEVC_SAMPLES =       \
 $(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call FATE_CBS_TEST,hevc,$(basename $(N)),hevc,hevc-conformance/$(N),hevc)))
 
 FATE_CBS_HEVC-$(call FATE_CBS_DEPS, HEVC, HEVC, HEVC, HEVC, HEVC) = $(FATE_CBS_hevc)
+
+$(eval $(call FATE_CBS_DISCARD_TEST,hevc,nonref,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
+$(eval $(call FATE_CBS_DISCARD_TEST,hevc,bidir,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
+$(eval $(call FATE_CBS_DISCARD_TEST,hevc,nonintra,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
+$(eval $(call FATE_CBS_DISCARD_TEST,hevc,nonkey,$(TARGET_PATH)/tests/data/hevc-mp4.mov,mp4,tests/data/hevc-mp4.mov))
+
+FATE_CBS_HEVC-$(call ALLYES, MP4_MUXER, HEVC_PARSER, FILTER_UNITS_BSF, HEVC_MUXER) += $(FATE_CBS_hevc_DISCARD)
+
 FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes)
 fate-cbs-hevc: $(FATE_CBS_HEVC-yes)
 
diff --git a/tests/ref/fate/cbs-h264-discard-bidir b/tests/ref/fate/cbs-h264-discard-bidir
new file mode 100644
index 0000000000..f161ee392c
--- /dev/null
+++ b/tests/ref/fate/cbs-h264-discard-bidir
@@ -0,0 +1,37 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-1024|dts_time=-0.080000|duration=512|duration_time=0.040000|size=22583|pos=48|flags=K__|data_hash=CRC32:69e4d65d
+packet|codec_type=video|stream_index=0|pts=2048|pts_time=0.160000|dts=-512|dts_time=-0.040000|duration=512|duration_time=0.040000|size=4023|pos=22631|flags=___|data_hash=CRC32:0013cf12
+packet|codec_type=video|stream_index=0|pts=4096|pts_time=0.320000|dts=1536|dts_time=0.120000|duration=512|duration_time=0.040000|size=4214|pos=26654|flags=___|data_hash=CRC32:3d1a75de
+packet|codec_type=video|stream_index=0|pts=6144|pts_time=0.480000|dts=3584|dts_time=0.280000|duration=512|duration_time=0.040000|size=4067|pos=30868|flags=___|data_hash=CRC32:0ae6ba93
+packet|codec_type=video|stream_index=0|pts=8192|pts_time=0.640000|dts=5632|dts_time=0.440000|duration=512|duration_time=0.040000|size=4223|pos=34935|flags=___|data_hash=CRC32:653ad50a
+packet|codec_type=video|stream_index=0|pts=10240|pts_time=0.800000|dts=7680|dts_time=0.600000|duration=512|duration_time=0.040000|size=4757|pos=39158|flags=___|data_hash=CRC32:9c63fc60
+packet|codec_type=video|stream_index=0|pts=12288|pts_time=0.960000|dts=9728|dts_time=0.760000|duration=512|duration_time=0.040000|size=26559|pos=43915|flags=K__|data_hash=CRC32:3d91ff30
+packet|codec_type=video|stream_index=0|pts=14336|pts_time=1.120000|dts=11776|dts_time=0.920000|duration=512|duration_time=0.040000|size=3419|pos=70474|flags=___|data_hash=CRC32:a16c6e06
+packet|codec_type=video|stream_index=0|pts=16384|pts_time=1.280000|dts=13824|dts_time=1.080000|duration=512|duration_time=0.040000|size=4270|pos=73893|flags=___|data_hash=CRC32:75f5fba0
+packet|codec_type=video|stream_index=0|pts=18432|pts_time=1.440000|dts=15872|dts_time=1.240000|duration=512|duration_time=0.040000|size=6351|pos=78163|flags=___|data_hash=CRC32:b71a5f72
+packet|codec_type=video|stream_index=0|pts=20480|pts_time=1.600000|dts=17920|dts_time=1.400000|duration=512|duration_time=0.040000|size=5504|pos=84514|flags=___|data_hash=CRC32:f4513593
+packet|codec_type=video|stream_index=0|pts=22528|pts_time=1.760000|dts=19968|dts_time=1.560000|duration=512|duration_time=0.040000|size=5330|pos=90018|flags=___|data_hash=CRC32:e0e58cfc
+packet|codec_type=video|stream_index=0|pts=24576|pts_time=1.920000|dts=22016|dts_time=1.720000|duration=512|duration_time=0.040000|size=25829|pos=95348|flags=K__|data_hash=CRC32:0ffa1941
+packet|codec_type=video|stream_index=0|pts=26624|pts_time=2.080000|dts=24064|dts_time=1.880000|duration=512|duration_time=0.040000|size=3788|pos=121177|flags=___|data_hash=CRC32:b7d88c97
+packet|codec_type=video|stream_index=0|pts=28672|pts_time=2.240000|dts=26112|dts_time=2.040000|duration=512|duration_time=0.040000|size=5277|pos=124965|flags=___|data_hash=CRC32:836281be
+packet|codec_type=video|stream_index=0|pts=30720|pts_time=2.400000|dts=28160|dts_time=2.200000|duration=512|duration_time=0.040000|size=4423|pos=130242|flags=___|data_hash=CRC32:16ce42d5
+packet|codec_type=video|stream_index=0|pts=32768|pts_time=2.560000|dts=30208|dts_time=2.360000|duration=512|duration_time=0.040000|size=4789|pos=134665|flags=___|data_hash=CRC32:c3253157
+packet|codec_type=video|stream_index=0|pts=34816|pts_time=2.720000|dts=32256|dts_time=2.520000|duration=512|duration_time=0.040000|size=4543|pos=139454|flags=___|data_hash=CRC32:2b284455
+packet|codec_type=video|stream_index=0|pts=36864|pts_time=2.880000|dts=34304|dts_time=2.680000|duration=512|duration_time=0.040000|size=24224|pos=143997|flags=K__|data_hash=CRC32:f4545b97
+packet|codec_type=video|stream_index=0|pts=38912|pts_time=3.040000|dts=36352|dts_time=2.840000|duration=512|duration_time=0.040000|size=3804|pos=168221|flags=___|data_hash=CRC32:9e182c9d
+packet|codec_type=video|stream_index=0|pts=40960|pts_time=3.200000|dts=38400|dts_time=3.000000|duration=512|duration_time=0.040000|size=4832|pos=172025|flags=___|data_hash=CRC32:9177a3b3
+packet|codec_type=video|stream_index=0|pts=43008|pts_time=3.360000|dts=40448|dts_time=3.160000|duration=512|duration_time=0.040000|size=5169|pos=176857|flags=___|data_hash=CRC32:4b98426d
+packet|codec_type=video|stream_index=0|pts=45056|pts_time=3.520000|dts=42496|dts_time=3.320000|duration=512|duration_time=0.040000|size=5428|pos=182026|flags=___|data_hash=CRC32:1b44d316
+packet|codec_type=video|stream_index=0|pts=47104|pts_time=3.680000|dts=44544|dts_time=3.480000|duration=512|duration_time=0.040000|size=5354|pos=187454|flags=___|data_hash=CRC32:e9e88511
+packet|codec_type=video|stream_index=0|pts=49152|pts_time=3.840000|dts=46592|dts_time=3.640000|duration=512|duration_time=0.040000|size=24046|pos=192808|flags=K__|data_hash=CRC32:ce41a6fe
+packet|codec_type=video|stream_index=0|pts=51200|pts_time=4.000000|dts=48640|dts_time=3.800000|duration=512|duration_time=0.040000|size=4427|pos=216854|flags=___|data_hash=CRC32:69f58de5
+packet|codec_type=video|stream_index=0|pts=53248|pts_time=4.160000|dts=50688|dts_time=3.960000|duration=512|duration_time=0.040000|size=5196|pos=221281|flags=___|data_hash=CRC32:82877b2a
+packet|codec_type=video|stream_index=0|pts=55296|pts_time=4.320000|dts=52736|dts_time=4.120000|duration=512|duration_time=0.040000|size=6958|pos=226477|flags=___|data_hash=CRC32:14b54257
+packet|codec_type=video|stream_index=0|pts=57344|pts_time=4.480000|dts=54784|dts_time=4.280000|duration=512|duration_time=0.040000|size=5007|pos=233435|flags=___|data_hash=CRC32:7b5d6eff
+packet|codec_type=video|stream_index=0|pts=59392|pts_time=4.640000|dts=56832|dts_time=4.440000|duration=512|duration_time=0.040000|size=1864|pos=238442|flags=___|data_hash=CRC32:32f9a8b3
+packet|codec_type=video|stream_index=0|pts=61440|pts_time=4.800000|dts=58880|dts_time=4.600000|duration=512|duration_time=0.040000|size=22592|pos=240306|flags=K__|data_hash=CRC32:413e519a
+packet|codec_type=video|stream_index=0|pts=61952|pts_time=4.840000|dts=60928|dts_time=4.760000|duration=512|duration_time=0.040000|size=158|pos=262898|flags=___|data_hash=CRC32:aedfe6be
+packet|codec_type=video|stream_index=0|pts=62464|pts_time=4.880000|dts=61440|dts_time=4.800000|duration=512|duration_time=0.040000|size=332|pos=263056|flags=___|data_hash=CRC32:4d2e6f42
+packet|codec_type=video|stream_index=0|pts=63488|pts_time=4.960000|dts=61952|dts_time=4.840000|duration=512|duration_time=0.040000|size=326|pos=263388|flags=___|data_hash=CRC32:c9e610e6
+packet|codec_type=video|stream_index=0|pts=64000|pts_time=5.000000|dts=62976|dts_time=4.920000|duration=512|duration_time=0.040000|size=235|pos=263714|flags=___|data_hash=CRC32:5b757bc6
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=640|height=360|coded_width=640|coded_height=360|closed_captions=0|film_grain=0|has_b_frames=2|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=41|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=tt|refs=1|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=25/1|avg_frame_rate=125/18|time_base=1/12800|start_pts=0|start_time=0.000000|duration_ts=64512|duration=5.040000|bit_rate=418890|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=35|nb_read_frames=N/A|nb_read_packets=35|extradata_size=54|extradata_hash=CRC32:148701ce|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposit
 ion:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=GPAC ISO Video Handler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-h264-discard-bidir.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=5.040000|size=265025|bit_rate=420674|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2avc1mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-h264-discard-nonintra b/tests/ref/fate/cbs-h264-discard-nonintra
new file mode 100644
index 0000000000..3fc237255a
--- /dev/null
+++ b/tests/ref/fate/cbs-h264-discard-nonintra
@@ -0,0 +1,8 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-1024|dts_time=-0.080000|duration=512|duration_time=0.040000|size=22583|pos=48|flags=K__|data_hash=CRC32:69e4d65d
+packet|codec_type=video|stream_index=0|pts=12288|pts_time=0.960000|dts=9728|dts_time=0.760000|duration=512|duration_time=0.040000|size=26559|pos=22631|flags=K__|data_hash=CRC32:3d91ff30
+packet|codec_type=video|stream_index=0|pts=24576|pts_time=1.920000|dts=22016|dts_time=1.720000|duration=512|duration_time=0.040000|size=25829|pos=49190|flags=K__|data_hash=CRC32:0ffa1941
+packet|codec_type=video|stream_index=0|pts=36864|pts_time=2.880000|dts=34304|dts_time=2.680000|duration=512|duration_time=0.040000|size=24224|pos=75019|flags=K__|data_hash=CRC32:f4545b97
+packet|codec_type=video|stream_index=0|pts=49152|pts_time=3.840000|dts=46592|dts_time=3.640000|duration=512|duration_time=0.040000|size=24046|pos=99243|flags=K__|data_hash=CRC32:ce41a6fe
+packet|codec_type=video|stream_index=0|pts=61440|pts_time=4.800000|dts=58880|dts_time=4.600000|duration=512|duration_time=0.040000|size=22592|pos=123289|flags=K__|data_hash=CRC32:413e519a
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=640|height=360|coded_width=640|coded_height=360|closed_captions=0|film_grain=0|has_b_frames=2|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=41|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=tt|refs=1|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=25/12|avg_frame_rate=75/59|time_base=1/12800|start_pts=0|start_time=0.000000|duration_ts=60416|duration=4.720000|bit_rate=247174|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=6|nb_read_frames=N/A|nb_read_packets=6|extradata_size=54|extradata_hash=CRC32:148701ce|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|dispositio
 n:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=GPAC ISO Video Handler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-h264-discard-nonintra.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=4.720000|size=146761|bit_rate=248747|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2avc1mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-h264-discard-nonkey b/tests/ref/fate/cbs-h264-discard-nonkey
new file mode 100644
index 0000000000..033235af55
--- /dev/null
+++ b/tests/ref/fate/cbs-h264-discard-nonkey
@@ -0,0 +1,3 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-1024|dts_time=-0.080000|duration=512|duration_time=0.040000|size=22583|pos=48|flags=K__|data_hash=CRC32:69e4d65d
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=640|height=360|coded_width=640|coded_height=360|closed_captions=0|film_grain=0|has_b_frames=2|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=41|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=tt|refs=1|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/12800|start_pts=0|start_time=0.000000|duration_ts=512|duration=0.040000|bit_rate=4516600|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=1|nb_read_frames=N/A|nb_read_packets=1|extradata_size=54|extradata_hash=CRC32:148701ce|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:t
 imed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=GPAC ISO Video Handler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-h264-discard-nonkey.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=0.040000|size=23463|bit_rate=4692600|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2avc1mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-h264-discard-nonref b/tests/ref/fate/cbs-h264-discard-nonref
new file mode 100644
index 0000000000..b63eec1abd
--- /dev/null
+++ b/tests/ref/fate/cbs-h264-discard-nonref
@@ -0,0 +1,67 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-1024|dts_time=-0.080000|duration=512|duration_time=0.040000|size=22583|pos=48|flags=K__|data_hash=CRC32:69e4d65d
+packet|codec_type=video|stream_index=0|pts=2048|pts_time=0.160000|dts=-512|dts_time=-0.040000|duration=512|duration_time=0.040000|size=4023|pos=22631|flags=___|data_hash=CRC32:0013cf12
+packet|codec_type=video|stream_index=0|pts=1024|pts_time=0.080000|dts=0|dts_time=0.000000|duration=512|duration_time=0.040000|size=1098|pos=26654|flags=___|data_hash=CRC32:0fa0e9cb
+packet|codec_type=video|stream_index=0|pts=4096|pts_time=0.320000|dts=1536|dts_time=0.120000|duration=512|duration_time=0.040000|size=4214|pos=27752|flags=___|data_hash=CRC32:3d1a75de
+packet|codec_type=video|stream_index=0|pts=3072|pts_time=0.240000|dts=2048|dts_time=0.160000|duration=512|duration_time=0.040000|size=1119|pos=31966|flags=___|data_hash=CRC32:2f0223aa
+packet|codec_type=video|stream_index=0|pts=6144|pts_time=0.480000|dts=3584|dts_time=0.280000|duration=512|duration_time=0.040000|size=4067|pos=33085|flags=___|data_hash=CRC32:0ae6ba93
+packet|codec_type=video|stream_index=0|pts=5120|pts_time=0.400000|dts=4096|dts_time=0.320000|duration=512|duration_time=0.040000|size=964|pos=37152|flags=___|data_hash=CRC32:c8ce52dc
+packet|codec_type=video|stream_index=0|pts=8192|pts_time=0.640000|dts=5632|dts_time=0.440000|duration=512|duration_time=0.040000|size=4223|pos=38116|flags=___|data_hash=CRC32:653ad50a
+packet|codec_type=video|stream_index=0|pts=7168|pts_time=0.560000|dts=6144|dts_time=0.480000|duration=512|duration_time=0.040000|size=1042|pos=42339|flags=___|data_hash=CRC32:9979a4e9
+packet|codec_type=video|stream_index=0|pts=10240|pts_time=0.800000|dts=7680|dts_time=0.600000|duration=512|duration_time=0.040000|size=4757|pos=43381|flags=___|data_hash=CRC32:9c63fc60
+packet|codec_type=video|stream_index=0|pts=9216|pts_time=0.720000|dts=8192|dts_time=0.640000|duration=512|duration_time=0.040000|size=1184|pos=48138|flags=___|data_hash=CRC32:b8909a00
+packet|codec_type=video|stream_index=0|pts=12288|pts_time=0.960000|dts=9728|dts_time=0.760000|duration=512|duration_time=0.040000|size=26559|pos=49322|flags=K__|data_hash=CRC32:3d91ff30
+packet|codec_type=video|stream_index=0|pts=11264|pts_time=0.880000|dts=10240|dts_time=0.800000|duration=512|duration_time=0.040000|size=1143|pos=75881|flags=___|data_hash=CRC32:cae51d5c
+packet|codec_type=video|stream_index=0|pts=14336|pts_time=1.120000|dts=11776|dts_time=0.920000|duration=512|duration_time=0.040000|size=3419|pos=77024|flags=___|data_hash=CRC32:a16c6e06
+packet|codec_type=video|stream_index=0|pts=13312|pts_time=1.040000|dts=12288|dts_time=0.960000|duration=512|duration_time=0.040000|size=1130|pos=80443|flags=___|data_hash=CRC32:53fdc474
+packet|codec_type=video|stream_index=0|pts=16384|pts_time=1.280000|dts=13824|dts_time=1.080000|duration=512|duration_time=0.040000|size=4270|pos=81573|flags=___|data_hash=CRC32:75f5fba0
+packet|codec_type=video|stream_index=0|pts=15360|pts_time=1.200000|dts=14336|dts_time=1.120000|duration=512|duration_time=0.040000|size=1121|pos=85843|flags=___|data_hash=CRC32:bcef6ae6
+packet|codec_type=video|stream_index=0|pts=18432|pts_time=1.440000|dts=15872|dts_time=1.240000|duration=512|duration_time=0.040000|size=6351|pos=86964|flags=___|data_hash=CRC32:b71a5f72
+packet|codec_type=video|stream_index=0|pts=17408|pts_time=1.360000|dts=16384|dts_time=1.280000|duration=512|duration_time=0.040000|size=1190|pos=93315|flags=___|data_hash=CRC32:bb46179d
+packet|codec_type=video|stream_index=0|pts=20480|pts_time=1.600000|dts=17920|dts_time=1.400000|duration=512|duration_time=0.040000|size=5504|pos=94505|flags=___|data_hash=CRC32:f4513593
+packet|codec_type=video|stream_index=0|pts=19456|pts_time=1.520000|dts=18432|dts_time=1.440000|duration=512|duration_time=0.040000|size=1242|pos=100009|flags=___|data_hash=CRC32:14765239
+packet|codec_type=video|stream_index=0|pts=22528|pts_time=1.760000|dts=19968|dts_time=1.560000|duration=512|duration_time=0.040000|size=5330|pos=101251|flags=___|data_hash=CRC32:e0e58cfc
+packet|codec_type=video|stream_index=0|pts=21504|pts_time=1.680000|dts=20480|dts_time=1.600000|duration=512|duration_time=0.040000|size=1273|pos=106581|flags=___|data_hash=CRC32:47e84071
+packet|codec_type=video|stream_index=0|pts=24576|pts_time=1.920000|dts=22016|dts_time=1.720000|duration=512|duration_time=0.040000|size=25829|pos=107854|flags=K__|data_hash=CRC32:0ffa1941
+packet|codec_type=video|stream_index=0|pts=23552|pts_time=1.840000|dts=22528|dts_time=1.760000|duration=512|duration_time=0.040000|size=1208|pos=133683|flags=___|data_hash=CRC32:c36f1ddc
+packet|codec_type=video|stream_index=0|pts=26624|pts_time=2.080000|dts=24064|dts_time=1.880000|duration=512|duration_time=0.040000|size=3788|pos=134891|flags=___|data_hash=CRC32:b7d88c97
+packet|codec_type=video|stream_index=0|pts=25600|pts_time=2.000000|dts=24576|dts_time=1.920000|duration=512|duration_time=0.040000|size=1189|pos=138679|flags=___|data_hash=CRC32:f1000036
+packet|codec_type=video|stream_index=0|pts=28672|pts_time=2.240000|dts=26112|dts_time=2.040000|duration=512|duration_time=0.040000|size=5277|pos=139868|flags=___|data_hash=CRC32:836281be
+packet|codec_type=video|stream_index=0|pts=27648|pts_time=2.160000|dts=26624|dts_time=2.080000|duration=512|duration_time=0.040000|size=1354|pos=145145|flags=___|data_hash=CRC32:60d42d85
+packet|codec_type=video|stream_index=0|pts=30720|pts_time=2.400000|dts=28160|dts_time=2.200000|duration=512|duration_time=0.040000|size=4423|pos=146499|flags=___|data_hash=CRC32:16ce42d5
+packet|codec_type=video|stream_index=0|pts=29696|pts_time=2.320000|dts=28672|dts_time=2.240000|duration=512|duration_time=0.040000|size=1466|pos=150922|flags=___|data_hash=CRC32:bb24a5a6
+packet|codec_type=video|stream_index=0|pts=32768|pts_time=2.560000|dts=30208|dts_time=2.360000|duration=512|duration_time=0.040000|size=4789|pos=152388|flags=___|data_hash=CRC32:c3253157
+packet|codec_type=video|stream_index=0|pts=31744|pts_time=2.480000|dts=30720|dts_time=2.400000|duration=512|duration_time=0.040000|size=1437|pos=157177|flags=___|data_hash=CRC32:25effcab
+packet|codec_type=video|stream_index=0|pts=34816|pts_time=2.720000|dts=32256|dts_time=2.520000|duration=512|duration_time=0.040000|size=4543|pos=158614|flags=___|data_hash=CRC32:2b284455
+packet|codec_type=video|stream_index=0|pts=33792|pts_time=2.640000|dts=32768|dts_time=2.560000|duration=512|duration_time=0.040000|size=1547|pos=163157|flags=___|data_hash=CRC32:fec8c6fd
+packet|codec_type=video|stream_index=0|pts=36864|pts_time=2.880000|dts=34304|dts_time=2.680000|duration=512|duration_time=0.040000|size=24224|pos=164704|flags=K__|data_hash=CRC32:f4545b97
+packet|codec_type=video|stream_index=0|pts=35840|pts_time=2.800000|dts=34816|dts_time=2.720000|duration=512|duration_time=0.040000|size=1424|pos=188928|flags=___|data_hash=CRC32:9fea2803
+packet|codec_type=video|stream_index=0|pts=38912|pts_time=3.040000|dts=36352|dts_time=2.840000|duration=512|duration_time=0.040000|size=3804|pos=190352|flags=___|data_hash=CRC32:9e182c9d
+packet|codec_type=video|stream_index=0|pts=37888|pts_time=2.960000|dts=36864|dts_time=2.880000|duration=512|duration_time=0.040000|size=1286|pos=194156|flags=___|data_hash=CRC32:80fc98bb
+packet|codec_type=video|stream_index=0|pts=40960|pts_time=3.200000|dts=38400|dts_time=3.000000|duration=512|duration_time=0.040000|size=4832|pos=195442|flags=___|data_hash=CRC32:9177a3b3
+packet|codec_type=video|stream_index=0|pts=39936|pts_time=3.120000|dts=38912|dts_time=3.040000|duration=512|duration_time=0.040000|size=1448|pos=200274|flags=___|data_hash=CRC32:ddfa0b77
+packet|codec_type=video|stream_index=0|pts=43008|pts_time=3.360000|dts=40448|dts_time=3.160000|duration=512|duration_time=0.040000|size=5169|pos=201722|flags=___|data_hash=CRC32:4b98426d
+packet|codec_type=video|stream_index=0|pts=41984|pts_time=3.280000|dts=40960|dts_time=3.200000|duration=512|duration_time=0.040000|size=1451|pos=206891|flags=___|data_hash=CRC32:aea0b422
+packet|codec_type=video|stream_index=0|pts=45056|pts_time=3.520000|dts=42496|dts_time=3.320000|duration=512|duration_time=0.040000|size=5428|pos=208342|flags=___|data_hash=CRC32:1b44d316
+packet|codec_type=video|stream_index=0|pts=44032|pts_time=3.440000|dts=43008|dts_time=3.360000|duration=512|duration_time=0.040000|size=1576|pos=213770|flags=___|data_hash=CRC32:cbb3eee1
+packet|codec_type=video|stream_index=0|pts=47104|pts_time=3.680000|dts=44544|dts_time=3.480000|duration=512|duration_time=0.040000|size=5354|pos=215346|flags=___|data_hash=CRC32:e9e88511
+packet|codec_type=video|stream_index=0|pts=46080|pts_time=3.600000|dts=45056|dts_time=3.520000|duration=512|duration_time=0.040000|size=1503|pos=220700|flags=___|data_hash=CRC32:b9ee459e
+packet|codec_type=video|stream_index=0|pts=49152|pts_time=3.840000|dts=46592|dts_time=3.640000|duration=512|duration_time=0.040000|size=24046|pos=222203|flags=K__|data_hash=CRC32:ce41a6fe
+packet|codec_type=video|stream_index=0|pts=48128|pts_time=3.760000|dts=47104|dts_time=3.680000|duration=512|duration_time=0.040000|size=1584|pos=246249|flags=___|data_hash=CRC32:4438c672
+packet|codec_type=video|stream_index=0|pts=51200|pts_time=4.000000|dts=48640|dts_time=3.800000|duration=512|duration_time=0.040000|size=4427|pos=247833|flags=___|data_hash=CRC32:69f58de5
+packet|codec_type=video|stream_index=0|pts=50176|pts_time=3.920000|dts=49152|dts_time=3.840000|duration=512|duration_time=0.040000|size=1494|pos=252260|flags=___|data_hash=CRC32:b78c9e7d
+packet|codec_type=video|stream_index=0|pts=53248|pts_time=4.160000|dts=50688|dts_time=3.960000|duration=512|duration_time=0.040000|size=5196|pos=253754|flags=___|data_hash=CRC32:82877b2a
+packet|codec_type=video|stream_index=0|pts=52224|pts_time=4.080000|dts=51200|dts_time=4.000000|duration=512|duration_time=0.040000|size=1485|pos=258950|flags=___|data_hash=CRC32:84553d2d
+packet|codec_type=video|stream_index=0|pts=55296|pts_time=4.320000|dts=52736|dts_time=4.120000|duration=512|duration_time=0.040000|size=6958|pos=260435|flags=___|data_hash=CRC32:14b54257
+packet|codec_type=video|stream_index=0|pts=54272|pts_time=4.240000|dts=53248|dts_time=4.160000|duration=512|duration_time=0.040000|size=1189|pos=267393|flags=___|data_hash=CRC32:845381ae
+packet|codec_type=video|stream_index=0|pts=57344|pts_time=4.480000|dts=54784|dts_time=4.280000|duration=512|duration_time=0.040000|size=5007|pos=268582|flags=___|data_hash=CRC32:7b5d6eff
+packet|codec_type=video|stream_index=0|pts=56320|pts_time=4.400000|dts=55296|dts_time=4.320000|duration=512|duration_time=0.040000|size=454|pos=273589|flags=___|data_hash=CRC32:eccc8273
+packet|codec_type=video|stream_index=0|pts=59392|pts_time=4.640000|dts=56832|dts_time=4.440000|duration=512|duration_time=0.040000|size=1864|pos=274043|flags=___|data_hash=CRC32:32f9a8b3
+packet|codec_type=video|stream_index=0|pts=58368|pts_time=4.560000|dts=57344|dts_time=4.480000|duration=512|duration_time=0.040000|size=361|pos=275907|flags=___|data_hash=CRC32:fe582a76
+packet|codec_type=video|stream_index=0|pts=61440|pts_time=4.800000|dts=58880|dts_time=4.600000|duration=512|duration_time=0.040000|size=22592|pos=276268|flags=K__|data_hash=CRC32:413e519a
+packet|codec_type=video|stream_index=0|pts=60416|pts_time=4.720000|dts=59392|dts_time=4.640000|duration=512|duration_time=0.040000|size=385|pos=298860|flags=___|data_hash=CRC32:aee406fc
+packet|codec_type=video|stream_index=0|pts=61952|pts_time=4.840000|dts=60928|dts_time=4.760000|duration=512|duration_time=0.040000|size=158|pos=299245|flags=___|data_hash=CRC32:aedfe6be
+packet|codec_type=video|stream_index=0|pts=62464|pts_time=4.880000|dts=61440|dts_time=4.800000|duration=512|duration_time=0.040000|size=332|pos=299403|flags=___|data_hash=CRC32:4d2e6f42
+packet|codec_type=video|stream_index=0|pts=63488|pts_time=4.960000|dts=61952|dts_time=4.840000|duration=512|duration_time=0.040000|size=326|pos=299735|flags=___|data_hash=CRC32:c9e610e6
+packet|codec_type=video|stream_index=0|pts=64000|pts_time=5.000000|dts=62976|dts_time=4.920000|duration=512|duration_time=0.040000|size=235|pos=300061|flags=___|data_hash=CRC32:5b757bc6
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=640|height=360|coded_width=640|coded_height=360|closed_captions=0|film_grain=0|has_b_frames=2|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=41|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=tt|refs=1|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=25/1|avg_frame_rate=1625/126|time_base=1/12800|start_pts=0|start_time=0.000000|duration_ts=64512|duration=5.040000|bit_rate=476584|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=65|nb_read_frames=N/A|nb_read_packets=65|extradata_size=54|extradata_hash=CRC32:148701ce|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|dispos
 ition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=GPAC ISO Video Handler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-h264-discard-nonref.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=5.040000|size=302420|bit_rate=480031|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2avc1mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-hevc-discard-bidir b/tests/ref/fate/cbs-hevc-discard-bidir
new file mode 100644
index 0000000000..65dbe73226
--- /dev/null
+++ b/tests/ref/fate/cbs-hevc-discard-bidir
@@ -0,0 +1,3 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=48000|duration_time=0.040000|size=7454|pos=44|flags=KD_|data_hash=CRC32:4c4c3bab
+stream|index=0|codec_name=hevc|profile=2|codec_type=video|codec_tag_string=hev1|codec_tag=0x31766568|width=416|height=240|coded_width=416|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=3|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p10le|level=60|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=unknown|refs=1|id=0x1|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=0|start_time=0.000000|duration_ts=48000|duration=0.040000|bit_rate=1490800|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=1|nb_read_frames=N/A|nb_read_packets=1|extradata_size=121|extradata_hash=CRC32:bd471302|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|dis
 position:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=VideoHandler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-hevc-discard-bidir.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=0.040000|size=8347|bit_rate=1669400|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-hevc-discard-nonintra b/tests/ref/fate/cbs-hevc-discard-nonintra
new file mode 100644
index 0000000000..dc726b895f
--- /dev/null
+++ b/tests/ref/fate/cbs-hevc-discard-nonintra
@@ -0,0 +1,3 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=48000|duration_time=0.040000|size=7454|pos=44|flags=KD_|data_hash=CRC32:4c4c3bab
+stream|index=0|codec_name=hevc|profile=2|codec_type=video|codec_tag_string=hev1|codec_tag=0x31766568|width=416|height=240|coded_width=416|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=3|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p10le|level=60|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=unknown|refs=1|id=0x1|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=0|start_time=0.000000|duration_ts=48000|duration=0.040000|bit_rate=1490800|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=1|nb_read_frames=N/A|nb_read_packets=1|extradata_size=121|extradata_hash=CRC32:bd471302|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|dis
 position:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=VideoHandler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-hevc-discard-nonintra.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=0.040000|size=8347|bit_rate=1669400|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-hevc-discard-nonkey b/tests/ref/fate/cbs-hevc-discard-nonkey
new file mode 100644
index 0000000000..e032a801f0
--- /dev/null
+++ b/tests/ref/fate/cbs-hevc-discard-nonkey
@@ -0,0 +1,3 @@ 
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=48000|duration_time=0.040000|size=7454|pos=44|flags=KD_|data_hash=CRC32:4c4c3bab
+stream|index=0|codec_name=hevc|profile=2|codec_type=video|codec_tag_string=hev1|codec_tag=0x31766568|width=416|height=240|coded_width=416|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=3|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p10le|level=60|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=unknown|refs=1|id=0x1|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=0|start_time=0.000000|duration_ts=48000|duration=0.040000|bit_rate=1490800|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=1|nb_read_frames=N/A|nb_read_packets=1|extradata_size=121|extradata_hash=CRC32:bd471302|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|dis
 position:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=VideoHandler|tag:vendor_id=[0][0][0][0]
+format|filename=cbs-hevc-discard-nonkey.mp4|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=0.040000|size=8347|bit_rate=1669400|probe_score=100|tag:major_brand=isom|tag:minor_version=512|tag:compatible_brands=isomiso2mp41|tag:encoder=Lavf60.5.100
diff --git a/tests/ref/fate/cbs-hevc-discard-nonref b/tests/ref/fate/cbs-hevc-discard-nonref
new file mode 100644
index 0000000000..ce173b4abb
--- /dev/null
+++ b/tests/ref/fate/cbs-hevc-discard-nonref
@@ -0,0 +1,26 @@ 
+packet|codec_type=video|stream_index=0|pts=-144000|pts_time=-0.120000|dts=-144000|dts_time=-0.120000|duration=48000|duration_time=0.040000|size=7454|pos=44|flags=KD_|data_hash=CRC32:4c4c3bab
+packet|codec_type=video|stream_index=0|pts=-96000|pts_time=-0.080000|dts=-96000|dts_time=-0.080000|duration=48000|duration_time=0.040000|size=2622|pos=7498|flags=_D_|data_hash=CRC32:a49f2745
+packet|codec_type=video|stream_index=0|pts=-48000|pts_time=-0.040000|dts=-48000|dts_time=-0.040000|duration=48000|duration_time=0.040000|size=4672|pos=10120|flags=_D_|data_hash=CRC32:37967f67
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=144000|duration_time=0.120000|size=4624|pos=14792|flags=___|data_hash=CRC32:f2b7eb13
+packet|codec_type=video|stream_index=0|pts=144000|pts_time=0.120000|dts=144000|dts_time=0.120000|duration=144000|duration_time=0.120000|size=4192|pos=19416|flags=___|data_hash=CRC32:6538ec17
+packet|codec_type=video|stream_index=0|pts=288000|pts_time=0.240000|dts=288000|dts_time=0.240000|duration=48000|duration_time=0.040000|size=2521|pos=23608|flags=___|data_hash=CRC32:eb27f045
+packet|codec_type=video|stream_index=0|pts=336000|pts_time=0.280000|dts=336000|dts_time=0.280000|duration=48000|duration_time=0.040000|size=1343|pos=26129|flags=___|data_hash=CRC32:a719dc68
+packet|codec_type=video|stream_index=0|pts=384000|pts_time=0.320000|dts=384000|dts_time=0.320000|duration=144000|duration_time=0.120000|size=952|pos=27472|flags=___|data_hash=CRC32:afeae5db
+packet|codec_type=video|stream_index=0|pts=528000|pts_time=0.440000|dts=528000|dts_time=0.440000|duration=144000|duration_time=0.120000|size=760|pos=28424|flags=___|data_hash=CRC32:1eacc92c
+packet|codec_type=video|stream_index=0|pts=672000|pts_time=0.560000|dts=672000|dts_time=0.560000|duration=48000|duration_time=0.040000|size=2591|pos=29184|flags=___|data_hash=CRC32:17372325
+packet|codec_type=video|stream_index=0|pts=720000|pts_time=0.600000|dts=720000|dts_time=0.600000|duration=48000|duration_time=0.040000|size=1188|pos=31775|flags=___|data_hash=CRC32:e9ce977b
+packet|codec_type=video|stream_index=0|pts=768000|pts_time=0.640000|dts=768000|dts_time=0.640000|duration=144000|duration_time=0.120000|size=794|pos=32963|flags=___|data_hash=CRC32:8d140f74
+packet|codec_type=video|stream_index=0|pts=912000|pts_time=0.760000|dts=912000|dts_time=0.760000|duration=144000|duration_time=0.120000|size=746|pos=33757|flags=___|data_hash=CRC32:3b811942
+packet|codec_type=video|stream_index=0|pts=1056000|pts_time=0.880000|dts=1056000|dts_time=0.880000|duration=48000|duration_time=0.040000|size=2603|pos=34503|flags=___|data_hash=CRC32:a486f249
+packet|codec_type=video|stream_index=0|pts=1104000|pts_time=0.920000|dts=1104000|dts_time=0.920000|duration=48000|duration_time=0.040000|size=1005|pos=37106|flags=___|data_hash=CRC32:27839d4c
+packet|codec_type=video|stream_index=0|pts=1152000|pts_time=0.960000|dts=1152000|dts_time=0.960000|duration=144000|duration_time=0.120000|size=459|pos=38111|flags=___|data_hash=CRC32:eb775bfc
+packet|codec_type=video|stream_index=0|pts=1296000|pts_time=1.080000|dts=1296000|dts_time=1.080000|duration=144000|duration_time=0.120000|size=502|pos=38570|flags=___|data_hash=CRC32:ea021457
+packet|codec_type=video|stream_index=0|pts=1440000|pts_time=1.200000|dts=1440000|dts_time=1.200000|duration=48000|duration_time=0.040000|size=2734|pos=39072|flags=___|data_hash=CRC32:6999b39c
+packet|codec_type=video|stream_index=0|pts=1488000|pts_time=1.240000|dts=1488000|dts_time=1.240000|duration=48000|duration_time=0.040000|size=1246|pos=41806|flags=___|data_hash=CRC32:0f9f3622
+packet|codec_type=video|stream_index=0|pts=1536000|pts_time=1.280000|dts=1536000|dts_time=1.280000|duration=144000|duration_time=0.120000|size=572|pos=43052|flags=___|data_hash=CRC32:7d6d8758
+packet|codec_type=video|stream_index=0|pts=1680000|pts_time=1.400000|dts=1680000|dts_time=1.400000|duration=144000|duration_time=0.120000|size=749|pos=43624|flags=___|data_hash=CRC32:69746ad8
+packet|codec_type=video|stream_index=0|pts=1824000|pts_time=1.520000|dts=1824000|dts_time=1.520000|duration=48000|duration_time=0.040000|size=1483|pos=44373|flags=___|data_hash=CRC32:3e9468fc
+packet|codec_type=video|stream_index=0|pts=1872000|pts_time=1.560000|dts=1872000|dts_time=1.560000|duration=144000|duration_time=0.120000|size=638|pos=45856|flags=___|data_hash=CRC32:dc0f1d30
+packet|codec_type=video|stream_index=0|pts=2016000|pts_time=1.680000|dts=2016000|dts_time=1.680000|duration=48000|duration_time=0.040000|size=1070|pos=46494|flags=___|data_hash=CRC32:49a62247
+stream|index=0|codec_name=hevc|profile=2|codec_type=video|codec_tag_string=hev1|codec_tag=0x31766568|width=416|height=240|coded_width=416|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=3|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p10le|level=60|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=unknown|refs=1|id=0x1|r_frame_rate=25/1|avg_frame_rate=300/23|time_base=1/1200000|start_pts=0|start_time=0.000000|duration_ts=2064000|duration=1.720000|bit_rate=206608|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=24|nb_read_frames=N/A|nb_read_packets=24|extradata_size=121|extradata_hash=CRC32:bd471302|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=
 0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=und|tag:handler_name=VideoHandler|tag:vendor_id=[0][0][0][0]