Re: [FFmpeg-devel] [PATCH 0/2] avcodec/dolby_e: Add a parser

2021-01-21 Thread Nicolas Gaullier
>De : Nicolas Gaullier  
>Envoyé : jeudi 14 janvier 2021 17:26
>À : ffmpeg-devel@ffmpeg.org
>Cc : Nicolas Gaullier 
>Objet : [PATCH 0/2] avcodec/dolby_e: Add a parser
>
>I have limited duplicated code by making the decoder calling the parser.
>An option would be to leave all common code to dolby_e.c and move decoding to 
>dolby_edec.c, but that would require either to duplicate 3 "very-internal" 
>functions (skip_input/parse_key/convert_input) 3x times instead of twice 
>>currently, or to share them with ff_ prefix although they are very-low level 
>and difficult to document etc.
>
>If you have an idea for a better design, please tell me.
>
>Nicolas Gaullier (2):
>  avcodec/dolby_e: Add a parser
>  avcodec/dolby_e: Split decoder/parser files
>
> Changelog|   1 +
> libavcodec/Makefile  |   1 +
> libavcodec/dolby_e.c | 209 -
> libavcodec/dolby_e.h | 608 +--
> libavcodec/dolby_e_parser.c  | 227 ++
> libavcodec/dolby_e_parser.h  |  41 ++
> libavcodec/dolby_e_parser_internal.h |  46 ++
> libavcodec/dolby_edec.h  | 607 ++
> libavcodec/parsers.c |   1 +
> libavcodec/version.h |   2 +-
> 10 files changed, 1019 insertions(+), 724 deletions(-)  create mode 100644 
> libavcodec/dolby_e_parser.c  create mode 100644 libavcodec/dolby_e_parser.h  
> create mode 100644 libavcodec/dolby_e_parser_internal.h
> create mode 100644 libavcodec/dolby_edec.h
>
>--
>2.27.0.windows.1

I have not received any feedback since my post last week.
Could someone find time to start the review ?
Thank you very much
Nicolas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 0/2] avcodec/dolby_e: Add a parser

2021-01-21 Thread Paul B Mahol
Changes looks trivial enough.

On Thu, Jan 21, 2021 at 1:30 PM Nicolas Gaullier 
wrote:

> >De : Nicolas Gaullier 
> >Envoyé : jeudi 14 janvier 2021 17:26
> >À : ffmpeg-devel@ffmpeg.org
> >Cc : Nicolas Gaullier 
> >Objet : [PATCH 0/2] avcodec/dolby_e: Add a parser
> >
> >I have limited duplicated code by making the decoder calling the parser.
> >An option would be to leave all common code to dolby_e.c and move
> decoding to dolby_edec.c, but that would require either to duplicate 3
> "very-internal" functions (skip_input/parse_key/convert_input) 3x times
> instead of twice >currently, or to share them with ff_ prefix although they
> are very-low level and difficult to document etc.
> >
> >If you have an idea for a better design, please tell me.
> >
> >Nicolas Gaullier (2):
> >  avcodec/dolby_e: Add a parser
> >  avcodec/dolby_e: Split decoder/parser files
> >
> > Changelog|   1 +
> > libavcodec/Makefile  |   1 +
> > libavcodec/dolby_e.c | 209 -
> > libavcodec/dolby_e.h | 608 +--
> > libavcodec/dolby_e_parser.c  | 227 ++
> > libavcodec/dolby_e_parser.h  |  41 ++
> > libavcodec/dolby_e_parser_internal.h |  46 ++
> > libavcodec/dolby_edec.h  | 607 ++
> > libavcodec/parsers.c |   1 +
> > libavcodec/version.h |   2 +-
> > 10 files changed, 1019 insertions(+), 724 deletions(-)  create mode
> 100644 libavcodec/dolby_e_parser.c  create mode 100644
> libavcodec/dolby_e_parser.h  create mode 100644
> libavcodec/dolby_e_parser_internal.h
> > create mode 100644 libavcodec/dolby_edec.h
> >
> >--
> >2.27.0.windows.1
>
> I have not received any feedback since my post last week.
> Could someone find time to start the review ?
> Thank you very much
> Nicolas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] ffmpeg_opts: remove lowres check

2021-01-21 Thread Anton Khirnov
Quoting James Almer (2021-01-09 18:47:17)
> The st->codec values are updated based on the lowres factor by
> avformat_find_stream_info() when it runs an instance of the decoder 
> internally,
> and the same thing happens in ffmpeg.c when we open ist->dec_ctx with
> avcodec_open2(), so these assignments are redundant.
> 
> Signed-off-by: James Almer 
> ---
> This chunk here is not properly wrapped with the relevant pre-processor check
> for AVStream->codec, and seeing it's ultimately redundant, i figured we might
> as well delete it now.
> 
> For that matter, the deprecation of lowres in avcodec.h is in a very strange
> state (the field is not removed, its offset is changed instead). Once the 
> value
> of FF_API_LOWRES is flipped, neither the field, the AVOption, or the usage
> within decoders will be removed, but some code in libavformat/utils.c will be
> disabled, and that may result in unexpected behavior.

IMO it should just be made a codec-private option. And lavf has no
business treating it specially.

Patch fine with me.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] ffmpeg_opts: remove lowres check

2021-01-21 Thread James Almer

On 1/21/2021 9:59 AM, Anton Khirnov wrote:

Quoting James Almer (2021-01-09 18:47:17)

The st->codec values are updated based on the lowres factor by
avformat_find_stream_info() when it runs an instance of the decoder internally,
and the same thing happens in ffmpeg.c when we open ist->dec_ctx with
avcodec_open2(), so these assignments are redundant.

Signed-off-by: James Almer 
---
This chunk here is not properly wrapped with the relevant pre-processor check
for AVStream->codec, and seeing it's ultimately redundant, i figured we might
as well delete it now.

For that matter, the deprecation of lowres in avcodec.h is in a very strange
state (the field is not removed, its offset is changed instead). Once the value
of FF_API_LOWRES is flipped, neither the field, the AVOption, or the usage
within decoders will be removed, but some code in libavformat/utils.c will be
disabled, and that may result in unexpected behavior.


IMO it should just be made a codec-private option. And lavf has no
business treating it specially.


Technically speaking, there's no reason for lavf to check for lowres to 
do what it's currently doing.


The code


int orig_w = st->codecpar->width;
int orig_h = st->codecpar->height;
ret = avcodec_parameters_from_context(st->codecpar, 
st->internal->avctx);
if (ret < 0)
goto find_stream_info_err;
ret = add_coded_side_data(st, st->internal->avctx);
if (ret < 0)
goto find_stream_info_err;
#if FF_API_LOWRES
// The decoder might reduce the video size by the lowres factor.
if (st->internal->avctx->lowres && orig_w) {
st->codecpar->width = orig_w;
st->codecpar->height = orig_h;
}
#endif


Could be simplified to unconditionally set st->codecpar dimensions to 
the backed up ones. If you agree, i can send a patch.


So based on the above, turning it into a codec specific option sounds 
good to me. We could repeat the FF_API_PRIVATE_OPT deprecation mechanism 
for it, but the global option/field needs to stay for another two years 
since neither were truly deprecated (same for AVCodec->max_lowres), just 
wrapped in a pre-processor check.




Patch fine with me.



Pushed, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Populate field order returned by avs script, Trac Ticket 8757

2021-01-21 Thread Stephen Hutchinson

On 1/17/21 1:23 PM, emco...@ffastrans.com wrote:

On 2021-01-17 09:02, wrote Stephen Hutchinson:

Comment bikeshedding aside, LGTM, but the avs_is* API usage added here
needs to be reflected in the AVSC_DECLARE_FUNC and LOAD_AVS_FUNC blocks.
If those parts of the API are present in 2.5, the LOAD_AVS_FUNC can be a
0. If they were added in 2.6 (or Plus, but I know these would have to be
from classic AviSynth), then it should be 1.


What i am not able to do is to add the used convenience functions 
avs_is_tff and bff to AVSC_DECLARE_FUNC and LOAD_AVS_FUNC, it refuses to 
compile when i do so. IMHO this is because it is just convenience 
functions that's function body is defined in the linked avisynth_c.h 
file instead of being exported by the avisynth api lib.
The existing code in avisynth.c also uses such convenience functions 
without adding them to the declaration, examples:

avs_has_video, line 524
avs_is_clip, line 571

Also, i found it safe to use the convenience functions avs_is_tff and 
bff because the minimum required version is 2.6 and Plus or above, so i 
hoped the functions will be always available.


Yeah, never mind about that.  I didn't notice that those are declared
AVSC_INLINE, not AVSC_API, so they don't get used through the dynamic
API loader.

The comment formatting seems to have been messed up in the second
version, though.

/* The following typically only works when assumetff (-bff) and
 * assumefieldbased is used in-script. Additional
 * logic using GetParity() could deliver more accurate results
 * but also decodes a frame which we want to avoid. */
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] fix for https://trac.ffmpeg.org/ticket/9057

2021-01-21 Thread konstantin
From: KM 

---
 libavcodec/aacdec_template.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index fbe3074..3c2dbe3 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -639,11 +639,14 @@ static int set_default_channel_config(AACContext *ac, 
AVCodecContext *avctx,
  * As actual intended 7.1(wide) streams are very rare, default to assuming 
a
  * 7.1 layout was intended.
  */
-if (channel_config == 7 && avctx->strict_std_compliance < 
FF_COMPLIANCE_STRICT && (!ac || !ac->warned_71_wide++)) {
-av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 
channel layout"
-   " instead of a spec-compliant 7.1(wide) layout, use -strict %d 
to decode"
-   " according to the specification instead.\n", 
FF_COMPLIANCE_STRICT);
+if (channel_config == 7 && avctx->strict_std_compliance < 
FF_COMPLIANCE_STRICT) {
 layout_map[2][2] = AAC_CHANNEL_SIDE;
+
+if (!ac || !ac->warned_71_wide++) {
+av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 
channel layout"
+   " instead of a spec-compliant 7.1(wide) layout, use -strict 
%d to decode"
+   " according to the specification instead.\n", 
FF_COMPLIANCE_STRICT);
+}
 }
 
 return 0;
-- 
2.25.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avfilter/vf_atadenoise: add sigma options

2021-01-21 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi |   9 ++
 libavfilter/atadenoise.h |  10 +-
 libavfilter/vf_atadenoise.c  | 148 +--
 libavfilter/x86/vf_atadenoise_init.c |  18 ++--
 4 files changed, 162 insertions(+), 23 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 3ce6699d7c..22cce1ecc2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7096,6 +7096,15 @@ Alternatively can be set to @code{s} serial.
 Parallel can be faster then serial, while other way around is never true.
 Parallel will abort early on first change being greater then thresholds, while 
serial
 will continue processing other side of frames if they are equal or below 
thresholds.
+
+@item 0s
+@item 1s
+@item 2s
+Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
+Valid range is from 0 to 32767.
+This options controls weight for each pixel in radius defined by size.
+Default value means every pixel have same weight.
+Setting this option to 0 effectively disables filtering.
 @end table
 
 @subsection Commands
diff --git a/libavfilter/atadenoise.h b/libavfilter/atadenoise.h
index 26cb20b9c8..7d92ece0d3 100644
--- a/libavfilter/atadenoise.h
+++ b/libavfilter/atadenoise.h
@@ -31,12 +31,12 @@ enum ATAAlgorithm {
 };
 
 typedef struct ATADenoiseDSPContext {
-void (*filter_row)(const uint8_t *src, uint8_t *dst,
-   const uint8_t **srcf,
-   int w, int mid, int size,
-   int thra, int thrb);
+void (*filter_row[4])(const uint8_t *src, uint8_t *dst,
+  const uint8_t **srcf,
+  int w, int mid, int size,
+  int thra, int thrb, const float *weight);
 } ATADenoiseDSPContext;
 
-void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int 
algorithm);
+void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int 
algorithm, const float *sigma);
 
 #endif /* AVFILTER_ATADENOISE_H */
diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index e1a822045f..b543665ebf 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -44,6 +44,7 @@ typedef struct ATADenoiseContext {
 const AVClass *class;
 
 float fthra[4], fthrb[4];
+float sigma[4];
 int thra[4], thrb[4];
 int algorithm;
 
@@ -55,7 +56,8 @@ typedef struct ATADenoiseContext {
 struct FFBufQueue q;
 void *data[4][SIZE];
 int linesize[4][SIZE];
-int size, mid;
+float weights[4][SIZE];
+int size, mid, radius;
 int available;
 
 int (*filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int 
nb_jobs);
@@ -79,6 +81,9 @@ static const AVOption atadenoise_options[] = {
 { "a",  "set variant of algorithm",  
OFFSET(algorithm),AV_OPT_TYPE_INT,   {.i64=PARALLEL},  0, NB_ATAA-1, FLAGS, "a" 
},
 { "p",  "parallel",  0,
AV_OPT_TYPE_CONST, {.i64=PARALLEL},  0, 0, FLAGS, "a" },
 { "s",  "serial",0,
AV_OPT_TYPE_CONST, {.i64=SERIAL},0, 0, FLAGS, "a" },
+{ "0s", "set sigma for 1st plane",   OFFSET(sigma[0]), 
AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
+{ "1s", "set sigma for 2nd plane",   OFFSET(sigma[1]), 
AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
+{ "2s", "set sigma for 3rd plane",   OFFSET(sigma[2]), 
AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
 { NULL }
 };
 
@@ -129,7 +134,8 @@ static av_cold int init(AVFilterContext *ctx)
 av_log(ctx, AV_LOG_WARNING, "size %d is invalid. Must be an odd value, 
setting it to %d.\n", s->size, s->size|1);
 s->size |= 1;
 }
-s->mid = s->size / 2 + 1;
+s->radius = s->size / 2;
+s->mid = s->radius + 1;
 
 return 0;
 }
@@ -138,11 +144,114 @@ typedef struct ThreadData {
 AVFrame *in, *out;
 } ThreadData;
 
+#define WFILTER_ROW(type, name) \
+static void fweight_row##name(const uint8_t *ssrc, uint8_t *ddst,   \
+  const uint8_t *ssrcf[SIZE],   \
+  int w, int mid, int size, \
+  int thra, int thrb, const float *weights) \
+{   \
+const type *src = (const type *)ssrc;   \
+const type **srcf = (const type **)ssrcf;   \
+type *dst = (type *)ddst;   \
+\
+for (int x = 0; x < w; x++) {   \
+   const int srcx = src[x]; \
+   unsigned lsumdiff = 0, rsumdiff = 0;   

Re: [FFmpeg-devel] [PATCH] Populate field order returned by avs script, Trac Ticket 8757

2021-01-21 Thread emcodem

On 2021-01-21 14:10, Stephen Hutchinson wrote:

Yeah, never mind about that.  I didn't notice that those are declared
AVSC_INLINE, not AVSC_API, so they don't get used through the dynamic
API loader.

The comment formatting seems to have been messed up in the second
version, though.

/* The following typically only works when assumetff (-bff) and
 * assumefieldbased is used in-script. Additional
 * logic using GetParity() could deliver more accurate results
 * but also decodes a frame which we want to avoid. */


OK, i have to admit formatting comments is in the top 10 of my greatest 
weaknesses :D
Thanks for your patience and also thanks for telling me directly how the 
formatting is done correctly.

New patch with formatted comment attached

From 243bb2cbae9fabc78fe7f48cb90ae1c620c51a51 Mon Sep 17 00:00:00 2001
From: emcodem 
Date: Thu, 21 Jan 2021 18:59:45 +0100
Subject: [PATCH] Populate field order returned by avs script, Trac Ticket 8757

---
 libavformat/avisynth.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 2c08ace8db..22ae8c0dd3 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -241,6 +241,23 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
 st->nb_frames = avs->vi->num_frames;
 avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator);
 
+av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi));
+av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi));
+
+/* The following typically only works when assumetff (-bff) and
+ * assumefieldbased is used in-script. Additional
+ * logic using GetParity() could deliver more accurate results
+ * but also decodes a frame which we want to avoid. */
+st->codecpar->field_order = AV_FIELD_UNKNOWN;
+if (avs_is_field_based(avs->vi)) {
+if (avs_is_tff(avs->vi)) {
+st->codecpar->field_order = AV_FIELD_TT;
+}
+else if (avs_is_bff(avs->vi)) {
+st->codecpar->field_order = AV_FIELD_BB;
+}
+}
+
 switch (avs->vi->pixel_type) {
 /* 10~16-bit YUV pix_fmts (AviSynth+) */
 case AVS_CS_YUV444P10:
-- 
2.25.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/3] avformat/paf: Do not zero allocated tables which are immedeately filled

2021-01-21 Thread Michael Niedermayer
On Wed, Jan 20, 2021 at 05:01:20PM +0100, Paul B Mahol wrote:
> could make use of av_malloc_array while there.

ok, will apply with av_malloc_array()

thx

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 03/13] cbs_h2645: Merge SEI message handling in common between codecs

2021-01-21 Thread Mark Thompson

On 21/01/2021 02:08, James Almer wrote:

On 1/18/2021 7:44 PM, Mark Thompson wrote:

diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index 95beabf4d7..5ce4ad3ccd 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -21,8 +21,132 @@
  #include 
  #include 
+
  #include "libavutil/buffer.h"
+#include "cbs.h"
+
+// SEI payload types form a common namespace between the H.264, H.265
+// and H.266 standards.  A given payload type always has the same
+// meaning, but some names have different payload types in different
+// standards (e.g. scalable-nesting is 30 in H.264 but 133 in H.265).
+// The content of the payload data depends on the standard, though
+// many generic parts have the same interpretation everywhere (such as
+// mastering-display-colour-volume and user-data-unregistered).
+enum {
+    SEI_TYPE_BUFFERING_PERIOD    = 0,
+    SEI_TYPE_PIC_TIMING  = 1,
+    SEI_TYPE_PAN_SCAN_RECT   = 2,
+    SEI_TYPE_FILLER_PAYLOAD  = 3,
+    SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35  = 4,
+    SEI_TYPE_USER_DATA_UNREGISTERED  = 5,
+    SEI_TYPE_RECOVERY_POINT  = 6,
+    SEI_TYPE_DEC_REF_PIC_MARKING_REPETITION  = 7,
+    SEI_TYPE_SPARE_PIC   = 8,
+    SEI_TYPE_SCENE_INFO  = 9,
+    SEI_TYPE_SUB_SEQ_INFO    = 10,
+    SEI_TYPE_SUB_SEQ_LAYER_CHARACTERISTICS   = 11,
+    SEI_TYPE_SUB_SEQ_CHARACTERISTICS = 12,
+    SEI_TYPE_FULL_FRAME_FREEZE   = 13,
+    SEI_TYPE_FULL_FRAME_FREEZE_RELEASE   = 14,
+    SEI_TYPE_FULL_FRAME_SNAPSHOT = 15,
+    SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START    = 16,
+    SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END  = 17,
+    SEI_TYPE_MOTION_CONSTRAINED_SLICE_GROUP_SET  = 18,
+    SEI_TYPE_FILM_GRAIN_CHARACTERISTICS  = 19,
+    SEI_TYPE_DEBLOCKING_FILTER_DISPLAY_PREFERENCE    = 20,
+    SEI_TYPE_STEREO_VIDEO_INFO   = 21,
+    SEI_TYPE_POST_FILTER_HINT    = 22,
+    SEI_TYPE_TONE_MAPPING_INFO   = 23,
+    SEI_TYPE_SCALABILITY_INFO    = 24,
+    SEI_TYPE_SUB_PIC_SCALABLE_LAYER  = 25,
+    SEI_TYPE_NON_REQUIRED_LAYER_REP  = 26,
+    SEI_TYPE_PRIORITY_LAYER_INFO = 27,
+    SEI_TYPE_LAYERS_NOT_PRESENT_4    = 28,
+    SEI_TYPE_LAYER_DEPENDENCY_CHANGE = 29,
+    SEI_TYPE_SCALABLE_NESTING_4  = 30,
+    SEI_TYPE_BASE_LAYER_TEMPORAL_HRD = 31,
+    SEI_TYPE_QUALITY_LAYER_INTEGRITY_CHECK   = 32,
+    SEI_TYPE_REDUNDANT_PIC_PROPERTY  = 33,
+    SEI_TYPE_TL0_DEP_REP_INDEX   = 34,
+    SEI_TYPE_TL_SWITCHING_POINT  = 35,
+    SEI_TYPE_PARALLEL_DECODING_INFO  = 36,
+    SEI_TYPE_MVC_SCALABLE_NESTING    = 37,
+    SEI_TYPE_VIEW_SCALABILITY_INFO   = 38,
+    SEI_TYPE_MULTIVIEW_SCENE_INFO_4  = 39,
+    SEI_TYPE_MULTIVIEW_ACQUISITION_INFO_4    = 40,
+    SEI_TYPE_NON_REQUIRED_VIEW_COMPONENT = 41,
+    SEI_TYPE_VIEW_DEPENDENCY_CHANGE  = 42,
+    SEI_TYPE_OPERATION_POINTS_NOT_PRESENT    = 43,
+    SEI_TYPE_BASE_VIEW_TEMPORAL_HRD  = 44,
+    SEI_TYPE_FRAME_PACKING_ARRANGEMENT   = 45,
+    SEI_TYPE_MULTIVIEW_VIEW_POSITION_4   = 46,
+    SEI_TYPE_DISPLAY_ORIENTATION = 47,
+    SEI_TYPE_MVCD_SCALABLE_NESTING   = 48,
+    SEI_TYPE_MVCD_VIEW_SCALABILITY_INFO  = 49,
+    SEI_TYPE_DEPTH_REPRESENTATION_INFO_4 = 50,
+    SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO_4 = 51,
+    SEI_TYPE_DEPTH_TIMING    = 52,
+    SEI_TYPE_DEPTH_SAMPLING_INFO = 53,
+    SEI_TYPE_CONSTRAINED_DEPTH_PARAMETER_SET_IDENTIFIER  = 54,
+    SEI_TYPE_GREEN_METADATA  = 56,
+    SEI_TYPE_STRUCTURE_OF_PICTURES_INFO  = 128,
+    SEI_TYPE_ACTIVE_PARAMETER_SETS   = 129,
+    SEI_TYPE_DECODING_UNIT_INFO  = 130,
+    SEI_TYPE_TEMPORAL_SUB_LAYER_ZERO_IDX = 131,
+    SEI_TYPE_DECODED_PICTURE_HASH    = 132,
+    SEI_TYPE_SCALABLE_NESTING_5  = 133,
+    SEI_TYPE_REGION_REFRESH_INFO = 134,
+    SEI_TYPE_NO_DISPLAY  = 135,
+    SEI_TYPE_TIME_CODE   = 136,
+    SEI_TYPE_MAS

Re: [FFmpeg-devel] [PATCH 4/7] avformat/nistspheredec: Check bits_per_coded_sample and channels

2021-01-21 Thread Michael Niedermayer
On Wed, Jan 20, 2021 at 09:41:49AM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2021-01-19 19:00:47)
> > On Mon, Jan 18, 2021 at 09:06:10PM +0100, Anton Khirnov wrote:
> > > Quoting Michael Niedermayer (2021-01-17 00:07:26)
> > > > Fixes: signed integer overflow: 80 * 92233009 cannot be represented in 
> > > > type 'int'
> > > > Fixes: 
> > > > 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_NISTSPHERE_fuzzer-6669100654919680
> > > > 
> > > > Found-by: continuous fuzzing process 
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavformat/nistspheredec.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
> > > > index 079369929f..fec5c88892 100644
> > > > --- a/libavformat/nistspheredec.c
> > > > +++ b/libavformat/nistspheredec.c
> > > > @@ -80,7 +80,9 @@ static int nist_read_header(AVFormatContext *s)
> > > >  
> > > >  avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
> > > >  
> > > > -st->codecpar->block_align = 
> > > > st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;
> > > > +if (st->codecpar->bits_per_coded_sample * 
> > > > (uint64_t)st->codecpar->channels / 8 > INT_MAX)
> > > > +return AVERROR_INVALIDDATA;
> > > > +st->codecpar->block_align = 
> > > > st->codecpar->bits_per_coded_sample * (uint64_t)st->codecpar->channels 
> > > > / 8;
> > > >  
> > > >  if (avio_tell(s->pb) > header_size)
> > > >  return AVERROR_INVALIDDATA;
> > > > -- 
> > > > 2.17.1
> > > 
> > > Both bits_per_coded_sample and channels seem to be arbitrary ints, so
> > > you are assuming sizeof(int) < sizeof(int64)
> > 
> > I wonder if we shouldnt limit these 2 fields in a platform independant way
> > But if we dont then the change below should do more correct checks
> 
> I would be in favor of limiting them both to 16 bits, that should be way
> beyond anything needed by any reasonable use case.
> 
> > 
> > @@ -80,7 +80,11 @@ static int nist_read_header(AVFormatContext *s)
> >  
> >  avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
> >  
> > -st->codecpar->block_align = 
> > st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;
> > +if (st->codecpar->bits_per_coded_sample < 0 || 
> > st->codecpar->channels <= 0 ||
> > +st->codecpar->bits_per_coded_sample > UINT64_MAX / 
> > st->codecpar->channels ||
> > +st->codecpar->bits_per_coded_sample * 
> > (uint64_t)st->codecpar->channels / 8 > INT_MAX)
> > +return AVERROR_INVALIDDATA;
> > +st->codecpar->block_align = 
> > st->codecpar->bits_per_coded_sample * (uint64_t)st->codecpar->channels / 8;
> >  
> >  if (avio_tell(s->pb) > header_size)
> >  return AVERROR_INVALIDDATA;
> 
> This looks ok.
> 
> Though it would be even better to sanity-check each value for
> zero/negative right after the sscanf() that reads it (not insisting you
> do it).

will apply with these changes

thx

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/7] libavformat/utils: consider avio_size() failure in ffio_limit()

2021-01-21 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 12:04:52AM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (>20sec -> 3ms)
> Fixes: 
> 26918/clusterfuzz-testcase-minimized-ffmpeg_dem_THP_fuzzer-5750425191710720
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/utils.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

will apply

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

Observe your enemies, for they first find out your faults. -- Antisthenes


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/7] avformat/dhav: Break out of infinite dhav search loop

2021-01-21 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 12:04:53AM +0100, Michael Niedermayer wrote:
> Fixes: Infinite loop
> Fixes: 
> 26922/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5794549613723648
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/dhav.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 6/7] avformat/avidec: dv does not support palettes

2021-01-21 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 12:04:55AM +0100, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: 
> 26937/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5763003338981376
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/avidec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

will apply

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

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 7/7] avcodec/cri: check for available input in unpack_10bit()

