Re: [FFmpeg-devel] [PATCH V3 3/5] libavutil/hwcontext_vulkan: Allocate vkFrame in one memory

2021-11-28 Thread Lynne
29 Nov 2021, 05:07 by wenbin.c...@intel.com:

>> 26 Nov 2021, 03:54 by wenbin.c...@intel.com:
>>
>> > The vaapi can import external frame, but the planes of the external
>> > frames should be in the same drm object. A new option
>> "contiguous_planes"
>> > is added to device. This flag tells device to allocate places in one
>> > memory. When device is derived from vaapi this flag will be enabled.
>> > A new flag frame_flag is also added to AVVulkanFramesContext. User
>> > can use this flag to force enable or disable this behaviour.
>> > A new variable "offset "is added to AVVKFrame. It describe describe the
>> > offset from the memory currently bound to the VkImage.
>> >
>> > Signed-off-by: Wenbin Chen 
>> >
>>
>> Why is a new offset variable needed?
>> vkGetImageSubresourceLayout is valid for DRM tiled images.
>> According to the specs,
>> "If the image’s tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
>> then vkGetImageSubresourceLayout describes one memory plane of the
>> image. If the image’s tiling is
>> VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT and the image is non-
>> linear, then the returned layout has an implementation-dependent meaning;
>> the vendor of the image’s DRM format modifier may provide documentation
>> that explains how to interpret the returned layout.".
>>
>> Isn't this what you already have in the offset field?
>>
>
> The offset we get from vkGetImageSubresourceLayout is from the start of the 
> image or plane.
> The offset drm_object need is from the start of the memory, and 
> vkGetImageSubresourceLayout
> cannot get this information. I add a new offset variable because I allocate 
> all planes in one memory 
> not because I use VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.
>

What do you mean, from the start of the plane? I don't recall it
being a thing.
The spec says it's driver-dependent, so wouldn't it make sense for
the driver to return the offset from the start of the memory?
___
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 3/5] libavutil/hwcontext_vulkan: Allocate vkFrame in one memory

2021-11-28 Thread Chen, Wenbin
> 26 Nov 2021, 03:54 by wenbin.c...@intel.com:
> 
> > The vaapi can import external frame, but the planes of the external
> > frames should be in the same drm object. A new option
> "contiguous_planes"
> > is added to device. This flag tells device to allocate places in one
> > memory. When device is derived from vaapi this flag will be enabled.
> > A new flag frame_flag is also added to AVVulkanFramesContext. User
> > can use this flag to force enable or disable this behaviour.
> > A new variable "offset "is added to AVVKFrame. It describe describe the
> > offset from the memory currently bound to the VkImage.
> >
> > Signed-off-by: Wenbin Chen 
> >
> 
> Why is a new offset variable needed?
> vkGetImageSubresourceLayout is valid for DRM tiled images.
> According to the specs,
> "If the image’s tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
> then vkGetImageSubresourceLayout describes one memory plane of the
> image. If the image’s tiling is
> VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT and the image is non-
> linear, then the returned layout has an implementation-dependent meaning;
> the vendor of the image’s DRM format modifier may provide documentation
> that explains how to interpret the returned layout.".
> 
> Isn't this what you already have in the offset field?

The offset we get from vkGetImageSubresourceLayout is from the start of the 
image or plane.
The offset drm_object need is from the start of the memory, and 
vkGetImageSubresourceLayout
cannot get this information. I add a new offset variable because I allocate all 
planes in one memory 
not because I use VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.

> ___
> 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 1/2] avformat/mxf: support MCA audio information

2021-11-28 Thread Pierre-Anthony Lemieux
On Sun, Nov 28, 2021 at 4:56 PM Marton Balint  wrote:
>
>
>
> On Thu, 25 Nov 2021, Marc-Antoine Arnaud wrote:
>
> > ---
> > doc/demuxers.texi |  10 ++
> > libavformat/mxf.h |   1 +
> > libavformat/mxfdec.c  | 293 +-
> > libavformat/version.h |   2 +-
> > 4 files changed, 299 insertions(+), 7 deletions(-)
>
> I went through this, and the MCA label spec (or rather the draft which is
> publicly available), and found several issues with your approach.
>
> At this point, after so many iterations, I believe it is better if I just
> post my follow-up patches which describe in detail what needed fixing.
>
> Please, check and test the patch series, because I don't have any real
> world files to tests, except the ones created by the BMX tools for
> regression tests.

A sample file is available at:

http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf

Attached is the XML dump of the header metadata of that sample file,
obtained using the online tool at:

https://registry.smpte-ra.org/apps/regxmldump/view/draft/

>
> Also please provide some MXF samples with MCA if you can, so features like
> routing can be more throroughly tested.
>
> Thanks,
> Marton
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


   93506
   
  
 urn:uuid:901ac013-fa32-4719-8a13-b42f62ac396c
 urn:smpte:ul:060e2b34.04010101.01030202.0200
 93506
 0
 urn:smpte:umid:.......
 0
  
   

 
 48000/1
 0
  
   
   
  
 urn:uuid:6c3fb642-e60c-496d-acfb-d3016626da18
 

   urn:uuid:b7b80275-5455-49ab-b619-9dce14f04f92
   urn:smpte:ul:060e2b34.0401010d.03020201.
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df
   sg51
   5.1
   en


   urn:uuid:ba76149c-ae84-4a1c-b5e0-6753e9119bc6
   urn:smpte:ul:060e2b34.0401010d.03020101.
   urn:uuid:70148463-b655-4f41-ad33-bf0f2261342c
   chL
   Left
   1
   en
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df


   urn:uuid:45f8e99b-fab5-4862-aa7e-4f6810f82c17
   urn:smpte:ul:060e2b34.0401010d.03020102.
   urn:uuid:557d8a12-b38e-4a17-8e83-5b590d08c783
   chR
   Right
   2
   en
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df


   urn:uuid:c708f849-e23b-4e29-9b15-c60b57a1bbea
   urn:smpte:ul:060e2b34.0401010d.03020103.
   urn:uuid:a7decaac-79f4-4d72-a1f0-12a066052105
   chC
   Center
   3
   en
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df


   urn:uuid:4da57436-e9bf-4367-a386-1377318cd1d7
   urn:smpte:ul:060e2b34.0401010d.03020104.
   urn:uuid:98b3cfed-49f4-48f8-98bc-9e218320504d
   chLFE
   LFE
   4
   en
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df


   urn:uuid:126c4065-c64b-4d9f-bc64-aa9d908cfe4b
   urn:smpte:ul:060e2b34.0401010d.03020105.
   urn:uuid:59f07f28-7e74-4bd4-b526-dc0f3c1dda1f
   chLs
   Left Surround
   5
   en
   urn:uuid:ca382d07-7b09-4478-ab2b-2419c96fe6df

[FFmpeg-devel] [PATCH 5/5] avformat/mxfdec: rework MCA channel layout parsing

2021-11-28 Thread Marton Balint
Setting the channel layout was based on SoundfieldGroupLabelSubDescriptor, but
this was wrong, because soundfield groups are not necessarily used and a file
can also contain e.g. a single channel of a multichannel audio.

The new approach is to parse every AudioChannelLabelSubDescriptor and create a
channel layout based on those. We should also make sure that we only provide a
channel layout if every channel designation is recognized and is supported. If
a designation is not supported, or if a channel designation is used more than
once (e.g. multiple languages) we fall back to the unknown channel layout.

MCA channel ID was also ignored previously, that should have been used to
determine which AudioChannelLabelSubDescriptor references which audio channel.
This is also fixed now.

The new parsing code also detects ambigous language or service types, and only
set these metadata if all channels have the same value.

Soundfield groups are now only used for determinig the language of the tracks,
if it is not provided in the AudioChannelLabelSubDescriptor. Track sub
descriptors not necessarily contain the references to their soundfield groups,
so pairing of the soundfield group with a channel is now based on MCA group
link ID. The language of the first GroupOfSoundfieldGroups which a
SoundfieldGroup is part of is also considered if the SoundfieldGroup has no
language metadata.

Signed-off-by: Marton Balint 
---
 libavformat/mxf.h|   4 +-
 libavformat/mxfdec.c | 333 ---
 2 files changed, 191 insertions(+), 146 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index cddbcb13c9..d53a16df51 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,7 +50,9 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
-MCASubDescriptor,
+AudioChannelLabelSubDescriptor,
+SoundfieldGroupLabelSubDescriptor,
+GroupOfSoundfieldGroupsLabelSubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 229c02a85e..6e1da75542 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -228,8 +228,11 @@ typedef struct MXFMCASubDescriptor {
 MXFMetadataSet meta;
 UID uid;
 UID mca_link_id;
-UID mca_group_link_id;
+UID soundfield_group_link_id;
+UID *group_of_soundfield_groups_link_id_refs;
+int group_of_soundfield_groups_link_id_count;
 UID mca_label_dictionary_id;
+int mca_channel_id;
 char *language;
 } MXFMCASubDescriptor;
 
