Re: [FFmpeg-devel] Patch: added V210 codec support to MXF encoder

2020-09-18 Thread Swami Kevala
 > On Sat, Sep 19, 2020 at 12:12 AM Carl Eugen Hoyos 
wrote:

> Imo - and this is not meant to block your patch - it would make more
sense to test the file produced with FFmpeg (and your patch) with the Sony
development kit.

Yes, you are right. That would make more sense. Unfortunately I don't have
access to the Sony Server - the sample files were provided to me by a
vendor.
Will see what I can do.

-- 
Swami Kevala -- http://www.ishafoundation.org
___
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/3] avformat/mov: replace multiple avio_r8() by avio_skip()

2020-09-18 Thread Steven Liu


> 2020年9月18日 下午10:33,Zhao Zhili  写道:
> 
> From: Zhao Zhili 
> 
> ---
> libavformat/mov.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 9462af743a..8c1243b48d 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -103,9 +103,7 @@ static int mov_metadata_int8_bypass_padding(MOVContext 
> *c, AVIOContext *pb,
> unsigned len, const char *key)
> {
> /* bypass padding bytes */
> -avio_r8(pb);
> -avio_r8(pb);
> -avio_r8(pb);
> +avio_skip(pb, 3);
> 
> c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
> av_dict_set_int(&c->fc->metadata, key, avio_r8(pb), 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".

LGTM


Thanks

Steven Liu



___
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 0/7] Support variable frame sizes in adpcm_argo

2020-09-18 Thread Zane van Iperen
On Fri, 18 Sep 2020 12:04:41 +
"Zane van Iperen"  wrote:

> 
> v2:
>  - handle variable sizes in muxer (argo_asf)
>  - fix incorrect pts tracking (argo_brp)
>  - add test for decoding argo_asf via argo_brp

Will apply the first three parts of this soon. The rest has been
superceded.


___
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] web: link GH Actions based Windows-Builds by BtbN

2020-09-18 Thread Lou Logan
Wed Sep 16 14:15:34 EEST 2020, Timo Rothenpieler wrote:

> ---
>  src/download | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/download b/src/download
> index 706d402..0f090b8 100644
> --- a/src/download
> +++ b/src/download
> @@ -79,6 +79,9 @@
>  Windows EXE Files
>  
>  
> +   href="https://github.com/BtbN/FFmpeg-Builds/releases";>
> +Windows builds by BtbN
> +  
>   
>  
> 

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] avformat/3dostr: Check remaining buffer in probe before 8 byte step

2020-09-18 Thread Michael Niedermayer
On Sat, Sep 19, 2020 at 12:26:36AM +0200, Michael Niedermayer wrote:
> Fixes: segfault
> Fixes: signal_sigabrt_76ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts
> Regression since: 3ac45bf66561a667260cac37223c0393f7333fca
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/3dostr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

will apply due to approval on IRC:
 michaelni: just apply 3dostr patch
 and why probe buffer is not padded?
 i assume it is padded

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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] avcodec/diracdsp: Fix integer anomaly in dequant_subband_*

2020-09-18 Thread Michael Niedermayer
On Sat, Jul 18, 2020 at 10:47:26PM +0200, Michael Niedermayer wrote:
> Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 
> 'int'); cast to an unsigned type to negate this value to itself
> Fixes: 
> 23760/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-604209011412172
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/diracdsp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply patchset

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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] avcodec/tiff: Fix default white level

2020-09-18 Thread Michael Niedermayer
On Fri, Jul 17, 2020 at 12:43:57AM +0200, Michael Niedermayer wrote:
> According to the spec bits per sample should be used
> 
> Fix invalid shift with bpp=32
> Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
> Fixes: 
> 23507/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4815432665268224
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/tiff.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)

will apply patchset

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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] avformat/3dostr: Check remaining buffer in probe before 8 byte step

2020-09-18 Thread Michael Niedermayer
Fixes: segfault
Fixes: signal_sigabrt_76ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts
Regression since: 3ac45bf66561a667260cac37223c0393f7333fca

Signed-off-by: Michael Niedermayer 
---
 libavformat/3dostr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c
index 2d92b46570..2a35d661c3 100644
--- a/libavformat/3dostr.c
+++ b/libavformat/3dostr.c
@@ -29,10 +29,9 @@ static int threedostr_probe(const AVProbeData *p)
 unsigned chunk = AV_RL32(p->buf + i);
 unsigned size  = AV_RB32(p->buf + i + 4);
 
-i += 8;
 if (size < 8 || p->buf_size - i < size)
 return 0;
-
+i += 8;
 size -= 8;
 switch (chunk) {
 case MKTAG('C','T','R','L'):
-- 
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] avutil/pixfmt: improve definition of AVColorRange

2020-09-18 Thread James Almer
On 9/18/2020 6:05 PM, Jan Ekström wrote:
> As it was brought up that the current documentation leaves things
> as specific to YCbCr only, ICtCp and RGB are now mentioned.
> Additionally, the specifications on which these definitions of
> narrow and full range are defined are mentioned.
> 
> This way, the documentation of AVColorRange should now match how
> most people seem to read interpret it at this point, and thus
> flagging RGB AVFrames as full range is valid not only according to
> common sense, but also the enum definition.
> ---
>  libavutil/pixfmt.h | 40 +---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index a46acf3c5e..68051bf4b9 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -530,12 +530,46 @@ enum AVColorSpace {
>  };
>  
>  /**
> - * MPEG vs JPEG YUV range.
> + * Visual content value range.
> + *
> + * These values are based on definitions that can be found in multiple
> + * specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance
> + * and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital
> + * Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit
> + * integer representation). At the time of writing, the BT.2100 one is
> + * recommended, as it also defines the full range representation.
> + *
> + * Common definitions:
> + *   - For luminance planes such as Y in YCbCr and I in ICtCp, 'E' is the
> + * original value in range of 0.0 to 1.0.
> + *   - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original
> + * value in range of -0.5 to 0.5.
> + *   - 'n' is the output bit depth.
> + *   - For additional definitions such as rounding and clipping to valid n
> + * bit unsigned integer range, please refer to BT.2100 (Table 9).
>   */
>  enum AVColorRange {
>  AVCOL_RANGE_UNSPECIFIED = 0,
> -AVCOL_RANGE_MPEG= 1, ///< the normal 219*2^(n-8) "MPEG" YUV 
> ranges
> -AVCOL_RANGE_JPEG= 2, ///< the normal 2^n-1   "JPEG" YUV 
> ranges
> +AVCOL_RANGE_MPEG= 1, ///< Narrow or limited range content.
> + ///
> + ///  For RGB and luminance planes:
> + ///  (219 * E + 16) * 2^(n-8)
> + ///  F.ex. the range of 16-235 for 8 bits
> + ///
> + ///  For chrominance planes:
> + ///  (224 * E + 128) * 2^(n-8)
> + ///  F.ex. the range of 16-240 for 8 bits

Is this parsed right by doxygen? Because if not you may want to use /**
*/ for multi-line descriptions, and placed above each value instead of
next to them.

> +
> +AVCOL_RANGE_JPEG= 2, ///< Full range content
> + ///
> + ///  For RGB and luminance planes:
> + ///  (2^n - 1) * E
> + ///  F.ex. the range of 0-255 for 8 bits
> + ///
> + ///  For chrominance planes:
> + ///  (2^n - 1) * E + 2^(n - 1)
> + ///  F.ex. the range of 1-255 for 8 bits
> +
>  AVCOL_RANGE_NB   ///< Not part of ABI
>  };
>  
> 

___
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] avutil/pixfmt: improve definition of AVColorRange

2020-09-18 Thread Jan Ekström
As it was brought up that the current documentation leaves things
as specific to YCbCr only, ICtCp and RGB are now mentioned.
Additionally, the specifications on which these definitions of
narrow and full range are defined are mentioned.

This way, the documentation of AVColorRange should now match how
most people seem to read interpret it at this point, and thus
flagging RGB AVFrames as full range is valid not only according to
common sense, but also the enum definition.
---
 libavutil/pixfmt.h | 40 +---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index a46acf3c5e..68051bf4b9 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -530,12 +530,46 @@ enum AVColorSpace {
 };
 
 /**
- * MPEG vs JPEG YUV range.
+ * Visual content value range.
+ *
+ * These values are based on definitions that can be found in multiple
+ * specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance
+ * and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital
+ * Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit
+ * integer representation). At the time of writing, the BT.2100 one is
+ * recommended, as it also defines the full range representation.
+ *
+ * Common definitions:
+ *   - For luminance planes such as Y in YCbCr and I in ICtCp, 'E' is the
+ * original value in range of 0.0 to 1.0.
+ *   - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original
+ * value in range of -0.5 to 0.5.
+ *   - 'n' is the output bit depth.
+ *   - For additional definitions such as rounding and clipping to valid n
+ * bit unsigned integer range, please refer to BT.2100 (Table 9).
  */
 enum AVColorRange {
 AVCOL_RANGE_UNSPECIFIED = 0,
-AVCOL_RANGE_MPEG= 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
-AVCOL_RANGE_JPEG= 2, ///< the normal 2^n-1   "JPEG" YUV ranges
+AVCOL_RANGE_MPEG= 1, ///< Narrow or limited range content.
+ ///
+ ///  For RGB and luminance planes:
+ ///  (219 * E + 16) * 2^(n-8)
+ ///  F.ex. the range of 16-235 for 8 bits
+ ///
+ ///  For chrominance planes:
+ ///  (224 * E + 128) * 2^(n-8)
+ ///  F.ex. the range of 16-240 for 8 bits
+
+AVCOL_RANGE_JPEG= 2, ///< Full range content
+ ///
+ ///  For RGB and luminance planes:
+ ///  (2^n - 1) * E
+ ///  F.ex. the range of 0-255 for 8 bits
+ ///
+ ///  For chrominance planes:
+ ///  (2^n - 1) * E + 2^(n - 1)
+ ///  F.ex. the range of 1-255 for 8 bits
+
 AVCOL_RANGE_NB   ///< Not part of ABI
 };
 
-- 
2.26.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 v3 2/2] dnn_backend_native_layer_conv2d.c: refine code.

2020-09-18 Thread Xu Jun


- Original Message -
> From: "Yejun Guo" 
> To: "FFmpeg development discussions and patches" 
> Cc: "xujunzz" 
> Sent: Thursday, September 17, 2020 9:30:08 PM
> Subject: RE: [FFmpeg-devel] [PATCH v3 2/2] dnn_backend_native_layer_conv2d.c: 
> refine code.

>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of Hendrik
>> Leppkes
>> Sent: 2020年9月17日 20:28
>> To: FFmpeg development discussions and patches 
>> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2]
>> dnn_backend_native_layer_conv2d.c: refine code.
>> 
>> On Thu, Sep 17, 2020 at 2:02 PM Guo, Yejun  wrote:
>> >
>> >
>> >
>> > > -Original Message-
>> > > From: ffmpeg-devel  On Behalf Of
>> > > Hendrik Leppkes
>> > > Sent: 2020年9月17日 19:21
>> > > To: FFmpeg development discussions and patches
>> > > 
>> > > Subject: Re: [FFmpeg-devel] [PATCH v3 2/2]
>> > > dnn_backend_native_layer_conv2d.c: refine code.
>> > >
>> > > On Thu, Sep 17, 2020 at 4:07 AM Guo, Yejun  wrote:
>> > > >
>> > > >
>> > > >
>> > > > > -Original Message-
>> > > > > From: ffmpeg-devel  On Behalf
>> > > > > Of xuju...@sjtu.edu.cn
>> > > > > Sent: 2020年9月16日 18:07
>> > > > > To: ffmpeg-devel@ffmpeg.org
>> > > > > Cc: xuju...@sjtu.edu.cn
>> > > > > Subject: [FFmpeg-devel] [PATCH v3 2/2]
>> > > dnn_backend_native_layer_conv2d.c:
>> > > > > refine code.
>> > > > >
>> > > > > From: Xu Jun 
>> > > > >
>> > > > > Move thread area allocate out of thread function into main thread.
>> > > > >
>> > > > > Signed-off-by: Xu Jun 
>> > > > > ---
>> > > > >  .../dnn/dnn_backend_native_layer_conv2d.c | 30
>> +--
>> > > > >  1 file changed, 14 insertions(+), 16 deletions(-)
>> > > >
>> > > > LGTM, will push soon, thanks.
>> > >
>> > > The dnn-layer-conv2d test fails after the recent changes on some
>> > > systems,
>> > > namely:
>> > >
>> > > Windows mingw 64-bit (eg.
>> > > http://fate.ffmpeg.org/report.cgi?time=20200917051623&slot=x86_64-mi
>> > > ngw-
>> > > w64-windows-native)
>> > > MSVC 32-bit static build (eg.
>> > > http://fate.ffmpeg.org/report.cgi?time=20200917102627&slot=x86_32-ms
>> > > vc16
>> > > -windows-native)
>> > > and maybe more windows combination, some of my boxes are still running
>> FATE.
>> > >
>> > > There is no output, just a wrong return value apparently. Any 
>> > > ideas/fixes?
>> > >
>> > thanks for pointing out.
>> >
>> > I think the output is in file dnn-layer-conv2d.err "Test
>> > dnn-layer-conv2d failed. Look at tests/data/fate/dnn-layer-conv2d.err for
>> details."
>> >
>> 
>> There is no output, all these files are empty.
>> 
> I see, and we are setting up the system locally to reproduce the issue.

I have build my mingw win10 environment and have reproduce the issue. 
I'm going to look for the bug and try to fix it.

- Xu Jun
___
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: added V210 codec support to MXF encoder

2020-09-18 Thread Carl Eugen Hoyos


> Am 17.09.2020 um 23:34 schrieb Swami Kevala :
> 
> Verified the container_ui and element_ui with a sample file produced by
> Sony Server  1.3.0.0.1 (Sony MXF Development Kit (Win32) 4.9.1.118.1)

Imo - and this is not meant to block your patch - it would make more sense to 
test the file produced with FFmpeg (and your patch) with the Sony development 
kit.

Carl Eugen
___
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] SCTE-35 implementation already (bounty)

2020-09-18 Thread Dennis Mungai
On Wed, 2 Sep 2020 at 07:29, MediaStream  wrote:

> Looking for SCTE-35 pass through implementation:
>
> 1. Extract SCTE-35 from MPEG-TS.
> 2. Translate timing of the original SCTE-35 events to match timing in the
> output file appropriately or keep timing as is.
> 3. Signal encoder to force key frames at the boundaries of the SCTE-35
> event.
> 4. Inject SCTE-35 messaging into output MP4 files as emsg and into MPD and
> M3U8 manifests if/as needed.
>
> More info:
> https://www.w3.org/TR/media-timed-events/#scte-35
>
> https://www.tvtechnology.com/opinions/scte10435-and-beyond-a-look-at-ad-insertion-in-an-ott-world
>
> source TS file with SCTE-35 also saved as ES and XML:
> https://www.mediafire.com/folder/zv20csqeo1ixt/
>
> Bounty of $2,500.00 USD (up to Oct 2020)
>
>
Hello there,

Please contact Devin Heitmueller (copied herein) for more on the same.
There's a branch with the SCTE-35 fix-ups here:
https://github.com/LTNGlobal-opensource/FFmpeg-ltn/commits/ltn_thumbnailer
Though its' based on an FFmpeg code-base from ~2 years ago. To get it to
run, try a minimalist build with the bare essentials enabled, as some
(newer) libraries such as libfdk-aac will give you trouble.

What I can confirm is that indeed, the SCTE-35 payloads can be passed
through and re-timed in mpegts muxer. So task (1) and (2) are *mostly*
complete. Let Devin confirm that for you.
There's also a generic bitstream filter you can use to dump the SCTE-35
messages.
See:
1.
https://github.com/LTNGlobal-opensource/FFmpeg-ltn/commit/f91fa5cc67b43183cf0bd6dab3b468bd2b94056d
2.
https://github.com/LTNGlobal-opensource/FFmpeg-ltn/commit/a04d2bbbc9829a5332472d86d5b86e69d1f7ec5d
3.
https://github.com/LTNGlobal-opensource/FFmpeg-ltn/commit/2f6fea5f86ee816b01e05840999bffc706a9af04

Porting these upstream (to ffmpeg master's git tip) will not be a trivial
task, but its' definitely doable.

Regards,

BR.
___
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] avformat/mov: fix typo in comments

2020-09-18 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8c1243b48d..9fc0db24d5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1473,7 +1473,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale);
 
 c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration 
*/
-// set the AVCodecContext duration because the duration of individual 
tracks
+// set the AVFormatContext duration because the duration of individual 
tracks
 // may be inaccurate
 if (c->time_scale > 0 && !c->trex_data)
 c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale);
-- 
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 1/3] avformat/mov: replace multiple avio_r8() by avio_skip()

2020-09-18 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavformat/mov.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9462af743a..8c1243b48d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -103,9 +103,7 @@ static int mov_metadata_int8_bypass_padding(MOVContext *c, 
AVIOContext *pb,
 unsigned len, const char *key)
 {
 /* bypass padding bytes */
-avio_r8(pb);
-avio_r8(pb);
-avio_r8(pb);
+avio_skip(pb, 3);
 
 c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
 av_dict_set_int(&c->fc->metadata, key, avio_r8(pb), 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 3/3] avformat/mov: remove an always true condition

2020-09-18 Thread Zhao Zhili
From: Zhao Zhili 

---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9fc0db24d5..f99605c2cd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1475,7 +1475,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration 
*/
 // set the AVFormatContext duration because the duration of individual 
tracks
 // may be inaccurate
-if (c->time_scale > 0 && !c->trex_data)
+if (!c->trex_data)
 c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale);
 avio_rb32(pb); /* preferred scale */
 
-- 
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] avcodec/av1dec: check avctx->hwaccel when hwaccel pix_fmt selected

2020-09-18 Thread James Almer
On 9/18/2020 2:40 AM, Wang, Fei W wrote:
> 
> 
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of
>> Hendrik Leppkes
>> Sent: Thursday, September 17, 2020 5:21 PM
>> To: FFmpeg development discussions and patches 
>> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/av1dec: check avctx->hwaccel
>> when hwaccel pix_fmt selected
>>
>> On Thu, Sep 17, 2020 at 10:38 AM Fei Wang  wrote:
>>>
>>> Pix fmt with hwaccel flag may not be chosen in format probing, in this
>>> case avctx->hwaccel will not be inited.
>>>
>>> Signed-off-by: Fei Wang 
>>> ---
>>>  libavcodec/av1dec.c | 12 
>>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index
>>> 0bb04a3e44..cdcc618013 100644
>>> --- a/libavcodec/av1dec.c
>>> +++ b/libavcodec/av1dec.c
>>> @@ -251,6 +251,7 @@ static int get_pixel_format(AVCodecContext *avctx)
>>> {
>>>  AV1DecContext *s = avctx->priv_data;
>>>  const AV1RawSequenceHeader *seq = s->raw_seq;
>>> +const AVPixFmtDescriptor *desc;
>>>  uint8_t bit_depth;
>>>  int ret;
>>>  enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; @@ -327,10 +328,13
>>> @@ static int get_pixel_format(AVCodecContext *avctx)
>>>   * Since now the av1 decoder doesn't support native decode, if it will 
>>> be
>>>   * implemented in the future, need remove this check.
>>>   */
>>> -if (!avctx->hwaccel) {
>>> -av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
>>> -   " hardware accelerated AV1 decoding.\n");
>>> -return AVERROR(ENOSYS);
>>> +desc = av_pix_fmt_desc_get(ret);
>>> +if (desc && (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
>>> +if (!avctx->hwaccel) {
>>> +av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
>>> +   " hardware accelerated AV1 decoding.\n");
>>> +return AVERROR(ENOSYS);
>>> +}
>>>  }
>>>
>>
>> Isn't it supposed to quit here, because we do not have software decoding?
> 
> Since now av1 decoder allow probe, that will try to decode first frame to 
> find stream info in open_file stage. While the hwaccel will not be inited.
> If without change here, the error log will be print out but later during
> transcode stage, it can gives out the correct output.

If you let it choose a software pix_fmt, it will think the decoder can
actually output something, which is not true.
Probing works fine even if it fails at this point. It will have set
enough AVCodecContext fields to allow things like remuxing, hence the
relevant fate tests succeeding as is.
___
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] avcodec/av1dec: check avctx->hwaccel when hwaccel pix_fmt selected

2020-09-18 Thread Michael Niedermayer
On Wed, Sep 16, 2020 at 04:57:15PM -0400, Fei Wang wrote:
> Pix fmt with hwaccel flag may not be chosen in format probing, in
> this case avctx->hwaccel will not be inited.
> 
> Signed-off-by: Fei Wang 
> ---
>  libavcodec/av1dec.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)

This breaks

make fate-cbs-av1-av1-1-b8-22-svc-L2T1
Assertion dst->width == 0 && dst->height == 0 failed at libavutil/frame.c:460
Aborted (core dumped)


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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] avfilter/vf_scale: translate and verify swscale internal range flag

2020-09-18 Thread Michael Niedermayer
On Thu, Sep 17, 2020 at 11:44:39PM +0300, Jan Ekström wrote:
> On Thu, Sep 17, 2020 at 11:31 PM Michael Niedermayer
>  wrote:
> >
> > On Wed, Sep 16, 2020 at 11:18:48PM +0300, Jan Ekström wrote:
> > > This value - while it looks like the actual range of the content -
> > > is nothing but the internal value of swscale.
> > >
> > > Thus, if we have RGB content, force the value to 1. Swscale will
> > > ignore it, but at least the value of the output AVFrame will now
> > > properly be "full range" instead of "limited range", as it is right
> > > now.
> > >
> > > Additionally, after calling sws_setColorspaceDetails double-check
> > > the configured internal flag for the color range. Warn if this is
> > > different to the requested value.
> > >
> > > Finally, utilize the translated configured output value into the
> > > output AVFrame's color_range.
> > > ---
> > >  libavfilter/vf_scale.c | 51 +-
> > >  1 file changed, 50 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > > index 58eee96744..592e4a344e 100644
> > > --- a/libavfilter/vf_scale.c
> > > +++ b/libavfilter/vf_scale.c
> > > @@ -750,11 +750,30 @@ scale:
> > >  || in_range != AVCOL_RANGE_UNSPECIFIED
> > >  || scale->out_range != AVCOL_RANGE_UNSPECIFIED) {
> > >  int in_full, out_full, brightness, contrast, saturation;
> > > +int configured_in_full_range_flag, 
> > > configured_out_full_range_flag;
> > >  const int *inv_table, *table;
> > > +const AVPixFmtDescriptor *in_desc  = 
> > > av_pix_fmt_desc_get(in->format);
> > > +const AVPixFmtDescriptor *out_desc = 
> > > av_pix_fmt_desc_get(out->format);
> >
> > > +if (!in_desc || !out_desc) {
> > > +av_log(ctx, AV_LOG_ERROR,
> > > +   "Failed to get one or more of the pixel format 
> > > descriptors "
> > > +   "for formats - in: %d (%s), out: %d (%s)!\n",
> > > +   in->format, in_desc ? "OK" : "bad",
> > > +   out->format, out_desc ? "OK": "bad");
> > > +av_frame_free(&in);
> > > +av_frame_free(frame_out);
> > > +return AVERROR_INVALIDDATA;
> > > +}
> >
> > can this be true ?
> >
> 
> Maybe it cannot, but it's a pointer. If the value somehow ends up
> being one for which there is no descriptor.
> 
> It all boils to, unless I know there cannot technically be a nullptr
> received, I check. Because this way the check is in one place, instead
> of doing `xx_desc ? xx_desc->thing : failover` everywhere.
> 

> I can change this to an assert as mentioned by Nicolas, of course.

please do

if theres a NULL check, both the human reader as well as things like coverity
assume it can be NULL. And both get confused if thats not actually possible


> 
> >
> > >
> > >  sws_getColorspaceDetails(scale->sws, (int **)&inv_table, 
> > > &in_full,
> > >   (int **)&table, &out_full,
> > >   &brightness, &contrast, &saturation);
> >
> > > +// translate the swscale internal range flags to hold true
> > > +// for RGB
> >
> > The range field of AVFrame is documented as
> > "MPEG vs JPEG YUV range."
> >
> 
> Yes, but I think quite a few people at this point just read it "full
> range" VS "limited range" without any connotations towards YCbCr
> specifically. Personally, I consider the enumeration names as just old
> left-overs from the time when the MPEG/JPEG or TV/PC naming sounded
> like a good idea and that nobody wanted to start the change of adding
> new defines and enum values etc, doing deprecation etc as that is
> quite a lot of work just to get the naming of enums nicer. Case in
> point - for example pngdec sets the range value for the RGB frames it
> returns.
> 
> Of course unless you specifically want to support limited range RGB,
> RGB should not only be implied being full range by default but also
> always set to be full range everywhere.
> 
> > so it is not defined for RGB and cannot be "wrong" for RGB
> > maybe iam nitpicking here but if you want to use the range for RGB
> > the API docs need to be changed first.
> >
> 
> The code was ALREADY doing that, and I'm just converting the value so
> that you don't end up with RGB + limited range AVFrames?!
> 
> > I mean you could set it to 1 for RGB thats ok without a API
> > docs change. But writing in a comment that one way is correct for RGB is not
> > compatible with the current documentation
> >
> 
> So you want another patch that changes it to just say "limited/narrow
> range" and "full range"? Like seriously, I just wanted to fix a
> problem that got found because I finally started plugging some pipes
> together!

If you want to change the range enum and field so it also applies to
RGB and not just YUV. That should be done in a consistent and complete
way and i imagine will not be just "one more thing"

otherw

[FFmpeg-devel] [PATCH v2 7/7] fate: add argo_adpcm via argo_brp demux test

2020-09-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 tests/fate/adpcm.mak  | 3 +++
 tests/ref/fate/adpcm-argo-brp | 1 +
 2 files changed, 4 insertions(+)
 create mode 100644 tests/ref/fate/adpcm-argo-brp

diff --git a/tests/fate/adpcm.mak b/tests/fate/adpcm.mak
index c75a756bc3..0d6a671d34 100644
--- a/tests/fate/adpcm.mak
+++ b/tests/fate/adpcm.mak
@@ -94,6 +94,9 @@ fate-adpcm-argo-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/argo-asf/PWIN22M.ASF -f s16
 FATE_ADPCM-$(call DEMDEC, ARGO_ASF, ADPCM_ARGO) += fate-adpcm-argo-stereo
 fate-adpcm-argo-stereo: CMD = md5 -i $(TARGET_SAMPLES)/argo-asf/CBK2_cut.asf 
-f s16le -af aresample
 
+FATE_ADPCM-$(call DEMDEC, ARGO_BRP, ADPCM_ARGO) += fate-adpcm-argo-brp
+fate-adpcm-argo-brp: CMD = md5 -i $(TARGET_SAMPLES)/argo-brp/CROCLOGO_CUT.BRP 
-f s16le -af aresample
+
 FATE_ADPCM-$(call DEMDEC, KVAG, ADPCM_IMA_SSI) += fate-adpcm-ima-ssi-mono
 fate-adpcm-ima-ssi-mono: CMD = md5 -i $(TARGET_SAMPLES)/kvag/mull1_cut.vag -f 
s16le
 
diff --git a/tests/ref/fate/adpcm-argo-brp b/tests/ref/fate/adpcm-argo-brp
new file mode 100644
index 00..8fcc3183ba
--- /dev/null
+++ b/tests/ref/fate/adpcm-argo-brp
@@ -0,0 +1 @@
+81183a0037984d6d0e84809e59ae80d7
-- 
2.25.4


___
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 v2 6/7] avformat/argo_brp: remove usage of floats

