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

2019-01-31 Thread James Almer
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 
>> ---
>>  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
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2019-01-31 Thread Michael Niedermayer
On Sat, Jan 19, 2019 at 12:00:48AM +0100, Michael Niedermayer wrote:
> Suggested-by: BBB
> Signed-off-by: Michael Niedermayer 
> ---
>  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

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2019-01-27 Thread Michael Niedermayer
On Sat, Jan 19, 2019 at 12:00:48AM +0100, Michael Niedermayer wrote:
> Suggested-by: BBB
> Signed-off-by: Michael Niedermayer 
> ---
>  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 GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2019-01-18 Thread Michael Niedermayer
Suggested-by: BBB
Signed-off-by: Michael Niedermayer 
---
 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 - XX - 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=0x0001
 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=0x0001
 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=0x0001
 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=0x0001
 extra_hw_frames=-1
+discard_damaged_percentage=95
-- 
2.20.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel