[FFmpeg-devel] [PATCH 1/2] avcodec: Add discard_sample_percentage
Michael Niedermayer
michael at niedermayer.cc
Sat Jan 19 01:00:48 EET 2019
Suggested-by: BBB
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
doc/APIchanges | 3 +++
libavcodec/avcodec.h | 8 ++++++++
libavcodec/options_table.h | 1 +
tests/ref/fate/api-mjpeg-codec-param | 2 ++
tests/ref/fate/api-png-codec-param | 2 ++
5 files changed, 16 insertions(+)
diff --git a/doc/APIchanges b/doc/APIchanges
index 5889fb246b..a146a487ef 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -21,6 +21,9 @@ API changes, most recent first:
-------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
+2019-XX-XX - XXXXXXXXXX - lavc 58.XX.100 - avcodec.h
+ Add discard_damaged_percentage
+
2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
Add av_read_image_line2(), av_write_image_line2()
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 90f9f08289..969cf83081 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3344,6 +3344,14 @@ typedef struct AVCodecContext {
* used as reference pictures).
*/
int extra_hw_frames;
+
+ /**
+ * The percentage of damaged samples to discard a frame.
+ *
+ * - decoding: set by user
+ * - encoding: unused
+ */
+ int discard_damaged_percentage;
} AVCodecContext;
#if FF_API_CODEC_GET_SET
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 2f36ec7b8e..a3235bcd57 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -479,6 +479,7 @@ static const AVOption avcodec_options[] = {
{"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
{"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
{"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D },
+{"discard_damaged_percentage", "Percentage of damaged samples to discard a frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D },
{NULL},
};
diff --git a/tests/ref/fate/api-mjpeg-codec-param b/tests/ref/fate/api-mjpeg-codec-param
index 0d2b55cff1..0815919d7d 100644
--- a/tests/ref/fate/api-mjpeg-codec-param
+++ b/tests/ref/fate/api-mjpeg-codec-param
@@ -138,6 +138,7 @@ stream=0, decode=0
max_pixels=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
+ discard_damaged_percentage=95
stream=0, decode=1
b=0
ab=0
@@ -278,3 +279,4 @@ stream=0, decode=1
max_pixels=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
+ discard_damaged_percentage=95
diff --git a/tests/ref/fate/api-png-codec-param b/tests/ref/fate/api-png-codec-param
index 1ae94a2e91..a47d0963da 100644
--- a/tests/ref/fate/api-png-codec-param
+++ b/tests/ref/fate/api-png-codec-param
@@ -138,6 +138,7 @@ stream=0, decode=0
max_pixels=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
+ discard_damaged_percentage=95
stream=0, decode=1
b=0
ab=0
@@ -278,3 +279,4 @@ stream=0, decode=1
max_pixels=2147483647
hwaccel_flags=0x00000001
extra_hw_frames=-1
+ discard_damaged_percentage=95
--
2.20.1
More information about the ffmpeg-devel
mailing list