2020-09-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_brp.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index a3e9846c74..3a5a0c0497 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -78,8 +78,8 @@ typedef struct ArgoBRPStreamHeader {
 typedef struct ArgoBRPDemuxContext {
 ArgoBRPFileHeader   fhdr;
 ArgoBRPStreamHeader *streams;
-/* To know how much of a BASF to give. */
-int64_t lastpts;
+/* Current PTS converted into BASF timebase (samples). */
+int64_t currpts;
 int hit_eof;
 
 /* BASF-specific fields. */
@@ -88,7 +88,6 @@ typedef struct ArgoBRPDemuxContext {
 ArgoASFChunkHeader  ckhdr;
 uint32_tblocks_read;
 int64_t offset;
-/* ms, not samples. */
 int64_t lastpts;
 } basf;
 } ArgoBRPDemuxContext;
@@ -352,7 +351,7 @@ static int argo_brp_read_basf(AVFormatContext *s, AVPacket 
*pkt,
 if (brp->basf.blocks_read >= ckhdr->num_blocks)
 return 0;
 
-if (!ignorepts && brp->lastpts < brp->basf.lastpts)
+if (!ignorepts && brp->currpts < brp->basf.lastpts)
 return 0;
 
 if ((ret = avio_tell(s->pb)) < 0)
@@ -377,8 +376,7 @@ static int argo_brp_read_basf(AVFormatContext *s, AVPacket 
*pkt,
 
 brp->basf.offset  += pkt->size;
 brp->basf.blocks_read += blocks_read;
-/* Need the ceil() because ((1 * 32 * 1000) / 44100) < 1 */
-brp->basf.lastpts += ceilf((blocks_read * ckhdr->num_samples * 
1000.0f) / ckhdr->sample_rate);
+brp->basf.lastpts += blocks_read * brp->basf.ckhdr.num_samples;
 return 1;
 }
 
@@ -434,7 +432,13 @@ static int argo_brp_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 
 pkt->stream_index = blk.stream_id;
 pkt->pts  = blk.start_ms;
-brp->lastpts  = FFMAX(brp->lastpts, blk.start_ms);
+
+if (brp->basf.index >= 0) {
+int64_t pts = av_rescale_rnd(blk.start_ms, brp->basf.ckhdr.sample_rate,
+ 1000, AV_ROUND_UP);
+brp->currpts = FFMAX(brp->currpts, pts);
+}
+
 return 0;
 }
 
-- 
2.25.4


___
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 v2 5/7] avformat/argo_brp: support reading multiple ASF blocks at once

