Re: [FFmpeg-devel] [PATCH v3 1/4] avformat/movenc: fix assert failure in get_cluster_duration()

2022-02-26 Thread Gyan Doshi



On 2022-02-27 12:04 pm, "zhilizhao(赵志立)" wrote:

Ping.


On Dec 31, 2021, at 7:36 PM, Zhao Zhili  wrote:

When editlist is disabled, the workaournd method of shift dts to
zero and increase the first sample duration doesn't work if the
timestamp is larger than mp4 spec restriction (e.g., sample_delta
in stts entry). Further more, it triggers get_cluster_duration()
assert failure. This patch will drop large offsets between
multiple tracks.
---
libavformat/movenc.c | 13 -
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f912dd012..f5bb785b01 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5917,7 +5917,18 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
*pkt)
  * to signal the difference in starting time without an edit list.
  * Thus move the timestamp for this first sample to 0, increasing
  * its duration instead. */
-trk->cluster[trk->entry].dts = trk->start_dts = 0;
+if (pkt->dts + pkt->duration <= INT32_MAX) {
+trk->cluster[trk->entry].dts = trk->start_dts = 0;
+} else {
+/* Impossible to write a sample duration >= UINT32_MAX.


As per 14496-12 (2005), sample_delta is stored as

unsigned int(32) sample_delta;

The only restriction is that no delta shall be zero except the last 
sample, which means UINT32_MAX  is allowed.
INT32_MAX had been set as max allowed delta in mov.c since inception. 
See my recent changes in mov.c correcting that.


Will this patch break remuxing of files with large deltas?
Let's not clamp if the spec does not call for it.

Regards,
Gyan
___
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 1/4] avformat/movenc: fix assert failure in get_cluster_duration()

2022-02-26 Thread zhilizhao(赵志立)
Ping.

> On Dec 31, 2021, at 7:36 PM, Zhao Zhili  wrote:
> 
> When editlist is disabled, the workaournd method of shift dts to
> zero and increase the first sample duration doesn't work if the
> timestamp is larger than mp4 spec restriction (e.g., sample_delta
> in stts entry). Further more, it triggers get_cluster_duration()
> assert failure. This patch will drop large offsets between
> multiple tracks.
> ---
> libavformat/movenc.c | 13 -
> 1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 0f912dd012..f5bb785b01 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5917,7 +5917,18 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  * to signal the difference in starting time without an edit list.
>  * Thus move the timestamp for this first sample to 0, increasing
>  * its duration instead. */
> -trk->cluster[trk->entry].dts = trk->start_dts = 0;
> +if (pkt->dts + pkt->duration <= INT32_MAX) {
> +trk->cluster[trk->entry].dts = trk->start_dts = 0;
> +} else {
> +/* Impossible to write a sample duration >= UINT32_MAX.
> + * Use INT32_MAX as a tight restriction.
> + */
> +trk->start_dts = pkt->dts;
> +av_log(s, AV_LOG_WARNING,
> +   "Track %d starts with a nonzero dts %" PRId64
> +   " which will be shifted to zero\n",
> +   pkt->stream_index, pkt->dts);
> +}
> }
> if (trk->start_dts == AV_NOPTS_VALUE) {
> trk->start_dts = pkt->dts;
> -- 
> 2.31.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 v3 1/2] libavcodec: Added DFPWM1a codec

2022-02-26 Thread James Almer

