Re: [FFmpeg-devel] [PATCH v7 0/3] Fix mpeg1/2 stream copy

2020-01-31 Thread Gaullier Nicolas
>Envoyé : mercredi 15 janvier 2020 00:42
>À : ffmpeg-devel@ffmpeg.org
>Objet : [PATCH v7 0/3] Fix mpeg1/2 stream copy
>
>Modified with Anton feedback: no public amendment, the code from 
>add_coded_side_data() is now duplicated from existing one in ffmpeg.c, but it 
>is rather small.
>
>Nicolas Gaullier (3):
>  avformat/utils: Make find_stream_info get side data from codec context
>  avcodec/utils: Fix ff_add_cpb_side_data() add twice
>  avcodec/mpeg12dec: Add CPB coded side data
>
> libavcodec/mpeg12dec.c   |  7 +++
> libavcodec/utils.c   |  5 +
> libavformat/utils.c  | 18 ++
> tests/ref/fate/mxf-probe-d10 |  3 +++
> tests/ref/fate/ts-demux  |  2 +-
> 5 files changed, 34 insertions(+), 1 deletion(-)

I have not received any feedback yet on this latest version that does not 
affect the public API.
The 3 patches are still available in patchwork:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200114234213.3224-2-nicolas.gaullier@cji.paris/
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200114234213.3224-3-nicolas.gaullier@cji.paris/
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200114234213.3224-4-nicolas.gaullier@cji.paris/

I think it should be near to be approved, could someone take some time for this 
review ? Thank you.
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] [PATCH] avfilter/vf_ssim: improve precision

2020-01-31 Thread Paul B Mahol
Use doubles for accumulating floats.

Signed-off-by: Paul B Mahol 
---
 libavfilter/ssim.h|  2 +-
 libavfilter/vf_ssim.c | 18 +--
 libavfilter/x86/vf_ssim.asm   | 36 ++
 libavfilter/x86/vf_ssim_init.c|  2 +-
 tests/ref/fate/filter-refcmp-ssim-rgb | 44 +--
 tests/ref/fate/filter-refcmp-ssim-yuv | 26 
 6 files changed, 70 insertions(+), 58 deletions(-)

diff --git a/libavfilter/ssim.h b/libavfilter/ssim.h
index ac0395a22a..a6a41aabe6 100644
--- a/libavfilter/ssim.h
+++ b/libavfilter/ssim.h
@@ -28,7 +28,7 @@ typedef struct SSIMDSPContext {
 void (*ssim_4x4_line)(const uint8_t *buf, ptrdiff_t buf_stride,
   const uint8_t *ref, ptrdiff_t ref_stride,
   int (*sums)[4], int w);
-float (*ssim_end_line)(const int (*sum0)[4], const int (*sum1)[4], int w);
+double (*ssim_end_line)(const int (*sum0)[4], const int (*sum1)[4], int w);
 } SSIMDSPContext;
 
 void ff_ssim_init_x86(SSIMDSPContext *dsp);
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index c08fbcdcc2..17dce8e8e8 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -55,13 +55,13 @@ typedef struct SSIMContext {
 uint64_t nb_frames;
 double ssim[4], ssim_total;
 char comps[4];
-float coefs[4];
+double coefs[4];
 uint8_t rgba_map[4];
 int planewidth[4];
 int planeheight[4];
 int *temp;
 int is_rgb;
-float (*ssim_plane)(SSIMDSPContext *dsp,
+double (*ssim_plane)(SSIMDSPContext *dsp,
 uint8_t *main, int main_stride,
 uint8_t *ref, int ref_stride,
 int width, int height, void *temp,
@@ -206,9 +206,9 @@ static float ssim_endn_16bit(const int64_t (*sum0)[4], 
const int64_t (*sum1)[4],
 return ssim;
 }
 
-static float ssim_endn_8bit(const int (*sum0)[4], const int (*sum1)[4], int 
width)
+static double ssim_endn_8bit(const int (*sum0)[4], const int (*sum1)[4], int 
width)
 {
-float ssim = 0.0;
+double ssim = 0.0;
 int i;
 
 for (i = 0; i < width; i++)
@@ -221,14 +221,14 @@ static float ssim_endn_8bit(const int (*sum0)[4], const 
int (*sum1)[4], int widt
 
 #define SUM_LEN(w) (((w) >> 2) + 3)
 
-static float ssim_plane_16bit(SSIMDSPContext *dsp,
+static double ssim_plane_16bit(SSIMDSPContext *dsp,
   uint8_t *main, int main_stride,
   uint8_t *ref, int ref_stride,
   int width, int height, void *temp,
   int max)
 {
 int z = 0, y;
-float ssim = 0.0;
+double ssim = 0.0;
 int64_t (*sum0)[4] = temp;
 int64_t (*sum1)[4] = sum0 + SUM_LEN(width);
 
@@ -249,14 +249,14 @@ static float ssim_plane_16bit(SSIMDSPContext *dsp,
 return ssim / ((height - 1) * (width - 1));
 }
 
-static float ssim_plane(SSIMDSPContext *dsp,
+static double ssim_plane(SSIMDSPContext *dsp,
 uint8_t *main, int main_stride,
 uint8_t *ref, int ref_stride,
 int width, int height, void *temp,
 int max)
 {
 int z = 0, y;
-float ssim = 0.0;
+double ssim = 0.0;
 int (*sum0)[4] = temp;
 int (*sum1)[4] = sum0 + SUM_LEN(width);
 
@@ -288,7 +288,7 @@ static int do_ssim(FFFrameSync *fs)
 SSIMContext *s = ctx->priv;
 AVFrame *master, *ref;
 AVDictionary **metadata;
-float c[4], ssimv = 0.0;
+double c[4], ssimv = 0.0;
 int ret, i;
 
 ret = ff_framesync_dualinput_get(fs, &master, &ref);
diff --git a/libavfilter/x86/vf_ssim.asm b/libavfilter/x86/vf_ssim.asm
index 3293e66701..4cd6293b59 100644
--- a/libavfilter/x86/vf_ssim.asm
+++ b/libavfilter/x86/vf_ssim.asm
@@ -169,8 +169,9 @@ SSIM_4X4_LINE 8
 %endif
 
 INIT_XMM sse4
-cglobal ssim_end_line, 3, 3, 6, sum0, sum1, w
+cglobal ssim_end_line, 3, 3, 7, sum0, sum1, w
 pxor  m0, m0
+pxor  m6, m6
 .loop:
 mova  m1, [sum0q+mmsize*0]
 mova  m2, [sum0q+mmsize*1]
@@ -214,34 +215,45 @@ cglobal ssim_end_line, 3, 3, 6, sum0, sum1, w
 mulps m4, m5
 mulps m3, m1
 divps m4, m3; ssim_endl
-addps m0, m4; ssim
+mova  m5, m4
+cvtps2pd  m3, m5
+movhlps   m5, m5
+cvtps2pd  m5, m5
+addpd m0, m3; ssim
+addpd m6, m5; ssim
 addsum0q, mmsize*4
 addsum1q, mmsize*4
 sub   wd, 4
 jg .loop
 
-; subps the ones we added too much
+; subpd the ones we added too much
 test  wd, wd
 jz .end
 add   wd, 4
+test  wd, 3
+jz .skip3
 test  wd, 2
 jz .skip2
-psrldqm4,

Re: [FFmpeg-devel] [PATCH] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Nicolas George
Steven Liu (12020-01-31):
> Signed-off-by: Steven Liu 
> ---
>  libavformat/protocols.c | 2 ++
>  1 file changed, 2 insertions(+)

In what situation is it useful for the caller?

Regards,

-- 
  Nicolas George


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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Liu Steven


> 在 2020年1月31日,下午7:13,Nicolas George  写道:
> 
> Steven Liu (12020-01-31):
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/protocols.c | 2 ++
>> 1 file changed, 2 insertions(+)
> 
> In what situation is it useful for the caller?
for example: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=250
> 
> Regards,
> 
> -- 
>  Nicolas George
> ___
> 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".

Steven
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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Nicolas George
Liu Steven (12020-01-31):
> for example: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=250

Yes, I saw it shortly afterwards. Seems misguided: same result for a
protocol not found (normal behavior, must be handled) and for a clumsy
programmer. I like it better when the core functions are strict, unless
when there is a significant benefit.

Also, it is abusing an undocumented behavior.

Regards,

-- 
  Nicolas George


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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Liu Steven


> 在 2020年1月31日,下午8:07,Nicolas George  写道:
> 
> Liu Steven (12020-01-31):
>> for example: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=250
> 
> Yes, I saw it shortly afterwards. Seems misguided: same result for a
> protocol not found (normal behavior, must be handled) and for a clumsy
> programmer. I like it better when the core functions are strict, unless
> when there is a significant benefit.
> 
> Also, it is abusing an undocumented behavior.
Just more safe than without check.
I think if it return -EINVAL maybe better than NULL, is it?
> 
> Regards,
> 
> -- 
>  Nicolas George
> ___
> 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".

Steven
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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Liu Steven


> 在 2020年1月31日,下午8:14,Liu Steven  写道:
> 
> 
> 
>> 在 2020年1月31日,下午8:07,Nicolas George  写道:
>> 
>> Liu Steven (12020-01-31):
>>> for example: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=250
>> 
>> Yes, I saw it shortly afterwards. Seems misguided: same result for a
>> protocol not found (normal behavior, must be handled) and for a clumsy
>> programmer. I like it better when the core functions are strict, unless
>> when there is a significant benefit.
>> 
>> Also, it is abusing an undocumented behavior.
> Just more safe than without check.
> I think if it return -EINVAL maybe better than NULL, is it?
Ah, no, it should return AVClass *
>> 
>> Regards,
>> 
>> -- 
>> Nicolas George
>> ___
>> 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".
> 
> Steven
> Thanks
> 

Steven
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] avformat/hlsenc: fix hls_ts_options with mpegts

2020-01-31 Thread Steven Liu
Marton Balint  于2020年1月31日周五 上午4:40写道:
>
>
>
> On Wed, 22 Jan 2020, Marton Balint wrote:
>
> > Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b.
>
> Ping, will apply soon.
>
> Thanks,
> Marton
>
> >
> > Signed-off-by: Marton Balint 
> > ---
> > libavformat/hlsenc.c | 36 +---
> > 1 file changed, 17 insertions(+), 19 deletions(-)
> >
> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> > index 2b3d3742d9..87b861d437 100644
> > --- a/libavformat/hlsenc.c
> > +++ b/libavformat/hlsenc.c
> > @@ -764,6 +764,7 @@ static int hls_mux_init(AVFormatContext *s, 
> > VariantStream *vs)
> > AVFormatContext *oc;
> > AVFormatContext *vtt_oc = NULL;
> > int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
> > (hls->max_seg_size > 0);
> > +int remaining_options;
> > int i, ret;
> >
> > ret = avformat_alloc_output_context2(&vs->avf, vs->oformat, NULL, NULL);
> > @@ -852,21 +853,25 @@ static int hls_mux_init(AVFormatContext *s, 
> > VariantStream *vs)
> > return ret;
> > }
> >
> > +av_dict_copy(&options, hls->format_options, 0);
> > if (hls->segment_type == SEGMENT_TYPE_FMP4) {
> > -int remaining_options;
> > -
> > -av_dict_copy(&options, hls->format_options, 0);
> > av_dict_set(&options, "fflags", "-autobsf", 0);
> > av_dict_set(&options, "movflags", "+frag_custom+dash+delay_moov", 
> > AV_DICT_APPEND);
> > -ret = avformat_init_output(oc, &options);
> > -remaining_options = av_dict_count(options);
> > -av_dict_free(&options);
> > -if (ret < 0)
> > -return ret;
> > -if (remaining_options) {
> > -av_log(s, AV_LOG_ERROR, "Some of the provided format options 
> > are not recognized\n");
> > -return AVERROR(EINVAL);
> > -}
> > +} else {
> > +/* We only require one PAT/PMT per segment. */
> > +char period[21];
> > +snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
> > +av_dict_set(&options, "sdt_period", period, 0);
> > +av_dict_set(&options, "pat_period", period, 0);
> > +}
> > +ret = avformat_init_output(oc, &options);
> > +remaining_options = av_dict_count(options);
> > +av_dict_free(&options);
> > +if (ret < 0)
> > +return ret;
> > +if (remaining_options) {
> > +av_log(s, AV_LOG_ERROR, "Some of the provided format options are 
> > not recognized\n");
> > +return AVERROR(EINVAL);
> > }
> > avio_flush(oc->pb);
> > return 0;
> > @@ -1683,15 +1688,8 @@ static int hls_start(AVFormatContext *s, 
> > VariantStream *vs)
> > }
> > }
> > if (c->segment_type != SEGMENT_TYPE_FMP4) {
> > -/* We only require one PAT/PMT per segment. */
> > if (oc->oformat->priv_class && oc->priv_data) {
> > -char period[21];
> > -
> > -snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
> > -
> > av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
> > -av_opt_set(oc->priv_data, "sdt_period", period, 0);
> > -av_opt_set(oc->priv_data, "pat_period", period, 0);
> > }
> > if (c->flags & HLS_SINGLE_FILE) {
> > set_http_options(s, &options, c);
> > --
> > 2.16.4
> >
LGTM
> > ___
> > 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 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] lavc/dvdsubenc: accept palette from options

2020-01-31 Thread Michael Niedermayer
On Thu, Jan 30, 2020 at 07:40:53PM +0100, Michael Kuron wrote:
> Is there anything else you need me to change before this can be
> merged? If not, I am happy to split it into two patches if necessary.

spliting the patch would certainly be a good thing if noone has any
objections to the patch itself

thx

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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] dashenc: check pts to prevent division by zero error

2020-01-31 Thread Jeyapal, Karthick

On 1/30/20 3:28 PM, Alfred E. Heggestad wrote:
> this usecase will cause a division by zero trap:
>
> 1. dashenc has received one frame
> 2. os->max_pts and os->start_pts have same value
> 3. delta between max_pts and start_pts is 0
> 4. av_rescale_q(0, x, y) returns 0
> 5. this value is used as denominator in division
> 6. Bang! -> segfault
>
> this fix checks that max_pts > start_pts.
> the fix has been tested and works.
>
> please review and suggest better fixes.
>
> Signed-off-by: Alfred E. Heggestad 
> ---
>   libavformat/dashenc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index f555f208a7..3b651b9514 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1883,7 +1883,7 @@ static int dash_flush(AVFormatContext *s, int 
> final, int stream)
>  
> st->time_base,
>  
> AV_TIME_BASE_Q));
>
> -if (!os->muxer_overhead)
> +if (!os->muxer_overhead && os->max_pts > os->start_pts)
>   os->muxer_overhead = ((int64_t) (range_length - 
> os->total_pkt_size) *
> 8 * AV_TIME_BASE) /
>av_rescale_q(os->max_pts - os->start_pts,
LGTM.

This actually exposes a corner case bug in overhead calculation logic. 
Guess we will need to come up with a better logic for it.
Until then, this fix will atleast make sure things don’t crash.

Thanks,
Karthick

___
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] dashenc: check pts to prevent division by zero error

2020-01-31 Thread James Almer
On 1/31/2020 10:08 AM, Jeyapal, Karthick wrote:
> 
> On 1/30/20 3:28 PM, Alfred E. Heggestad wrote:
>> this usecase will cause a division by zero trap:
>>
>> 1. dashenc has received one frame
>> 2. os->max_pts and os->start_pts have same value
>> 3. delta between max_pts and start_pts is 0
>> 4. av_rescale_q(0, x, y) returns 0
>> 5. this value is used as denominator in division
>> 6. Bang! -> segfault
>>
>> this fix checks that max_pts > start_pts.
>> the fix has been tested and works.
>>
>> please review and suggest better fixes.
>>
>> Signed-off-by: Alfred E. Heggestad 
>> ---
>>   libavformat/dashenc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> index f555f208a7..3b651b9514 100644
>> --- a/libavformat/dashenc.c
>> +++ b/libavformat/dashenc.c
>> @@ -1883,7 +1883,7 @@ static int dash_flush(AVFormatContext *s, int 
>> final, int stream)
>>  
>> st->time_base,
>>  
>> AV_TIME_BASE_Q));
>>
>> -if (!os->muxer_overhead)
>> +if (!os->muxer_overhead && os->max_pts > os->start_pts)
>>   os->muxer_overhead = ((int64_t) (range_length - 
>> os->total_pkt_size) *
>> 8 * AV_TIME_BASE) /
>>av_rescale_q(os->max_pts - os->start_pts,
> LGTM.
> 
> This actually exposes a corner case bug in overhead calculation logic. 
> Guess we will need to come up with a better logic for it.
> Until then, this fix will atleast make sure things don’t crash.
> 
> Thanks,
> Karthick

Applied.
___
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 4/6] fftools/ffprobe: search for demuxer by extension as well

2020-01-31 Thread Gyan Doshi
Identifies demuxer based on extension if short name search fails.
---
 fftools/ffprobe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index b619c1f34e..a2886ec976 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3166,8 +3166,8 @@ static void ffprobe_show_pixel_formats(WriterContext *w)
 
 static int opt_format(void *optctx, const char *opt, const char *arg)
 {
-iformat = av_find_input_format(arg);
-if (!iformat) {
+if (!(iformat = av_find_input_format(arg)) &&
+!(iformat = av_demuxer_find_by_ext(arg))) {
 av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg);
 return AVERROR(EINVAL);
 }
-- 
2.24.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 3/6] fftools/ffmpeg: search for demuxer by extension as well

2020-01-31 Thread Gyan Doshi
Identifies demuxer based on extension if short name search fails.
---
 fftools/ffmpeg_opt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 12d44886ee..ecc7d8f1c5 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1026,7 +1026,8 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 }
 
 if (o->format) {
-if (!(file_iformat = av_find_input_format(o->format))) {
+if (!(file_iformat = av_find_input_format(o->format)) &&
+!(file_iformat = av_demuxer_find_by_ext(o->format))) {
 av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", 
o->format);
 exit_program(1);
 }
-- 
2.24.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/6] doc/APIchanges: add entry for av_demuxer_find_by_ext

2020-01-31 Thread Gyan Doshi
---
 doc/APIchanges | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 2494a3901b..e3db90d5fd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-01-31 - xx - lavf 58.38.100 - avformat.h
+  Add av_demuxer_find_by_ext().
+
 2020-01-30 - xx - lavf 58.37.100 - avio.h
   Add avio_protocol_get_class().
 
-- 
2.24.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/6] avformat/format: add av_demuxer_find_by_ext

2020-01-31 Thread Gyan Doshi
Allows selecting demuxer by extension which are more widely recognized
by users.

Conditional cast added since this function will usually be called after
av_find_input_format, and so matches its return type.
---
 libavformat/avformat.h |  5 +
 libavformat/format.c   | 15 +++
 libavformat/version.h  |  2 +-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9b9b634ec3..9172ddbc8a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2237,6 +2237,11 @@ int avformat_alloc_output_context2(AVFormatContext 
**ctx, ff_const59 AVOutputFor
  */
 ff_const59 AVInputFormat *av_find_input_format(const char *short_name);
 
+/**
+ * Find AVInputFormat based on an extension.
+ */
+const AVInputFormat *av_demuxer_find_by_ext(const char *extension);
+
 /**
  * Guess the file format.
  *
diff --git a/libavformat/format.c b/libavformat/format.c
index c47490c8eb..9dda6df676 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -125,6 +125,21 @@ ff_const59 AVInputFormat *av_find_input_format(const char 
*short_name)
 return NULL;
 }
 
+const AVInputFormat *av_demuxer_find_by_ext(const char *extension)
+{
+const AVInputFormat *fmt = NULL;
+void *i = 0;
+while ((fmt = av_demuxer_iterate(&i)))
+if (fmt->extensions && av_match_name(extension, fmt->extensions))
+#if FF_API_AVIOFORMAT
+return (AVInputFormat*)fmt;
+#else
+return fmt;
+#endif
+
+return NULL;
+}
+
 ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, 
int is_opened,
   int *score_ret)
 {
diff --git a/libavformat/version.h b/libavformat/version.h
index 15fdb73e3e..be22abc010 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  37
+#define LIBAVFORMAT_VERSION_MINOR  38
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.24.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 5/6] fftools/ffplay: search for demuxer by extension as well

2020-01-31 Thread Gyan Doshi
Identifies demuxer based on extension if short name search fails.
---
 fftools/ffplay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index fee0619f7c..4b5f46949c 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3477,8 +3477,8 @@ static int opt_height(void *optctx, const char *opt, 
const char *arg)
 
 static int opt_format(void *optctx, const char *opt, const char *arg)
 {
-file_iformat = av_find_input_format(arg);
-if (!file_iformat) {
+if (!(file_iformat = av_find_input_format(arg)) &&
+!(file_iformat = av_demuxer_find_by_ext(arg))) {
 av_log(NULL, AV_LOG_FATAL, "Unknown input format: %s\n", arg);
 return AVERROR(EINVAL);
 }
-- 
2.24.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 6/6] fftools/cmdutils: search for demuxer by extension as well

2020-01-31 Thread Gyan Doshi
Identifies demuxer based on extension if short name search fails.
---
 fftools/cmdutils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f0f2b4fde4..855a78e15f 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1854,9 +1854,10 @@ static void show_help_codec(const char *name, int 
encoder)
 
 static void show_help_demuxer(const char *name)
 {
-const AVInputFormat *fmt = av_find_input_format(name);
+const AVInputFormat *fmt;
 
-if (!fmt) {
+if (!(fmt = av_find_input_format(name)) &&
+!(fmt = av_demuxer_find_by_ext(name))) {
 av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
 return;
 }
-- 
2.24.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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Nicolas George
Liu Steven (12020-01-31):
> Just more safe than without check.

This is a mistake, a common one: this is not safer, it is less: the
caller has the incorrect assumption that their pointer is not NULL, and
you are letting them keep it, and even in some extents validating it.

> I think if it return -EINVAL maybe better than NULL, is it?

If it was possible (you accurately noticed that not), it would be
actually worse because it introduce a extra case for something that is
not supposed to happen in the first place.

Remember, FFmpeg is programmed in C, not Java or Python: when the
programmers do something stupid, like dividing by 0 or dereferencing
NULL, the program crashes: this is the correct behavior.

Unless there is a useful semantic to give to the NULL case, crashing
immediately is the right behavior. And saying the user "the protocol you
specified does not exist" when the issue is they did not specify a
protocol is not a useful semantic.

Regards,

-- 
  Nicolas George


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] lavfi: add mbfequalizer filter.

2020-01-31 Thread Paul B Mahol
On 12/23/19, Nicolas George  wrote:
> Thanks for the comment.
>
> James Almer (12019-12-23):
>> > +frame_out = ff_get_audio_buffer(ctx->outputs[0],
>> > frame->nb_samples);
>
>> Can't you use av_frame_make_writable() instead to simplify this?
>
> No, because it does not use ff_get_audio_buffer(), and therefore does
> not allow direct rendering. Also, it unnecessarily copies the data. I
> have already noted that this is a frequent pattern in filters that
> should be factored soon.
>

I do not get it. Which filters are affected by this?

> Regards,
>
> --
>   Nicolas George
>
___
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] lavfi: add mbfequalizer filter.

2020-01-31 Thread Paul B Mahol
On 12/23/19, Nicolas George  wrote:
> TODO changelog and version bump
>
> Signed-off-by: Nicolas George 
> ---
>  doc/filters.texi  |  48 +++
>  libavfilter/Makefile  |   1 +
>  libavfilter/af_mbfequalizer.c | 567 ++
>  libavfilter/allfilters.c  |   1 +
>  4 files changed, 617 insertions(+)
>  create mode 100644 libavfilter/af_mbfequalizer.c
>
>
> I think I'll rewrite the bands parser to allow per-channel options and make
> the structure of the code clearer. But I can already send the whole patch
> for your consideration.
>
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 8c5d3a5760..c6917fad38 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -4383,6 +4383,54 @@
> lv2=p=http://www.openavproductions.com/artyfx#bitta:c=crush=0.3
>  @end example
>  @end itemize
>
> +@section mbfequalizer
> +Multiband fast equalizer.
> +
> +As an equalizer, it allows to selectively alter the volume of the different
> +frequencies in the audio signal. This particular equalizer does not allow a
> +very sharp separation of the frequencies, but that gives it other
> +advantages. It is rather fast. It does not add latency. It supports all
> +sample formats, and for integer formats it uses bit-exact integer
> +arithmetic.
> +
> +It accepts the following parameters:
> +
> +@table @option
> +@item defs
> +Definition of bands and gain. The syntax is:
> +"gain/freq/gain[/freq/gain...][|gain/freq/gain...]"
> +where @var{freq} is the cut frequency between bands and @var{gain} the
> +associated gain.
> +Gain and bands for several channels can be defined by separating them with
> +the pipe "|" character; if only one definition is given, it is used for all
> +channels; otherwise, the number of definitions must match the number of
> +input channels.
> +Frequencies should be in ascending order. Gain greater than 1 or negative
> +may result in overflows and ugly noise or other strange results.
> +
> +@item global_gain
> +Gain applied to all channels and all bands. Can be greater than 1 without
> +risk; in case of overflow, soft clipping is applied.
> +
> +@item keep_all_bands
> +By default, bands beyond @var{sample_rate}/4 are discarded. If this option
> +is enabled, they are kept; it can result in strange effects.
> +@end table
> +
> +A Gnuplot formula mapping the frequency to the gain is printed at verbose
> +log level. It can be used to check the result, proably with
> +"set logscale x; db(x) = 20*log(x)/log(10); plot [20:2000] db(...)".
> +
> +@subsection Examples
> +
> +Assuming 3.1 input, reduce high frequencies on left and right, keep a
> narrow
> +band on center and dampen bass on LFE. All gains were lowered by 5dB, then
> +raised again using global gain, and the -2.8dB for the middle band was
> found
> +by looking at the graph.
> +@example
> +mbfequalizer=-5dB/7040/-15dB|-5dB/7040/-15dB|0/220/-2.8dB/880/0|-10dB/110/-5dB:global_gain=+5dB
> +@end example
> +
>  @section mcompand
>  Multiband Compress or expand the audio's dynamic range.
>
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 37d4eee858..f5690a50db 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -124,6 +124,7 @@ OBJS-$(CONFIG_LOWPASS_FILTER)+=
> af_biquads.o
>  OBJS-$(CONFIG_LOWSHELF_FILTER)   += af_biquads.o
>  OBJS-$(CONFIG_LV2_FILTER)+= af_lv2.o
>  OBJS-$(CONFIG_MCOMPAND_FILTER)   += af_mcompand.o
> +OBJS-$(CONFIG_MBFEQUALIZER_FILTER)   += af_mbfequalizer.o
>  OBJS-$(CONFIG_PAN_FILTER)+= af_pan.o
>  OBJS-$(CONFIG_REPLAYGAIN_FILTER) += af_replaygain.o
>  OBJS-$(CONFIG_RESAMPLE_FILTER)   += af_resample.o
> diff --git a/libavfilter/af_mbfequalizer.c b/libavfilter/af_mbfequalizer.c
> new file mode 100644
> index 00..aadd3cb3da
> --- /dev/null
> +++ b/libavfilter/af_mbfequalizer.c
> @@ -0,0 +1,567 @@
> +/*
> + * Copyright (c) 2019 Nicolas George 
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public License
> + * as published by the Free Software Foundation; either version 2.1 of the
> + * License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +/*
> + * Low-pass-high-pass equalizer using a simple sliding weighed average.
> + *
> + * Input signal: u(t)
> + * Low freqs:a(t)
> + * High freqs:   b(t)
> + *
> + * a(t) = (1-k) a(t-

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/avdct: Clear IDCTDSPContext context

2020-01-31 Thread James Almer
On 1/28/2020 10:30 AM, Michael Niedermayer wrote:
> On Mon, Jan 27, 2020 at 11:49:49PM -0300, James Almer wrote:
>> On 1/27/2020 9:25 PM, Michael Niedermayer wrote:
>>> On Mon, Jan 27, 2020 at 06:09:28PM -0300, James Almer wrote:
 On 1/27/2020 5:54 PM, Michael Niedermayer wrote:
> Fixes use of uninitialized variable and segfault
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avdct.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c
> index 47e5f7134e..7c761cf39a 100644
> --- a/libavcodec/avdct.c
> +++ b/libavcodec/avdct.c
> @@ -100,7 +100,7 @@ int avcodec_dct_init(AVDCT *dsp)
>  
>  #if CONFIG_IDCTDSP
>  {
> -IDCTDSPContext idsp;
> +IDCTDSPContext idsp = {0};

 Should probably be a memset() in ff_idctdsp_init(). This is not the only
 IDCTDSPContext user.
>>>
>>> this would not work as IDCTDSPContext.mpeg4_studio_profile must be 
>>> initialized but it is also an input to ff_idctdsp_init()
>>>
>>> an alternative to the = {0} on the caller side would be to
>>> simply add the mpeg4_studio_profile as an argument to ff_idctdsp_init()
>>> and remove it from the context, its all just internal API so we can
>>> easily redesign this. It should also be documented better ...
>>>
>>> What do you suggest ?
>>
>> memset(c, 0, offsetof(IDCTDSPContext, mpeg4_studio_profile)) in
>> ff_idctdsp_init() should workaround that without the need to add new
>> parameters. Just document that mpeg4_studio_profile must be at the end
>> of the struct, and be the first field of all those that must be
>> initialized before a call to ff_idctdsp_init(), in case new ones are
>> added in the future for whatever reason.
> 
> The memset() suggested in ff_idctdsp_init() would make no difference
> as the function already sets all fields which are not an input.
> This would reduce the suggestion to setting mpeg4_studio_profile
> in the ?single? caller which does not memset(0) the context prior.
> 
> That leaves 3 suggestions
> A. "-IDCTDSPContext idsp;"
> A. "+IDCTDSPContext idsp = {0};" (for one caller)
> 
> B. "+idsp.mpeg4_studio_profile = 0;" (for one caller)
> 
> C. "-ff_idctdsp_init();"   
> C. "+ff_idctdsp_init(0);"(for all callers)
> 
> In all cases ff_idctdsp_init() also probably should be documented.
> 
> What do you prefer ?

In that case just go with A, your original patch.

> 
> thx
> 
> [...]
> 
> 
> ___
> 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 v3] lavc/qsv: adding DX11 support

2020-01-31 Thread Artem Galin
This enables DX11 support for QSV with higher priority than DX9.
In case of multiple GPUs configuration, DX9 API does not allow to get
access to QSV device in some cases - headless.
Implementation based on DX11 resolves that restriction by enumerating list of 
available GPUs and finding device with QSV support.

Signed-off-by: Artem Galin 
---
 libavcodec/qsv.c  |  38 
 libavcodec/qsv_internal.h |   5 ++
 libavcodec/version.h  |   2 +-
 libavfilter/qsvvpp.c  |  19 +---
 libavutil/hwcontext_d3d11va.c |  55 +++-
 libavutil/hwcontext_qsv.c | 160 +-
 libavutil/hwcontext_qsv.h |  11 ++-
 libavutil/version.h   |   2 +-
 8 files changed, 232 insertions(+), 60 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index db98c75073..df622d9c7d 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -362,7 +362,11 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
  const char *load_plugins, int gpu_copy)
 {
+#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
 mfxIMPL  impl = MFX_IMPL_AUTO_ANY;
+#else
+mfxIMPL  impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
+#endif
 mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
 mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };
 
@@ -452,6 +456,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef 
*hw_frames_ref)
 for (i = 0; i < nb_surfaces; i++) {
 QSVMid *mid = &mids[i];
 mid->handle= frames_hwctx->surfaces[i].Data.MemId;
+mid->texture   = frames_hwctx->texture;
 mid->hw_frames_ref = hw_frames_ref1;
 }
 
@@ -661,7 +666,13 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId 
mid, mfxFrameData *ptr)
 static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 {
 QSVMid *qsv_mid = (QSVMid*)mid;
-*hdl = qsv_mid->handle;
+if (qsv_mid->texture) {
+mfxHDLPair *pair  =  (mfxHDLPair*)hdl;
+pair->first  = qsv_mid->texture;
+pair->second = qsv_mid->handle;
+} else {
+*hdl = qsv_mid->handle;
+}
 return MFX_ERR_NONE;
 }
 
@@ -669,14 +680,10 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
AVBufferRef *device_ref, const char 
*load_plugins,
int gpu_copy)
 {
-static const mfxHandleType handle_types[] = {
-MFX_HANDLE_VA_DISPLAY,
-MFX_HANDLE_D3D9_DEVICE_MANAGER,
-MFX_HANDLE_D3D11_DEVICE,
-};
 AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data;
 AVQSVDeviceContext *device_hwctx = device_ctx->hwctx;
 mfxSessionparent_session = device_hwctx->session;
+mfxHandleType parent_handle_type = device_hwctx->handle_type;
 mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY };
 mfxHDLhandle = NULL;
 
@@ -686,7 +693,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 mfxHandleType handle_type;
 mfxStatus err;
 
-int i, ret;
+int ret;
 
 err = MFXQueryIMPL(parent_session, &impl);
 if (err == MFX_ERR_NONE)
@@ -695,17 +702,12 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 return ff_qsv_print_error(avctx, err,
   "Error querying the session attributes");
 
-for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) {
-err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], &handle);
-if (err == MFX_ERR_NONE) {
-handle_type = handle_types[i];
-break;
-}
-handle = NULL;
-}
-if (!handle) {
-av_log(avctx, AV_LOG_VERBOSE, "No supported hw handle could be 
retrieved "
-   "from the session\n");
+err = MFXVideoCORE_GetHandle(parent_session, parent_handle_type, &handle);
+if (err == MFX_ERR_NONE) {
+handle_type = parent_handle_type;
+} else {
+return ff_qsv_print_error(avctx, err,
+"Error no supported hw handle could be retrieved from the 
session");
 }
 
 #if QSV_VERSION_ATLEAST(1, 16)
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 6489836a67..c985f227ec 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -65,6 +65,11 @@ typedef struct QSVMid {
 AVFrame *locked_frame;
 AVFrame *hw_frame;
 mfxFrameSurface1 surf;
+/**
+ * ID3D11Texture2D texture in which the frame is located for D3D11VA 
device. 
+ * Null in case of DXVA2 device.
+ */
+void *texture;
 } QSVMid;
 
 typedef struct QSVFrame {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6cf333eeb6..2fba26e8d0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 

Re: [FFmpeg-devel] [PATCH] dashenc: check pts to prevent division by zero error

2020-01-31 Thread Alfred E. Heggestad



On 31/01/2020 14:17, James Almer wrote:

On 1/31/2020 10:08 AM, Jeyapal, Karthick wrote:


On 1/30/20 3:28 PM, Alfred E. Heggestad wrote:

this usecase will cause a division by zero trap:

1. dashenc has received one frame
2. os->max_pts and os->start_pts have same value
3. delta between max_pts and start_pts is 0
4. av_rescale_q(0, x, y) returns 0
5. this value is used as denominator in division
6. Bang! -> segfault

this fix checks that max_pts > start_pts.
the fix has been tested and works.

please review and suggest better fixes.

Signed-off-by: Alfred E. Heggestad 
---
   libavformat/dashenc.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f555f208a7..3b651b9514 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1883,7 +1883,7 @@ static int dash_flush(AVFormatContext *s, int
final, int stream)
  
st->time_base,
  
AV_TIME_BASE_Q));


-if (!os->muxer_overhead)
+if (!os->muxer_overhead && os->max_pts > os->start_pts)
   os->muxer_overhead = ((int64_t) (range_length -
os->total_pkt_size) *
 8 * AV_TIME_BASE) /
av_rescale_q(os->max_pts - os->start_pts,

LGTM.

This actually exposes a corner case bug in overhead calculation logic.
Guess we will need to come up with a better logic for it.
Until then, this fix will atleast make sure things don’t crash.

Thanks,
Karthick


Applied.


Great!

Thanks Jeyapal and James.



/alfred

___
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] fftools/ffmpeg: search for demuxer by extension as well

2020-01-31 Thread Andreas Rheinhardt
Gyan Doshi:
> Identifies demuxer based on extension if short name search fails.
> ---
>  fftools/ffmpeg_opt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 12d44886ee..ecc7d8f1c5 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -1026,7 +1026,8 @@ static int open_input_file(OptionsContext *o, const 
> char *filename)
>  }
>  
>  if (o->format) {
> -if (!(file_iformat = av_find_input_format(o->format))) {
> +if (!(file_iformat = av_find_input_format(o->format)) &&
> +!(file_iformat = av_demuxer_find_by_ext(o->format))) {
>  av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", 
> o->format);
>  exit_program(1);
>  }
> 
This discards the const qualifier. You should get a warning for this.
But looking at this a bit more made me realize that a library user
that does not want to wait with const-correctness until the next major
version bump can't do so (without casts, that is):
avformat_open_input() does not accept a const AVInputFormat yet. Maybe
it would have been better to already accept it now (which means that
one has to cast a const away inside avformat_open_input() until the
next major bump)?

Furthermore, adding const will likely also lead to const-warnings wrt
av_opt_find(). This is bad and will need to be dealt with before the
next major bump. Maybe one should add versions of av_opt_find[2] that
accepts a const void* (this seems to be more of a problem for
av_opt_find2 because of its target_obj)?

- Andreas
___
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] fftools/ffmpeg: search for demuxer by extension as well