@@ -328,8 +331,6 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
-static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
-static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
 
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
@@ -346,7 +347,9 @@ static const uint8_t mxf_apple_coll_max_fall[] 
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
 static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_group_of_soundfield_groups_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x04,0x00,0x00,0x00 
};
 static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_channel_id[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x04,0x0a,0x00,0x00,0x00,0x00 
};
 static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
 static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
 
@@ -374,8 +377,11 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
 break;
-case MCASubDescrip

[FFmpeg-devel] [PATCH 4/5] avformat/mxfdec: do not ignore mxf_read_strong_ref_array return value when reading sub descriptors

2021-11-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mxfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e0a52e3883..229c02a85e 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1419,7 +1419,7 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 }
 
 if (IS_KLV_KEY(uid, mxf_sub_descriptor))
-mxf_read_strong_ref_array(pb, &descriptor->sub_descriptors_refs, 
&descriptor->sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
&descriptor->sub_descriptors_refs, &descriptor->sub_descriptors_count);
 
 break;
 }
-- 
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] [PATCH 3/5] avformat/mxfdec: also check for non-positive number of channels

2021-11-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mxfdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8cb66b73c4..e0a52e3883 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2843,8 +2843,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 
 current_channel = 0;
 
-if (descriptor->channels >= FF_SANE_NB_CHANNELS) {
-av_log(mxf->fc, AV_LOG_ERROR, "max number of channels %d 
reached\n", FF_SANE_NB_CHANNELS);
+if (descriptor->channels <= 0 || descriptor->channels >= 
FF_SANE_NB_CHANNELS) {
+av_log(mxf->fc, AV_LOG_ERROR, "Invalid number of channels %d, 
must be less than %d\n", descriptor->channels, FF_SANE_NB_CHANNELS);
 return AVERROR_INVALIDDATA;
 }
 
-- 
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] [PATCH 1/5] avformat/mxf: support MCA audio information

2021-11-28 Thread Marton Balint
From: Marc-Antoine Arnaud 

Signed-off-by: Marton Balint 
---
 doc/demuxers.texi |  10 ++
 libavformat/mxf.h |   1 +
 libavformat/mxfdec.c  | 293 +-
 libavformat/version.h |   2 +-
 4 files changed, 299 insertions(+), 7 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index cab8a7072c..23b6753602 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
will result in a stricte
 of the boundary value.
 @end table
 
+@section mxf
+
+MXF demuxer.
+
+@table @option
+
+@item -skip_audio_reordering @var{bool}
+This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..58ba330475 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mx

[FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: remove uneeded check before av_freep

2021-11-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mxfdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 58ba330475..8cb66b73c4 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -375,8 +375,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
 break;
 case MCASubDescriptor:
-if (((MXFMCASubDescriptor *)*ctx)->language)
-av_freep(&((MXFMCASubDescriptor *)*ctx)->language);
+av_freep(&((MXFMCASubDescriptor *)*ctx)->language);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
-- 
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".


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-11-28 Thread Marton Balint




On Thu, 25 Nov 2021, Marc-Antoine Arnaud wrote:


---
doc/demuxers.texi |  10 ++
libavformat/mxf.h |   1 +
libavformat/mxfdec.c  | 293 +-
libavformat/version.h |   2 +-
4 files changed, 299 insertions(+), 7 deletions(-)


I went through this, and the MCA label spec (or rather the draft which is 
publicly available), and found several issues with your approach.


At this point, after so many iterations, I believe it is better if I just 
post my follow-up patches which describe in detail what needed fixing.


Please, check and test the patch series, because I don't have any real 
world files to tests, except the ones created by the BMX tools for 
regression tests.


Also please provide some MXF samples with MCA if you can, so features like 
routing can be more throroughly tested.


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

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


Re: [FFmpeg-devel] [PATCH v7 0/4] Add support for Matroska BlockAdditionMapping elements

2021-11-28 Thread quietvoid
>
> This patch set adds support for reading/writing the Matroska 
> BlockAdditionMapping
> elements, as well as for reading/writing dvcC/dvvC blocks in Matroska.
>
> Created utility functions to read/write Dolby Vision boxes for ISOM.
> This was done to avoid duplicating the code, as the Matroska blocks and MOV 
> boxes
> follow the same specification, defined by Dolby.
>
> Refactored the reading/writing in mov/movenc to use the new dovi_isom 
> functions.
>
> Differences compared to v6:
>   - Dropped the avformat/mpegts patch as suggested, because the specification
> is different from the ISOM specification defined by Dolby.
>   - Added a patch to refactor avformat/movenc to further reduce the duplicated
> code. The implementation in dovi_isom is the same.
>   - Moved init_put_bits after the size validation in ff_isom_put_dvcc_dvvc.
>   - Added dvwC to the ff_isom_put_dvcc_dvvc logging.
>
> quietvoid (4):
>   avformat/dovi_isom: Implement Dolby Vision configuration
> parsing/writing
>   avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements
>   avformat/mov: Refactor mov_read_dvcc_dvvc to use
> ff_isom_parse_dvcc_dvvc
>   avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use
> ff_isom_put_dvcc_dvvc
>
>  libavformat/Makefile  |   4 +-
>  libavformat/dovi_isom.c   | 121 ++
>  libavformat/dovi_isom.h   |  35 +++
>  libavformat/matroska.h|   9 +++
>  libavformat/matroskadec.c |  58 +-
>  libavformat/matroskaenc.c |  45 ++
>  libavformat/mov.c |  50 +++-
>  libavformat/movenc.c  |  26 +++-
>  8 files changed, 286 insertions(+), 62 deletions(-)
>  create mode 100644 libavformat/dovi_isom.c
>  create mode 100644 libavformat/dovi_isom.h
>
>
Ping.

I've made a separate patch for regression tests for mov here:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211126170534.2041327-1-tcchlis...@gmail.com
The tests are all passing with the changes from this patch set.
___
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 v17 14/19] avfilter/overlaytextsubs: Add overlaytextsubs and textsubs2video filters

2021-11-28 Thread Michael Niedermayer
On Sat, Nov 27, 2021 at 07:38:07PM +, Soft Works wrote:
> - overlaytextsubs {VS -> V)
>   Overlay text subtitles onto a video stream.
> 
> - textsubs2video {S -> V)
>   Converts text subtitles to video frames
> 
> Signed-off-by: softworkz 
> ---
>  configure|   2 +
>  doc/filters.texi | 113 ++
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   4 +-
>  libavfilter/vf_overlaytextsubs.c | 633 +++
>  5 files changed, 753 insertions(+), 1 deletion(-)
>  create mode 100644 libavfilter/vf_overlaytextsubs.c

(tested this as it was the last applying automatically)

this or a previous patch breaks:

./ffmpeg -i ~/tickets/1332/Starship_Troopers.vob -scodec xsub -qscale 2 -an  
file1332.avi

  Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(tv, top coded first 
(swapped)), 720x480 [SAR 32:27 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn
Metadata:
  encoder : Lavc mpeg4
Side data:
  cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Subtitle: xsub (DXSB / 0x42535844)
Metadata:
  encoder : Lavc xsub
[mpeg @ 0x564897855840] New subtitle stream 0:7 at pos:8497166 and 
DTS:1999.51ss speed=14.6x
Subtitle encoding failed - Error code: -1397118274
Conversion failed!


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

No snowflake in an avalanche ever feels responsible. -- 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 v17 15/19] avfilter/textmod: Add textmod, censor and show_speaker filters

2021-11-28 Thread Michael Niedermayer
On Sun, Nov 28, 2021 at 07:22:10PM +, Soft Works wrote:
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Michael
> > Niedermayer
> > Sent: Sunday, November 28, 2021 8:05 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v17 15/19] avfilter/textmod: Add textmod,
> > censor and show_speaker filters
> > 
> > On Sat, Nov 27, 2021 at 07:38:09PM +, Soft Works wrote:
> > > - textmod {S -> S)
> > >   Modify subtitle text in a number of ways
> > >
> > > - censor {S -> S)
> > >   Censor subtitles using a word list
> > >
> > > - show_speaker {S -> S)
> > >   Prepend speaker names from ASS subtitles to the visible text lines
> > >
> > > Signed-off-by: softworkz 
> > > ---
> > >  doc/filters.texi | 206 
> > >  libavfilter/Makefile |   5 +
> > >  libavfilter/allfilters.c |   3 +
> > >  libavfilter/sf_textmod.c | 697 +++
> > >  4 files changed, 911 insertions(+)
> > >  create mode 100644 libavfilter/sf_textmod.c
> > 
> > git doesnt like this one
> > 
> > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters
> > .git/rebase-apply/patch:269: trailing whitespace.
> > /*
> > .git/rebase-apply/patch:270: trailing whitespace.
> >  * Copyright (c) 2021 softworkz
> > .git/rebase-apply/patch:271: trailing whitespace.
> >  *
> > .git/rebase-apply/patch:272: trailing whitespace.
> >  * This file is part of FFmpeg.
> > .git/rebase-apply/patch:273: trailing whitespace.
> >  *
> > warning: squelched 692 whitespace errors
> > warning: 697 lines add whitespace errors.
> > Using index info to reconstruct a base tree...
> > M   doc/filters.texi
> > .git/rebase-apply/patch:269: trailing whitespace.
> > /*
> > .git/rebase-apply/patch:270: trailing whitespace.
> >  * Copyright (c) 2021 softworkz
> > .git/rebase-apply/patch:271: trailing whitespace.
> >  *
> > .git/rebase-apply/patch:272: trailing whitespace.
> >  * This file is part of FFmpeg.
> > .git/rebase-apply/patch:273: trailing whitespace.
> >  *
> > error: patch failed: doc/filters.texi:25551
> > error: doc/filters.texi: patch does not apply
> > error: patch failed: libavfilter/Makefile:551
> > error: libavfilter/Makefile: patch does not apply
> > error: patch failed: libavfilter/allfilters.c:541
> > error: libavfilter/allfilters.c: patch does not apply
> > error: Did you hand edit your patch?
> > It does not apply to blobs recorded in its index.
> > Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker
> > filters
> > Use 'git am --show-current-patch' to see the failed patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".
> > 
> 
> 
> Thanks, I'll check. I thought I had eliminated all trailing whitespace
> from filters.texi.
> 
> It's weird that patchwork could apply the patch. What do you use
> 'patch' or 'git am'?`

git am

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

It is what and why we do it that matters, not just one of them.


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 v17 15/19] avfilter/textmod: Add textmod, censor and show_speaker filters

2021-11-28 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Michael
> Niedermayer
> Sent: Sunday, November 28, 2021 8:05 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v17 15/19] avfilter/textmod: Add textmod,
> censor and show_speaker filters
> 
> On Sat, Nov 27, 2021 at 07:38:09PM +, Soft Works wrote:
> > - textmod {S -> S)
> >   Modify subtitle text in a number of ways
> >
> > - censor {S -> S)
> >   Censor subtitles using a word list
> >
> > - show_speaker {S -> S)
> >   Prepend speaker names from ASS subtitles to the visible text lines
> >
> > Signed-off-by: softworkz 
> > ---
> >  doc/filters.texi | 206 
> >  libavfilter/Makefile |   5 +
> >  libavfilter/allfilters.c |   3 +
> >  libavfilter/sf_textmod.c | 697 +++
> >  4 files changed, 911 insertions(+)
> >  create mode 100644 libavfilter/sf_textmod.c
> 
> git doesnt like this one
> 
> Applying: avfilter/textmod: Add textmod, censor and show_speaker filters
> .git/rebase-apply/patch:269: trailing whitespace.
> /*
> .git/rebase-apply/patch:270: trailing whitespace.
>  * Copyright (c) 2021 softworkz
> .git/rebase-apply/patch:271: trailing whitespace.
>  *
> .git/rebase-apply/patch:272: trailing whitespace.
>  * This file is part of FFmpeg.
> .git/rebase-apply/patch:273: trailing whitespace.
>  *
> warning: squelched 692 whitespace errors
> warning: 697 lines add whitespace errors.
> Using index info to reconstruct a base tree...
> M doc/filters.texi
> .git/rebase-apply/patch:269: trailing whitespace.
> /*
> .git/rebase-apply/patch:270: trailing whitespace.
>  * Copyright (c) 2021 softworkz
> .git/rebase-apply/patch:271: trailing whitespace.
>  *
> .git/rebase-apply/patch:272: trailing whitespace.
>  * This file is part of FFmpeg.
> .git/rebase-apply/patch:273: trailing whitespace.
>  *
> error: patch failed: doc/filters.texi:25551
> error: doc/filters.texi: patch does not apply
> error: patch failed: libavfilter/Makefile:551
> error: libavfilter/Makefile: patch does not apply
> error: patch failed: libavfilter/allfilters.c:541
> error: libavfilter/allfilters.c: patch does not apply
> error: Did you hand edit your patch?
> It does not apply to blobs recorded in its index.
> Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker
> filters
> Use 'git am --show-current-patch' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> 


Thanks, I'll check. I thought I had eliminated all trailing whitespace
from filters.texi.

It's weird that patchwork could apply the patch. What do you use
'patch' or 'git am'?`

Thanks,
softworkz



___
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 v17 15/19] avfilter/textmod: Add textmod, censor and show_speaker filters

2021-11-28 Thread Michael Niedermayer
On Sat, Nov 27, 2021 at 07:38:09PM +, Soft Works wrote:
> - textmod {S -> S)
>   Modify subtitle text in a number of ways
> 
> - censor {S -> S)
>   Censor subtitles using a word list
> 
> - show_speaker {S -> S)
>   Prepend speaker names from ASS subtitles to the visible text lines
> 
> Signed-off-by: softworkz 
> ---
>  doc/filters.texi | 206 
>  libavfilter/Makefile |   5 +
>  libavfilter/allfilters.c |   3 +
>  libavfilter/sf_textmod.c | 697 +++
>  4 files changed, 911 insertions(+)
>  create mode 100644 libavfilter/sf_textmod.c

git doesnt like this one

Applying: avfilter/textmod: Add textmod, censor and show_speaker filters
.git/rebase-apply/patch:269: trailing whitespace.
/*
.git/rebase-apply/patch:270: trailing whitespace.
 * Copyright (c) 2021 softworkz
.git/rebase-apply/patch:271: trailing whitespace.
 *
.git/rebase-apply/patch:272: trailing whitespace.
 * This file is part of FFmpeg.
.git/rebase-apply/patch:273: trailing whitespace.
 *
warning: squelched 692 whitespace errors
warning: 697 lines add whitespace errors.
Using index info to reconstruct a base tree...
M   doc/filters.texi
.git/rebase-apply/patch:269: trailing whitespace.
/*
.git/rebase-apply/patch:270: trailing whitespace.
 * Copyright (c) 2021 softworkz
.git/rebase-apply/patch:271: trailing whitespace.
 *
.git/rebase-apply/patch:272: trailing whitespace.
 * This file is part of FFmpeg.
.git/rebase-apply/patch:273: trailing whitespace.
 *
error: patch failed: doc/filters.texi:25551
error: doc/filters.texi: patch does not apply
error: patch failed: libavfilter/Makefile:551
error: libavfilter/Makefile: patch does not apply
error: patch failed: libavfilter/allfilters.c:541
error: libavfilter/allfilters.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker 
filters
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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

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


[FFmpeg-devel] [PATCH 1/2] avformat/cinedec: Avoid repeatedly allocating packets beyond the input

2021-11-28 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
41025/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5540848285122560

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/cinedec.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
index c83a4c1471b..f4779b26766 100644
--- a/libavformat/cinedec.c
+++ b/libavformat/cinedec.c
@@ -33,6 +33,7 @@
 
 typedef struct {
 uint64_t pts;
+uint64_t maxsize;
 } CineDemuxContext;
 
 /** Compression */
@@ -288,21 +289,32 @@ static int cine_read_packet(AVFormatContext *avctx, 
AVPacket *pkt)
 FFStream *const sti = ffstream(st);
 AVIOContext *pb = avctx->pb;
 int n, size, ret;
+int64_t ret64;
 
 if (cine->pts >= sti->nb_index_entries)
 return AVERROR_EOF;
 
-avio_seek(pb, sti->index_entries[cine->pts].pos, SEEK_SET);
+ret64 = avio_seek(pb, sti->index_entries[cine->pts].pos, SEEK_SET);
+if (ret64 < 0)
+return ret64;
 n = avio_rl32(pb);
 if (n < 8)
 return AVERROR_INVALIDDATA;
 avio_skip(pb, n - 8);
 size = avio_rl32(pb);
+if (avio_feof(pb))
+return AVERROR_INVALIDDATA;
+
+if (cine->maxsize && sti->index_entries[cine->pts].pos + size + n > 
cine->maxsize)
+size = cine->maxsize - sti->index_entries[cine->pts].pos - n;
 
 ret = av_get_packet(pb, pkt, size);
 if (ret < 0)
 return ret;
 
+if (ret != size)
+cine->maxsize = sti->index_entries[cine->pts].pos + n + ret;
+
 pkt->pts = cine->pts++;
 pkt->stream_index = 0;
 pkt->flags |= AV_PKT_FLAG_KEY;
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 2/2] avcodec/gemdec: Check tag & planes before image allocation