2021-01-21 Thread Michael Niedermayer
On Tue, Nov 10, 2020 at 05:17:40PM +0100, Michael Niedermayer wrote:
> On Tue, Nov 10, 2020 at 01:46:10AM +0100, Andreas Rheinhardt wrote:
> > Michael Niedermayer:
> > > Fixes: Timeout (>20sec -> 56ms)
> > > Fixes: 
> > > 26995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-5107217080254464
> > > 
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/cri.c | 11 +++
> > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/libavcodec/cri.c b/libavcodec/cri.c
> > > index dafbc1f1be..9bcd2ebfc6 100644
> > > --- a/libavcodec/cri.c
> > > +++ b/libavcodec/cri.c
> > > @@ -80,10 +80,13 @@ static void unpack_10bit(GetByteContext *gb, uint16_t 
> > > *dst, int shift,
> > >  int pos = 0;
> > >  
> > >  while (count > 0) {
> > > -uint32_t a0 = bytestream2_get_le32(gb);
> > > -uint32_t a1 = bytestream2_get_le32(gb);
> > > -uint32_t a2 = bytestream2_get_le32(gb);
> > > -uint32_t a3 = bytestream2_get_le32(gb);
> > > +uint32_t a0, a1,a2,a3;
> > > +if (bytestream2_get_bytes_left(gb) < 4)
> > > +break;
> > > +a0 = bytestream2_get_le32(gb);
> > > +a1 = bytestream2_get_le32(gb);
> > > +a2 = bytestream2_get_le32(gb);
> > > +a3 = bytestream2_get_le32(gb);
> > >  dst[pos] = (((a0 >> 1) & 0xE00) | (a0 & 0x1FF)) << shift;
> > >  pos++;
> > >  if (pos >= w) {
> > > 
> > Wouldn't it make sense to check for 16 bytes to be left given that
> > that's the amount that is read immediately afterwards? And if you check
> > for this, you could just use bytestream2_get_le32u().
> 
> the code can break out before using all 4 so i felt it was more
> cautious to check only for the first

will apply

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] libavcodec/adts_header: add frame_length field and avpriv function to parse AAC ADTS header

2021-01-21 Thread Nachiket Tarate
These will be used by HLS demuxer in case of SAMPLE-AES encryption/decryption.

Signed-off-by: Nachiket Tarate 
---
 libavcodec/adts_header.c |  1 +
 libavcodec/adts_header.h | 14 ++
 libavcodec/adts_parser.c | 28 
 3 files changed, 43 insertions(+)

diff --git a/libavcodec/adts_header.c b/libavcodec/adts_header.c
index 0889820f8a..c6680b0fc8 100644
--- a/libavcodec/adts_header.c
+++ b/libavcodec/adts_header.c
@@ -66,6 +66,7 @@ int ff_adts_header_parse(GetBitContext *gbc, 
AACADTSHeaderInfo *hdr)
 hdr->sample_rate= avpriv_mpeg4audio_sample_rates[sr];
 hdr->samples= (rdb + 1) * 1024;
 hdr->bit_rate   = size * 8 * hdr->sample_rate / hdr->samples;
+hdr->frame_length  = size;
 
 return size;
 }
diff --git a/libavcodec/adts_header.h b/libavcodec/adts_header.h
index f615f6a9f9..efdb5cdc15 100644
--- a/libavcodec/adts_header.h
+++ b/libavcodec/adts_header.h
@@ -34,6 +34,7 @@ typedef struct AACADTSHeaderInfo {
 uint8_t  sampling_index;
 uint8_t  chan_config;
 uint8_t  num_aac_frames;
+uint32_t frame_length;
 } AACADTSHeaderInfo;
 
 /**
@@ -47,4 +48,17 @@ typedef struct AACADTSHeaderInfo {
  */
 int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
 
+/**
+ * Parse the ADTS frame header contained in the buffer, which is
+ * the first 54 bits.
+ * @param[in]  buf  Pointer to buffer containing the first 54 bits of the 
frame.
+ * @param[in]  size Size of buffer containing the first 54 bits of the frame.
+ * @param[out] phdr Pointer to pointer to struct AACADTSHeaderInfo for which
+ * memory is allocated and header info is written into it.
+ * @return Returns 0 on success, -1 if there is a sync word mismatch,
+ * -2 if the version element is invalid, -3 if the sample rate
+ * element is invalid, or -4 if the bit rate element is invalid.
+ */
+int avpriv_adts_header_parse (AACADTSHeaderInfo **phdr, const uint8_t *buf, 
size_t size);
+
 #endif /* AVCODEC_ADTS_HEADER_H */
diff --git a/libavcodec/adts_parser.c b/libavcodec/adts_parser.c
index 5c9f8ff6f2..2f10b9adcf 100644
--- a/libavcodec/adts_parser.c
+++ b/libavcodec/adts_parser.c
@@ -42,3 +42,31 @@ int av_adts_header_parse(const uint8_t *buf, uint32_t 
*samples, uint8_t *frames)
 return AVERROR(ENOSYS);
 #endif
 }
+
+int avpriv_adts_header_parse (AACADTSHeaderInfo **phdr, const uint8_t *buf, 
size_t size)
+{
+#if CONFIG_ADTS_HEADER
+int ret = 0;
+GetBitContext gb;
+
+if (size < AV_AAC_ADTS_HEADER_SIZE)
+return AVERROR_INVALIDDATA;
+
+if (!*phdr)
+*phdr = av_mallocz(sizeof(AACADTSHeaderInfo));
+if (!*phdr)
+return AVERROR(ENOMEM);
+
+ret = init_get_bits8(&gb, buf, AV_AAC_ADTS_HEADER_SIZE);
+if (ret < 0)
+return ret;
+
+ret = ff_adts_header_parse(&gb, *phdr);
+if (ret < 0)
+return ret;
+
+return 0;
+#else
+return AVERROR(ENOSYS);
+#endif
+}
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] libavformat/hls: add support for SAMPLE-AES decryption in HLS demuxer

2021-01-21 Thread Nachiket Tarate
Apple HTTP Live Streaming Sample Encryption:

https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption

Signed-off-by: Nachiket Tarate 
---
 libavformat/Makefile |   2 +-
 libavformat/hls.c|  97 ++-
 libavformat/hls_sample_aes.c | 486 +++
 libavformat/hls_sample_aes.h |  64 +
 libavformat/mpegts.c |  12 +
 5 files changed, 647 insertions(+), 14 deletions(-)
 create mode 100644 libavformat/hls_sample_aes.c
 create mode 100644 libavformat/hls_sample_aes.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3a8fbcbe5f..c97930d98b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -237,7 +237,7 @@ OBJS-$(CONFIG_HCOM_DEMUXER)  += hcom.o pcm.o
 OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
 OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
 OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
-OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
+OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o hls_sample_aes.o
 OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o avc.o
 OBJS-$(CONFIG_HNM_DEMUXER)   += hnm.o
 OBJS-$(CONFIG_ICO_DEMUXER)   += icodec.o
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 619e4800de..9e7f020cea 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2,6 +2,7 @@
  * Apple HTTP Live Streaming demuxer
  * Copyright (c) 2010 Martin Storsjo
  * Copyright (c) 2013 Anssi Hannula
+ * Copyright (c) 2021 Nachiket Tarate
  *
  * This file is part of FFmpeg.
  *
@@ -39,6 +40,8 @@
 #include "avio_internal.h"
 #include "id3v2.h"
 
+#include "hls_sample_aes.h"
+
 #define INITIAL_BUFFER_SIZE 32768
 
 #define MAX_FIELD_LEN 64