2020-01-31 Thread Gyan Doshi



On 31-01-2020 11:17 pm, Andreas Rheinhardt wrote:

Gyan Doshi:

Identifies demuxer based on extension if short name search fails.
---
  fftools/ffmpeg_opt.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 12d44886ee..ecc7d8f1c5 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1026,7 +1026,8 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
  }
  
  if (o->format) {

-if (!(file_iformat = av_find_input_format(o->format))) {
+if (!(file_iformat = av_find_input_format(o->format)) &&
+!(file_iformat = av_demuxer_find_by_ext(o->format))) {
  av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", 
o->format);
  exit_program(1);
  }


This discards the const qualifier. You should get a warning for this.
I do. I thought of adding the cast in the user calls. But I think the 
better way around is to do what I did originally, use ff_const59 with 
the return cast.

And remove that cast post-bump.


But looking at this a bit more made me realize that a library user
that does not want to wait with const-correctness until the next major
version bump can't do so (without casts, that is):
avformat_open_input() does not accept a const AVInputFormat yet. Maybe
it would have been better to already accept it now (which means that
one has to cast a const away inside avformat_open_input() until the
next major bump)?

Furthermore, adding const will likely also lead to const-warnings wrt
av_opt_find(). This is bad and will need to be dealt with before the
next major bump. Maybe one should add versions of av_opt_find[2] that
accepts a const void* (this seems to be more of a problem for
av_opt_find2 because of its target_obj)?

- Andreas
___
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 v2] avfilter/scale: fix CID 1457833