2021-11-28 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
41083/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5843826518917120

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/gemdec.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/gemdec.c b/libavcodec/gemdec.c
index 2464dda8a7e..eee21a50d4b 100644
--- a/libavcodec/gemdec.c
+++ b/libavcodec/gemdec.c
@@ -157,6 +157,14 @@ static int gem_decode_frame(AVCodecContext *avctx,
 if (header_size >= 11)
 tag = bytestream2_peek_be32(&gb);
 
+if (tag == AV_RB32("STTT") || tag == AV_RB32("TIMG") || tag == 
AV_RB32("XIMG") ||
+planes == 1 || planes == 2 || planes == 3 || planes == 4 ||
+planes == 8 || planes == 16 || planes == 24) {
+} else {
+avpriv_request_sample(avctx, "planes=%d", planes);
+return AVERROR_PATCHWELCOME;
+}
+
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
 return ret;
 
@@ -236,9 +244,6 @@ static int gem_decode_frame(AVCodecContext *avctx,
 planes = 1;
 row_width = avctx->width * pixel_size;
 put_lines = put_lines_bytes;
-} else {
-avpriv_request_sample(avctx, "planes=%d", planes);
-return AVERROR_PATCHWELCOME;
 }
 
 ret = av_reallocp_array(&avctx->priv_data, planes, row_width);
-- 
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 0/2]