On 2/26/2022 8:26 PM, Jack Bruienne wrote:


 From the wiki page (https://wiki.vexatos.com/dfpwm):

DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec
created by Ben “GreaseMonkey” Russell in 2012, originally to be used
as a voice codec for asiekierka's pixmess, a C remake of 64pixels.
It is a 1-bit-per-sample codec which uses a dynamic-strength one-pole
low-pass filter as a predictor. Due to the fact that a raw DPFWM decoding
creates a high-pitched whine, it is often followed by some 
post-processing

filters to make the stream more listenable.


It has recently gained popularity through the ComputerCraft mod for
Minecraft, which added support for audio through this codec, as well as
the Computronics expansion which preceeded the official support. These
both implement the slightly adjusted 1a version of the codec, which is
the version I have chosen for this patch.

This patch adds a new codec (with encoding and decoding) for DFPWM1a.

The codec sources are pretty simple: they use the reference codec with
a basic wrapper to connect it to the FFmpeg AVCodec system.

This patch will be highly useful to ComputerCraft developers who are
working with audio, as it is the standard format for audio, and there
are few user-friendly encoders out there. It will streamline the process
for importing audio, replacing the need to write code or use tools that
require very specific input formats.

You may use the CraftOS-PC program (https://www.craftos-pc.cc) to test
out DFPWM playback. To use it, run the program and type this command:
"attach left speaker" Then run "speaker play " for each file.
The app runs in a sandbox, so files have to be transferred in first;
the easiest way to do this is to simply drag the file on the window.
(Or copy files to the folder at https://www.craftos-pc.cc/docs/saves.)

Sample DFPWM files can be generated with an online tool at
https://music.madefor.cc. This is the current best way to encode DFPWM
files. Simply drag an audio file onto the page, and it will encode it,
giving a download link on the page.

I've made sure to update all of the docs as per Developer§7, and I've
tested it as per section 8. Test files encoded to DFPWM play correctly
in ComputerCraft, and other files that work in CC are correctly decoded.
I have also verified that corrupt files do not crash the decoder - this
should theoretically not be an issue as the result size is constant with
respect to the input size.

Changes since the prior v2 patch:
I've found that the reference encoder has a few errors, and sounds
worse than the Java-based implementation that is used most often. I got
in contact with someone who knows DFPWM much better than I do, and I
worked with them to make a few adjustments that should improve the
audio quality. I also made sure that the output matches the Java
codec exactly, so it should have the exact same quality as other codecs.

Signed-off-by: Jack Bruienne 
---
  Changelog |   1 +
  MAINTAINERS   |   1 +
  doc/general_contents.texi |   1 +
  libavcodec/Makefile   |   2 +
  libavcodec/allcodecs.c    |   2 +
  libavcodec/codec_desc.c   |   7 +++
  libavcodec/codec_id.h |   1 +
  libavcodec/dfpwmdec.c | 129 ++
  libavcodec/dfpwmenc.c | 123 
  libavcodec/utils.c    |   2 +
  libavcodec/version.h  |   2 +-
  11 files changed, 270 insertions(+), 1 deletion(-)
  create mode 100644 libavcodec/dfpwmdec.c
  create mode 100644 libavcodec/dfpwmenc.c



diff --git a/Changelog b/Changelog
index 5ad2cef..5170a6a 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version 5.1:
 - dialogue enhance audio filter
 - dropped obsolete XvMC hwaccel
+- DFPWM audio encoder/decoder
 
 
 version 5.0:

diff --git a/MAINTAINERS b/MAINTAINERS
index f33ccbd..57b6f33 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -161,6 +161,7 @@ Codecs:
   cscd.cReimar Doeffinger
   cuviddec.cTimo Rothenpieler
   dca*  foo86
+  dfpwm*Jack Bruienne
   dirac*Rostislav Pehlivanov
   dnxhd*Baptiste Coudurier
   dolby_e*  foo86
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index df1692c..14aeaed 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -1194,6 +1194,7 @@ following image formats are supported:
 @item CRI HCA@tab @tab X
 @item Delphine Software International CIN audio  @tab @tab  X
 @tab Codec used in Delphine Software International games.
+@item DFPWM  @tab  X  @tab  X
 @item Digital Speech Standard - Standard Play mode (DSS SP) @tab @tab  X
 @item Discworld II BMV Audio @tab @tab  X
 @item COOK   @tab @tab  X
diff --git 

[FFmpeg-devel] [PATCH] avformat/av1: support av1C extradata in ff_av1_parse_seq_header()

2022-02-26 Thread James Almer
Fixes dash manifest creation for av1 streams with av1C formatted extradata.

Signed-off-by: James Almer 
---
 libavformat/av1.c | 35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/libavformat/av1.c b/libavformat/av1.c
index 1fcfac2356..7771c09b4a 100644
--- a/libavformat/av1.c
+++ b/libavformat/av1.c
@@ -335,10 +335,43 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, 
const uint8_t *buf, int
 {
 int64_t obu_size;
 int start_pos, type, temporal_id, spatial_id;
+int is_av1c;
 
 if (size <= 0)
 return AVERROR_INVALIDDATA;
 
+is_av1c = !!(buf[0] & 0x80);
+if (is_av1c) {
+GetBitContext gb;
+int ret, version = buf[0] & 0x7F;
+
+if (version != 1 || size < 4)
+return AVERROR_INVALIDDATA;
+
+ret = init_get_bits8(, buf, 4);
+if (ret < 0)
+return ret;
+
+memset(seq, 0, sizeof(*seq));
+
+skip_bits(, 8);
+seq->profile= get_bits(, 3);
+seq->level  = get_bits(, 5);
+seq->tier   = get_bits(, 1);
+seq->bitdepth   = get_bits(, 1) * 2 + 8;
+seq->bitdepth  += get_bits(, 1) * 2;
+seq->monochrome   = get_bits(, 1);
+seq->chroma_subsampling_x = get_bits(, 1);
+seq->chroma_subsampling_y = get_bits(, 1);
+seq->chroma_sample_position   = get_bits(, 2);
+seq->color_primaries  = AVCOL_PRI_UNSPECIFIED;
+seq->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
+seq->matrix_coefficients  = AVCOL_SPC_UNSPECIFIED;
+
+size -= 4;
+buf  += 4;
+}
+
 while (size > 0) {
 int len = parse_obu_header(buf, size, _size, _pos,
, _id, _id);
@@ -358,7 +391,7 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, 
const uint8_t *buf, int
 buf  += len;
 }
 
-return AVERROR_INVALIDDATA;
+return is_av1c ? 0 : AVERROR_INVALIDDATA;
 }
 
 int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
-- 
2.35.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 v3 1/2] libavcodec: Added DFPWM1a codec

2022-02-26 Thread Jack Bruienne


From the wiki page (https://wiki.vexatos.com/dfpwm):

DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec
created by Ben “GreaseMonkey” Russell in 2012, originally to be used
as a voice codec for asiekierka's pixmess, a C remake of 64pixels.
It is a 1-bit-per-sample codec which uses a dynamic-strength one-pole
low-pass filter as a predictor. Due to the fact that a raw DPFWM decoding
creates a high-pitched whine, it is often followed by some post-processing
filters to make the stream more listenable.


It has recently gained popularity through the ComputerCraft mod for
Minecraft, which added support for audio through this codec, as well as
the Computronics expansion which preceeded the official support. These
both implement the slightly adjusted 1a version of the codec, which is
the version I have chosen for this patch.

This patch adds a new codec (with encoding and decoding) for DFPWM1a.

The codec sources are pretty simple: they use the reference codec with
a basic wrapper to connect it to the FFmpeg AVCodec system.

This patch will be highly useful to ComputerCraft developers who are
working with audio, as it is the standard format for audio, and there
are few user-friendly encoders out there. It will streamline the process
for importing audio, replacing the need to write code or use tools that
require very specific input formats.

You may use the CraftOS-PC program (https://www.craftos-pc.cc) to test
out DFPWM playback. To use it, run the program and type this command:
"attach left speaker" Then run "speaker play " for each file.
The app runs in a sandbox, so files have to be transferred in first;
the easiest way to do this is to simply drag the file on the window.
(Or copy files to the folder at https://www.craftos-pc.cc/docs/saves.)

Sample DFPWM files can be generated with an online tool at
https://music.madefor.cc. This is the current best way to encode DFPWM
files. Simply drag an audio file onto the page, and it will encode it,
giving a download link on the page.

I've made sure to update all of the docs as per Developer§7, and I've
tested it as per section 8. Test files encoded to DFPWM play correctly
in ComputerCraft, and other files that work in CC are correctly decoded.
I have also verified that corrupt files do not crash the decoder - this
should theoretically not be an issue as the result size is constant with
respect to the input size.

Changes since the prior v2 patch:
I've found that the reference encoder has a few errors, and sounds
worse than the Java-based implementation that is used most often. I got
in contact with someone who knows DFPWM much better than I do, and I
worked with them to make a few adjustments that should improve the
audio quality. I also made sure that the output matches the Java
codec exactly, so it should have the exact same quality as other codecs.

Signed-off-by: Jack Bruienne 
---
 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/general_contents.texi |   1 +
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/codec_desc.c   |   7 +++
 libavcodec/codec_id.h |   1 +
 libavcodec/dfpwmdec.c | 129 ++
 libavcodec/dfpwmenc.c | 123 
 libavcodec/utils.c|   2 +
 libavcodec/version.h  |   2 +-
 11 files changed, 270 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/dfpwmdec.c
 create mode 100644 libavcodec/dfpwmenc.c

diff --git a/Changelog b/Changelog
index 5ad2cef..5170a6a 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version 5.1:
 - dialogue enhance audio filter
 - dropped obsolete XvMC hwaccel
+- DFPWM audio encoder/decoder
 
 
 version 5.0:
diff --git a/MAINTAINERS b/MAINTAINERS
index f33ccbd..57b6f33 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -161,6 +161,7 @@ Codecs:
   cscd.cReimar Doeffinger
   cuviddec.cTimo Rothenpieler
   dca*  foo86
+  dfpwm*Jack Bruienne
   dirac*Rostislav Pehlivanov
   dnxhd*Baptiste Coudurier
   dolby_e*  foo86
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index df1692c..14aeaed 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -1194,6 +1194,7 @@ following image formats are supported:
 @item CRI HCA@tab @tab X
 @item Delphine Software International CIN audio  @tab @tab  X
 @tab Codec used in Delphine Software International games.
+@item DFPWM  @tab  X  @tab  X
 @item Digital Speech Standard - Standard Play mode (DSS SP) @tab @tab  X
 @item Discworld II BMV Audio @tab @tab  X
 @item COOK   @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6076b4a..7474220 100644

[FFmpeg-devel] [PATCH 2/2] avcodec: add pcm-bluray encoder

2022-02-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/pcm-blurayenc.c | 291 +
 3 files changed, 293 insertions(+)
 create mode 100644 libavcodec/pcm-blurayenc.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6076b4ad80..e34a9ae862 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -800,6 +800,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER)+= zmbvenc.o
 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
 OBJS-$(CONFIG_PCM_ALAW_ENCODER)   += pcm.o
+OBJS-$(CONFIG_PCM_BLURAY_ENCODER) += pcm-blurayenc.o
 OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
 OBJS-$(CONFIG_PCM_DVD_DECODER)+= pcm-dvd.o
 OBJS-$(CONFIG_PCM_DVD_ENCODER)+= pcm-dvdenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d1e10197de..1be67e3ec3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -531,6 +531,7 @@ extern const AVCodec ff_xma2_decoder;
 /* PCM codecs */
 extern const AVCodec ff_pcm_alaw_encoder;
 extern const AVCodec ff_pcm_alaw_decoder;
+extern const AVCodec ff_pcm_bluray_encoder;
 extern const AVCodec ff_pcm_bluray_decoder;
 extern const AVCodec ff_pcm_dvd_encoder;
 extern const AVCodec ff_pcm_dvd_decoder;
diff --git a/libavcodec/pcm-blurayenc.c b/libavcodec/pcm-blurayenc.c
new file mode 100644
index 00..9201ad9690
--- /dev/null
+++ b/libavcodec/pcm-blurayenc.c
@@ -0,0 +1,291 @@
+/*
+ * LPCM codecs for PCM formats found in Blu-ray m2ts streams
+ *
+ * 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 "libavutil/channel_layout.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "encode.h"
+#include "internal.h"
+
+typedef struct BlurayPCMEncContext {
+uint16_t header;  // Header added to every frame
+} BlurayPCMEncContext;
+
+static av_cold int pcm_bluray_encode_init(AVCodecContext *avctx)
+{
+BlurayPCMEncContext *s = avctx->priv_data;
+uint8_t ch_layout;
+int quant, freq;
+
+switch (avctx->sample_rate) {
+case 48000:
+freq = 1;
+break;
+case 96000:
+freq = 4;
+break;
+case 192000:
+freq = 5;
+break;
+}
+
+switch (avctx->sample_fmt) {
+case AV_SAMPLE_FMT_S16:
+avctx->bits_per_coded_sample = 16;
+quant = 1;
+break;
+case AV_SAMPLE_FMT_S32:
+avctx->bits_per_coded_sample = 24;
+quant = 3;
+break;
+}
+
+switch (avctx->channel_layout) {
+case AV_CH_LAYOUT_MONO:
+ch_layout = 1;
+break;
+case AV_CH_LAYOUT_STEREO:
+ch_layout = 3;
+break;
+case AV_CH_LAYOUT_SURROUND:
+ch_layout = 4;
+break;
+case AV_CH_LAYOUT_2_1:
+ch_layout = 5;
+break;
+case AV_CH_LAYOUT_4POINT0:
+ch_layout = 6;
+break;
+case AV_CH_LAYOUT_2_2:
+ch_layout = 7;
+break;
+case AV_CH_LAYOUT_5POINT0:
+ch_layout = 8;
+break;
+case AV_CH_LAYOUT_5POINT1:
+ch_layout = 9;
+break;
+case AV_CH_LAYOUT_7POINT0:
+ch_layout = 10;
+break;
+case AV_CH_LAYOUT_7POINT1:
+ch_layout = 11;
+break;
+default:
+return AVERROR_BUG;
+}
+
+s->header = (((ch_layout << 4) | freq) << 8) | (quant << 6);
+
+return 0;
+}
+
+static int pcm_bluray_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+   const AVFrame *frame, int *got_packet_ptr)
+{
+BlurayPCMEncContext *s = avctx->priv_data;
+int sample_size, samples, channel, num_dest_channels;
+const int16_t *src16;
+const int32_t *src32;
+unsigned pkt_size;
+PutByteContext pb;
+int ret;
+
+num_dest_channels = FFALIGN(avctx->channels, 2);
+sample_size = (num_dest_channels *
+   (avctx->sample_fmt == AV_SAMPLE_FMT_S16 ? 16 : 24)) >> 3;
+samples = frame->nb_samples;
+
+pkt_size = sample_size * samples + 4;
+
+if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
+return ret;
+
+AV_WB16(avpkt->data, pkt_size - 4);
+AV_WB16(avpkt->data + 2, s->header);
+
+src16 = (const int16_t *)frame->data[0];

[FFmpeg-devel] [PATCH 1/2] avformat/mpegtsenc: fix muxing pcm-bluray

2022-02-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/mpegtsenc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 971b3f55d8..48cd54c770 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -2097,6 +2097,10 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 ts_st->dvb_ac3_desc = dvb_ac3_desc;
 }
 av_free(hdr);
+} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_BLURAY) {
+mpegts_write_pes(s, st, buf, size, pts, dts,
+ pkt->flags & AV_PKT_FLAG_KEY, stream_id);
+return 0;
 }
 
 if (ts_st->payload_size && (ts_st->payload_size + size > 
ts->pes_payload_size ||
-- 
2.33.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 2/2] configure: stop allowing disabling lzo

2022-02-26 Thread James Almer



On 2/26/2022 1:46 PM, Reimar Döffinger wrote:



On 26 Feb 2022, at 16:33, James Almer  wrote:

The module is now always compiled in.


Thanks, both patches in this series or the alternative patch are fine with me.
Only possible downside I could think of is if there is any use-case why someone 
would want the matroska decoder to specifically NOT have LZO support.



Applied then, thanks.


Best regards,
Reimar

P.S.: If it's not too much effort I do appreciate a CC on patches for things 
where I am mentioned in MAINTAINERS as the list is a bit high-traffic for me
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

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

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


Re: [FFmpeg-devel] [PATCH 2/2] configure: stop allowing disabling lzo

2022-02-26 Thread Reimar Döffinger


> On 26 Feb 2022, at 16:33, James Almer  wrote:
> 
> The module is now always compiled in.

Thanks, both patches in this series or the alternative patch are fine with me.
Only possible downside I could think of is if there is any use-case why someone 
would want the matroska decoder to specifically NOT have LZO support.

Best regards,
Reimar

P.S.: If it's not too much effort I do appreciate a CC on patches for things 
where I am mentioned in MAINTAINERS as the list is a bit high-traffic for me
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 2/2] configure: stop allowing disabling lzo

2022-02-26 Thread James Almer
The module is now always compiled in.

Signed-off-by: James Almer 
---
 configure | 7 ++-
 libavformat/matroskadec.c | 4 
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 4dab8d4715..8c69ab0c86 100755
--- a/configure
+++ b/configure
@@ -140,7 +140,6 @@ Component options:
   --disable-dwtdisable DWT code
   --disable-error-resilience disable error resilience code
   --disable-lspdisable LSP code
-  --disable-lzodisable LZO decoder code
   --disable-mdct   disable MDCT code
   --disable-rdft   disable RDFT code
   --disable-fftdisable FFT code
@@ -1975,7 +1974,6 @@ SUBSYSTEM_LIST="
 fast_unaligned
 fft
 lsp
-lzo
 mdct
 pixelutils
 network
@@ -2780,7 +2778,6 @@ clearvideo_decoder_select="idctdsp"
 cllc_decoder_select="bswapdsp"
 comfortnoise_encoder_select="lpc"
 cook_decoder_select="audiodsp mdct sinewin"
-cscd_decoder_select="lzo"
 cscd_decoder_suggest="zlib"
 dca_decoder_select="mdct"
 dca_encoder_select="mdct"
@@ -2896,7 +2893,7 @@ mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
 notchlc_decoder_select="lzf"
-nuv_decoder_select="idctdsp lzo"
+nuv_decoder_select="idctdsp"
 on2avc_decoder_select="mdct"
 opus_decoder_deps="swresample"
 opus_decoder_select="mdct15"
@@ -3423,7 +3420,7 @@ ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
 latm_muxer_select="aac_adtstoasc_bsf mpeg4audio"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="riffdec"
-matroska_demuxer_suggest="bzlib lzo zlib"
+matroska_demuxer_suggest="bzlib zlib"
 matroska_muxer_select="mpeg4audio riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
 mlp_demuxer_select="mlp_parser"
 mmf_muxer_select="riffenc"
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 31e5111225..36b96df351 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1684,7 +1684,6 @@ static int matroska_decode_buffer(uint8_t **buf, int 
*buf_size,
 memcpy(pkt_data + header_size, data, isize);
 break;
 }
-#if CONFIG_LZO
 case MATROSKA_TRACK_ENCODING_COMP_LZO:
 do {
 int insize = isize;
@@ -1704,7 +1703,6 @@ static int matroska_decode_buffer(uint8_t **buf, int 
*buf_size,
 }
 pkt_size -= olen;
 break;
-#endif
 #if CONFIG_ZLIB
 case MATROSKA_TRACK_ENCODING_COMP_ZLIB:
 {
@@ -2527,9 +2525,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 #if CONFIG_BZLIB
  encodings[0].compression.algo != 
MATROSKA_TRACK_ENCODING_COMP_BZLIB &&
 #endif
-#if CONFIG_LZO
  encodings[0].compression.algo != 
MATROSKA_TRACK_ENCODING_COMP_LZO   &&
-#endif
  encodings[0].compression.algo != 
MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP) {
 encodings[0].scope = 0;
 av_log(matroska->ctx, AV_LOG_ERROR,
-- 
2.35.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 v2] avutil: make lzo always compile

2022-02-26 Thread James Almer
Having optionally installed headers is a bad idea as there's no way to know
if they are present or not, and the module is small enough that it's pointless
having it be optional.

Signed-off-by: James Almer 
---
 libavutil/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index d17876df1a..b867d3b362 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -52,6 +52,7 @@ HEADERS = adler32.h   
  \
   intreadwrite.h\
   lfg.h \
   log.h \
+  lzo.h \
   macros.h  \
   mathematics.h \
   mastering_display_metadata.h  \
@@ -87,8 +88,6 @@ HEADERS = adler32.h   
  \
   tx.h  \
   film_grain_params.h   \
 
-HEADERS-$(CONFIG_LZO)   += lzo.h
-
 ARCH_HEADERS = bswap.h  \
intmath.h\
intreadwrite.h   \
@@ -139,6 +138,7 @@ OBJS = adler32.o
\
lls.o\
log.o\
log2_tab.o   \
+   lzo.o\
mathematics.o\
mastering_display_metadata.o \
md5.o\
@@ -180,7 +180,6 @@ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
 OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o
 OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
-OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_MACOS_KPERF)  += macos_kperf.o
 OBJS-$(CONFIG_MEDIACODEC)   += hwcontext_mediacodec.o
 OBJS-$(CONFIG_OPENCL)   += hwcontext_opencl.o
-- 
2.35.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] avutil: make lzo always compile

2022-02-26 Thread James Almer
Having optionally installed headers is a bad idea as there's no way to know
if they are present or not (unless a define is added to avconfig.h, but that's
just ugly).
Since configure allows the user to disable lzo, ensure the symbol is always
present even if the functionality is not there.

Signed-off-by: James Almer 
---
av_lzo1x_decode() does not return AVERROR values on failure, meaning i can't
use ENOSYS, so I decided to just return the most generic error from those
defined in the header.

 libavutil/Makefile | 5 ++---
 libavutil/lzo.c| 7 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index d17876df1a..b867d3b362 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -52,6 +52,7 @@ HEADERS = adler32.h   
  \
   intreadwrite.h\
   lfg.h \
   log.h \
+  lzo.h \
   macros.h  \
   mathematics.h \
   mastering_display_metadata.h  \
@@ -87,8 +88,6 @@ HEADERS = adler32.h   
  \
   tx.h  \
   film_grain_params.h   \
 
-HEADERS-$(CONFIG_LZO)   += lzo.h
-
 ARCH_HEADERS = bswap.h  \
intmath.h\
intreadwrite.h   \
@@ -139,6 +138,7 @@ OBJS = adler32.o
\
lls.o\
log.o\
log2_tab.o   \
+   lzo.o\
mathematics.o\
mastering_display_metadata.o \
md5.o\
@@ -180,7 +180,6 @@ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
 OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o
 OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
-OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_MACOS_KPERF)  += macos_kperf.o
 OBJS-$(CONFIG_MEDIACODEC)   += hwcontext_mediacodec.o
 OBJS-$(CONFIG_OPENCL)   += hwcontext_opencl.o
diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index bcbe2c861d..39088340bc 100644
--- a/libavutil/lzo.c
+++ b/libavutil/lzo.c
@@ -29,6 +29,7 @@
 #include "macros.h"
 #include "mem.h"
 
+#if CONFIG_LZO
 /// Define if we may write up to 12 bytes beyond the output buffer.
 #define OUTBUF_PADDED 1
 /// Define if we may read up to 8 bytes beyond the input buffer.
@@ -205,3 +206,9 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, 
int *inlen)
 *outlen = c.out_end - c.out;
 return c.error;
 }
+#else
+int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
+{
+return AV_LZO_ERROR;
+}
+#endif
-- 
2.35.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] avformat: always compile isom_tags

2022-02-26 Thread James Almer
It's needed for avformat_get_mov_video_tags() and avformat_get_mov_audio_tags(),
both public symbols defined in avformat.h

Signed-off-by: James Almer 
---
 libavformat/Makefile | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6566e40cac..16d019df4e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -13,6 +13,7 @@ OBJS = allformats.o \
format.o \
id3v1.o  \
id3v2.o  \
+   isom_tags.o  \
metadata.o   \
mux.o\
options.o\
@@ -27,7 +28,7 @@ OBJS = allformats.o \
 OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
 
 # subsystems
-OBJS-$(CONFIG_ISO_MEDIA) += isom.o isom_tags.o
+OBJS-$(CONFIG_ISO_MEDIA) += isom.o
 OBJS-$(CONFIG_NETWORK)   += network.o
 OBJS-$(CONFIG_RIFFDEC)   += riffdec.o
 OBJS-$(CONFIG_RIFFENC)   += riffenc.o
@@ -121,7 +122,7 @@ OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
 OBJS-$(CONFIG_AST_MUXER) += ast.o astenc.o
 OBJS-$(CONFIG_AU_DEMUXER)+= au.o pcm.o
 OBJS-$(CONFIG_AU_MUXER)  += au.o rawenc.o
-OBJS-$(CONFIG_AVI_DEMUXER)   += avidec.o isom_tags.o
+OBJS-$(CONFIG_AVI_DEMUXER)   += avidec.o
 OBJS-$(CONFIG_AVI_MUXER) += avienc.o mpegtsenc.o avlanguage.o 
rawutils.o
 OBJS-$(CONFIG_AVM2_MUXER)+= swfenc.o swf.o
 OBJS-$(CONFIG_AVR_DEMUXER)   += avr.o pcm.o
@@ -316,11 +317,11 @@ OBJS-$(CONFIG_LXF_DEMUXER)   += lxfdec.o
 OBJS-$(CONFIG_M4V_DEMUXER)   += m4vdec.o rawdec.o
 OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
 OBJS-$(CONFIG_MATROSKA_DEMUXER)  += matroskadec.o matroska.o  \
-flac_picture.o isom_tags.o 
rmsipr.o \
+flac_picture.o rmsipr.o \
 oggparsevorbis.o vorbiscomment.o \
 qtpalette.o replaygain.o 
dovi_isom.o
 OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \
-av1.o avc.o hevc.o isom_tags.o \
+av1.o avc.o hevc.o \
 flacenc_header.o avlanguage.o \
 vorbiscomment.o wv.o dovi_isom.o
 OBJS-$(CONFIG_MCA_DEMUXER)   += mca.o
@@ -382,7 +383,7 @@ OBJS-$(CONFIG_NISTSPHERE_DEMUXER)+= nistspheredec.o 
pcm.o
 OBJS-$(CONFIG_NSP_DEMUXER)   += nspdec.o pcm.o
 OBJS-$(CONFIG_NSV_DEMUXER)   += nsvdec.o
 OBJS-$(CONFIG_NULL_MUXER)+= nullenc.o
-OBJS-$(CONFIG_NUT_DEMUXER)   += nutdec.o nut.o isom_tags.o
+OBJS-$(CONFIG_NUT_DEMUXER)   += nutdec.o nut.o
 OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o
 OBJS-$(CONFIG_NUV_DEMUXER)   += nuv.o
 OBJS-$(CONFIG_AV1_DEMUXER)   += av1dec.o
-- 
2.35.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] AVS3: add support for AVS3 High profile - same syntax as AVS3 Main profile

2022-02-26 Thread lance . lmwang
On Sat, Feb 26, 2022 at 07:48:24AM +, Paul Higgs wrote:
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > lance.lmw...@gmail.com
> > Sent: 26 February 2022 07:18
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH] AVS3: add support for AVS3 High profile
> > - same syntax as AVS3 Main profile
> > 
> > On Sat, Feb 26, 2022 at 05:50:39AM +, Paul Higgs wrote:
> > > This patch adds high level syntax support for parsing AVS3 High profile
> > bitstreams.
> > > Latest AVS3 specification including High profile is available at
> > > http://www.avs.org.cn/AVS3_download/en_index.asp
> > >
> > > Signed-off-by: Paul Higgs 
> > > ---
> > >  libavcodec/avs3.h| 2 ++
> > >  libavcodec/avs3_parser.c | 8 
> > >  libavformat/avs3dec.c| 2 +-
> > >  3 files changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/libavcodec/avs3.h b/libavcodec/avs3.h index
> > > 4189d9b583..c8caa58b0a 100644
> > > --- a/libavcodec/avs3.h
> > > +++ b/libavcodec/avs3.h
> > > @@ -35,6 +35,8 @@
> > >  #define AVS3_FIRST_SLICE_START_CODE  0x00
> > >  #define AVS3_PROFILE_BASELINE_MAIN   0x20
> > >  #define AVS3_PROFILE_BASELINE_MAIN10 0x22
> > > +#define AVS3_PROFILE_BASELINE_HIGH   0x30
> > > +#define AVS3_PROFILE_BASELINE_HIGH10 0x32
> > >
> > >  #define AVS3_ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) ==
> > > AVS3_INTER_PIC_START_CODE)  #define AVS3_ISUNIT(x) ((x) ==
> > > AVS3_SEQ_START_CODE || AVS3_ISPIC(x)) diff --git
> > > a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c index
> > > d04d96a03a..483b38fe76 100644
> > > --- a/libavcodec/avs3_parser.c
> > > +++ b/libavcodec/avs3_parser.c
> > > @@ -91,11 +91,11 @@ static void
> > parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> > >  //sampe_precision(3)
> > >  skip_bits(, 47);
> > >
> > > -if (profile == AVS3_PROFILE_BASELINE_MAIN10) {
> > > -int sample_precision = get_bits(, 3);
> > > -if (sample_precision == 1) {
> > > +if (profile == AVS3_PROFILE_BASELINE_MAIN10 || profile ==
> > AVS3_PROFILE_BASELINE_HIGH10) {
> > > +int encoding_precision = get_bits(, 3);
> > > +if (encoding_precision == 1) {
> > 
> > Please keep sample_precision name, it's unrelated cosmetic change in this
> > patch.
> > 
> Changed this because the three bits read in get_bits(,3) are for the 
> encoding precision. sample_precision syntax element was 
> Skipped previously

then I think it's better to fix this in another patch instead of mixed changed.


> > >  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
> > > -} else if (sample_precision == 2) {
> > > +} else if (encoding_precision == 2) {
> > >  avctx->pix_fmt = AV_PIX_FMT_YUV420P10LE;
> > >  } else {
> > >  avctx->pix_fmt = AV_PIX_FMT_NONE; diff --git
> > > a/libavformat/avs3dec.c b/libavformat/avs3dec.c index
> > > 2395df171b..335b5409f5 100644
> > > --- a/libavformat/avs3dec.c
> > > +++ b/libavformat/avs3dec.c
> > > @@ -47,7 +47,7 @@ static int avs3video_probe(const AVProbeData *p)
> > >  }
> > >  if (state == AVS3_SEQ_START_CODE) {
> > >  seq++;
> > > -if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> > AVS3_PROFILE_BASELINE_MAIN10)
> > > +if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr !=
> > > + AVS3_PROFILE_BASELINE_MAIN10 && *ptr !=
> > AVS3_PROFILE_BASELINE_HIGH
> > > + && *ptr != AVS3_PROFILE_BASELINE_HIGH10)
> > 
> > The line is too long.
> Ok, will wrap before 80 characters
> > 
> > >  return 0;
> > >  } else if (AVS3_ISPIC(state)) {
> > >  pic++;
> > > --
> > > 2.30.0.windows.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".
> > 
> > --
> > Thanks,
> > Limin Wang
> > ___
> > 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".

-- 
Thanks,
Limin Wang
___
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 v9 5/5] lavc, doc: add libuavs3d video decoder wrapper

2022-02-26 Thread Jean-Baptiste Kempf
Hello,

On Mon, 31 Aug 2020, at 17:07, hwr...@126.com wrote:
> +  --enable-libuavs3d   enable AVS3 decoding via libuavs3d [no]

uavs3d is BSD 4-clause, and is therefore not compatible with GPLv2, GPLv3, 
LGPLv2.1 or LGPLv3

uavs3d should be flagged as "non-free" (and undistributable) then.

Best,

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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".