2020-01-31 Thread Michael Niedermayer
On Fri, Jan 31, 2020 at 12:46:13PM +0530, Gyan Doshi wrote:
> Remove expressions with constant results and
> improve overflow checks.
> ---
>  libavfilter/vf_scale.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 0348f19d33..b6c6414258 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -497,10 +497,8 @@ static int config_props(AVFilterLink *outlink)
> scale->force_original_aspect_ratio,
> scale->force_divisible_by);
>  
> -if (scale->w > INT_MAX ||
> -scale->h > INT_MAX ||
> -(scale->h * inlink->w) > INT_MAX ||
> -(scale->w * inlink->h) > INT_MAX)
> +if ((scale->h > INT_MAX / inlink->w) ||
> +(scale->w > INT_MAX / inlink->h))
>  av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too 
> big.\n");

taking a very quick look at the history it seemed the w / h values where
originally int64_t

more specifically, av_rescale() produces int64_t and simply storing that
in int might introduce a truncation of the results so there are maybe
checks missing elsewhere since the variables changed to int

Thanks

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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 1/6] avformat/format: add av_demuxer_find_by_ext

2020-01-31 Thread Andreas Rheinhardt
Gyan Doshi:
> Allows selecting demuxer by extension which are more widely recognized
> by users.
> 
> Conditional cast added since this function will usually be called after
> av_find_input_format, and so matches its return type.

That's not a good point. av_demuxer_find_by_ext() already always
returns const AVInputFormat *, so you casting the const away when
returning is pointless. Furthermore, any caller that wants to use this
new function can simply use a pointer to const AVInputFormat to work
with both av_find_input_format() and av_demuxer_find_by_ext(). And
after all, adding const makes the code more future-proof
(av_find_input_format() will return const AVInputFormat * after the
next major bump).