2021-11-28 Thread Ronald S. Bultje
Hi John-Paul,

On Sat, Nov 27, 2021 at 8:22 PM John-Paul Stewart <
jpstew...@personalprojects.net> wrote:

> On 2021-11-27 8:51 a.m., Ronald S. Bultje wrote:
> > Hi,
> >
> > On Fri, Nov 26, 2021 at 4:52 PM John-Paul Stewart <
> > jpstew...@personalprojects.net> wrote:
> >
> >> There were no single channel examples and no 8 bit
> >> examples.
> >>
> >> I have created four clips with SGI's original 'moviemaker' utility (so
> >> they are guaranteed to be correctly formatted) to reverse engineer those
> >> two pieces of metadata since the format is largely undocumented.  They
> >> are under 1MB each and available at:
> >>
> >
> > To prevent this from breaking in the future, it would be great if
> > "as-small-as-possible" versions of these could be integrated into FATE
> (our
> > automated test system). How small can you make these so they still test
> the
> > bits-per-sample / channels features?
>
> I think they're already as small as I can practically make them.  The
> biggest is only 600 KiloBytes.  In fact, my whole set of four is smaller
> (2.0 MB) than the smallest existing test file (2.3 MB for 12345.mv) in
> FATE's mv directory.
>
> In fact, the stereo16bit.movie example is redundant since there are
> already samples with that combination.  So you'd really only need about
> 1.4 MB of new test files.
>