2020-09-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_brp.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 122f616ecc..a3e9846c74 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -86,7 +86,7 @@ typedef struct ArgoBRPDemuxContext {
 struct {
 int index;
 ArgoASFChunkHeader  ckhdr;
-int64_t blocks_read;
+uint32_tblocks_read;
 int64_t offset;
 /* ms, not samples. */
 int64_t lastpts;
@@ -340,13 +340,14 @@ static int argo_brp_read_basf(AVFormatContext *s, 
AVPacket *pkt,
   ArgoBRPDemuxContext *brp, int ignorepts)
 {
 ArgoASFChunkHeader *ckhdr = &brp->basf.ckhdr;
-AVCodecParameters *par;
+AVStream *st;
 int64_t ret, old;
+uint32_t blocks_read;
 
 if (brp->basf.index < 0)
 return 0;
 
-par = s->streams[brp->basf.index]->codecpar;
+st = s->streams[brp->basf.index];
 
 if (brp->basf.blocks_read >= ckhdr->num_blocks)
 return 0;
@@ -364,21 +365,20 @@ static int argo_brp_read_basf(AVFormatContext *s, 
AVPacket *pkt,
 else if (ret != brp->basf.offset)
 return AVERROR(EIO);
 
-if ((ret = av_get_packet(s->pb, pkt, par->frame_size)) < 0)
+if ((ret = ff_argo_asf_read(s->pb, st, pkt, ckhdr, brp->basf.blocks_read)) 
< 0)
 return ret;
 
+blocks_read = ret;
+
 if ((ret = avio_seek(s->pb, old, SEEK_SET)) < 0)
 return ret;
 else if (ret != old)
 return AVERROR(EIO);
 
-pkt->stream_index  = brp->basf.index;
-pkt->duration  = ckhdr->num_samples;
-
 brp->basf.offset  += pkt->size;
-brp->basf.blocks_read += 1;
-/* Need the ceil() because ((32 * 1000) / 44100) < 1 */
-brp->basf.lastpts += ceilf((ckhdr->num_samples * 1000.0f) / 
ckhdr->sample_rate);
+brp->basf.blocks_read += blocks_read;
+/* Need the ceil() because ((1 * 32 * 1000) / 44100) < 1 */
+brp->basf.lastpts += ceilf((blocks_read * ckhdr->num_samples * 
1000.0f) / ckhdr->sample_rate);
 return 1;
 }
 
-- 
2.25.4


___
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 v2 3/7] avformat/argo_asf: read/write multiple blocks at once

2020-09-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 38 --
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index b1632f3ba5..048e5441d6 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -26,6 +26,9 @@
 #include "libavutil/opt.h"
 #include "argo_asf.h"
 
+/* Maximum number of blocks to read at once. */
+#define ASF_NB_BLOCKS 32
+
 typedef struct ArgoASFDemuxContext {
 ArgoASFFileHeader   fhdr;
 ArgoASFChunkHeader  ckhdr;
@@ -37,6 +40,7 @@ typedef struct ArgoASFMuxContext {
 intversion_major;
 intversion_minor;
 const char*name;
+int64_tnb_blocks;
 } ArgoASFMuxContext;
 
 void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf)
@@ -125,12 +129,10 @@ int ff_argo_asf_fill_stream(AVStream *st, const 
ArgoASFFileHeader *fhdr,
  * (nchannel control bytes) + ((bytes_per_channel) * nchannel)
  * For mono, this is 17. For stereo, this is 34.
  */
-st->codecpar->frame_size= st->codecpar->channels +
+st->codecpar->block_align   = st->codecpar->channels +
   (ckhdr->num_samples / 2) *
   st->codecpar->channels;
 
-st->codecpar->block_align   = st->codecpar->frame_size;
-
 st->codecpar->bit_rate  = st->codecpar->channels *
   st->codecpar->sample_rate *
   st->codecpar->bits_per_coded_sample;
@@ -221,15 +223,21 @@ static int argo_asf_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (asf->blocks_read >= asf->ckhdr.num_blocks)
 return AVERROR_EOF;
 
-if ((ret = av_get_packet(pb, pkt, st->codecpar->frame_size)) < 0)
+ret = av_get_packet(pb, pkt, st->codecpar->block_align *
+FFMIN(ASF_NB_BLOCKS, asf->ckhdr.num_blocks - 
asf->blocks_read));
+if (ret < 0)
 return ret;
-else if (ret != st->codecpar->frame_size)
+
+/* Something real screwy is going on. */
+if (ret % st->codecpar->block_align != 0)
 return AVERROR_INVALIDDATA;
 
+
 pkt->stream_index   = st->index;
-pkt->duration   = asf->ckhdr.num_samples;
+pkt->duration   = asf->ckhdr.num_samples * (ret / 
st->codecpar->block_align);
+asf->blocks_read   += (ret / st->codecpar->block_align);
 
-++asf->blocks_read;
+pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
 return 0;
 }
 
@@ -277,6 +285,9 @@ static int argo_asf_write_init(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
+if (par->block_align != 17 * par->channels)
+return AVERROR(EINVAL);
+
 if (par->sample_rate > UINT16_MAX) {
 av_log(s, AV_LOG_ERROR, "Sample rate too large\n");
 return AVERROR(EINVAL);
@@ -364,24 +375,31 @@ static int argo_asf_write_header(AVFormatContext *s)
 
 static int argo_asf_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-if (pkt->size != 17 * s->streams[0]->codecpar->channels)
+ArgoASFMuxContext *ctx = s->priv_data;
+AVCodecParameters *par = s->streams[0]->codecpar;
+int nb_blocks = pkt->size / par->block_align;
+
+if (pkt->size % par->block_align != 0)
 return AVERROR_INVALIDDATA;
 
-if (s->streams[0]->nb_frames >= UINT32_MAX)
+if (ctx->nb_blocks + nb_blocks > UINT32_MAX)
 return AVERROR_INVALIDDATA;
 
 avio_write(s->pb, pkt->data, pkt->size);
+
+ctx->nb_blocks += nb_blocks;
 return 0;
 }
 
 static int argo_asf_write_trailer(AVFormatContext *s)
 {
+ArgoASFMuxContext *ctx = s->priv_data;
 int64_t ret;
 
 if ((ret = avio_seek(s->pb, ASF_FILE_HEADER_SIZE, SEEK_SET) < 0))
 return ret;
 
-avio_wl32(s->pb, (uint32_t)s->streams[0]->nb_frames);
+avio_wl32(s->pb, (uint32_t)ctx->nb_blocks);
 return 0;
 }
 
-- 
2.25.4


___
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 v2 4/7] avformat/argo_asf: add ff_argo_asf_read()

2020-09-18 Thread Zane van Iperen
For the argo_brp demuxer.

Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 45 --
 libavformat/argo_asf.h |  2 ++
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 048e5441d6..0e9ccbd02f 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -144,6 +144,30 @@ int ff_argo_asf_fill_stream(AVStream *st, const 
ArgoASFFileHeader *fhdr,
 return 0;
 }
 
+int ff_argo_asf_read(AVIOContext *pb, AVStream *st, AVPacket *pkt,
+ const ArgoASFChunkHeader *ckhdr, uint32_t blocks_read)
+{
+int64_t ret;
+
+if (blocks_read >= ckhdr->num_blocks)
+return AVERROR_EOF;
+
+ret = av_get_packet(pb, pkt, st->codecpar->block_align *
+FFMIN(ASF_NB_BLOCKS, ckhdr->num_blocks - blocks_read));
+if (ret < 0)
+return ret;
+
+/* Something real screwy is going on. */
+if (ret % st->codecpar->block_align != 0)
+return AVERROR_INVALIDDATA;
+
+pkt->stream_index   = st->index;
+pkt->duration   = ckhdr->num_samples * (ret / 
st->codecpar->block_align);
+
+pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+return ret / st->codecpar->block_align;
+}
+
 #if CONFIG_ARGO_ASF_DEMUXER
 /*
  * Known versions:
@@ -215,29 +239,12 @@ static int argo_asf_read_header(AVFormatContext *s)
 static int argo_asf_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 ArgoASFDemuxContext *asf = s->priv_data;
-
-AVStream *st = s->streams[0];
-AVIOContext *pb = s->pb;
 int ret;
 
-if (asf->blocks_read >= asf->ckhdr.num_blocks)
-return AVERROR_EOF;
-
-ret = av_get_packet(pb, pkt, st->codecpar->block_align *
-FFMIN(ASF_NB_BLOCKS, asf->ckhdr.num_blocks - 
asf->blocks_read));
-if (ret < 0)
+if ((ret = ff_argo_asf_read(s->pb, s->streams[0], pkt, &asf->ckhdr, 
asf->blocks_read)) < 0)
 return ret;
 
-/* Something real screwy is going on. */
-if (ret % st->codecpar->block_align != 0)
-return AVERROR_INVALIDDATA;
-
-
-pkt->stream_index   = st->index;
-pkt->duration   = asf->ckhdr.num_samples * (ret / 
st->codecpar->block_align);
-asf->blocks_read   += (ret / st->codecpar->block_align);
-
-pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+asf->blocks_read += ret;
 return 0;
 }
 
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
index eb2669a63f..e676dfb882 100644
--- a/libavformat/argo_asf.h
+++ b/libavformat/argo_asf.h
@@ -67,5 +67,7 @@ int  ff_argo_asf_validate_file_header(AVFormatContext *s, 
const ArgoASFFileHeade
 void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t 
*buf);
 int  ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr,
  const ArgoASFChunkHeader *ckhdr);
+int  ff_argo_asf_read(AVIOContext *pb, AVStream *st, AVPacket *pkt,
+  const ArgoASFChunkHeader *ckhdr, uint32_t blocks_read);
 
 #endif /* AVFORMAT_ARGO_ASF_H */
-- 
2.25.4


___
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 v2 2/7] avcodec/adpcm_{psx, argo}: add missing indent