> ---
>  libavformat/avformat.h |  5 +
>  libavformat/format.c   | 15 +++
>  libavformat/version.h  |  2 +-
>  3 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 9b9b634ec3..9172ddbc8a 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -2237,6 +2237,11 @@ int avformat_alloc_output_context2(AVFormatContext 
> **ctx, ff_const59 AVOutputFor
>   */
>  ff_const59 AVInputFormat *av_find_input_format(const char *short_name);
>  
> +/**
> + * Find AVInputFormat based on an extension.
> + */
> +const AVInputFormat *av_demuxer_find_by_ext(const char *extension);
> +
>  /**
>   * Guess the file format.
>   *
> diff --git a/libavformat/format.c b/libavformat/format.c
> index c47490c8eb..9dda6df676 100644
> --- a/libavformat/format.c
> +++ b/libavformat/format.c
> @@ -125,6 +125,21 @@ ff_const59 AVInputFormat *av_find_input_format(const 
> char *short_name)
>  return NULL;
>  }
>  
> +const AVInputFormat *av_demuxer_find_by_ext(const char *extension)
> +{
> +const AVInputFormat *fmt = NULL;
> +void *i = 0;

Use NULL, it's a pointer after all (yes, I know that
av_demuxer_iterate() treats it as a uintptr_t internally).

> +while ((fmt = av_demuxer_iterate(&i)))
> +if (fmt->extensions && av_match_name(extension, fmt->extensions))
> +#if FF_API_AVIOFORMAT
> +return (AVInputFormat*)fmt;
> +#else
> +return fmt;
> +#endif

As has been said: The first branch of the #if should be deleted (as
the #if, of course).

- Andreas
___
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] avcodec/avdct: Clear IDCTDSPContext context

2020-01-31 Thread Michael Niedermayer
On Fri, Jan 31, 2020 at 12:47:57PM -0300, James Almer wrote:
> On 1/28/2020 10:30 AM, Michael Niedermayer wrote:
> > On Mon, Jan 27, 2020 at 11:49:49PM -0300, James Almer wrote:
> >> On 1/27/2020 9:25 PM, Michael Niedermayer wrote:
> >>> On Mon, Jan 27, 2020 at 06:09:28PM -0300, James Almer wrote:
>  On 1/27/2020 5:54 PM, Michael Niedermayer wrote:
> > Fixes use of uninitialized variable and segfault
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/avdct.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c
> > index 47e5f7134e..7c761cf39a 100644
> > --- a/libavcodec/avdct.c
> > +++ b/libavcodec/avdct.c
> > @@ -100,7 +100,7 @@ int avcodec_dct_init(AVDCT *dsp)
> >  
> >  #if CONFIG_IDCTDSP
> >  {
> > -IDCTDSPContext idsp;
> > +IDCTDSPContext idsp = {0};
> 
>  Should probably be a memset() in ff_idctdsp_init(). This is not the only
>  IDCTDSPContext user.
> >>>
> >>> this would not work as IDCTDSPContext.mpeg4_studio_profile must be 
> >>> initialized but it is also an input to ff_idctdsp_init()
> >>>
> >>> an alternative to the = {0} on the caller side would be to
> >>> simply add the mpeg4_studio_profile as an argument to ff_idctdsp_init()
> >>> and remove it from the context, its all just internal API so we can
> >>> easily redesign this. It should also be documented better ...
> >>>
> >>> What do you suggest ?
> >>
> >> memset(c, 0, offsetof(IDCTDSPContext, mpeg4_studio_profile)) in
> >> ff_idctdsp_init() should workaround that without the need to add new
> >> parameters. Just document that mpeg4_studio_profile must be at the end
> >> of the struct, and be the first field of all those that must be
> >> initialized before a call to ff_idctdsp_init(), in case new ones are
> >> added in the future for whatever reason.
> > 
> > The memset() suggested in ff_idctdsp_init() would make no difference
> > as the function already sets all fields which are not an input.
> > This would reduce the suggestion to setting mpeg4_studio_profile
> > in the ?single? caller which does not memset(0) the context prior.
> > 
> > That leaves 3 suggestions
> > A. "-IDCTDSPContext idsp;"
> > A. "+IDCTDSPContext idsp = {0};" (for one caller)
> > 
> > B. "+idsp.mpeg4_studio_profile = 0;" (for one caller)
> > 
> > C. "-ff_idctdsp_init();"   
> > C. "+ff_idctdsp_init(0);"(for all callers)
> > 
> > In all cases ff_idctdsp_init() also probably should be documented.
> > 
> > What do you prefer ?
> 
> In that case just go with A, your original patch.

ok, will apply

thx

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

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier


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 1/2] MAINTAINERS: Add patchwork maintainer

2020-01-31 Thread Michael Niedermayer
On Mon, Jan 27, 2020 at 09:54:21PM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)

will apply

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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] avformat/hlsenc: fix hls_ts_options with mpegts

2020-01-31 Thread Marton Balint


On Fri, 31 Jan 2020, Steven Liu wrote:


Marton Balint  于2020年1月31日周五 上午4:40写道:




On Wed, 22 Jan 2020, Marton Balint wrote:

> Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b.

Ping, will apply soon.

Thanks,
Marton

>
> Signed-off-by: Marton Balint 
> ---
> libavformat/hlsenc.c | 36 +---
> 1 file changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 2b3d3742d9..87b861d437 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -764,6 +764,7 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
> AVFormatContext *oc;
> AVFormatContext *vtt_oc = NULL;
> int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size 
> 0);
> +int remaining_options;
> int i, ret;
>
> ret = avformat_alloc_output_context2(&vs->avf, vs->oformat, NULL, NULL);
> @@ -852,21 +853,25 @@ static int hls_mux_init(AVFormatContext *s, 
VariantStream *vs)
> return ret;
> }
>
> +av_dict_copy(&options, hls->format_options, 0);
> if (hls->segment_type == SEGMENT_TYPE_FMP4) {
> -int remaining_options;
> -
> -av_dict_copy(&options, hls->format_options, 0);
> av_dict_set(&options, "fflags", "-autobsf", 0);
> av_dict_set(&options, "movflags", "+frag_custom+dash+delay_moov", 
AV_DICT_APPEND);
> -ret = avformat_init_output(oc, &options);
> -remaining_options = av_dict_count(options);
> -av_dict_free(&options);
> -if (ret < 0)
> -return ret;
> -if (remaining_options) {
> -av_log(s, AV_LOG_ERROR, "Some of the provided format options are not 
recognized\n");
> -return AVERROR(EINVAL);
> -}
> +} else {
> +/* We only require one PAT/PMT per segment. */
> +char period[21];
> +snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
> +av_dict_set(&options, "sdt_period", period, 0);
> +av_dict_set(&options, "pat_period", period, 0);
> +}
> +ret = avformat_init_output(oc, &options);
> +remaining_options = av_dict_count(options);
> +av_dict_free(&options);
> +if (ret < 0)
> +return ret;
> +if (remaining_options) {
> +av_log(s, AV_LOG_ERROR, "Some of the provided format options are not 
recognized\n");
> +return AVERROR(EINVAL);
> }
> avio_flush(oc->pb);
> return 0;
> @@ -1683,15 +1688,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
*vs)
> }
> }
> if (c->segment_type != SEGMENT_TYPE_FMP4) {
> -/* We only require one PAT/PMT per segment. */
> if (oc->oformat->priv_class && oc->priv_data) {
> -char period[21];
> -
> -snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
> -
> av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
> -av_opt_set(oc->priv_data, "sdt_period", period, 0);
> -av_opt_set(oc->priv_data, "pat_period", period, 0);
> }
> if (c->flags & HLS_SINGLE_FILE) {
> set_http_options(s, &options, c);
> --
> 2.16.4
>

LGTM


Thanks, applied.

Regards,
Marton
___
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] avfilter/vf_geq: use per-thread AVExpr for expression evaluation

2020-01-31 Thread Marton Balint



On Thu, 30 Jan 2020, Michael Niedermayer wrote:


On Wed, Jan 29, 2020 at 08:25:17PM +0100, Marton Balint wrote:

There was no consensus about separating AVExprState from AVExpr so here is a
minimal patch using the existing AVExpr to fix ticket #7528.

Signed-off-by: Marton Balint 
---
 doc/filters.texi |  5 +
 libavfilter/vf_geq.c | 26 +++---
 2 files changed, 20 insertions(+), 11 deletions(-)


not sure this is optimal but it fixes the issue so ok


Thanks, applied.

Regards,
Marton
___
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] fftools/cmdutils: add no demuxer/muxer name specified message