Alright. Would it be possible for you to submit a patch adding these other
3 samples to FATE then?

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

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


Re: [FFmpeg-devel] [PATCH] avfilter: add audio spectral stats filter

2021-11-28 Thread Paul B Mahol
will apply soon
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avfilter: add audio dynamic smooth filter

2021-11-28 Thread Paul B Mahol
will apply soon
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avfilter: add audio dynamic equalizer filter

2021-11-28 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi   |  75 +++
 libavfilter/Makefile   |   1 +
 libavfilter/af_adynamicequalizer.c | 310 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 387 insertions(+)
 create mode 100644 libavfilter/af_adynamicequalizer.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 7852948d2f..cfddefff30 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -843,6 +843,81 @@ Compute derivative/integral of audio stream.
 
 Applying both filters one after another produces original audio.
 
+@section adynamicequalizer
+
+Apply dynamic equalization to input audio stream.
+
+A description of the accepted options follows.
+
+@table @option
+@item threshold
+Set the detection threshold used to trigger equalization.
+Threshold detection is using bandpass filter.
+Default value is 0. Allowed range is from 0 to 50.
+
+@item dfrequency
+Set the detection frequency in Hz used for bandpass filter used to trigger 
equalization.
+Default value is 1000 Hz. Allowed range is between 2 and 100 Hz.
+
+@item dqfactor
+Set the detection resonance factor for bandpass filter used to trigger 
equalization.
+Default value is 1. Allowed range is from 0.001 to 1000.
+
+@item sfrequency
+Set the frequency of lowpass filter to smooth equalization filter gains.
+Default value is 100 Hz. Allowed range is between 2 and 100 Hz.
+
+@item sqfactor
+Set the resonance factor of lowpass filter to smooth equalization filter gains.
+Default value is 1. Allowed range is from 0.001 to 1000.
+
+@item tfrequency
+Set the target frequency of equalization filter.
+Default value is 1000 Hz. Allowed range is between 2 and 100 Hz.
+
+@item tqfactor
+Set the target resonance factor for target equalization filter.
+Default value is 1. Allowed range is from 0.001 to 1000.
+
+@item attack
+Set the amount of milliseconds the signal from detection has to rise above
+the detection threshold before equalization starts.
+Default is 10. Allowed range is between 1 and 2000.
+
+@item release
+Set the amount of milliseconds the signal from detection has to fall below the
+detection threshold before equalization ends.
+Default is 80. Allowed range is between 1 and 2000.
+
+@item knee
+Curve the sharp knee around the detection threshold to calculate
+equalization gain more softly.
+Default is 2. Allowed range is between 1 and 8.
+
+@item ratio
+Set the ratio by which the equalization gain is raised.
+Default is 1. Allowed range is between 1 and 20.
+
+@item range
+Set the max allowed cut/boost amount. Default is 0.06125.
+Allowed range is from 0.0001 to 1.
+
+@item mode
+Set the mode of filter operation, can be one of the following:
+
+@table @samp
+@item cut
+Cut frequencies above detection threshold.
+@item boost
+Boost frequencies bellow detection threshold.
+@end table
+Default mode is @samp{cut}.
+@end table
+
+@subsection Commands
+
+This filter supports the all above options as @ref{commands}.
+
 @section adynamicsmooth
 
 Apply dynamic smoothing to input audio stream.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c8082c4a2f..d40be4b252 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_ADECORRELATE_FILTER)   += 