2020-09-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/adpcm.c | 86 +++---
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 14be1f4f88..4755308824 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1966,42 +1966,42 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 case AV_CODEC_ID_ADPCM_PSX:
 for (int block = 0; block < avpkt->size / FFMAX(avctx->block_align, 16 
* avctx->channels); block++) {
 int nb_samples_per_block = 28 * FFMAX(avctx->block_align, 16 * 
avctx->channels) / (16 * avctx->channels);
-for (channel = 0; channel < avctx->channels; channel++) {
-samples = samples_p[channel] + block * nb_samples_per_block;
-
-/* Read in every sample for this channel.  */
-for (i = 0; i < nb_samples_per_block / 28; i++) {
-int filter, shift, flag, byte;
-
-filter = bytestream2_get_byteu(&gb);
-shift  = filter & 0xf;
-filter = filter >> 4;
-if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table))
-return AVERROR_INVALIDDATA;
-flag   = bytestream2_get_byteu(&gb);
-
-/* Decode 28 samples.  */
-for (n = 0; n < 28; n++) {
-int sample = 0, scale;
-
-if (flag < 0x07) {
-if (n & 1) {
-scale = sign_extend(byte >> 4, 4);
-} else {
-byte  = bytestream2_get_byteu(&gb);
-scale = sign_extend(byte, 4);
+for (channel = 0; channel < avctx->channels; channel++) {
+samples = samples_p[channel] + block * nb_samples_per_block;
+
+/* Read in every sample for this channel.  */
+for (i = 0; i < nb_samples_per_block / 28; i++) {
+int filter, shift, flag, byte;
+
+filter = bytestream2_get_byteu(&gb);
+shift  = filter & 0xf;
+filter = filter >> 4;
+if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table))
+return AVERROR_INVALIDDATA;
+flag   = bytestream2_get_byteu(&gb);
+
+/* Decode 28 samples.  */
+for (n = 0; n < 28; n++) {
+int sample = 0, scale;
+
+if (flag < 0x07) {
+if (n & 1) {
+scale = sign_extend(byte >> 4, 4);
+} else {
+byte  = bytestream2_get_byteu(&gb);
+scale = sign_extend(byte, 4);
+}
+
+scale  = scale * (1 << 12);
+sample = (int)((scale >> shift) + 
(c->status[channel].sample1 * xa_adpcm_table[filter][0] + 
c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64);
 }
-
-scale  = scale * (1 << 12);
-sample = (int)((scale >> shift) + 
(c->status[channel].sample1 * xa_adpcm_table[filter][0] + 
c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64);
+*samples++ = av_clip_int16(sample);
+c->status[channel].sample2 = 
c->status[channel].sample1;
+c->status[channel].sample1 = sample;
 }
-*samples++ = av_clip_int16(sample);
-c->status[channel].sample2 = c->status[channel].sample1;
-c->status[channel].sample1 = sample;
 }
 }
 }
-}
 break;
 case AV_CODEC_ID_ADPCM_ARGO:
 /*
@@ -2022,23 +2022,23 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
  * They should be 0 initially.
  */
 for (int block = 0; block < avpkt->size / avctx->block_align; block++) 
{
-for (channel = 0; channel < avctx->channels; channel++) {
-int control, shift;
+for (channel = 0; channel < avctx->channels; channel++) {
+int control, shift;
 
-samples = samples_p[channel] + block * 32;
-cs = c->status + channel;
+samples = samples_p[channel] + block * 32;
+cs = c->status + channel;
 
-/* Get the control byte and decode the samples, 2 at a time. */
-control = bytestream2_get_byteu(&gb);
-shift = (control >> 4) + 2;
+/* Get the control byte and decode the samples, 2 at a time. */
+control = bytestream2_get_byteu(&gb);
+shift = (control >> 4) + 2;
 
-for (n = 0; n < 16; n++) {
-int sample = bytestream2_get_byteu(&gb);
-

[FFmpeg-devel] [PATCH v2 1/7] avcodec/adpcm_argo: support decoding multiple frames

2020-09-18 Thread Zane van Iperen
Increases decode speed significantly.

Signed-off-by: Zane van Iperen 
---
 libavcodec/adpcm.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index e409a3aa6a..14be1f4f88 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -181,7 +181,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
 c->vqa_version = AV_RL16(avctx->extradata);
 break;
 case AV_CODEC_ID_ADPCM_ARGO:
-if (avctx->bits_per_coded_sample != 4)
+if (avctx->bits_per_coded_sample != 4 || avctx->block_align != 17 * 
avctx->channels)
 return AVERROR_INVALIDDATA;
 break;
 case AV_CODEC_ID_ADPCM_ZORK:
@@ -745,11 +745,6 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
 return 0;
 nb_samples = 64;
 break;
-case AV_CODEC_ID_ADPCM_ARGO:
-if (buf_size < 17 * ch)
-return 0;
-nb_samples = 32;
-break;
 /* simple 4-bit adpcm */
 case AV_CODEC_ID_ADPCM_CT:
 case AV_CODEC_ID_ADPCM_IMA_APC:
@@ -922,6 +917,9 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
 case AV_CODEC_ID_ADPCM_PSX:
 nb_samples = buf_size / (16 * ch) * 28;
 break;
+case AV_CODEC_ID_ADPCM_ARGO:
+nb_samples = buf_size / avctx->block_align * 32;
+break;
 case AV_CODEC_ID_ADPCM_ZORK:
 nb_samples = buf_size / ch;
 break;
@@ -2023,22 +2021,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
  * Each block relies on the previous two samples of each channel.
  * They should be 0 initially.
  */
+for (int block = 0; block < avpkt->size / avctx->block_align; block++) 
{
 for (channel = 0; channel < avctx->channels; channel++) {
 int control, shift;
 
-samples = samples_p[channel];
+samples = samples_p[channel] + block * 32;
 cs = c->status + channel;
 
 /* Get the control byte and decode the samples, 2 at a time. */
 control = bytestream2_get_byteu(&gb);
 shift = (control >> 4) + 2;
 
-for (n = 0; n < nb_samples / 2; n++) {
+for (n = 0; n < 16; n++) {
 int sample = bytestream2_get_byteu(&gb);
 *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 4, 
shift, control & 0x04);
 *samples++ = ff_adpcm_argo_expand_nibble(cs, sample >> 0, 
shift, control & 0x04);
 }
 }
+}
 break;
 case AV_CODEC_ID_ADPCM_ZORK:
 if (!c->has_status) {
-- 
2.25.4


___
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 v2 0/7] Support variable frame sizes in adpcm_argo

2020-09-18 Thread Zane van Iperen
v2:
 - handle variable sizes in muxer (argo_asf)
 - fix incorrect pts tracking (argo_brp)
 - add test for decoding argo_asf via argo_brp

Test sample is https://0x0.st/iIhK.BRP, needs to go in
fate-suite/argo-brp/CROCLOGO_CUT.BRP.

Original email to samples-requ...@ffmpeg.org was bounced.

Zane van Iperen (7):
  avcodec/adpcm_argo: support decoding multiple frames
  avcodec/adpcm_{psx,argo}: add missing indent
  avformat/argo_asf: read/write multiple blocks at once
  avformat/argo_asf: add ff_argo_asf_read()
  avformat/argo_brp: support reading multiple ASF blocks at once
  avformat/argo_brp: remove usage of floats
  fate: add argo_adpcm via argo_brp demux test

 libavcodec/adpcm.c| 96 +--
 libavformat/argo_asf.c| 63 ---
 libavformat/argo_asf.h|  2 +
 libavformat/argo_brp.c| 34 +++--
 tests/fate/adpcm.mak  |  3 ++
 tests/ref/fate/adpcm-argo-brp |  1 +
 6 files changed, 117 insertions(+), 82 deletions(-)
 create mode 100644 tests/ref/fate/adpcm-argo-brp

-- 
2.25.4


___
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/adxdec: demux multiple blocks at once

2020-09-18 Thread Paul B Mahol
On Fri, Sep 18, 2020 at 12:29:41PM +0200, Andreas Rheinhardt wrote:
> Paul B Mahol:
> > On Fri, Sep 18, 2020 at 12:16:18PM +0200, Andreas Rheinhardt wrote:
> >> Paul B Mahol:
> >>> Improves decoding speed by 24x
> >>>
> >>> Signed-off-by: Paul B Mahol 
> >>> ---
> >>>  libavformat/adxdec.c | 23 +++
> >>>  1 file changed, 15 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
> >>> index ccd5049acd..0e4c251cfc 100644
> >>> --- a/libavformat/adxdec.c
> >>> +++ b/libavformat/adxdec.c
> >>> @@ -53,6 +53,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
> >>> *pkt)
> >>>  AVCodecParameters *par = s->streams[0]->codecpar;
> >>>  int ret, size;
> >>>  
> >>> +if (avio_feof(s->pb))
> >>> +return AVERROR_EOF;
> >>> +
> >>>  if (par->channels <= 0) {
> >>>  av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", 
> >>> par->channels);
> >>>  return AVERROR_INVALIDDATA;
> >>> @@ -63,16 +66,20 @@ static int adx_read_packet(AVFormatContext *s, 
> >>> AVPacket *pkt)
> >>>  pkt->pos = avio_tell(s->pb);
> >>>  pkt->stream_index = 0;
> >>>  
> >>> -ret = av_get_packet(s->pb, pkt, size);
> >>> -if (ret != size) {
> >>> -return ret < 0 ? ret : AVERROR(EIO);
> >>> -}
> >>> -if (AV_RB16(pkt->data) & 0x8000) {
> >>> -return AVERROR_EOF;
> >>> +ret = av_get_packet(s->pb, pkt, size * 128);
> >>> +if (ret < 0)
> >>> +return ret;
> >>> +if ((ret % size) && ret >= size) {
> >>
> >> So if ret < size you don't set the corrupt flag. Why?
> > 
> > Because data, that is not gonna be used at all, is discarded, instead of
> > pointlessly being passed to decoder and there errored out.
> > This happens at every single eof.
> > 
> 
> But you don't return an error if the return value is in the range
> 0..size - 1; you return the packet with the incomplete and apparently
> useless packet.

I fixed that locally too.

> 
> >>
> >>> +size = ret - (ret % size);
> >>> +av_shrink_packet(pkt, size);
> >>> +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> >>> +} else {
> >>> +size = ret;
> >>>  }
> >>> +
> >>>  pkt->size = size;
> >>
> >> This line makes no sense any more: If the first branch above is taken,
> >> av_shrink_packet() will already set the size; in the other branch,
> >> av_get_packet() already did.
> > 
> > Removed that line locally.
> > 
> >>
> >>> -pkt->duration = 1;
> >>> -pkt->pts  = (pkt->pos - c->header_size) / size;
> >>> +pkt->duration = size / (BLOCK_SIZE * par->channels);
> >>> +pkt->pts  = (pkt->pos - c->header_size) / (BLOCK_SIZE * 
> >>> par->channels);
> >>>  
> >>>  return 0;
> >>>  }
> >>>
> >>
> >> ___
> >> 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".
___
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] Revert "avcodec/vlc: Add macro for ff_init_vlc_sparse()"

2020-09-18 Thread Andreas Rheinhardt
Hendrik Leppkes:
> On Fri, Sep 18, 2020 at 8:25 AM Andreas Rheinhardt
>  wrote:
>>
>> This reverts commit 61669b7c40b8dc3a0841768fb39c7567513b7cfc.
>>
>> This commit broke building with MSVC due to its spec-incompliant handling
>> of ',' in __VA_ARGS__: These are not treated as argument separators for
>> further macros, so that in our case the init_vlc2() macro is treated as
>> having only one argument whenever the init_vlc() macro is used. See [1]
>> for further details.
>>
>> [1]: https://reviews.llvm.org/D69626
>>
> 
> The new preprocessor mentioned in the llvm report is now officially
> available in VS2019 (ie. no longer experimental), but its opt-in to
> not break old code, and of course we want to support older versions as
> well for the time being, so reverting this is probably the only
> realistic option.
> 
> LGTM.
> 
> - Hendrik

Thanks, applied.

- 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] avformat/adxdec: demux multiple blocks at once

2020-09-18 Thread Andreas Rheinhardt
Paul B Mahol:
> On Fri, Sep 18, 2020 at 12:16:18PM +0200, Andreas Rheinhardt wrote:
>> Paul B Mahol:
>>> Improves decoding speed by 24x
>>>
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavformat/adxdec.c | 23 +++
>>>  1 file changed, 15 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
>>> index ccd5049acd..0e4c251cfc 100644
>>> --- a/libavformat/adxdec.c
>>> +++ b/libavformat/adxdec.c
>>> @@ -53,6 +53,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
>>> *pkt)
>>>  AVCodecParameters *par = s->streams[0]->codecpar;
>>>  int ret, size;
>>>  
>>> +if (avio_feof(s->pb))
>>> +return AVERROR_EOF;
>>> +
>>>  if (par->channels <= 0) {
>>>  av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", 
>>> par->channels);
>>>  return AVERROR_INVALIDDATA;
>>> @@ -63,16 +66,20 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
>>> *pkt)
>>>  pkt->pos = avio_tell(s->pb);
>>>  pkt->stream_index = 0;
>>>  
>>> -ret = av_get_packet(s->pb, pkt, size);
>>> -if (ret != size) {
>>> -return ret < 0 ? ret : AVERROR(EIO);
>>> -}
>>> -if (AV_RB16(pkt->data) & 0x8000) {
>>> -return AVERROR_EOF;
>>> +ret = av_get_packet(s->pb, pkt, size * 128);
>>> +if (ret < 0)
>>> +return ret;
>>> +if ((ret % size) && ret >= size) {
>>
>> So if ret < size you don't set the corrupt flag. Why?
> 
> Because data, that is not gonna be used at all, is discarded, instead of
> pointlessly being passed to decoder and there errored out.
> This happens at every single eof.
> 

But you don't return an error if the return value is in the range
0..size - 1; you return the packet with the incomplete and apparently
useless packet.

>>
>>> +size = ret - (ret % size);
>>> +av_shrink_packet(pkt, size);
>>> +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
>>> +} else {
>>> +size = ret;
>>>  }
>>> +
>>>  pkt->size = size;
>>
>> This line makes no sense any more: If the first branch above is taken,
>> av_shrink_packet() will already set the size; in the other branch,
>> av_get_packet() already did.
> 
> Removed that line locally.
> 
>>
>>> -pkt->duration = 1;
>>> -pkt->pts  = (pkt->pos - c->header_size) / size;
>>> +pkt->duration = size / (BLOCK_SIZE * par->channels);
>>> +pkt->pts  = (pkt->pos - c->header_size) / (BLOCK_SIZE * 
>>> par->channels);
>>>  
>>>  return 0;
>>>  }
>>>
>>
>> ___
>> 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] avformat/adxdec: demux multiple blocks at once