@@ -145,6 +148,8 @@ struct playlist {
 int id3_changed; /* ID3 tag data has changed at some point */
 ID3v2ExtraMeta *id3_deferred_extra; /* stored here until subdemuxer is 
opened */
 
+HLSAudioSetupInfo audio_setup_info;
+
 int64_t seek_timestamp;
 int seek_flags;
 int seek_stream_index; /* into subdemuxer stream array */
@@ -986,7 +991,10 @@ fail:
 
 static struct segment *current_segment(struct playlist *pls)
 {
-return pls->segments[pls->cur_seq_no - pls->start_seq_no];
+int n = pls->cur_seq_no - pls->start_seq_no;
+if (n >= pls->n_segments)
+return NULL;
+return pls->segments[n];
 }
 
 static struct segment *next_segment(struct playlist *pls)
@@ -1015,10 +1023,11 @@ static int read_from_url(struct playlist *pls, struct 
segment *seg,
 
 /* Parse the raw ID3 data and pass contents to caller */
 static void parse_id3(AVFormatContext *s, AVIOContext *pb,
-  AVDictionary **metadata, int64_t *dts,
+  AVDictionary **metadata, int64_t *dts, HLSAudioSetupInfo 
*audio_setup_info,
   ID3v2ExtraMetaAPIC **apic, ID3v2ExtraMeta **extra_meta)
 {
 static const char id3_priv_owner_ts[] = 
"com.apple.streaming.transportStreamTimestamp";
+static const char id3_priv_owner_audio_setup[] = 
"com.apple.streaming.audioDescription";
 ID3v2ExtraMeta *meta;
 
 ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
@@ -1034,6 +1043,9 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb,
 else
 av_log(s, AV_LOG_ERROR, "Invalid HLS ID3 audio timestamp 
%"PRId64"\n", ts);
 }
+else if (priv->datasize >= 8 && !strcmp(priv->owner, 
id3_priv_owner_audio_setup)) {
+ff_hls_read_audio_setup_info(audio_setup_info, priv->data, 
priv->datasize);
+}
 } else if (!strcmp(meta->tag, "APIC") && apic)
 *apic = &meta->data.apic;
 }
@@ -1076,7 +1088,7 @@ static void handle_id3(AVIOContext *pb, struct playlist 
*pls)
 ID3v2ExtraMeta *extra_meta = NULL;
 int64_t timestamp = AV_NOPTS_VALUE;
 
-parse_id3(pls->ctx, pb, &metadata, ×tamp, &apic, &extra_meta);
+parse_id3(pls->ctx, pb, &metadata, ×tamp, &pls->audio_setup_info, 
&apic, &extra_meta);
 
 if (timestamp != AV_NOPTS_VALUE) {
 pls->id3_mpegts_timestamp = timestamp;
@@ -1230,10 +1242,7 @@ static int open_input(HLSContext *c, struct playlist 
*pls, struct segment *seg,
 av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset 
%"PRId64", playlist %d\n",
seg->url, seg->url_offset, pls->index);
 
-if (seg->key_type == KEY_NONE) {
-ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, 
&is_http);
-} else if (seg->key_type == KEY_AES_128) {
-char iv[33], key[33], url[MAX_URL_SIZE];
+if (seg->key_type == KEY_AES_128 || seg->key_type == KEY_SAMPLE_AES) {
 if (strcmp(seg->key, pls->key_url)) {
 AVIOContext *pb = NULL;
 if (open_url(pls->parent, &pb, seg->key, &c->avio_opts, opts, 
NULL) == 0) {
@@ -1249,6 +1258,10 @@ static int open_input(HLSContext *c, struct playlist 
*pls, struct segment *seg,

Re: [FFmpeg-devel] [PATCH 2/3] libavformat/hls: add support for SAMPLE-AES decryption in HLS demuxer

2021-01-21 Thread Lynne
Jan 21, 2021, 20:42 by nachiket.program...@gmail.com:

> Apple HTTP Live Streaming Sample Encryption:
>
> https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption
>
> Signed-off-by: Nachiket Tarate 
> ---
>  libavformat/Makefile |   2 +-
>  libavformat/hls.c|  97 ++-
>  libavformat/hls_sample_aes.c | 486 +++
>  libavformat/hls_sample_aes.h |  64 +
>  libavformat/mpegts.c |  12 +
>  5 files changed, 647 insertions(+), 14 deletions(-)
>  create mode 100644 libavformat/hls_sample_aes.c
>  create mode 100644 libavformat/hls_sample_aes.h
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 3a8fbcbe5f..c97930d98b 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -237,7 +237,7 @@ OBJS-$(CONFIG_HCOM_DEMUXER)  += hcom.o pcm.o
>  OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
>  OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
>  OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
> -OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
> +OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o hls_sample_aes.o
>  OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o avc.o
>  OBJS-$(CONFIG_HNM_DEMUXER)   += hnm.o
>  OBJS-$(CONFIG_ICO_DEMUXER)   += icodec.o
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 619e4800de..9e7f020cea 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -2,6 +2,7 @@
>  * Apple HTTP Live Streaming demuxer
>  * Copyright (c) 2010 Martin Storsjo
>  * Copyright (c) 2013 Anssi Hannula
> + * Copyright (c) 2021 Nachiket Tarate
>  *
>  * This file is part of FFmpeg.
>  *
> @@ -39,6 +40,8 @@
>  #include "avio_internal.h"
>  #include "id3v2.h"
>  
> +#include "hls_sample_aes.h"
> +
>  #define INITIAL_BUFFER_SIZE 32768
>  
>  #define MAX_FIELD_LEN 64
> @@ -145,6 +148,8 @@ struct playlist {
>  int id3_changed; /* ID3 tag data has changed at some point */
>  ID3v2ExtraMeta *id3_deferred_extra; /* stored here until subdemuxer is 
> opened */
>  
> +HLSAudioSetupInfo audio_setup_info;
> +
>  int64_t seek_timestamp;
>  int seek_flags;
>  int seek_stream_index; /* into subdemuxer stream array */
> @@ -986,7 +991,10 @@ fail:
>  
>  static struct segment *current_segment(struct playlist *pls)
>  {
> -return pls->segments[pls->cur_seq_no - pls->start_seq_no];
> +int n = pls->cur_seq_no - pls->start_seq_no;
> +if (n >= pls->n_segments)
> +return NULL;
> +return pls->segments[n];
>  }
>  
>  static struct segment *next_segment(struct playlist *pls)
> @@ -1015,10 +1023,11 @@ static int read_from_url(struct playlist *pls, struct 
> segment *seg,
>  
>  /* Parse the raw ID3 data and pass contents to caller */
>  static void parse_id3(AVFormatContext *s, AVIOContext *pb,
> -  AVDictionary **metadata, int64_t *dts,
> +  AVDictionary **metadata, int64_t *dts, 
> HLSAudioSetupInfo *audio_setup_info,
>  ID3v2ExtraMetaAPIC **apic, ID3v2ExtraMeta **extra_meta)
>  {
>  static const char id3_priv_owner_ts[] = 
> "com.apple.streaming.transportStreamTimestamp";
> +static const char id3_priv_owner_audio_setup[] = 
> "com.apple.streaming.audioDescription";
>  ID3v2ExtraMeta *meta;
>  
>  ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
> @@ -1034,6 +1043,9 @@ static void parse_id3(AVFormatContext *s, AVIOContext 
> *pb,
>  else
>  av_log(s, AV_LOG_ERROR, "Invalid HLS ID3 audio timestamp %"PRId64"\n", ts);
>  }
> +else if (priv->datasize >= 8 && !strcmp(priv->owner, 
> id3_priv_owner_audio_setup)) {
>

We do not put else conditions on a new line, not even to save on deletion
stats in patches.


> +ff_hls_read_audio_setup_info(audio_setup_info, priv->data, 
> priv->datasize);
> +}
>  } else if (!strcmp(meta->tag, "APIC") && apic)
>  *apic = &meta->data.apic;
>  }
> @@ -1076,7 +1088,7 @@ static void handle_id3(AVIOContext *pb, struct playlist 
> *pls)
>  ID3v2ExtraMeta *extra_meta = NULL;
>  int64_t timestamp = AV_NOPTS_VALUE;
>  
> -parse_id3(pls->ctx, pb, &metadata, ×tamp, &apic, &extra_meta);
> +parse_id3(pls->ctx, pb, &metadata, ×tamp, &pls->audio_setup_info, 
> &apic, &extra_meta);
>  
>  if (timestamp != AV_NOPTS_VALUE) {
>  pls->id3_mpegts_timestamp = timestamp;
> @@ -1230,10 +1242,7 @@ static int open_input(HLSContext *c, struct playlist 
> *pls, struct segment *seg,
>  av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset 
> %"PRId64", playlist %d\n",
>  seg->url, seg->url_offset, pls->index);
>  
> -if (seg->key_type == KEY_NONE) {
> -ret = open_url(pls->parent, in, seg->url, &c->avio_opts, opts, 
> &is_http);
> -} else if (seg->key_type == KEY_AES_128) {
> -char iv[33], key[33], url[MAX_URL_SIZE];
> +if (seg->key_type == KEY_AES_128 || seg->key_type == KEY_SAMPLE_AES) {
>  if (strcmp(seg->key, pls->key_url)) {
>  AVIO

Re: [FFmpeg-devel] [PATCH 20/39] avcodec/h261dec: Don't initialize unused part of RLTable

2021-01-21 Thread Andreas Rheinhardt
Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-12-10 12:16:38)
>> The H.261 decoder only uses an RLTable's VLC table, yet it also
>> initializes its index_run, max_level and max_run. This commit stops
>> doing so; it will also simplify making this decoder init-threadsafe,
>> as the H.261 decoder and encoder now initialize disjoint parts of their
>> common RLTable.
> 
> Does it then make sense to keep this RLTable common?
> 
I presume you want to know whether the RLTable structure should be split
into smaller structures?

To answer this question, let's examine what parts are used for each RLTable.

Initializing an RLTable's VLCs uses all three static tables (table_vlc,
table_run and table_level); initializing the rest only uses table_run
and table_level. get_rl_index (only used in encoders) uses index_run and
max_level, which is initialized by ff_rl_init).

ff_h261_rl_tcoeff:
The H.261 encoder uses table_vlc and get_rl_index (thereby also using
index_run and max_level); the H.261 decoder uses only the first VLC.
max_run is completely unused.

ff_rl_mpeg1/ff_rl_mpeg2:
Only the first VLC table is used by the various decoders using them; the
encoder uses max_level, index_run and table_vlc. max_run is unused.

ff_rl_speedhq:
The decoder uses the first VLC table; the encoder uses table_vlc as well
as max_level and index_run. max_run is unused.

ff_h263_rl_inter:
ituh263dec.c only uses the first VLC table; mpeg4videodec.c uses all the
VLC tables as well as max_run and max_level. ituh263enc.c uses
index_run, max_level as well as table_vlc. mpeg4videoenc.c uses
table_vlc, max_level, max_run as well as index_run.

ff_rl_intra_aic:
ituh263dec.c only uses the first VLC; ituh263enc uses table_vlc,
index_run, max_level. max_run is unused.

ff_rvlc_rl_intra/inter:
Only used in mpeg4videodec.c. For ff_rvlc_rl_intra, only the first VLC
is used; for ff_rvlc_rl_inter, all VLCs are potentially used. max_level,
max_run and index_run are completely unused (notice that I did not
remove the calls to ff_rl_init for these RLTables because I actually do
not have a sample to confirm that these are unused).

ff_rl_table
msmpeg4dec.c uses the VLCs (only the first VLC for 0..2) as well as
max_run and max_level; msmpeg4enc.c uses table_vlc, index_run, max_level
and max_run.

ff_mpeg4_rl_intra
mpeg4videodec.c uses the first VLC as well as max_run and max_level.
mpeg4videoenc.c uses table_vlc as well as index_run, max_level and max_run.

So seven of the ten RLTables (I am counting the ff_rl_tables as one)
don't use max_run at all; and seven of the ten RLTables (but not the
same seven) only use the first VLC. It is possible to remove rl_vlc from
RLTable and make it separate; the code in mpeg4videodec.c and
msmpeg4dec.c (the only places where VLCs other than the first are used)
are already compatible with this. Yet the other things belong together
in the same struct.

- Andreas

PS: It seems you overlooked patches 7-13.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/3] libavformat/hls: correct indentation

2021-01-21 Thread Nachiket Tarate
Signed-off-by: Nachiket Tarate 
---
 libavformat/hls.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 9e7f020cea..a2efa18b07 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2028,23 +2028,23 @@ static int hls_read_header(AVFormatContext *s)
 break;
 }
 } else {
-pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
-pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
s->max_analyze_duration : 4 * AV_TIME_BASE;
-pls->ctx->interrupt_callback = s->interrupt_callback;
-url = av_strdup(pls->segments[0]->url);
-ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0);
-if (ret < 0) {
-/* Free the ctx - it isn't initialized properly at this point,
- * so avformat_close_input shouldn't be called. If
- * avformat_open_input fails below, it frees and zeros the
- * context, so it doesn't need any special treatment like this. */
-av_log(s, AV_LOG_ERROR, "Error when loading first segment '%s'\n", 
url);
-avformat_free_context(pls->ctx);
-pls->ctx = NULL;
+pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
+pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
s->max_analyze_duration : 4 * AV_TIME_BASE;
+pls->ctx->interrupt_callback = s->interrupt_callback;
+url = av_strdup(pls->segments[0]->url);
+ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0);
+if (ret < 0) {
+/* Free the ctx - it isn't initialized properly at this point,
+* so avformat_close_input shouldn't be called. If
+* avformat_open_input fails below, it frees and zeros the
+* context, so it doesn't need any special treatment like this. 
*/
+av_log(s, AV_LOG_ERROR, "Error when loading first segment 
'%s'\n", url);
+avformat_free_context(pls->ctx);
+pls->ctx = NULL;
+av_free(url);
+goto fail;
+}
 av_free(url);
-goto fail;
-}
-av_free(url);
 }
 
 pls->ctx->pb   = &pls->pb;
@@ -2079,7 +2079,7 @@ static int hls_read_header(AVFormatContext *s)
 pls->ctx->nb_streams == 1) {
 ret = ff_hls_parse_audio_setup_info(pls->ctx->streams[0], 
&pls->audio_setup_info);
 } else {
-ret = avformat_find_stream_info(pls->ctx, NULL);
+ret = avformat_find_stream_info(pls->ctx, NULL);
 }
 if (ret < 0)
 goto fail;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/5] dnn: Delete unused global variable

2021-01-21 Thread Mark Thompson
---
 libavfilter/dnn/dnn_backend_native_layer_mathbinary.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c 
b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
index 998a75245c..fc48242093 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
@@ -28,7 +28,6 @@
 #include "dnn_backend_native_layer_mathbinary.h"
 
 typedef float (*FunType)(float src0, float src1);
-FunType pfun;
 
 static float sub(float src0, float src1)
 {
-- 
2.29.2

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/5] dnn: Add missing static to local variable

2021-01-21 Thread Mark Thompson
---
 libavfilter/dnn/dnn_backend_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index 5e7fc0f10c..ffb79dc000 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -36,7 +36,7 @@ static const AVOption dnn_native_options[] = {
 { NULL },
 };
 
-const AVClass dnn_native_class = {
+static const AVClass dnn_native_class = {
 .class_name = "dnn_native",
 .item_name  = av_default_item_name,
 .option = dnn_native_options,
-- 
2.29.2

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/5] libavfilter/dnn: add prefix ff_ for internal functions

2021-01-21 Thread Mark Thompson
From: "Guo, Yejun" 

from proc_from_frame_to_dnn to ff_proc_from_frame_to_dnn, and
from proc_from_dnn_to_frame to ff_proc_from_dnn_to_frame.

Signed-off-by: Guo, Yejun 
---
This was sent a few days ago to fix some of these issues, and is included here 
because it is needed for the test in 5/5 to pass.

 libavfilter/dnn/dnn_backend_native.c   | 4 ++--
 libavfilter/dnn/dnn_backend_openvino.c | 4 ++--
 libavfilter/dnn/dnn_backend_tf.c   | 4 ++--
 libavfilter/dnn/dnn_io_proc.c  | 4 ++--
 libavfilter/dnn/dnn_io_proc.h  | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index ffb79dc000..0094ec5444 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -320,7 +320,7 @@ static DNNReturnType execute_model_native(const DNNModel 
*model, const char *inp
 if (native_model->model->pre_proc != NULL) {
 native_model->model->pre_proc(in_frame, &input, 
native_model->model->filter_ctx);
 } else {
-proc_from_frame_to_dnn(in_frame, &input, ctx);
+ff_proc_from_frame_to_dnn(in_frame, &input, ctx);
 }
 }
 
@@ -368,7 +368,7 @@ static DNNReturnType execute_model_native(const DNNModel 
*model, const char *inp
 if (native_model->model->post_proc != NULL) {
 native_model->model->post_proc(out_frame, &output, 
native_model->model->filter_ctx);
 } else {
-proc_from_dnn_to_frame(out_frame, &output, ctx);
+ff_proc_from_dnn_to_frame(out_frame, &output, ctx);
 }
 } else {
 out_frame->width = output.width;
diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index 8a7abb33f0..d5b83cef97 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -160,7 +160,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, 
RequestItem *request
 if (ov_model->model->pre_proc != NULL) {
 ov_model->model->pre_proc(task->in_frame, &input, 
ov_model->model->filter_ctx);
 } else {
-proc_from_frame_to_dnn(task->in_frame, &input, ctx);
+ff_proc_from_frame_to_dnn(task->in_frame, &input, ctx);
 }
 }
 input.data = (uint8_t *)input.data
@@ -228,7 +228,7 @@ static void infer_completion_callback(void *args)
 if (task->ov_model->model->post_proc != NULL) {
 task->ov_model->model->post_proc(task->out_frame, &output, 
task->ov_model->model->filter_ctx);
 } else {
-proc_from_dnn_to_frame(task->out_frame, &output, ctx);
+ff_proc_from_dnn_to_frame(task->out_frame, &output, ctx);
 }
 } else {
 task->out_frame->width = output.width;
diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c
index b9fe01693b..81a55bfed5 100644
--- a/libavfilter/dnn/dnn_backend_tf.c
+++ b/libavfilter/dnn/dnn_backend_tf.c
@@ -743,7 +743,7 @@ static DNNReturnType execute_model_tf(const DNNModel 
*model, const char *input_n
 if (tf_model->model->pre_proc != NULL) {
 tf_model->model->pre_proc(in_frame, &input, 
tf_model->model->filter_ctx);
 } else {
-proc_from_frame_to_dnn(in_frame, &input, ctx);
+ff_proc_from_frame_to_dnn(in_frame, &input, ctx);
 }
 }
 
@@ -800,7 +800,7 @@ static DNNReturnType execute_model_tf(const DNNModel 
*model, const char *input_n
 if (tf_model->model->post_proc != NULL) {
 tf_model->model->post_proc(out_frame, &output, 
tf_model->model->filter_ctx);
 } else {
-proc_from_dnn_to_frame(out_frame, &output, ctx);
+ff_proc_from_dnn_to_frame(out_frame, &output, ctx);
 }
 } else {
 out_frame->width = output.width;
diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index 2744cb6502..3ed8a98a39 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -22,7 +22,7 @@
 #include "libavutil/imgutils.h"
 #include "libswscale/swscale.h"
 
-DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void 
*log_ctx)
+DNNReturnType ff_proc_from_dnn_to_frame(AVFrame *frame, DNNData *output, void 
*log_ctx)
 {
 struct SwsContext *sws_ctx;
 int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
@@ -93,7 +93,7 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData 
*output, void *log_
 return DNN_SUCCESS;
 }
 
-DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void 
*log_ctx)
+DNNReturnType ff_proc_from_frame_to_dnn(AVFrame *frame, DNNData *input, void 
*log_ctx)
 {
 struct SwsContext *sws_ctx;
 int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
diff -

[FFmpeg-devel] [PATCH 4/5] dnn: Add ff_ prefix to unnamespaced globals

2021-01-21 Thread Mark Thompson
---
 libavfilter/dnn/dnn_backend_native.c   | 10 +-
 libavfilter/dnn/dnn_backend_native.h   |  4 ++--
 .../dnn/dnn_backend_native_layer_avgpool.c |  8 
 .../dnn/dnn_backend_native_layer_avgpool.h |  6 +++---
 .../dnn/dnn_backend_native_layer_conv2d.c  |  8 
 .../dnn/dnn_backend_native_layer_conv2d.h  |  6 +++---
 .../dnn/dnn_backend_native_layer_dense.c   |  8 
 .../dnn/dnn_backend_native_layer_dense.h   |  6 +++---
 .../dnn/dnn_backend_native_layer_depth2space.c |  8 
 .../dnn/dnn_backend_native_layer_depth2space.h |  6 +++---
 .../dnn/dnn_backend_native_layer_mathbinary.c  | 12 ++--
 .../dnn/dnn_backend_native_layer_mathbinary.h  |  6 +++---
 .../dnn/dnn_backend_native_layer_mathunary.c   | 10 +-
 .../dnn/dnn_backend_native_layer_mathunary.h   |  6 +++---
 .../dnn/dnn_backend_native_layer_maximum.c | 10 +-
 .../dnn/dnn_backend_native_layer_maximum.h |  6 +++---
 libavfilter/dnn/dnn_backend_native_layer_pad.c |  8 
 libavfilter/dnn/dnn_backend_native_layer_pad.h |  6 +++---
 libavfilter/dnn/dnn_backend_native_layers.c| 18 +-
 libavfilter/dnn/dnn_backend_native_layers.h|  2 +-
 20 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index 0094ec5444..924f5a44ad 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -208,7 +208,7 @@ DNNModel *ff_dnn_load_model_native(const char 
*model_filename, const char *optio
 }
 
 native_model->layers[layer].type = layer_type;
-parsed_size = 
layer_funcs[layer_type].pf_load(&native_model->layers[layer], 
model_file_context, file_size, native_model->operands_num);
+parsed_size = 
ff_layer_funcs[layer_type].pf_load(&native_model->layers[layer], 
model_file_context, file_size, native_model->operands_num);
 if (!parsed_size) {
 goto fail;
 }
@@ -300,7 +300,7 @@ static DNNReturnType execute_model_native(const DNNModel 
*model, const char *inp
 oprd->dims[2] = in_frame->width;
 
 av_freep(&oprd->data);
-oprd->length = calculate_operand_data_length(oprd);
+oprd->length = ff_calculate_operand_data_length(oprd);
 if (oprd->length <= 0) {
 av_log(ctx, AV_LOG_ERROR, "The input data length overflow\n");
 return DNN_ERROR;
@@ -333,7 +333,7 @@ static DNNReturnType execute_model_native(const DNNModel 
*model, const char *inp
 
 for (layer = 0; layer < native_model->layers_num; ++layer){
 DNNLayerType layer_type = native_model->layers[layer].type;
-if (layer_funcs[layer_type].pf_exec(native_model->operands,
+if (ff_layer_funcs[layer_type].pf_exec(native_model->operands,
 
native_model->layers[layer].input_operand_indexes,
 
native_model->layers[layer].output_operand_index,
 native_model->layers[layer].params,
@@ -398,7 +398,7 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel 
*model, const char *inp
 return execute_model_native(model, input_name, in_frame, output_names, 
nb_output, out_frame, 1);
 }
 
-int32_t calculate_operand_dims_count(const DnnOperand *oprd)
+int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd)
 {
 int32_t result = 1;
 for (int i = 0; i < 4; ++i)
@@ -407,7 +407,7 @@ int32_t calculate_operand_dims_count(const DnnOperand *oprd)
 return result;
 }
 
-int32_t calculate_operand_data_length(const DnnOperand* oprd)
+int32_t ff_calculate_operand_data_length(const DnnOperand* oprd)
 {
 // currently, we just support DNN_FLOAT
 uint64_t len = sizeof(float);
diff --git a/libavfilter/dnn/dnn_backend_native.h 
b/libavfilter/dnn/dnn_backend_native.h
index 5acdbe0da7..5c8ce82b35 100644
--- a/libavfilter/dnn/dnn_backend_native.h
+++ b/libavfilter/dnn/dnn_backend_native.h
@@ -137,6 +137,6 @@ void ff_dnn_free_model_native(DNNModel **model);
 
 // NOTE: User must check for error (return value <= 0) to handle
 // case like integer overflow.
-int32_t calculate_operand_data_length(const DnnOperand *oprd);
-int32_t calculate_operand_dims_count(const DnnOperand *oprd);
+int32_t ff_calculate_operand_data_length(const DnnOperand *oprd);
+int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd);
 #endif
diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c 
b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
index 989006d797..8164bb45a6 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
@@ -26,7 +26,7 @@
 #include "libavutil/avassert.h"
 #include "dnn_backend_native_layer_avgpool.h"
 
-int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, int 
file_size, int operands_num)
+int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOC

[FFmpeg-devel] [PATCH 5/5] fate: Add test for namespace prefixes in libraries

2021-01-21 Thread Mark Thompson
Ensures that external symbols in the built static libraries either have
correct namespace prefixes or are on a known list of exceptions.
---
 tests/Makefile  |  1 +
 tests/fate/namespace.mak| 19 ++
 tests/fate/namespace.sh | 15 
 tests/ref/fate/namespace-avcodec|  0
 tests/ref/fate/namespace-avdevice   |  0
 tests/ref/fate/namespace-avfilter   |  0
 tests/ref/fate/namespace-avformat   |  0
 tests/ref/fate/namespace-avutil |  0
 tests/ref/fate/namespace-postproc   |  0
 tests/ref/fate/namespace-swresample |  0
 tests/ref/fate/namespace-swscale| 58 +
 11 files changed, 93 insertions(+)
 create mode 100644 tests/fate/namespace.mak
 create mode 100755 tests/fate/namespace.sh
 create mode 100644 tests/ref/fate/namespace-avcodec
 create mode 100644 tests/ref/fate/namespace-avdevice
 create mode 100644 tests/ref/fate/namespace-avfilter
 create mode 100644 tests/ref/fate/namespace-avformat
 create mode 100644 tests/ref/fate/namespace-avutil
 create mode 100644 tests/ref/fate/namespace-postproc
 create mode 100644 tests/ref/fate/namespace-swresample
 create mode 100644 tests/ref/fate/namespace-swscale

diff --git a/tests/Makefile b/tests/Makefile
index 7844901e53..94057eb81d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak
 include $(SRC_PATH)/tests/fate/mpegps.mak
 include $(SRC_PATH)/tests/fate/mpegts.mak
 include $(SRC_PATH)/tests/fate/mxf.mak
+include $(SRC_PATH)/tests/fate/namespace.mak
 include $(SRC_PATH)/tests/fate/opus.mak
 include $(SRC_PATH)/tests/fate/pcm.mak
 include $(SRC_PATH)/tests/fate/pixfmt.mak
diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
new file mode 100644
index 00..0021e7152d
--- /dev/null
+++ b/tests/fate/namespace.mak
@@ -0,0 +1,19 @@
+
+define FATE_NAMESPACE
+# (library_name, config_option)
+FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1)
+fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF)
+fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P 
lib$(1)/$(LIBPREF)$(1)$(LIBSUF)"
+endef
+
+$(eval $(call FATE_NAMESPACE,avutil, AVUTIL))
+$(eval $(call FATE_NAMESPACE,avcodec,AVCODEC))
+$(eval $(call FATE_NAMESPACE,avformat,   AVFORMAT))
+$(eval $(call FATE_NAMESPACE,avfilter,   AVFILTER))
+$(eval $(call FATE_NAMESPACE,avdevice,   AVDEVICE))
+$(eval $(call FATE_NAMESPACE,swscale,SWSCALE))
+$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE))
+$(eval $(call FATE_NAMESPACE,postproc,   POSTPROC))
+
+FATE += $(FATE_NAMESPACE-yes)
+fate-namespace: $(FATE_NAMESPACE-yes)
diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
new file mode 100755
index 00..bd3702d596
--- /dev/null
+++ b/tests/fate/namespace.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+$1 |
+   grep ' [TDB] ' | # Filter to all global text/data/bss symbols.
+   grep -v '^ff_' | # Internal-only globals.
+   grep -v '^av'  | # libav* external API.
+   grep -v '^sws' | # libswscale external API.
+   grep -v '^swr' | # libswresample external API.
+   grep -v '^\(postproc\|pp\)_' | # libpostproc external API.
+   grep -v '^\(ffio\|ffurl\)_'  | # libavformat internal ffio/ffurl APIs.
+   grep -v '^rgb2rgb_init_' | # libswscale arch-specific init function.
+   sed 's/ .*//'  | # Remove everything except the symbol name.
+   sort # Sort to allow deterministic comparison.
+
+exit 0
diff --git a/tests/ref/fate/namespace-avcodec b/tests/ref/fate/namespace-avcodec
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avdevice 
b/tests/ref/fate/namespace-avdevice
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avfilter 
b/tests/ref/fate/namespace-avfilter
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avformat 
b/tests/ref/fate/namespace-avformat
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avutil b/tests/ref/fate/namespace-avutil
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-postproc 
b/tests/ref/fate/namespace-postproc
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swresample 
b/tests/ref/fate/namespace-swresample
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swscale b/tests/ref/fate/namespace-swscale
new file mode 100644
index 00..a7aa4504ae
--- /dev/null
+++ b/tests/ref/fate/namespace-swscale
@@ -0,0 +1,58 @@
+deinterleaveBytes
+interleaveBytes
+planar2x
+rgb12to15
+rgb12tobgr12
+rgb15to16
+rgb15to24
+rgb15to32
+rgb15tobgr15
+rgb15tobgr16
+rgb15tobgr24
+rgb15tobgr32
+rgb16to15
+rgb16to24
+rgb16to32
+rgb16tobgr15
+rgb16tobgr16
+rgb16tobgr24
+rgb16tobgr32
+rgb24to15
+rgb24to16
+rgb24to32
+rgb24tobgr15
+rgb24tobgr16
+rgb24tobgr24
+rgb24tobgr32
+rgb32to15
+rgb32to16
+rgb32to24
+rgb32tobgr15
+rgb32tobgr16
+rgb32tobg

Re: [FFmpeg-devel] [PATCH 3/6] libavfilter/dnn: add prefix ff_ for internal functions

2021-01-21 Thread Mark Thompson

On 18/01/2021 12:52, Guo, Yejun wrote:

from proc_from_frame_to_dnn to ff_proc_from_frame_to_dnn, and
from proc_from_dnn_to_frame to ff_proc_from_dnn_to_frame.

Signed-off-by: Guo, Yejun 
---
  libavfilter/dnn/dnn_backend_native.c   | 4 ++--
  libavfilter/dnn/dnn_backend_openvino.c | 4 ++--
  libavfilter/dnn/dnn_backend_tf.c   | 4 ++--
  libavfilter/dnn/dnn_io_proc.c  | 4 ++--
  libavfilter/dnn/dnn_io_proc.h  | 4 ++--
  5 files changed, 10 insertions(+), 10 deletions(-)


LGTM.

I fixed some more of these and added a fate test to prevent it from happening again 
in .

Thanks,

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 7/7] avcodec/cri: check for available input in unpack_10bit()

2021-01-21 Thread Paul B Mahol
On Tue, Nov 10, 2020 at 12:15 AM Michael Niedermayer 
wrote:

> Fixes: Timeout (>20sec -> 56ms)
> Fixes:
> 26995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-5107217080254464
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> :
> Michael Niedermayer 
> ---
>  libavcodec/cri.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/cri.c b/libavcodec/cri.c
> index dafbc1f1be..9bcd2ebfc6 100644
> --- a/libavcodec/cri.c
> +++ b/libavcodec/cri.c
> @@ -80,10 +80,13 @@ static void unpack_10bit(GetByteContext *gb, uint16_t
> *dst, int shift,
>  int pos = 0;
>
>  while (count > 0) {
> -uint32_t a0 = bytestream2_get_le32(gb);
> -uint32_t a1 = bytestream2_get_le32(gb);
> -uint32_t a2 = bytestream2_get_le32(gb);
> -uint32_t a3 = bytestream2_get_le32(gb);
> +uint32_t a0, a1,a2,a3;
>

Why style issue is very bad here?


> +if (bytestream2_get_bytes_left(gb) < 4)
>

This should be 16, not 4.


> +break;
> +a0 = bytestream2_get_le32(gb);
> +a1 = bytestream2_get_le32(gb);
> +a2 = bytestream2_get_le32(gb);
> +a3 = bytestream2_get_le32(gb);
>  dst[pos] = (((a0 >> 1) & 0xE00) | (a0 & 0x1FF)) << shift;
>  pos++;
>  if (pos >= w) {
> --
> 2.17.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] vc2enc: Add missing static to local variables

2021-01-21 Thread Mark Thompson
---
Andreas noted that we should add 'R' to the set of symbol types in 5/5, which 
found this one as well.

 libavcodec/vc2enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index bab9d0f3d5..7bd2e4c2ab 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -423,7 +423,7 @@ static void encode_slice_params(VC2EncContext *s)
 }
 
 /* 1st idx = LL, second - vertical, third - horizontal, fourth - total */
-const uint8_t vc2_qm_col_tab[][4] = {
+static const uint8_t vc2_qm_col_tab[][4] = {
 {20,  9, 15,  4},
 { 0,  6,  6,  4},
 { 0,  3,  3,  5},
@@ -431,7 +431,7 @@ const uint8_t vc2_qm_col_tab[][4] = {
 { 0, 11, 10, 11}
 };
 
-const uint8_t vc2_qm_flat_tab[][4] = {
+static const uint8_t vc2_qm_flat_tab[][4] = {
 { 0,  0,  0,  0},
 { 0,  0,  0,  0},
 { 0,  0,  0,  0},
-- 
2.29.2

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavd/dshow: Add namespace prefix to global functions

2021-01-21 Thread Mark Thompson

On 25/06/2018 19:47, Mark Thompson wrote:

---
Not tested at all.

  libavdevice/dshow.c  | 6 +++---
  libavdevice/dshow_capture.h  | 4 ++--
  libavdevice/dshow_crossbar.c | 8 
  3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index de910c0994..6f613f31b0 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -509,7 +509,7 @@ end:
   * Pops up a user dialog allowing them to adjust properties for the given 
filter, if possible.
   */
  void
-dshow_show_filter_properties(IBaseFilter *device_filter, AVFormatContext 
*avctx) {
+ff_dshow_show_filter_properties(IBaseFilter *device_filter, AVFormatContext 
*avctx) {
  ISpecifyPropertyPages *property_pages = NULL;
  IUnknown *device_filter_iunknown = NULL;
  HRESULT hr;
@@ -581,7 +581,7 @@ dshow_cycle_pins(AVFormatContext *avctx, enum 
dshowDeviceType devtype,
  int should_show_properties = (devtype == VideoDevice) ? 
ctx->show_video_device_dialog : ctx->show_audio_device_dialog;
  
  if (should_show_properties)

-dshow_show_filter_properties(device_filter, avctx);
+ff_dshow_show_filter_properties(device_filter, avctx);
  
  r = IBaseFilter_EnumPins(device_filter, &pins);

  if (r != S_OK) {
@@ -886,7 +886,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
  goto error;
  }
  
-r = dshow_try_setup_crossbar_options(graph_builder2, device_filter, devtype, avctx);

+r = ff_dshow_try_setup_crossbar_options(graph_builder2, device_filter, 
devtype, avctx);
  
  if (r != S_OK) {

  av_log(avctx, AV_LOG_ERROR, "Could not setup CrossBar\n");
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 475d62ba99..79c004a87f 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -346,9 +346,9 @@ struct dshow_ctx {
  /*
   * CrossBar
   /
-HRESULT dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
+HRESULT ff_dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  IBaseFilter *device_filter, enum dshowDeviceType devtype, AVFormatContext 
*avctx);
  
-void dshow_show_filter_properties(IBaseFilter *pFilter, AVFormatContext *avctx);

+void ff_dshow_show_filter_properties(IBaseFilter *pFilter, AVFormatContext 
*avctx);
  
  #endif /* AVDEVICE_DSHOW_CAPTURE_H */

diff --git a/libavdevice/dshow_crossbar.c b/libavdevice/dshow_crossbar.c
index 95fb466f4e..2438683cde 100644
--- a/libavdevice/dshow_crossbar.c
+++ b/libavdevice/dshow_crossbar.c
@@ -137,7 +137,7 @@ setup_crossbar_options(IAMCrossbar *cross_bar, enum 
dshowDeviceType devtype, AVF
   * Given a fully constructed graph, check if there is a cross bar filter, and 
configure its pins if so.
   */
  HRESULT
-dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
+ff_dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
  IBaseFilter *device_filter, enum dshowDeviceType devtype, AVFormatContext 
*avctx)
  {
  struct dshow_ctx *ctx = avctx->priv_data;
@@ -163,7 +163,7 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  hr = IAMCrossbar_QueryInterface(cross_bar, &IID_IBaseFilter, (void **) 
&cross_bar_base_filter);
  if (hr != S_OK)
  goto end;
-dshow_show_filter_properties(cross_bar_base_filter, avctx);
+ff_dshow_show_filter_properties(cross_bar_base_filter, avctx);
  }
  
  if (devtype == VideoDevice && ctx->show_analog_tv_tuner_dialog) {

@@ -173,7 +173,7 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  hr = IAMCrossbar_QueryInterface(tv_tuner_filter, &IID_IBaseFilter, 
(void **) &tv_tuner_base_filter);
  if (hr != S_OK)
  goto end;
-dshow_show_filter_properties(tv_tuner_base_filter, avctx);
+ff_dshow_show_filter_properties(tv_tuner_base_filter, avctx);
  } else {
  av_log(avctx, AV_LOG_WARNING, "unable to find a tv tuner to display 
dialog for!");
  }
@@ -185,7 +185,7 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  hr = IAMCrossbar_QueryInterface(tv_audio_filter, &IID_IBaseFilter, 
(void **) &tv_audio_base_filter);
  if (hr != S_OK)
  goto end;
-dshow_show_filter_properties(tv_audio_base_filter, avctx);
+ff_dshow_show_filter_properties(tv_audio_base_filter, avctx);
  } else {
  av_log(avctx, AV_LOG_WARNING, "unable to find a tv audio tuner to 
display dialog for!");
  }



Ping.  (30 months is a good time to wait, right?)

- Mark
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ff

Re: [FFmpeg-devel] [PATCH 5/5] fate: Add test for namespace prefixes in libraries

2021-01-21 Thread James Almer

On 1/21/2021 6:39 PM, Mark Thompson wrote:

Ensures that external symbols in the built static libraries either have
correct namespace prefixes or are on a known list of exceptions.
---
  tests/Makefile  |  1 +
  tests/fate/namespace.mak| 19 ++
  tests/fate/namespace.sh | 15 
  tests/ref/fate/namespace-avcodec|  0
  tests/ref/fate/namespace-avdevice   |  0
  tests/ref/fate/namespace-avfilter   |  0
  tests/ref/fate/namespace-avformat   |  0
  tests/ref/fate/namespace-avutil |  0
  tests/ref/fate/namespace-postproc   |  0
  tests/ref/fate/namespace-swresample |  0
  tests/ref/fate/namespace-swscale| 58 +
  11 files changed, 93 insertions(+)
  create mode 100644 tests/fate/namespace.mak
  create mode 100755 tests/fate/namespace.sh
  create mode 100644 tests/ref/fate/namespace-avcodec
  create mode 100644 tests/ref/fate/namespace-avdevice
  create mode 100644 tests/ref/fate/namespace-avfilter
  create mode 100644 tests/ref/fate/namespace-avformat
  create mode 100644 tests/ref/fate/namespace-avutil
  create mode 100644 tests/ref/fate/namespace-postproc
  create mode 100644 tests/ref/fate/namespace-swresample
  create mode 100644 tests/ref/fate/namespace-swscale

diff --git a/tests/Makefile b/tests/Makefile
index 7844901e53..94057eb81d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak
  include $(SRC_PATH)/tests/fate/mpegps.mak
  include $(SRC_PATH)/tests/fate/mpegts.mak
  include $(SRC_PATH)/tests/fate/mxf.mak
+include $(SRC_PATH)/tests/fate/namespace.mak
  include $(SRC_PATH)/tests/fate/opus.mak
  include $(SRC_PATH)/tests/fate/pcm.mak
  include $(SRC_PATH)/tests/fate/pixfmt.mak
diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
new file mode 100644
index 00..0021e7152d
--- /dev/null
+++ b/tests/fate/namespace.mak
@@ -0,0 +1,19 @@
+
+define FATE_NAMESPACE
+# (library_name, config_option)
+FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1)
+fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF)
+fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P 
lib$(1)/$(LIBPREF)$(1)$(LIBSUF)"
+endef
+
+$(eval $(call FATE_NAMESPACE,avutil, AVUTIL))
+$(eval $(call FATE_NAMESPACE,avcodec,AVCODEC))
+$(eval $(call FATE_NAMESPACE,avformat,   AVFORMAT))
+$(eval $(call FATE_NAMESPACE,avfilter,   AVFILTER))
+$(eval $(call FATE_NAMESPACE,avdevice,   AVDEVICE))
+$(eval $(call FATE_NAMESPACE,swscale,SWSCALE))
+$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE))
+$(eval $(call FATE_NAMESPACE,postproc,   POSTPROC))
+
+FATE += $(FATE_NAMESPACE-yes)
+fate-namespace: $(FATE_NAMESPACE-yes)
diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
new file mode 100755
index 00..bd3702d596
--- /dev/null
+++ b/tests/fate/namespace.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+$1 |
+   grep ' [TDB] ' | # Filter to all global text/data/bss symbols.


Probably use git grep, like in source.mak


+   grep -v '^ff_' | # Internal-only globals.
+   grep -v '^av'  | # libav* external API.
+   grep -v '^sws' | # libswscale external API.
+   grep -v '^swr' | # libswresample external API.
+   grep -v '^\(postproc\|pp\)_' | # libpostproc external API.
+   grep -v '^\(ffio\|ffurl\)_'  | # libavformat internal ffio/ffurl APIs.
+   grep -v '^rgb2rgb_init_' | # libswscale arch-specific init function.
+   sed 's/ .*//'  | # Remove everything except the symbol name.
+   sort # Sort to allow deterministic comparison.
+
+exit 0
diff --git a/tests/ref/fate/namespace-avcodec b/tests/ref/fate/namespace-avcodec
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avdevice 
b/tests/ref/fate/namespace-avdevice
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avfilter 
b/tests/ref/fate/namespace-avfilter
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avformat 
b/tests/ref/fate/namespace-avformat
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-avutil b/tests/ref/fate/namespace-avutil
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-postproc 
b/tests/ref/fate/namespace-postproc
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swresample 
b/tests/ref/fate/namespace-swresample
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/ref/fate/namespace-swscale b/tests/ref/fate/namespace-swscale
new file mode 100644
index 00..a7aa4504ae
--- /dev/null
+++ b/tests/ref/fate/namespace-swscale
@@ -0,0 +1,58 @@
+deinterleaveBytes
+interleaveBytes
+planar2x
+rgb12to15
+rgb12tobgr12
+rgb15to16
+rgb15to24
+rgb15to32
+rgb15tobgr15
+rgb15tobgr16
+rgb15tobgr24
+rgb15tobgr32
+rgb16to15
+rgb16to24
+rgb16to32
+rgb16tobgr15
+rgb16tobgr16
+rgb16tobgr24
+rgb16tobgr32
+rgb24to15
+rgb24to16
+rgb24to32
+rgb24to

Re: [FFmpeg-devel] [PATCH] lavd/dshow: Add namespace prefix to global functions

2021-01-21 Thread James Almer

On 1/21/2021 7:52 PM, Mark Thompson wrote:

On 25/06/2018 19:47, Mark Thompson wrote:

---
Not tested at all.

  libavdevice/dshow.c  | 6 +++---
  libavdevice/dshow_capture.h  | 4 ++--
  libavdevice/dshow_crossbar.c | 8 
  3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index de910c0994..6f613f31b0 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -509,7 +509,7 @@ end:
   * Pops up a user dialog allowing them to adjust properties for the 
given filter, if possible.

   */
  void
-dshow_show_filter_properties(IBaseFilter *device_filter, 
AVFormatContext *avctx) {
+ff_dshow_show_filter_properties(IBaseFilter *device_filter, 
AVFormatContext *avctx) {

  ISpecifyPropertyPages *property_pages = NULL;
  IUnknown *device_filter_iunknown = NULL;
  HRESULT hr;
@@ -581,7 +581,7 @@ dshow_cycle_pins(AVFormatContext *avctx, enum 
dshowDeviceType devtype,
  int should_show_properties = (devtype == VideoDevice) ? 
ctx->show_video_device_dialog : ctx->show_audio_device_dialog;

  if (should_show_properties)
-    dshow_show_filter_properties(device_filter, avctx);
+    ff_dshow_show_filter_properties(device_filter, avctx);
  r = IBaseFilter_EnumPins(device_filter, &pins);
  if (r != S_OK) {
@@ -886,7 +886,7 @@ dshow_open_device(AVFormatContext *avctx, 
ICreateDevEnum *devenum,

  goto error;
  }
-    r = dshow_try_setup_crossbar_options(graph_builder2, 
device_filter, devtype, avctx);
+    r = ff_dshow_try_setup_crossbar_options(graph_builder2, 
device_filter, devtype, avctx);

  if (r != S_OK) {
  av_log(avctx, AV_LOG_ERROR, "Could not setup CrossBar\n");
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 475d62ba99..79c004a87f 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -346,9 +346,9 @@ struct dshow_ctx {
  
/* 


   * CrossBar
   
/ 

-HRESULT dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
+HRESULT ff_dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  IBaseFilter *device_filter, enum dshowDeviceType devtype, 
AVFormatContext *avctx);
-void dshow_show_filter_properties(IBaseFilter *pFilter, 
AVFormatContext *avctx);
+void ff_dshow_show_filter_properties(IBaseFilter *pFilter, 
AVFormatContext *avctx);

  #endif /* AVDEVICE_DSHOW_CAPTURE_H */
diff --git a/libavdevice/dshow_crossbar.c b/libavdevice/dshow_crossbar.c
index 95fb466f4e..2438683cde 100644
--- a/libavdevice/dshow_crossbar.c
+++ b/libavdevice/dshow_crossbar.c
@@ -137,7 +137,7 @@ setup_crossbar_options(IAMCrossbar *cross_bar, 
enum dshowDeviceType devtype, AVF
   * Given a fully constructed graph, check if there is a cross bar 
filter, and configure its pins if so.

   */
  HRESULT
-dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
+ff_dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 
*graph_builder2,
  IBaseFilter *device_filter, enum dshowDeviceType devtype, 
AVFormatContext *avctx)

  {
  struct dshow_ctx *ctx = avctx->priv_data;
@@ -163,7 +163,7 @@ 
dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
  hr = IAMCrossbar_QueryInterface(cross_bar, &IID_IBaseFilter, 
(void **) &cross_bar_base_filter);

  if (hr != S_OK)
  goto end;
-    dshow_show_filter_properties(cross_bar_base_filter, avctx);
+    ff_dshow_show_filter_properties(cross_bar_base_filter, avctx);
  }
  if (devtype == VideoDevice && ctx->show_analog_tv_tuner_dialog) {
@@ -173,7 +173,7 @@ 
dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
  hr = IAMCrossbar_QueryInterface(tv_tuner_filter, 
&IID_IBaseFilter, (void **) &tv_tuner_base_filter);

  if (hr != S_OK)
  goto end;
-    dshow_show_filter_properties(tv_tuner_base_filter, avctx);
+    ff_dshow_show_filter_properties(tv_tuner_base_filter, 
avctx);

  } else {
  av_log(avctx, AV_LOG_WARNING, "unable to find a tv tuner 
to display dialog for!");

  }
@@ -185,7 +185,7 @@ 
dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
  hr = IAMCrossbar_QueryInterface(tv_audio_filter, 
&IID_IBaseFilter, (void **) &tv_audio_base_filter);

  if (hr != S_OK)
  goto end;
-    dshow_show_filter_properties(tv_audio_base_filter, avctx);
+    ff_dshow_show_filter_properties(tv_audio_base_filter, 
avctx);

  } else {
  av_log(avctx, AV_LOG_WARNING, "unable to find a tv audio 
tuner to display dialog for!");

  }



Ping.  (30 months is a good time to wait, right?)


It just needed time to marinate, is all :p

Applied.
_

[FFmpeg-devel] [PATCH] avdevice/dshow: Add namespace prefix to the remaining global symbols

2021-01-21 Thread James Almer
Signed-off-by: James Almer 
---
 libavdevice/dshow.c|  18 +--
 libavdevice/dshow_capture.h| 226 ++---
 libavdevice/dshow_enummediatypes.c |  51 +++
 libavdevice/dshow_enumpins.c   |  62 
 libavdevice/dshow_filter.c | 119 +++
 libavdevice/dshow_pin.c| 225 +---
 6 files changed, 325 insertions(+), 376 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index d7f5bd7069..05c6bc13e0 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -87,13 +87,13 @@ dshow_read_close(AVFormatContext *s)
 }
 
 if (ctx->capture_pin[VideoDevice])
-libAVPin_Release(ctx->capture_pin[VideoDevice]);
+ff_dshow_pin_Release(ctx->capture_pin[VideoDevice]);
 if (ctx->capture_pin[AudioDevice])
-libAVPin_Release(ctx->capture_pin[AudioDevice]);
+ff_dshow_pin_Release(ctx->capture_pin[AudioDevice]);
 if (ctx->capture_filter[VideoDevice])
-libAVFilter_Release(ctx->capture_filter[VideoDevice]);
+ff_dshow_filter_Release(ctx->capture_filter[VideoDevice]);
 if (ctx->capture_filter[AudioDevice])
-libAVFilter_Release(ctx->capture_filter[AudioDevice]);
+ff_dshow_filter_Release(ctx->capture_filter[AudioDevice]);
 
 if (ctx->device_pin[VideoDevice])
 IPin_Release(ctx->device_pin[VideoDevice]);
@@ -731,8 +731,8 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 char *device_filter_unique_name = NULL;
 IGraphBuilder *graph = ctx->graph;
 IPin *device_pin = NULL;
-libAVPin *capture_pin = NULL;
-libAVFilter *capture_filter = NULL;
+DShowPin *capture_pin = NULL;
+DShowFilter *capture_filter = NULL;
 ICaptureGraphBuilder2 *graph_builder2 = NULL;
 int ret = AVERROR(EIO);
 int r;
@@ -807,7 +807,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 
 ctx->device_pin[devtype] = device_pin;
 
-capture_filter = libAVFilter_Create(avctx, callback, devtype);
+capture_filter = ff_dshow_filter_Create(avctx, callback, devtype);
 if (!capture_filter) {
 av_log(avctx, AV_LOG_ERROR, "Could not create grabber filter.\n");
 goto error;
@@ -863,7 +863,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 goto error;
 }
 
-libAVPin_AddRef(capture_filter->pin);
+ff_dshow_pin_AddRef(capture_filter->pin);
 capture_pin = capture_filter->pin;
 ctx->capture_pin[devtype] = capture_pin;
 
@@ -953,7 +953,7 @@ dshow_add_device(AVFormatContext *avctx,
 
 ctx->capture_filter[devtype]->stream_index = st->index;
 
-libAVPin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
+ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
 
 par = st->codecpar;
 if (devtype == VideoDevice) {
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 475d62ba99..8f770d42d5 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -68,20 +68,20 @@ enum dshowSourceFilterType {
 AudioSourceDevice = 1,
 };
 
-#define DECLARE_QUERYINTERFACE(class, ...)   \
-long WINAPI  \
-class##_QueryInterface(class *this, const GUID *riid, void **ppvObject)  \
+#define DECLARE_QUERYINTERFACE(prefix, class, ...)   \
+long \
+ff_dshow_##prefix##_QueryInterface(class *this, const GUID *riid, void 
**ppvObject) \
 {\
 struct GUIDoffset ifaces[] = __VA_ARGS__;\
 int i;   \
-dshowdebug(AV_STRINGIFY(class)"_QueryInterface(%p, %p, %p)\n", this, riid, 
ppvObject); \
+dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_QueryInterface(%p, %p, %p)\n", 
this, riid, ppvObject); \
 ff_printGUID(riid);  \
 if (!ppvObject)  \
 return E_POINTER;\
 for (i = 0; i < sizeof(ifaces)/sizeof(ifaces[0]); i++) { \
 if (IsEqualGUID(riid, ifaces[i].iid)) {  \
 void *obj = (void *) ((uint8_t *) this + ifaces[i].offset);  \
-class##_AddRef(this);\
+ff_dshow_##prefix##_AddRef(this);\
 dshowdebug("\tfound %d with offset %d\n", i, ifaces[i].offset);  \
 *ppvObject = (void *) obj;   \
 return S_OK; \
@@ -91,28 +91,28 @@ class##_QueryInterface(class 

[FFmpeg-devel] [PATCH] avformat/concatdec: add support for setting input options

2021-01-21 Thread Jan Ekström
This way protocol or format related options can be set for all
of the files opened during concatenation.
---
 libavformat/concatdec.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 6d5b9914f9..3c81d9fea6 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -66,6 +66,7 @@ typedef struct {
 ConcatMatchMode stream_match_mode;
 unsigned auto_convert;
 int segment_time_metadata;
+AVDictionary *input_options;
 } ConcatContext;
 
 static int concat_probe(const AVProbeData *probe)
@@ -329,6 +330,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
 {
 ConcatContext *cat = avf->priv_data;
 ConcatFile *file = &cat->files[fileno];
+AVDictionary *options = NULL;
 int ret;
 
 if (cat->avf)
@@ -344,12 +346,31 @@ static int open_file(AVFormatContext *avf, unsigned 
fileno)
 if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0)
 return ret;
 
-if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 ||
+if (cat->input_options &&
+(ret = av_dict_copy(&options, cat->input_options, 0) < 0))
+return ret;
+
+if ((ret = avformat_open_input(&cat->avf, file->url, NULL, &options)) < 0 
||
 (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) {
 av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url);
 avformat_close_input(&cat->avf);
+av_dict_free(&options);
 return ret;
 }
+
+if (av_dict_count(options)) {
+AVDictionaryEntry *en = NULL;
+
+while ((en = av_dict_get(options, "", en, AV_DICT_IGNORE_SUFFIX))) {
+av_log(avf, AV_LOG_WARNING,
+   "Option '%s' set to '%s' was ignored when opening %s "
+   "with the %s reader!\n",
+   en->key, en->value, file->url, cat->avf->iformat->name);
+}
+}
+
+av_dict_free(&options);
+
 cat->cur_file = file;
 file->start_time = !fileno ? 0 :
cat->files[fileno - 1].start_time +
@@ -764,6 +785,9 @@ static const AVOption options[] = {
   OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC },
 { "segment_time_metadata", "output file segment start time and duration as 
packet metadata",
   OFFSET(segment_time_metadata), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC },
+{ "input_options",
+  "set options for all opened inputs using a :-separated list of key=value 
pairs",
+  OFFSET(input_options), AV_OPT_TYPE_DICT, { .str = NULL }, 0, 0, DEC },
 { NULL }
 };
 
-- 
2.29.2

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/6] libavfilter/dnn: add prefix ff_ for internal functions

2021-01-21 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: 2021年1月22日 5:43
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 3/6] libavfilter/dnn: add prefix ff_ for
> internal functions
> 
> On 18/01/2021 12:52, Guo, Yejun wrote:
> > from proc_from_frame_to_dnn to ff_proc_from_frame_to_dnn, and from
> > proc_from_dnn_to_frame to ff_proc_from_dnn_to_frame.
> >
> > Signed-off-by: Guo, Yejun 
> > ---
> >   libavfilter/dnn/dnn_backend_native.c   | 4 ++--
> >   libavfilter/dnn/dnn_backend_openvino.c | 4 ++--
> >   libavfilter/dnn/dnn_backend_tf.c   | 4 ++--
> >   libavfilter/dnn/dnn_io_proc.c  | 4 ++--
> >   libavfilter/dnn/dnn_io_proc.h  | 4 ++--
> >   5 files changed, 10 insertions(+), 10 deletions(-)
> 
> LGTM.
> 
> I fixed some more of these and added a fate test to prevent it from happening
> again in
> 
> .

thanks, will push this patch set soon, and then back to the patch set with the 
fate test.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/5] dnn: Delete unused global variable

2021-01-21 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: 2021年1月22日 5:40
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 1/5] dnn: Delete unused global variable
> 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_mathbinary.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
> b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
> index 998a75245c..fc48242093 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
> @@ -28,7 +28,6 @@
>  #include "dnn_backend_native_layer_mathbinary.h"
> 
>  typedef float (*FunType)(float src0, float src1); -FunType pfun;
> 
>  static float sub(float src0, float src1)  {
> --
thanks, will change the title from dnn to 
dnn_backend_native_layer_mathbinary.c, and push soon
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/5] dnn: Add missing static to local variable

2021-01-21 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: 2021年1月22日 5:40
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 2/5] dnn: Add missing static to local variable
> 
> ---
>  libavfilter/dnn/dnn_backend_native.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 5e7fc0f10c..ffb79dc000 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -36,7 +36,7 @@ static const AVOption dnn_native_options[] = {
>  { NULL },
>  };
> 
> -const AVClass dnn_native_class = {
> +static const AVClass dnn_native_class = {
>  .class_name = "dnn_native",
>  .item_name  = av_default_item_name,
>  .option = dnn_native_options,
> --
There is a dependency of dnn_native_class in dnn-layer-conv2d-test.c, and it 
makes FATE failed.
Will send a new patch to remove that dependency, and push the two patches 
together soon.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] dnn-layer-conv2d-test.c: remove dependency of dnn_native_class

2021-01-21 Thread Guo, Yejun
---
 tests/dnn/dnn-layer-conv2d-test.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/dnn/dnn-layer-conv2d-test.c 
b/tests/dnn/dnn-layer-conv2d-test.c
index 378a05eafc..b623ddac0d 100644
--- a/tests/dnn/dnn-layer-conv2d-test.c
+++ b/tests/dnn/dnn-layer-conv2d-test.c
@@ -25,8 +25,6 @@
 
 #define EPSON 0.1
 
-extern const AVClass dnn_native_class;
-
 static int test_with_same_dilate(void)
 {
 // the input data and expected data are generated with below python code.
@@ -99,7 +97,7 @@ static int test_with_same_dilate(void)
 float bias[2] = { -1.6574852, -0.72915393 };
 
 NativeContext ctx;
-ctx.class = &dnn_native_class;
+ctx.class = NULL;
 ctx.options.conv2d_threads = 1;
 
 params.activation = TANH;
@@ -203,7 +201,7 @@ static int test_with_valid(void)
 float bias[2] = { -0.4773722, -0.19620377 };
 
 NativeContext ctx;
-ctx.class = &dnn_native_class;
+ctx.class = NULL;
 ctx.options.conv2d_threads = 1;
 
 params.activation = TANH;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] dnn_backend_native.c: Add missing static to local variable

2021-01-21 Thread Guo, Yejun
From: Mark Thompson 

---
 libavfilter/dnn/dnn_backend_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index 2c0b938839..be43081170 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -36,7 +36,7 @@ static const AVOption dnn_native_options[] = {
 { NULL },
 };
 
-const AVClass dnn_native_class = {
+static const AVClass dnn_native_class = {
 .class_name = "dnn_native",
 .item_name  = av_default_item_name,
 .option = dnn_native_options,
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avutils/vulkan: hwmap, respect src frame resolution

2021-01-21 Thread Lynne
Jan 21, 2021, 05:35 by guangxin...@intel.com:

> fixes http://trac.ffmpeg.org/ticket/9055
>
> The hw decoder may allocate a large frame from AVHWFramesContext, and adjust 
> width and height based on bitstream.
> We need to use resolution from src frame instead of AVHWFramesContext.
>
> test command:
> ffmpeg -loglevel debug -hide_banner -hwaccel vaapi -init_hw_device 
> vaapi=va:/dev/dri/renderD128 -hwaccel_device va -hwaccel_output_format vaapi 
> -init_hw_device vulkan=vulk -filter_hw_device vulk -i 1920x1080.264 -c:v 
> libx264 -r:v 30 -profile:v high -preset veryfast -vf 
> "hwmap,chromaber_vulkan=0:0,hwdownload,format=nv12" -map 0 -y vaapiouts.mkv
>
> expected:
> No green bar at bottom.
> ---
>  libavutil/hwcontext_vulkan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index d4ff4ae307..f6d0cae8ae 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -2009,7 +2009,7 @@ static inline VkFormat drm_to_vulkan_fmt(uint32_t 
> drm_fourcc)
>  }
>  
>  static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame 
> **frame,
> -  AVDRMFrameDescriptor *desc)
> +  const AVFrame *src, 
> AVDRMFrameDescriptor *desc)
>  {
>  int err = 0;
>  VkResult ret;
> @@ -2085,7 +2085,7 @@ static int 
> vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f
>  };
>  
>  get_plane_wh(&create_info.extent.width, &create_info.extent.height,
> - hwfc->sw_format, hwfc->width, hwfc->height, i);
> + hwfc->sw_format, src->width, src->height, i);
>  
>  for (int j = 0; j < planes; j++) {
>  plane_data[j].offset = desc->layers[i].planes[j].offset;
> @@ -2246,7 +2246,7 @@ static int vulkan_map_from_drm(AVHWFramesContext *hwfc, 
> AVFrame *dst,
>  AVVkFrame *f;
>  VulkanMapping *map = NULL;
>  
> -err = vulkan_map_from_drm_frame_desc(hwfc, &f,
> +err = vulkan_map_from_drm_frame_desc(hwfc, &f, src,
>  (AVDRMFrameDescriptor *)src->data[0]);
>  if (err)
>  return err;
>

Thanks, pushed with a small style nit.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avutils/vulkan: hwmap, respect src frame resolution

2021-01-21 Thread Xu, Guangxin


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Lynne
> Sent: Friday, January 22, 2021 11:37 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avutils/vulkan: hwmap, respect src
> frame resolution
> 
> Jan 21, 2021, 05:35 by guangxin...@intel.com:
> 
> > fixes http://trac.ffmpeg.org/ticket/9055
> >
> > The hw decoder may allocate a large frame from AVHWFramesContext,
> and adjust width and height based on bitstream.
> > We need to use resolution from src frame instead of AVHWFramesContext.
> >
> > test command:
> > ffmpeg -loglevel debug -hide_banner -hwaccel vaapi -init_hw_device
> > vaapi=va:/dev/dri/renderD128 -hwaccel_device va -
> hwaccel_output_format
> > vaapi -init_hw_device vulkan=vulk -filter_hw_device vulk -i
> > 1920x1080.264 -c:v libx264 -r:v 30 -profile:v high -preset veryfast
> > -vf "hwmap,chromaber_vulkan=0:0,hwdownload,format=nv12" -map 0 -y
> > vaapiouts.mkv
> >
> > expected:
> > No green bar at bottom.
> > ---
> >  libavutil/hwcontext_vulkan.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/hwcontext_vulkan.c
> > b/libavutil/hwcontext_vulkan.c index d4ff4ae307..f6d0cae8ae 100644
> > --- a/libavutil/hwcontext_vulkan.c
> > +++ b/libavutil/hwcontext_vulkan.c
> > @@ -2009,7 +2009,7 @@ static inline VkFormat
> > drm_to_vulkan_fmt(uint32_t drm_fourcc)  }
> >
> >  static int vulkan_map_from_drm_frame_desc(AVHWFramesContext
> *hwfc, AVVkFrame **frame,
> > -  AVDRMFrameDescriptor *desc)
> > +  const AVFrame *src,
> > + AVDRMFrameDescriptor *desc)
> >  {
> >  int err = 0;
> >  VkResult ret;
> > @@ -2085,7 +2085,7 @@ static int
> > vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc,
> AVVkFrame **f
> > };
> >
> >  get_plane_wh(&create_info.extent.width, &create_info.extent.height,
> > - hwfc->sw_format, hwfc->width, hwfc->height, i);
> > + hwfc->sw_format, src->width, src->height, i);
> >
> >  for (int j = 0; j < planes; j++) {
> >  plane_data[j].offset = desc->layers[i].planes[j].offset;
> > @@ -2246,7 +2246,7 @@ static int
> vulkan_map_from_drm(AVHWFramesContext
> > *hwfc, AVFrame *dst,  AVVkFrame *f;  VulkanMapping *map = NULL;
> >
> > -err = vulkan_map_from_drm_frame_desc(hwfc, &f,
> > +err = vulkan_map_from_drm_frame_desc(hwfc, &f, src,
> >  (AVDRMFrameDescriptor *)src->data[0]);  if (err)  return err;
> >
> 
> Thanks, pushed with a small style nit.
Great! thanks.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org
> with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] dnn_backend_native.c: Add missing static to local variable

2021-01-21 Thread Guo, Yejun


> -Original Message-
> From: Guo, Yejun 
> Sent: 2021年1月22日 10:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun 
> Subject: [PATCH 2/2] dnn_backend_native.c: Add missing static to local
> variable
> 
> From: Mark Thompson 
> 
> ---
>  libavfilter/dnn/dnn_backend_native.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 2c0b938839..be43081170 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -36,7 +36,7 @@ static const AVOption dnn_native_options[] = {
>  { NULL },
>  };
> 
> -const AVClass dnn_native_class = {
> +static const AVClass dnn_native_class = {
>  .class_name = "dnn_native",
>  .item_name  = av_default_item_name,
>  .option = dnn_native_options,
> --
patchwork passed, will push the two patches soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/5] dnn: Add ff_ prefix to unnamespaced globals

2021-01-21 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: 2021年1月22日 5:40
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 4/5] dnn: Add ff_ prefix to unnamespaced
> globals
> 
> ---
>  libavfilter/dnn/dnn_backend_native.c   | 10 +-
>  libavfilter/dnn/dnn_backend_native.h   |  4 ++--
>  .../dnn/dnn_backend_native_layer_avgpool.c |  8 
>  .../dnn/dnn_backend_native_layer_avgpool.h |  6 +++---
>  .../dnn/dnn_backend_native_layer_conv2d.c  |  8 
>  .../dnn/dnn_backend_native_layer_conv2d.h  |  6 +++---
>  .../dnn/dnn_backend_native_layer_dense.c   |  8 
>  .../dnn/dnn_backend_native_layer_dense.h   |  6 +++---
>  .../dnn/dnn_backend_native_layer_depth2space.c |  8
>   .../dnn/dnn_backend_native_layer_depth2space.h |  6
> +++---  .../dnn/dnn_backend_native_layer_mathbinary.c  | 12
> ++--  .../dnn/dnn_backend_native_layer_mathbinary.h  |  6 +++---
>  .../dnn/dnn_backend_native_layer_mathunary.c   | 10 +-
>  .../dnn/dnn_backend_native_layer_mathunary.h   |  6 +++---
>  .../dnn/dnn_backend_native_layer_maximum.c | 10 +-
>  .../dnn/dnn_backend_native_layer_maximum.h |  6 +++---
>  libavfilter/dnn/dnn_backend_native_layer_pad.c |  8 
> libavfilter/dnn/dnn_backend_native_layer_pad.h |  6 +++---
>  libavfilter/dnn/dnn_backend_native_layers.c| 18 +-
>  libavfilter/dnn/dnn_backend_native_layers.h|  2 +-
>  20 files changed, 77 insertions(+), 77 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 0094ec5444..924f5a44ad 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c

missed change in file tests/dnn/dnn-layer-*-test.c, will help to rebase, update 
test files, and push soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3] avformat/hls: change sequence number type to int64_t

2021-01-21 Thread zhilizhao(赵志立)
Ping for review.

> On Jan 16, 2021, at 11:40 AM, Zhao Zhili  wrote:
> 
> Fix atoi() overflow for large EXT-X-MEDIA-SEQUENCE.
> 
> The spec says the type of sequence number is uint64_t. Use int64_t
> here since current implementation requires it to be signed integer,
> and hlsenc use int64_t too.
> ---
> v3:
> handle MEDIA-SEQUENCE higher than INT64_MAX
> 
> v2:
> AV_WB32 -> AV_WB64
> 
> libavformat/hls.c | 56 +++
> 1 file changed, 32 insertions(+), 24 deletions(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 619e4800de..af2468ad9b 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -112,13 +112,13 @@ struct playlist {
> int finished;
> enum PlaylistType type;
> int64_t target_duration;
> -int start_seq_no;
> +int64_t start_seq_no;
> int n_segments;
> struct segment **segments;
> int needed;
> int broken;
> -int cur_seq_no;
> -int last_seq_no;
> +int64_t cur_seq_no;
> +int64_t last_seq_no;
> int m3u8_hold_counters;
> int64_t cur_seg_offset;
> int64_t last_load_time;
> @@ -199,7 +199,7 @@ typedef struct HLSContext {
> int n_renditions;
> struct rendition **renditions;
> 
> -int cur_seq_no;
> +int64_t cur_seq_no;
> int m3u8_hold_counters;
> int live_start_index;
> int first_packet;
> @@ -722,7 +722,7 @@ static int parse_playlist(HLSContext *c, const char *url,
> int is_http = av_strstart(url, "http", NULL);
> struct segment **prev_segments = NULL;
> int prev_n_segments = 0;
> -int prev_start_seq_no = -1;
> +int64_t prev_start_seq_no = -1;
> 
> if (is_http && !in && c->http_persistent && c->playlist_pb) {
> in = c->playlist_pb;
> @@ -808,10 +808,17 @@ static int parse_playlist(HLSContext *c, const char 
> *url,
> goto fail;
> pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE;
> } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
> +uint64_t seq_no;
> ret = ensure_playlist(c, &pls, url);
> if (ret < 0)
> goto fail;
> -pls->start_seq_no = atoi(ptr);
> +seq_no = strtoull(ptr, NULL, 10);
> +if (seq_no > INT64_MAX) {
> +av_log(c->ctx, AV_LOG_DEBUG, "MEDIA-SEQUENCE higher than "
> +"INT64_MAX, mask out the highest bit\n");
> +seq_no &= INT64_MAX;
> +}
> +pls->start_seq_no = seq_no;
> } else if (av_strstart(line, "#EXT-X-PLAYLIST-TYPE:", &ptr)) {
> ret = ensure_playlist(c, &pls, url);
> if (ret < 0)
> @@ -832,9 +839,9 @@ static int parse_playlist(HLSContext *c, const char *url,
> if (has_iv) {
> memcpy(cur_init_section->iv, iv, sizeof(iv));
> } else {
> -int seq = pls->start_seq_no + pls->n_segments;
> +int64_t seq = pls->start_seq_no + pls->n_segments;
> memset(cur_init_section->iv, 0, sizeof(cur_init_section->iv));
> -AV_WB32(cur_init_section->iv + 12, seq);
> +AV_WB64(cur_init_section->iv + 8, seq);
> }
> 
> if (key_type != KEY_NONE) {
> @@ -889,9 +896,9 @@ static int parse_playlist(HLSContext *c, const char *url,
> if (has_iv) {
> memcpy(seg->iv, iv, sizeof(iv));
> } else {
> -int seq = pls->start_seq_no + pls->n_segments;
> +int64_t seq = pls->start_seq_no + pls->n_segments;
> memset(seg->iv, 0, sizeof(seg->iv));
> -AV_WB32(seg->iv + 12, seq);
> +AV_WB64(seg->iv + 8, seq);
> }
> 
> if (key_type != KEY_NONE) {
> @@ -954,16 +961,17 @@ static int parse_playlist(HLSContext *c, const char 
> *url,
> if (prev_segments) {
> if (pls->start_seq_no > prev_start_seq_no && c->first_timestamp != 
> AV_NOPTS_VALUE) {
> int64_t prev_timestamp = c->first_timestamp;
> -int i, diff = pls->start_seq_no - prev_start_seq_no;
> +int i;
> +int64_t diff = pls->start_seq_no - prev_start_seq_no;
> for (i = 0; i < prev_n_segments && i < diff; i++) {
> c->first_timestamp += prev_segments[i]->duration;
> }
> -av_log(c->ctx, AV_LOG_DEBUG, "Media sequence change (%d -> %d)"
> +av_log(c->ctx, AV_LOG_DEBUG, "Media sequence change (%"PRId64" 
> -> %"PRId64")"
>" reflected in first_timestamp: %"PRId64" -> %"PRId64"\n",
>prev_start_seq_no, pls->start_seq_no,
>prev_timestamp, c->first_timestamp);
> } else if (pls->start_seq_no < prev_start_seq_no) {
> -av_log(c->ctx, AV_LOG_WARNING, "Media sequence changed 
> unexpectedly: %d -> %d\n",
> +av_log(c->ctx, AV_LOG_WARN