2020-01-31 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 fftools/cmdutils.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f0f2b4fde4..6e387ccb10 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1854,8 +1854,14 @@ static void show_help_codec(const char *name, int 
encoder)
 
 static void show_help_demuxer(const char *name)
 {
-const AVInputFormat *fmt = av_find_input_format(name);
+const AVInputFormat *fmt = NULL;
 
+if (!name) {
+av_log(NULL, AV_LOG_ERROR, "No demuxer name specified.\n");
+return;
+}
+
+fmt = av_find_input_format(name);
 if (!fmt) {
 av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
 return;
@@ -1891,8 +1897,13 @@ static void show_help_protocol(const char *name)
 static void show_help_muxer(const char *name)
 {
 const AVCodecDescriptor *desc;
-const AVOutputFormat *fmt = av_guess_format(name, NULL, NULL);
+const AVOutputFormat *fmt = NULL;
 
+if (!name) {
+av_log(NULL, AV_LOG_ERROR, "No muxer name specified.\n");
+return;
+}
+fmt = av_guess_format(name, NULL, NULL);
 if (!fmt) {
 av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
 return;
-- 
2.17.2 (Apple Git-113)



___
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] avformat/protocols: check protocol name before foreach

2020-01-31 Thread Liu Steven


> 在 2020年1月31日,下午11:24,Nicolas George  写道:
> 
> Liu Steven (12020-01-31):
>> Just more safe than without check.
> 
> This is a mistake, a common one: this is not safer, it is less: the
> caller has the incorrect assumption that their pointer is not NULL, and
> you are letting them keep it, and even in some extents validating it.
> 
>> I think if it return -EINVAL maybe better than NULL, is it?
> 
> If it was possible (you accurately noticed that not), it would be
> actually worse because it introduce a extra case for something that is
> not supposed to happen in the first place.
> 
> Remember, FFmpeg is programmed in C, not Java or Python: when the
> programmers do something stupid, like dividing by 0 or dereferencing
> NULL, the program crashes: this is the correct behavior.
> 
> Unless there is a useful semantic to give to the NULL case, crashing
> immediately is the right behavior. And saying the user "the protocol you
> specified does not exist" when the issue is they did not specify a
> protocol is not a useful semantic.

There have two way for this:
1. make same with other help message, for example:
StevenLiu:dash StevenLiu$ ./ffmpeg -hide_banner -h demuxer
Unknown format '(null)'.
StevenLiu:dash StevenLiu$
StevenLiu:dash StevenLiu$ ./ffmpeg -hide_banner -h muxer
Unknown format '(null)’.

2. i submmit patch to make demuxer mixer help message same as for unified 
message.
"the demuxer you specified does not exist”
"the muxer you specified does not exist”

two patch to choose, 1st is this patch, 2nd it the new patch 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200131233704.38591-1...@chinaffmpeg.org/

> 
> Regards,
> 
> -- 
>  Nicolas George
> ___
> 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".

Steven
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] [PATCH] avcodec/xvididct: Fix integer overflow in MULT()

2020-01-31 Thread Michael Niedermayer
Fixes: signed integer overflow: 23170 * 95058 cannot be represented in type 
'int'
Fixes: 
20295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5800212870463488

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/xvididct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index d8f3dd7072..14116bd6d3 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -142,7 +142,7 @@ static int idct_row(short *in, const int *const tab, int 
rnd)
 #define TAN3  0xAB0E
 #define SQRT2 0x5A82
 
-#define MULT(c, x, n)  (((c) * (x)) >> (n))
+#define MULT(c, x, n)  ((unsigned)((int)((c) * (unsigned)(x)) >> (n)))
 // 12b version => #define MULT(c,x, n)  c) >> 3) * (x)) >> ((n) - 3))
 // 12b zero-testing version:
 
-- 
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/2] avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant

2020-01-31 Thread Zane van Iperen
Adds support for the ADPCM variant used by some Simon & Schuster
Interactive games such as Real War, and Real War: Rogue States.

Signed-off-by: Zane van Iperen 
---
 libavcodec/Makefile |  1 +
 libavcodec/adpcm.c  | 10 ++
 libavcodec/allcodecs.c  |  1 +
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  7 +++
 libavcodec/version.h|  2 +-
 6 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a2fbb910a0..9072e5c7e6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -844,6 +844,7 @@ OBJS-$(CONFIG_ADPCM_IMA_OKI_DECODER)  += adpcm.o 
adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER)   += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_RAD_DECODER)  += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_SSI_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)  += adpcmenc.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index dad3da28d3..5ca6ad2760 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -13,6 +13,7 @@
  * MAXIS EA ADPCM decoder by Robert Marston (rmars...@gmail.com)
  * THP ADPCM decoder by Marco Gerards (mgera...@xs4all.nl)
  * Argonaut Games ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com)
+ * Simon & Schuster Interactive ADPCM decoder by Zane van Iperen 
(z...@zanevaniperen.com)
  *
  * This file is part of FFmpeg.
  *
@@ -608,6 +609,7 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
 case AV_CODEC_ID_ADPCM_IMA_WS:
 case AV_CODEC_ID_ADPCM_YAMAHA:
 case AV_CODEC_ID_ADPCM_AICA:
+case AV_CODEC_ID_ADPCM_IMA_SSI:
 nb_samples = buf_size * 2 / ch;
 break;
 }
@@ -1160,6 +1162,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
 }
 break;
+case AV_CODEC_ID_ADPCM_IMA_SSI:
+while (bytestream2_get_bytes_left(&gb) > 0) {
+int v = bytestream2_get_byteu(&gb);
+*samples++ = adpcm_ima_qt_expand_nibble(&c->status[0],  v >> 4  , 
3);
+*samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F, 
3);
+}
+break;
 case AV_CODEC_ID_ADPCM_IMA_OKI:
 while (bytestream2_get_bytes_left(&gb) > 0) {
 int v = bytestream2_get_byteu(&gb);
@@ -1910,6 +1919,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, 
sample_fmts_s16,  adpcm_ima_iss,
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_OKI, sample_fmts_s16,  adpcm_ima_oki,  
   "ADPCM IMA Dialogic OKI");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT,  sample_fmts_s16p, adpcm_ima_qt,   
   "ADPCM IMA QuickTime");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_RAD, sample_fmts_s16,  adpcm_ima_rad,  
   "ADPCM IMA Radical");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SSI, sample_fmts_s16,  adpcm_ima_ssi,  
   "ADPCM IMA Simon & Schuster Interactive");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG,  sample_fmts_s16,  
adpcm_ima_smjpeg,  "ADPCM IMA Loki SDL MJPEG");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav,  
   "ADPCM IMA WAV");
 ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS,  sample_fmts_both, adpcm_ima_ws,   
   "ADPCM IMA Westwood");
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 01a083d06b..0ad3338f9a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -609,6 +609,7 @@ extern AVCodec ff_adpcm_ima_oki_decoder;
 extern AVCodec ff_adpcm_ima_qt_encoder;
 extern AVCodec ff_adpcm_ima_qt_decoder;
 extern AVCodec ff_adpcm_ima_rad_decoder;
