diff mbox

[FFmpeg-devel,1/2] avcodec: Add discard_sample_percentage

Message ID 20190118230049.23122-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer Jan. 18, 2019, 11 p.m. UTC
Suggested-by: BBB
Signed-off-by: Michael Niedermayer <michael@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(+)

Comments

Michael Niedermayer Jan. 27, 2019, 10:17 p.m. UTC | #1
On Sat, Jan 19, 2019 at 12:00:48AM +0100, Michael Niedermayer wrote:
> Suggested-by: BBB
> Signed-off-by: Michael Niedermayer <michael@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(+)

will apply

[...]
Michael Niedermayer Jan. 31, 2019, 4:25 p.m. UTC | #2
On Sat, Jan 19, 2019 at 12:00:48AM +0100, Michael Niedermayer wrote:
> Suggested-by: BBB
> Signed-off-by: Michael Niedermayer <michael@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(+)

do people prefer i backport this user parameter to release branches or is
it preferred
to ommit fixes which depend on this option ?
or some other solution ?

thx

[...]
James Almer Jan. 31, 2019, 5:55 p.m. UTC | #3
On 1/31/2019 1:25 PM, Michael Niedermayer wrote:
> On Sat, Jan 19, 2019 at 12:00:48AM +0100, Michael Niedermayer wrote:
>> Suggested-by: BBB
>> Signed-off-by: Michael Niedermayer <michael@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(+)
> 
> do people prefer i backport this user parameter to release branches or is
> it preferred
> to ommit fixes which depend on this option ?
> or some other solution ?

No, don't backport API like this. And unless it's security related, i
would just not adapt and backport fixes that depend on it.

> 
> thx
> 
> [...]
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
diff mbox

Patch

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