2020-09-18 Thread Paul B Mahol
On Fri, Sep 18, 2020 at 12:16:18PM +0200, Andreas Rheinhardt wrote:
> Paul B Mahol:
> > Improves decoding speed by 24x
> > 
> > Signed-off-by: Paul B Mahol 
> > ---
> >  libavformat/adxdec.c | 23 +++
> >  1 file changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
> > index ccd5049acd..0e4c251cfc 100644
> > --- a/libavformat/adxdec.c
> > +++ b/libavformat/adxdec.c
> > @@ -53,6 +53,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
> > *pkt)
> >  AVCodecParameters *par = s->streams[0]->codecpar;
> >  int ret, size;
> >  
> > +if (avio_feof(s->pb))
> > +return AVERROR_EOF;
> > +
> >  if (par->channels <= 0) {
> >  av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", 
> > par->channels);
> >  return AVERROR_INVALIDDATA;
> > @@ -63,16 +66,20 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
> > *pkt)
> >  pkt->pos = avio_tell(s->pb);
> >  pkt->stream_index = 0;
> >  
> > -ret = av_get_packet(s->pb, pkt, size);
> > -if (ret != size) {
> > -return ret < 0 ? ret : AVERROR(EIO);
> > -}
> > -if (AV_RB16(pkt->data) & 0x8000) {
> > -return AVERROR_EOF;
> > +ret = av_get_packet(s->pb, pkt, size * 128);
> > +if (ret < 0)
> > +return ret;
> > +if ((ret % size) && ret >= size) {
> 
> So if ret < size you don't set the corrupt flag. Why?

Because data, that is not gonna be used at all, is discarded, instead of
pointlessly being passed to decoder and there errored out.
This happens at every single eof.

> 
> > +size = ret - (ret % size);
> > +av_shrink_packet(pkt, size);
> > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > +} else {
> > +size = ret;
> >  }
> > +
> >  pkt->size = size;
> 
> This line makes no sense any more: If the first branch above is taken,
> av_shrink_packet() will already set the size; in the other branch,
> av_get_packet() already did.

Removed that line locally.

> 
> > -pkt->duration = 1;
> > -pkt->pts  = (pkt->pos - c->header_size) / size;
> > +pkt->duration = size / (BLOCK_SIZE * par->channels);
> > +pkt->pts  = (pkt->pos - c->header_size) / (BLOCK_SIZE * 
> > par->channels);
> >  
> >  return 0;
> >  }
> > 
> 
> ___
> 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] Added V210 codec support to MXF encoder

2020-09-18 Thread Swami Kevala
Verified the container_ui and element_ui with a sample file produced by
Sony Server  1.3.0.0.1 (Sony MXF Development Kit (Win32) 4.9.1.118.1)

Tested converting an ffv1/mkv to v210/mxf successfully