+extern AVCodec ff_adpcm_ima_ssi_decoder;
 extern AVCodec ff_adpcm_ima_smjpeg_decoder;
 extern AVCodec ff_adpcm_ima_wav_encoder;
 extern AVCodec ff_adpcm_ima_wav_decoder;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0e7ca1db4d..77eb890549 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -546,6 +546,7 @@ enum AVCodecID {
 AV_CODEC_ID_ADPCM_MTAF,
 AV_CODEC_ID_ADPCM_AGM,
 AV_CODEC_ID_ADPCM_ARGO,
+AV_CODEC_ID_ADPCM_IMA_SSI,
 
 /* AMR */
 AV_CODEC_ID_AMR_NB = 0x12000,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 32f573d58c..621a87cf34 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2304,6 +2304,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("ADPCM Argonaut Games"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_ADPCM_IMA_SSI,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "adpcm_ima_ssi",
+.long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Simon & Schuster 
Interactive"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_P

[FFmpeg-devel] [PATCH 2/2] avformat: add demuxer for Simon & Schuster Interactive's VAG format

2020-01-31 Thread Zane van Iperen
Adds support for the custom VAG container used by some Simon & Schuster
Interactive games such as Real War, and Real War: Rogue States.

Signed-off-by: Zane van Iperen 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/kvag.c   | 149 +++
 libavformat/version.h|   2 +-
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/kvag.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index ba6ea8c4a6..710cc4d088 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -279,6 +279,7 @@ OBJS-$(CONFIG_JACOSUB_DEMUXER)   += jacosubdec.o 
subtitles.o
 OBJS-$(CONFIG_JACOSUB_MUXER) += jacosubenc.o rawenc.o
 OBJS-$(CONFIG_JV_DEMUXER)+= jvdec.o
 OBJS-$(CONFIG_KUX_DEMUXER)   += flvdec.o
+OBJS-$(CONFIG_KVAG_DEMUXER)  += kvag.o
 OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o
 OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
 OBJS-$(CONFIG_LOAS_DEMUXER)  += loasdec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index fe74a32e47..3ea4100e85 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -214,6 +214,7 @@ extern AVInputFormat  ff_jacosub_demuxer;
 extern AVOutputFormat ff_jacosub_muxer;
 extern AVInputFormat  ff_jv_demuxer;
 extern AVInputFormat  ff_kux_demuxer;
+extern AVInputFormat  ff_kvag_demuxer;
 extern AVOutputFormat ff_latm_muxer;
 extern AVInputFormat  ff_lmlm4_demuxer;
 extern AVInputFormat  ff_loas_demuxer;
diff --git a/libavformat/kvag.c b/libavformat/kvag.c
new file mode 100644
index 00..fb58701fd7
--- /dev/null
+++ b/libavformat/kvag.c
@@ -0,0 +1,149 @@
+/*
+ * Simon & Schuster Interactive VAG demuxer
+ *
+ * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define KVAG_TAGMKTAG('K', 'V', 'A', 'G')
+#define KVAG_HEADER_SIZE14
+
+typedef struct KVAGHeader {
+uint32_tmagic;
+uint32_tdata_size;
+uint32_tsample_rate;
+uint32_tstereo;
+} KVAGHeader;
+
+typedef struct KVAGDemuxContext {
+KVAGHeader  hdr;
+uint32_tsamples_per_frame;
+uint32_tbytes_read;
+} KVAGDemuxContext;
+
+static int kvag_probe(const AVProbeData *p)
+{
+if (AV_RL32(p->buf) != KVAG_TAG)
+return 0;
+
+return AVPROBE_SCORE_EXTENSION + 1;
+}
+
+static int kvag_read_header(AVFormatContext *s)
+{
+int64_t ret;
+AVIOContext *pb = s->pb;
+AVStream *st;
+KVAGDemuxContext *kvag = s->priv_data;
+
+uint8_t buf[KVAG_HEADER_SIZE];
+
+if (!(st = avformat_new_stream(s, NULL)))
+return AVERROR(ENOMEM);
+
+if ((ret = avio_read(pb, buf, KVAG_HEADER_SIZE)) < 0)
+return ret;
+else if (ret != KVAG_HEADER_SIZE)
+return AVERROR(EIO);
+
+kvag->hdr.magic = AV_RL32(buf +  0);
+kvag->hdr.data_size = AV_RL32(buf +  4);
+kvag->hdr.sample_rate   = AV_RL32(buf +  8);
+kvag->hdr.stereo= AV_RL16(buf + 12);
+
+
+st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id  = AV_CODEC_ID_ADPCM_IMA_SSI;
+st->codecpar->format= AV_SAMPLE_FMT_S16;
+
+if (kvag->hdr.stereo) {
+st->codecpar->channel_layout= AV_CH_LAYOUT_STEREO;
+st->codecpar->channels  = 2;
+} else {
+st->codecpar->channel_layout= AV_CH_LAYOUT_MONO;
+st->codecpar->channels  = 1;
+}
+
+st->codecpar->sample_rate   = kvag->hdr.sample_rate;
+st->codecpar->bits_per_coded_sample = 4;
+st->codecpar->bits_per_raw_sample   = 16;
+
+/*
+ * The game doesn't use "frames", it just reads the whole file.
+ * 32 seems like a good number.
+ */
+st->codecpar->frame_size= 32;
+st->codecpar->block_align   = st->codecpar->frame_size;
+st->codecpar->bit_rate  = st->codecpar->channels *
+  st->codecpar->sample_rate *
+ 

[FFmpeg-devel] [PATCH 0/2] Simon & Schuster Interactive VAG demuxer + decoder.

2020-01-31 Thread Zane van Iperen
Hi all,

This patchset adds support for the VAG container and ADPCM variant used
by some Simon & Schuster Interactive games such as 'Real War',
and 'Real War: Rogue States'.

It has been tested against VAG files from both games.

Some things to note:
* SSI's VAG has no relation to the existing PS2 VAG.
  I've named it 'kvag' (after its tag), but am open to suggestions if this
  is inappropriate (ssi_vag?).
* The ROUNDED_DIV() call causes a (harmless) warning when called with
  unsigned arguments. I'm not sure of the policy for situations like this.

Zane


Zane van Iperen (2):
  avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant
  avformat: add demuxer for Simon & Schuster Interactive's VAG format

 libavcodec/Makefile  |   1 +
 libavcodec/adpcm.c   |  10 +++
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 ++
 libavcodec/version.h |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/kvag.c   | 149 +++
 libavformat/version.h|   2 +-
 10 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/kvag.c

-- 
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 1/6] avformat/format: add av_demuxer_find_by_ext

2020-01-31 Thread Gyan Doshi



On 31-01-2020 10:41 pm, Andreas Rheinhardt wrote:

Gyan Doshi:

Allows selecting demuxer by extension which are more widely recognized
by users.

Conditional cast added since this function will usually be called after
av_find_input_format, and so matches its return type.

That's not a good point. av_demuxer_find_by_ext() already always
returns const AVInputFormat *, so you casting the const away when
returning is pointless. Furthermore, any caller that wants to use this
new function can simply use a pointer to const AVInputFormat to work
with both av_find_input_format() and av_demuxer_find_by_ext(). And
after all, adding const makes the code more future-proof
(av_find_input_format() will return const AVInputFormat * after the
next major bump).


Ok, I don't think I should add const to the pointers at the receiving 
end (fftools) since they are global variables and may not be acceptable 
as const. So I'll cast away the const when receiving and remove the 
conditional cast.


Sounds fine?

Gyan




---
  libavformat/avformat.h |  5 +
  libavformat/format.c   | 15 +++
  libavformat/version.h  |  2 +-
  3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9b9b634ec3..9172ddbc8a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2237,6 +2237,11 @@ int avformat_alloc_output_context2(AVFormatContext 
**ctx, ff_const59 AVOutputFor
   */
  ff_const59 AVInputFormat *av_find_input_format(const char *short_name);
  
+/**

+ * Find AVInputFormat based on an extension.
+ */
+const AVInputFormat *av_demuxer_find_by_ext(const char *extension);
+
  /**
   * Guess the file format.
   *
diff --git a/libavformat/format.c b/libavformat/format.c
index c47490c8eb..9dda6df676 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -125,6 +125,21 @@ ff_const59 AVInputFormat *av_find_input_format(const char 
*short_name)
  return NULL;
  }
  
+const AVInputFormat *av_demuxer_find_by_ext(const char *extension)

+{
+const AVInputFormat *fmt = NULL;
+void *i = 0;

Use NULL, it's a pointer after all (yes, I know that
av_demuxer_iterate() treats it as a uintptr_t internally).


+while ((fmt = av_demuxer_iterate(&i)))
+if (fmt->extensions && av_match_name(extension, fmt->extensions))
+#if FF_API_AVIOFORMAT
+return (AVInputFormat*)fmt;
+#else
+return fmt;
+#endif

As has been said: The first branch of the #if should be deleted (as
the #if, of course).

- Andreas
___
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] avcodec/adpcm_argo: simplify and move duplicated logic into a function

2020-01-31 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/adpcm.c | 40 ++--
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index dad3da28d3..9a42353351 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -552,9 +552,21 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const 
uint8_t *buf, int buf_
 }
 }
 
-static inline int16_t adpcm_argo_expand_nibble(int nibble, int shift, int16_t 
prev0, int16_t prev1)
+static inline int16_t adpcm_argo_expand_nibble(ADPCMChannelStatus *cs, int 
nibble, int control, int shift)
 {
-return ((8 * prev0) - (4 * prev1) + (nibble * (1 << shift))) >> 2;
+int sample = nibble * (1 << shift);
+
+if (control & 0x04)
+sample += (8 * cs->sample1) - (4 * cs->sample2);
+else
+sample += 4 * cs->sample1;
+
+sample = av_clip_int16(sample >> 2);
+
+cs->sample2 = cs->sample1;
+cs->sample1 = sample;
+
+return sample;
 }
 
 /**
@@ -1805,7 +1817,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void 
*data,
  * They should be 0 initially.
  */
 for (channel = 0; channel < avctx->channels; channel++) {
-int control, shift, sample, nibble;
+int control, shift;
 
 samples = samples_p[channel];
 cs = c->status + channel;
@@ -1815,25 +1827,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 shift = (control >> 4) + 2;
 
 for (n = 0; n < nb_samples / 2; n++) {
-sample = bytestream2_get_byteu(&gb);
-
-nibble = sign_extend(sample >> 4, 4);
-if (control & 0x04)
-*samples = adpcm_argo_expand_nibble(nibble, shift, 
cs->sample1, cs->sample2);
-else
-*samples = adpcm_argo_expand_nibble(nibble, shift, 
cs->sample1, cs->sample1);
-
-cs->sample2 = cs->sample1;
-cs->sample1 = *samples++;
-
-nibble = sign_extend(sample >> 0, 4);
-if (control & 0x04)
-*samples = adpcm_argo_expand_nibble(nibble, shift, 
cs->sample1, cs->sample2);
-else
-*samples = adpcm_argo_expand_nibble(nibble, shift, 
cs->sample1, cs->sample1);
-
-cs->sample2 = cs->sample1;
-cs->sample1 = *samples++;
+int sample = bytestream2_get_byteu(&gb);
+*samples++ = adpcm_argo_expand_nibble(cs, sign_extend(sample 
>> 4, 4), control, shift);
+*samples++ = adpcm_argo_expand_nibble(cs, sign_extend(sample 
>> 0, 4), control, shift);
 }
 }
 break;
-- 
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".