af_adecorrelate.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
 OBJS-$(CONFIG_ADENORM_FILTER)+= af_adenorm.o
 OBJS-$(CONFIG_ADERIVATIVE_FILTER)+= af_aderivative.o
+OBJS-$(CONFIG_ADYNAMICEQUALIZER_FILTER)  += af_adynamicequalizer.o
 OBJS-$(CONFIG_ADYNAMICSMOOTH_FILTER) += af_adynamicsmooth.o
 OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
 OBJS-$(CONFIG_AEMPHASIS_FILTER)  += af_aemphasis.o
diff --git a/libavfilter/af_adynamicequalizer.c 
b/libavfilter/af_adynamicequalizer.c
new file mode 100644
index 00..da3d96d7cf
--- /dev/null
+++ b/libavfilter/af_adynamicequalizer.c
@@ -0,0 +1,310 @@
+/*
+ * 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/ffmath.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "formats.h"
+#include "hermite.h"
+
+typedef struct AudioDynamicEqualizerContext {
+const AVClass *class;
+
+do

Re: [FFmpeg-devel] [PATCH v2] lavfi: add nlmeans CUDA filter

2021-11-28 Thread Timo Rothenpieler

+for (i = 0; i < nb_pixel / 4; i++) {
+
+int *dx_cur = dxdy + 8 * i;
+int *dy_cur = dxdy + 8 * i + 4;
+
+call_horiz(ctx, 1, src_dptr, src_width, src_height, src_pitch,
+   integ_img, dx_cur, dy_cur, pixel_size);
+
+call_vert(ctx, 1, src_width, src_height, integ_img, pixel_size);
+
+call_weight(ctx, 1, src_dptr, src_width, src_height, src_pitch, integ_img, 
(float*)s->sum, (float*)s->weight, p, dx_cur, dy_cur, pixel_size);
+}
+
+call_average(ctx, 1, src_dptr, src_width, src_height, src_pitch, 
(float*)s->sum, (float*)s->weight,
+   dst_dptr, dst_width, dst_height, dst_pitch, pixel_size);


My immediate thought when seeing that block is "move this all to the 
CUDA side", but you're calling all those with different block layouts?


I don't understand the algorithm well enough, so I guess this is necessary.

How well does it perform? All those jumps between C and CUDA code come 
at an overhead.



Some other nits:
I'm not a fan of a functions just called "init", "uninit" and so on. 
It's not wrong, given it's static, but it's usually nicer to give all 
functions a common prefix. "cunlmeans_" or something like that.


What's up with that if(!s->initialised) block in filter_frame? I would 
have thought it's logically impossible that it gets that far without 
init being called?




Otherwise, the filter looks fine to me.


smime.p7s
Description: S/MIME Cryptographic 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".