Signed-off-by: Swami Kevala 
---
 libavformat/mxfenc.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index cbb0fc5..32e5ffa 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -123,6 +123,7 @@ enum ULIndex {
 INDEX_DV,
 INDEX_DNXHD,
 INDEX_JPEG2000,
+INDEX_V210,
 INDEX_H264,
 INDEX_S436M,
 INDEX_PRORES,
@@ -138,6 +139,7 @@ static const struct {
 { AV_CODEC_ID_DVVIDEO,INDEX_DV },
 { AV_CODEC_ID_DNXHD,  INDEX_DNXHD },
 { AV_CODEC_ID_JPEG2000,   INDEX_JPEG2000 },
+{ AV_CODEC_ID_V210,   INDEX_V210 },
 { AV_CODEC_ID_H264,   INDEX_H264 },
 { AV_CODEC_ID_PRORES, INDEX_PRORES },
 { AV_CODEC_ID_NONE }
@@ -189,6 +191,11 @@ static const MXFContainerEssenceEntry
mxf_essence_container_uls[] = {
   {
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x15,0x01,0x08,0x00
},
   {
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x04,0x01,0x02,0x02,0x03,0x01,0x01,0x00
},
   mxf_write_cdci_desc },
+// V210
+{ {
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x05,0x01,0x05
},
+  {
0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x02,0x00
},
+  {
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x02,0x01
},
+  mxf_write_cdci_desc },
 // H.264
 { {
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0a,0x0D,0x01,0x03,0x01,0x02,0x10,0x60,0x01
},
   {
0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00
},
--
1.8.3.1
-- 
Swami Kevala -- http://www.ishafoundation.org

___
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] avformat/adxdec: demux multiple blocks at once

2020-09-18 Thread Paul B Mahol
Improves decoding speed by 24x

Signed-off-by: Paul B Mahol 
---
 libavformat/adxdec.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index ccd5049acd..0e4c251cfc 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -53,6 +53,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
 AVCodecParameters *par = s->streams[0]->codecpar;
 int ret, size;
 
+if (avio_feof(s->pb))
+return AVERROR_EOF;
+
 if (par->channels <= 0) {
 av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", 
par->channels);
 return AVERROR_INVALIDDATA;
@@ -63,16 +66,20 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 pkt->pos = avio_tell(s->pb);
 pkt->stream_index = 0;
 
-ret = av_get_packet(s->pb, pkt, size);
-if (ret != size) {
-return ret < 0 ? ret : AVERROR(EIO);
-}
-if (AV_RB16(pkt->data) & 0x8000) {
-return AVERROR_EOF;
+ret = av_get_packet(s->pb, pkt, size * 128);
+if (ret < 0)
+return ret;
+if ((ret % size) && ret >= size) {
+size = ret - (ret % size);
+av_shrink_packet(pkt, size);
+pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+} else {
+size = ret;
 }
+
 pkt->size = size;
-pkt->duration = 1;
-pkt->pts  = (pkt->pos - c->header_size) / size;
+pkt->duration = size / (BLOCK_SIZE * par->channels);
+pkt->pts  = (pkt->pos - c->header_size) / (BLOCK_SIZE * par->channels);
 
 return 0;
 }
-- 
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] avformat/adxdec: demux multiple blocks at once

2020-09-18 Thread Andreas Rheinhardt
Paul B Mahol:
> Improves decoding speed by 24x
> 
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/adxdec.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
> index ccd5049acd..0e4c251cfc 100644
> --- a/libavformat/adxdec.c
> +++ b/libavformat/adxdec.c
> @@ -53,6 +53,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  AVCodecParameters *par = s->streams[0]->codecpar;
>  int ret, size;
>  
> +if (avio_feof(s->pb))
> +return AVERROR_EOF;
> +
>  if (par->channels <= 0) {
>  av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", 
> par->channels);
>  return AVERROR_INVALIDDATA;
> @@ -63,16 +66,20 @@ static int adx_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  pkt->pos = avio_tell(s->pb);
>  pkt->stream_index = 0;
>  
> -ret = av_get_packet(s->pb, pkt, size);
> -if (ret != size) {
> -return ret < 0 ? ret : AVERROR(EIO);
> -}
> -if (AV_RB16(pkt->data) & 0x8000) {
> -return AVERROR_EOF;
> +ret = av_get_packet(s->pb, pkt, size * 128);
> +if (ret < 0)
> +return ret;
> +if ((ret % size) && ret >= size) {

So if ret < size you don't set the corrupt flag. Why?

> +size = ret - (ret % size);
> +av_shrink_packet(pkt, size);
> +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> +} else {
> +size = ret;
>  }
> +
>  pkt->size = size;

This line makes no sense any more: If the first branch above is taken,
av_shrink_packet() will already set the size; in the other branch,
av_get_packet() already did.

> -pkt->duration = 1;
> -pkt->pts  = (pkt->pos - c->header_size) / size;
> +pkt->duration = size / (BLOCK_SIZE * par->channels);
> +pkt->pts  = (pkt->pos - c->header_size) / (BLOCK_SIZE * 
> par->channels);
>  
>  return 0;
>  }
> 

___
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] Revert "avcodec/vlc: Add macro for ff_init_vlc_sparse()"

2020-09-18 Thread Hendrik Leppkes
On Fri, Sep 18, 2020 at 8:25 AM Andreas Rheinhardt
 wrote:
>
> This reverts commit 61669b7c40b8dc3a0841768fb39c7567513b7cfc.
>
> This commit broke building with MSVC due to its spec-incompliant handling
> of ',' in __VA_ARGS__: These are not treated as argument separators for
> further macros, so that in our case the init_vlc2() macro is treated as
> having only one argument whenever the init_vlc() macro is used. See [1]
> for further details.
>
> [1]: https://reviews.llvm.org/D69626
>

The new preprocessor mentioned in the llvm report is now officially
available in VS2019 (ie. no longer experimental), but its opt-in to
not break old code, and of course we want to support older versions as
well for the time being, so reverting this is probably the only
realistic option.

LGTM.

- Hendrik
___
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] opusdec: do not fail when LBRR frames are present

2020-09-18 Thread Paul B Mahol
On Fri, Sep 11, 2020 at 07:37:14PM +0200, Anton Khirnov wrote:
> Decode and discard them.
> 
> Fixes ticket 4641.
> ---
>  libavcodec/opus_silk.c | 28 
>  libavcodec/opustab.c   |  3 +++
>  libavcodec/opustab.h   |  3 +++
>  3 files changed, 26 insertions(+), 8 deletions(-)
> 

looks fine.
___
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/3] avdevice/lavfi: av_malloc -> av_malloc_array

2020-09-18 Thread Paul B Mahol
On Fri, Sep 18, 2020 at 09:04:26AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavdevice/lavfi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


lgtm

> 
> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
> index a4b510f..ff0be64 100644
> --- a/libavdevice/lavfi.c
> +++ b/libavdevice/lavfi.c
> @@ -69,7 +69,7 @@ static int *create_all_formats(int n)
>  count++;
>  }
>  
> -if (!(fmts = av_malloc((count+1) * sizeof(int
> +if (!(fmts = av_malloc_array(count + 1, sizeof(*fmts
>  return NULL;
>  for (j = 0, i = 0; i < n; i++) {
>  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
> -- 
> 1.8.3.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".

Re: [FFmpeg-devel] [PATCH 4/4] dnn: add a new interface DNNModel.get_output

2020-09-18 Thread Guo, Yejun


> -Original Message-
> From: Guo, Yejun 
> Sent: 2020年9月14日 14:29
> To: ffmpeg-devel@ffmpeg.org
> Cc: Guo, Yejun 
> Subject: [PATCH 4/4] dnn: add a new interface DNNModel.get_output
> 
> for some cases (for example, super resolution), the DNN model changes the
> frame size which impacts the filter behavior, so the filter needs to know the 
> out
> frame size at very beginning.
> 
> Currently, the filter reuses DNNModule.execute_model to query the out frame
> size, it is not clear from interface perspective, so add a new explict 
> interface
> DNNModel.get_output for such query.
> 
> Signed-off-by: Guo, Yejun 
> ---
>  libavfilter/dnn/dnn_backend_native.c   | 66 ++
>  libavfilter/dnn/dnn_backend_openvino.c | 66 ++
>  libavfilter/dnn/dnn_backend_tf.c   | 66 ++
>  libavfilter/dnn_interface.h|  3 ++
>  libavfilter/vf_dnn_processing.c| 17 ++-
>  libavfilter/vf_sr.c| 25 --
>  6 files changed, 185 insertions(+), 58 deletions(-)
will push next Monday if no other comments, 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".