Re: [FFmpeg-devel] 回复: [EXT] Re: [PATCH] avcodec/v4l2_buffers: don't prevent enqueue capture buffer to driver

2020-04-26 Thread Andriy Gelman
On Thu, 09. Apr 00:27, Andriy Gelman wrote:
> On Thu, 09. Apr 02:14, Ming Qian wrote:
> > Did you try increasing the -num_capture_buffers option? It may solve your 
> > problem.
> > 1. We can't increase the num_capture_buffers indefinitely.
> > 2. There is a ring buffer in driver, so the number of frames who is stored 
> > in the ring buffer may be a large value, This depends on the speed of the 
> > input and output. So it's likely that when output port is done, there are a 
> > large count of frames who have not been decoded,  if the capture port 
> > prevent qbuf to driver, there will no frame buffer to store the decoded 
> > frame.
> > 
> > There is currently a check that sets ctx->done=1 when all the capture 
> > buffers are dequeued (v4l2_context.c:300), and this patch would prevent it 
> > (although it's not needed if an eos event is received).
> 
> > Yes, but I think it's not appropriate to judge whether the capture port is 
> > done by checking all the capture buffers are dequeued.
> > 
> 
> I tend to agree with you. Even if eos event is not setup/supported, we should
> be able to set ctx->done=1 via the EPIPE error.  
> 
> But let's wait for some more comments. 
> 

In [1] it says that capture buffers should be enqueued back to the device while
draining.

I'll apply this patch on Wednesday if no one objects.


[1] https://patchwork.kernel.org/patch/0031/

"...The client must continue to handle both queues independently,
   smilarly to normal encode operation. This includes:

   * queuing and dequeuing ``CAPTURE`` buffers, until a buffer marked with the
 ``V4L2_BUF_FLAG_LAST`` flag is dequeued, ... " 

-- 
Andriy
___
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] libavutil: add clean aperture (CLAP) side data.

2020-04-26 Thread Neil Birkbeck
The clean aperature represents a cropping of the stored image data used to
relate the image data to a canonical video system and exists as container
metadata (see 'clap' section in 
https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html)

Addition of the side data is a first step towards demuxing CLAP atom metadata,
helping to resolve https://trac.ffmpeg.org/ticket/7437

This CleanAperture representation can also carry PixelCrop fields from MKV.
Side data was suggested as a way to carry such PixelCrop fields in:
https://ffmpeg.org/pipermail/ffmpeg-devel/2016-March/192302.html

Transmuxing the side data can then be added (MOV to/from MKV), and
auto-application could optionally be enabled like autorotate in ffmpeg_filter.c.

Signed-off-by: Neil Birkbeck 
---
 libavcodec/avpacket.c  |  1 +
 libavcodec/packet.h| 12 
 libavformat/dump.c | 15 +
 libavutil/Makefile |  2 ++
 libavutil/clean_aperture.c | 30 ++
 libavutil/clean_aperture.h | 63 ++
 6 files changed, 123 insertions(+)
 create mode 100644 libavutil/clean_aperture.c
 create mode 100644 libavutil/clean_aperture.h

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 55b509108e..2ff779720b 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -397,6 +397,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
 case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
 case AV_PKT_DATA_DOVI_CONF:  return "DOVI configuration 
record";
+case AV_PKT_DATA_CLEAN_APERTURE: return "Clean Aperture";
 }
 return NULL;
 }
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 41485f4527..a0f8c29a33 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -282,6 +282,18 @@ enum AVPacketSideDataType {
  */
 AV_PKT_DATA_DOVI_CONF,
 
+/**
+ * This side data contains a crop region (clean aperture) that defines the
+ * region of the stored image that should be cropped.
+ *
+ * It is intended to be used to store crop-related metadata from the
+ * container. For example, the CLAP atom in MOV files, and PixelCrop fields
+ * in MKV.
+ *
+ * The data is of type AVCleanAperture (see libavutil/clean_aperture.h)
+ */
+AV_PKT_DATA_CLEAN_APERTURE,
+
 /**
  * The number of side data types.
  * This is not part of the public API/ABI in the sense that it may
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 5e9a03185f..060e7b2d10 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -26,6 +26,7 @@
 #include "libavutil/display.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
+#include "libavutil/clean_aperture.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/mathematics.h"
@@ -402,6 +403,16 @@ static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
dovi->dv_bl_signal_compatibility_id);
 }
 
+static void dump_clean_aperture(void *ctx, AVPacketSideData *sd)
+{
+AVCleanAperture *clap = (AVCleanAperture *)sd->data;
+av_log(ctx, AV_LOG_INFO, "[width %d/%d height:%d/%d h_offset:%d/%d 
v_offset:%d/%d]",
+   clap->width.num, clap->width.den,
+   clap->height.num, clap->height.den,
+   clap->horizontal_offset.num, clap->horizontal_offset.den,
+   clap->vertical_offset.num, clap->vertical_offset.den);
+}
+
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
 {
 int i;
@@ -468,6 +479,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
 dump_dovi_conf(ctx, );
 break;
+case AV_PKT_DATA_CLEAN_APERTURE:
+av_log(ctx, AV_LOG_INFO, "Clean aperture:");
+dump_clean_aperture(ctx, );
+break;
 default:
 av_log(ctx, AV_LOG_INFO,
"unknown side data type %d (%d bytes)", sd.type, sd.size);
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 966eec41aa..e9c9b2bff1 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -17,6 +17,7 @@ HEADERS = adler32.h   
  \
   cast5.h   \
   camellia.h\
   channel_layout.h  \
+  clean_aperture.h  \
   common.h  \
   cpu.h \
   crc.h \
@@ -107,6 +108,7 

Re: [FFmpeg-devel] [PATCH v1] MAINTAINERS: add myself to the general developers list

2020-04-26 Thread Limin Wang
On Sun, Apr 26, 2020 at 11:44:32PM +0200, Marton Balint wrote:
> 
> 
> On Sun, 26 Apr 2020, lance.lmw...@gmail.com wrote:
> 
> >From: Limin Wang 
> >
> >Signed-off-by: Limin Wang 
> >---
> >I have actively contributed to FFmpeg in the past year and should be familiar
> >with the entire code base and the rules of the developers.
> 
> Then maybe could you omit v1 designators in the future? A patch
> without a version designator is usually the first version, or at
> least that is how most of the developers send patches, so I suggest
> you follow this as well.

Got it, I'm glad to learn for the rule. Maybe it's better to add the rule
to developer document to follow.

> 
> Thanks,
> Marton
> 
> >Up to now, more than
> >one hundred patches have been accepted and pushed with the help of
> >other developers. However, some reviewed patches have not been
> >pushed yet, so I am
> >glad to request push access to the FFmpeg repository so that I can push them
> >by the developer rules. I think being a committer is a duty, I prefer to 
> >submit
> >any patch to ML for review to avoid making mistakes.
> >
> >Please the core team give comments or vote for my request.
> >
> >MAINTAINERS | 1 +
> >1 file changed, 1 insertion(+)
> >
> >diff --git a/MAINTAINERS b/MAINTAINERS
> >index e19d1ee586..06956f8741 100644
> >--- a/MAINTAINERS
> >+++ b/MAINTAINERS
> >@@ -564,6 +564,7 @@ Joakim Plate
> >Jun Zhao
> >Kieran Kunhya
> >Kirill Gavrilov
> >+Limin Wang
> >Martin Storsjö
> >Panagiotis Issaris
> >Pedro Arthur
> >-- 
> >2.21.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".

-- 
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] [PATCH] fate/exr: add test for YA16

2020-04-26 Thread mindmark
From: Mark Reid 

Hi, I noticed there was not fate test for this support format of exr.

here is the test file to add to fate
https://www.dropbox.com/s/urzus0svmq1oizd/ya_scanline_zip_half_12x8.exr?dl=0

---
 tests/fate/image.mak | 3 +++
 tests/ref/fate/exr-ya-scanline-zip-half-12x8 | 6 ++
 2 files changed, 9 insertions(+)
 create mode 100644 tests/ref/fate/exr-ya-scanline-zip-half-12x8

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 121405aab9..f65119bffc 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -281,6 +281,9 @@ fate-exr-y-tile-zip-half-12x8: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/y_tile_zi
 FATE_EXR += fate-exr-y-scanline-zip-half-12x8
 fate-exr-y-scanline-zip-half-12x8: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/y_scanline_zip_half_12x8.exr -pix_fmt gray16le

+FATE_EXR += fate-exr-ya-scanline-zip-half-12x8
+fate-exr-ya-scanline-zip-half-12x8: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/ya_scanline_zip_half_12x8.exr -pix_fmt ya16le
+
 FATE_EXR += fate-exr-rgb-scanline-half-piz-dw-t08
 fate-exr-rgb-scanline-half-piz-dw-t08: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_half_piz_dw_t08.exr -pix_fmt rgb48le

diff --git a/tests/ref/fate/exr-ya-scanline-zip-half-12x8 
b/tests/ref/fate/exr-ya-scanline-zip-half-12x8
new file mode 100644
index 00..f166396164
--- /dev/null
+++ b/tests/ref/fate/exr-ya-scanline-zip-half-12x8
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 12x8
+#sar 0: 1/1
+0,  0,  0,1,  384, 0xcb9148cc
--
2.25.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] ffmpeg.org down

2020-04-26 Thread Timo Rothenpieler

Trac and Website are working fine 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".

Re: [FFmpeg-devel] [PATCH v10 2/2] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-26 Thread Zane van Iperen
On Sun, 26 Apr 2020 00:07:52 +0200
"Michael Niedermayer"  wrote:

> 
> also iam not sure it makes sense or if it goes to far but the probe
> code could check all tracks which are within the buffer
> all these low 10 scores are a bit ugly, some more solid "yes iam sure
> this is / is not" instead of such really low scores.
> 
> low scores which get returned based on few weak checks have the
> problem of more often producing errors in detection. Random non
> multimedia files being detected as something they are not or if 2
> demuxers have such a low score detection then its more likely the
> wrong one will be choosen
> 
> 

How's this?

I've removed the "track_count > 113" check and made it
all-or-nothing.

static int pp_bnk_probe(const AVProbeData *p)
{
uint32_t sample_rate = AV_RL32(p->buf +  4);
uint32_t track_count = AV_RL32(p->buf + 12);
uint32_t flags   = AV_RL32(p->buf + 16);

if (track_count == 0 || track_count > INT_MAX)
return 0;

if ((sample_rate !=  5512) && (sample_rate != 11025) &&
(sample_rate != 22050) && (sample_rate != 44100))
return 0;

/* Check the first track header. */
if (AV_RL32(p->buf + 28) != sample_rate)
return 0;

if ((flags & ~PP_BNK_FLAG_MASK) != 0)
return 0;

return AVPROBE_SCORE_MAX / 4 + 1;
}


Zane

___
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] ffmpeg.org down

2020-04-26 Thread Dennis Mungai
On Sun, 26 Apr 2020 at 20:25, Tom Needham <06needh...@gmail.com> wrote:

> This is probably off-topic for this mailing list, but I wasn't sure where
> to post this.
>
> ffmpeg.org seems to be down for me at the moment and all connections are
> timing out, is there any in progress maintenance/issues currently?
>
> Thanks
> Tom
>
>
Can confirm, even the wikis appear to be offline.
___
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 1/6] avformat: only allow a single bitstream filter when muxing

2020-04-26 Thread James Almer
On 4/25/2020 5:14 AM, Marton Balint wrote:
> 
> 
> On Sun, 19 Apr 2020, Andreas Rheinhardt wrote:
> 
>> Marton Balint:
>>> Current muxers only use a single bitstream filter, so there is no
>>> need to
>>> maintain code which operates on a list of bitstream filters. When
>>> multiple
>>> bitstream filters are needed muxers can simply use a list bitstream
>>> filter.
>>>
>>> If there is a use case in the future when different bitstream filters
>>> should be
>>> added at subsequent packets then a new API possibly involving
>>> reconfiguring the
>>> list bistream filter can be added knowing the exact requirements.
>>>
>>> Signed-off-by: Marton Balint 
>>> ---
>>>  libavformat/dashenc.c  |  6 ++
>>>  libavformat/internal.h |  5 ++---
>>>  libavformat/mux.c  |  6 +++---
>>>  libavformat/segment.c  |  6 ++
>>>  libavformat/utils.c    | 27 +--
>>>  5 files changed, 18 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index 5a8cff4034..b977761a00 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -2307,10 +2307,8 @@ static int dash_check_bitstream(struct
>>> AVFormatContext *s, const AVPacket *avpkt
>>>  if (ret == 1) {
>>>  AVStream *st = s->streams[avpkt->stream_index];
>>>  AVStream *ost = oc->streams[0];
>>> -    st->internal->bsfcs = ost->internal->bsfcs;
>>> -    st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
>>> -    ost->internal->bsfcs = NULL;
>>> -    ost->internal->nb_bsfcs = 0;
>>> +    st->internal->bsfc = ost->internal->bsfc;
>>> +    ost->internal->bsfc = NULL;
>>>  }
>>>  return ret;
>>>  }
>>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>>> index 7e4284b217..cafb4a9686 100644
>>> --- a/libavformat/internal.h
>>> +++ b/libavformat/internal.h
>>> @@ -152,12 +152,11 @@ struct AVStreamInternal {
>>>  int reorder;
>>>
>>>  /**
>>> - * bitstream filters to run on stream
>>> + * bitstream filter to run on stream
>>>   * - encoding: Set by muxer using ff_stream_add_bitstream_filter
>>>   * - decoding: unused
>>>   */
>>> -    AVBSFContext **bsfcs;
>>> -    int nb_bsfcs;
>>> +    AVBSFContext *bsfc;
>>>
>>>  /**
>>>   * Whether or not check_bitstream should still be run on each
>>> packet
>>> diff --git a/libavformat/mux.c b/libavformat/mux.c
>>> index 3d63d59faf..5209c84f40 100644
>>> --- a/libavformat/mux.c
>>> +++ b/libavformat/mux.c
>>> @@ -824,7 +824,7 @@ static int prepare_input_packet(AVFormatContext
>>> *s, AVPacket *pkt)
>>>
>>>  static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) {
>>>  AVStream *st = s->streams[pkt->stream_index];
>>> -    int i, ret;
>>> +    int ret;
>>>
>>>  if (!(s->flags & AVFMT_FLAG_AUTO_BSF))
>>>  return 1;
>>> @@ -838,8 +838,8 @@ static int do_packet_auto_bsf(AVFormatContext *s,
>>> AVPacket *pkt) {
>>>  }
>>>  }
>>>
>>> -    for (i = 0; i < st->internal->nb_bsfcs; i++) {
>>> -    AVBSFContext *ctx = st->internal->bsfcs[i];
>>> +    if (st->internal->bsfc) {
>>> +    AVBSFContext *ctx = st->internal->bsfc;
>>>  // TODO: when any bitstream filter requires flushing at EOF,
>>> we'll need to
>>>  // flush each stream's BSF chain on write_trailer.
>>>  if ((ret = av_bsf_send_packet(ctx, pkt)) < 0) {
>>> diff --git a/libavformat/segment.c b/libavformat/segment.c
>>> index 60b72b7d15..32c09827eb 100644
>>> --- a/libavformat/segment.c
>>> +++ b/libavformat/segment.c
>>> @@ -1034,10 +1034,8 @@ static int seg_check_bitstream(struct
>>> AVFormatContext *s, const AVPacket *pkt)
>>>  if (ret == 1) {
>>>  AVStream *st = s->streams[pkt->stream_index];
>>>  AVStream *ost = oc->streams[pkt->stream_index];
>>> -    st->internal->bsfcs = ost->internal->bsfcs;
>>> -    st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
>>> -    ost->internal->bsfcs = NULL;
>>> -    ost->internal->nb_bsfcs = 0;
>>> +    st->internal->bsfc = ost->internal->bsfc;
>>> +    ost->internal->bsfc = NULL;
>>>  }
>>>  return ret;
>>>  }
>>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>>> index a58e47fabc..eff73252ec 100644
>>> --- a/libavformat/utils.c
>>> +++ b/libavformat/utils.c
>>> @@ -4410,10 +4410,7 @@ static void free_stream(AVStream **pst)
>>>
>>>  if (st->internal) {
>>>  avcodec_free_context(>internal->avctx);
>>> -    for (i = 0; i < st->internal->nb_bsfcs; i++) {
>>> -    av_bsf_free(>internal->bsfcs[i]);
>>> -    av_freep(>internal->bsfcs);
>>
>> I can't believe it! This only works if there is only one bsf. So a real
>> list has indeed never been tested.
>>
>>> -    }
>>> +    av_bsf_free(>internal->bsfc);
>>>  av_freep(>internal->priv_pts);
>>>  av_bsf_free(>internal->extract_extradata.bsf);
>>>    

Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/decode: use a single list bsf for codec decode bsfs

2020-04-26 Thread James Almer
On 4/26/2020 5:34 AM, Marton Balint wrote:
>  void avcodec_flush_buffers(AVCodecContext *avctx)
>  {
>  AVCodecInternal *avci = avctx->internal;
> @@ -2117,7 +2001,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>  avctx->pts_correction_last_pts =
>  avctx->pts_correction_last_dts = INT64_MIN;
>  
> -bsfs_flush(avctx);
> +av_bsf_flush(avci->filter.bsf);

This function can be called with encoders as well, and after this change
you'll be calling av_bsf_flush() with NULL as argument.

Easiest solution is to add an av_codec_is_decoder(avctx->codec) check
before calling it, i guess.

>  
>  if (!avctx->refcounted_frames)
>  av_frame_unref(avci->to_free);

___
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] fftools/ffmpeg_opt: use av_bsf_list_parse_str for parsing bsf lists

2020-04-26 Thread James Almer
On 4/25/2020 3:55 PM, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  fftools/ffmpeg_opt.c | 57 
> +++-
>  1 file changed, 3 insertions(+), 54 deletions(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index b52aa28626..dc42fb19d6 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -1416,7 +1416,6 @@ static OutputStream *new_output_stream(OptionsContext 
> *o, AVFormatContext *oc, e
>  {
>  OutputStream *ost;
>  AVStream *st = avformat_new_stream(oc, NULL);
> -AVBSFList *bsf_list = NULL;
>  int idx  = oc->nb_streams - 1, ret = 0;
>  const char *bsfs = NULL, *time_base = NULL;
>  char *next, *codec_tag = NULL;
> @@ -1536,60 +1535,10 @@ static OutputStream *new_output_stream(OptionsContext 
> *o, AVFormatContext *oc, e
>  MATCH_PER_STREAM_OPT(copy_prior_start, i, ost->copy_prior_start, oc ,st);
>  
>  MATCH_PER_STREAM_OPT(bitstream_filters, str, bsfs, oc, st);
> -while (bsfs && *bsfs) {
> -const AVBitStreamFilter *filter;
> -char *bsf, *bsf_options_str, *bsf_name;
> -AVBSFContext *bsf_ctx;
> -
> -bsf = av_get_token(, ",");
> -if (!bsf)
> -exit_program(1);
> -bsf_name = av_strtok(bsf, "=", _options_str);
> -if (!bsf_name)
> -exit_program(1);
> -
> -filter = av_bsf_get_by_name(bsf_name);
> -if (!filter) {
> -av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", 
> bsf_name);
> -exit_program(1);
> -}
> -
> -ret = av_bsf_alloc(filter, _ctx);
> -if (ret < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Error allocating a bitstream filter 
> context\n");
> -exit_program(1);
> -}
> -
> -if (bsf_options_str && filter->priv_class) {
> -const AVOption *opt = av_opt_next(bsf_ctx->priv_data, NULL);
> -const char * shorthand[2] = {NULL};
> -
> -if (opt)
> -shorthand[0] = opt->name;
> -
> -ret = av_opt_set_from_string(bsf_ctx->priv_data, 
> bsf_options_str, shorthand, "=", ":");
> -if (ret < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Error parsing options for 
> bitstream filter %s\n", bsf_name);
> -exit_program(1);
> -}
> -}
> -
> -if (!bsf_list)
> -bsf_list = av_bsf_list_alloc();
> -if (!bsf_list || av_bsf_list_append(bsf_list, bsf_ctx) < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Failed to allocate or append to bsf 
> list\n");
> -exit_program(1);
> -}
> -
> -av_freep();
> -
> -if (*bsfs)
> -bsfs++;
> -}
> -if (bsf_list) {
> -ret = av_bsf_list_finalize(_list, >bsf_ctx);
> +if (bsfs && *bsfs) {
> +ret = av_bsf_list_parse_str(bsfs, >bsf_ctx);
>  if (ret < 0) {
> -av_log(NULL, AV_LOG_ERROR, "Failed to finalize bsf list\n");
> +av_log(NULL, AV_LOG_ERROR, "Error parsing bitstream filter 
> sequence '%s': %s\n", bsfs, av_err2str(ret));
>  exit_program(1);
>  }
>  }

Maybe this patch could instead be merged with 1/3 and applied after 2/3?
___
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 1/6] avformat: only allow a single bitstream filter when muxing

2020-04-26 Thread Marton Balint



On Sat, 25 Apr 2020, Marton Balint wrote:




On Sun, 19 Apr 2020, Andreas Rheinhardt wrote:


Marton Balint:

Current muxers only use a single bitstream filter, so there is no need to
maintain code which operates on a list of bitstream filters. When multiple
bitstream filters are needed muxers can simply use a list bitstream 

filter.


If there is a use case in the future when different bitstream filters 

should be
added at subsequent packets then a new API possibly involving 

reconfiguring the

list bistream filter can be added knowing the exact requirements.

Signed-off-by: Marton Balint 
---
 libavformat/dashenc.c  |  6 ++
 libavformat/internal.h |  5 ++---
 libavformat/mux.c  |  6 +++---
 libavformat/segment.c  |  6 ++
 libavformat/utils.c| 27 +--
 5 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5a8cff4034..b977761a00 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2307,10 +2307,8 @@ static int dash_check_bitstream(struct 

AVFormatContext *s, const AVPacket *avpkt

 if (ret == 1) {
 AVStream *st = s->streams[avpkt->stream_index];
 AVStream *ost = oc->streams[0];
-st->internal->bsfcs = ost->internal->bsfcs;
-st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
-ost->internal->bsfcs = NULL;
-ost->internal->nb_bsfcs = 0;
+st->internal->bsfc = ost->internal->bsfc;
+ost->internal->bsfc = NULL;
 }
 return ret;
 }
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 7e4284b217..cafb4a9686 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -152,12 +152,11 @@ struct AVStreamInternal {
 int reorder;

 /**
- * bitstream filters to run on stream
+ * bitstream filter to run on stream
  * - encoding: Set by muxer using ff_stream_add_bitstream_filter
  * - decoding: unused
  */
-AVBSFContext **bsfcs;
-int nb_bsfcs;
+AVBSFContext *bsfc;

 /**
  * Whether or not check_bitstream should still be run on each packet
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 3d63d59faf..5209c84f40 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -824,7 +824,7 @@ static int prepare_input_packet(AVFormatContext *s, 

AVPacket *pkt)


 static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) {
 AVStream *st = s->streams[pkt->stream_index];
-int i, ret;
+int ret;

 if (!(s->flags & AVFMT_FLAG_AUTO_BSF))
 return 1;
@@ -838,8 +838,8 @@ static int do_packet_auto_bsf(AVFormatContext *s, 

AVPacket *pkt) {

 }
 }

-for (i = 0; i < st->internal->nb_bsfcs; i++) {
-AVBSFContext *ctx = st->internal->bsfcs[i];
+if (st->internal->bsfc) {
+AVBSFContext *ctx = st->internal->bsfc;
 // TODO: when any bitstream filter requires flushing at EOF, 

we'll need to

 // flush each stream's BSF chain on write_trailer.
 if ((ret = av_bsf_send_packet(ctx, pkt)) < 0) {
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 60b72b7d15..32c09827eb 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -1034,10 +1034,8 @@ static int seg_check_bitstream(struct 

AVFormatContext *s, const AVPacket *pkt)

 if (ret == 1) {
 AVStream *st = s->streams[pkt->stream_index];
 AVStream *ost = oc->streams[pkt->stream_index];
-st->internal->bsfcs = ost->internal->bsfcs;
-st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
-ost->internal->bsfcs = NULL;
-ost->internal->nb_bsfcs = 0;
+st->internal->bsfc = ost->internal->bsfc;
+ost->internal->bsfc = NULL;
 }
 return ret;
 }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a58e47fabc..eff73252ec 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4410,10 +4410,7 @@ static void free_stream(AVStream **pst)

 if (st->internal) {
 avcodec_free_context(>internal->avctx);
-for (i = 0; i < st->internal->nb_bsfcs; i++) {
-av_bsf_free(>internal->bsfcs[i]);
-av_freep(>internal->bsfcs);


I can't believe it! This only works if there is only one bsf. So a real
list has indeed never been tested.


-}
+av_bsf_free(>internal->bsfc);
 av_freep(>internal->priv_pts);
 av_bsf_free(>internal->extract_extradata.bsf);
 av_packet_free(>internal->extract_extradata.pkt);
@@ -5574,7 +5571,11 @@ int ff_stream_add_bitstream_filter(AVStream *st, 

const char *name, const char *a

 int ret;
 const AVBitStreamFilter *bsf;
 AVBSFContext *bsfc;
-AVCodecParameters *in_par;
+
+if (st->internal->bsfc) {
+av_log(NULL, AV_LOG_ERROR, "A bitstream filter is already 

specified for stream %d\n", st->index);

+return AVERROR(EINVAL);
+}


Given that 

Re: [FFmpeg-devel] [PATCH v1] MAINTAINERS: add myself to the general developers list

2020-04-26 Thread Marton Balint



On Sun, 26 Apr 2020, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Signed-off-by: Limin Wang 
---
I have actively contributed to FFmpeg in the past year and should be familiar
with the entire code base and the rules of the developers.


Then maybe could you omit v1 designators in the future? A patch without a 
version designator is usually the first version, or at least that is how 
most of the developers send patches, so I suggest you follow this as well.


Thanks,
Marton


Up to now, more than
one hundred patches have been accepted and pushed with the help of other 
developers. However, some reviewed patches have not been pushed yet, so I am

glad to request push access to the FFmpeg repository so that I can push them
by the developer rules. I think being a committer is a duty, I prefer to submit
any patch to ML for review to avoid making mistakes.

Please the core team give comments or vote for my request.

MAINTAINERS | 1 +
1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e19d1ee586..06956f8741 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -564,6 +564,7 @@ Joakim Plate
Jun Zhao
Kieran Kunhya
Kirill Gavrilov
+Limin Wang
Martin Storsjö
Panagiotis Issaris
Pedro Arthur
--
2.21.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".

Re: [FFmpeg-devel] [PATCH]lavc/jpeg2000dec: Scale 4-7bit output to 8 bits

2020-04-26 Thread Michael Niedermayer
On Sat, Apr 25, 2020 at 07:26:08PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch makes the output of the reference sample p0_03.j2k
> bit-exact with opj_decompress and kdu_render and more similar to
> jasper's output.
> 
> Please comment, Carl Eugen

>  jpeg2000dec.c |   10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 895351be2965009049944f0ceeb42bc5f8cee733  
> 0001-lavc-jpeg2000dec-Scale-4-7-bit-output-to-8-bits.patch
> From de80453a8decd95b4a71cea71b20ba0bd74485cb Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Sat, 25 Apr 2020 18:31:22 +0200
> Subject: [PATCH] lavc/jpeg2000dec: Scale 4-7 bit output to 8 bits.
> 
> Makes p0_03.j2k output bitexact with opj_decompress and kdu_render
> and more similar with the output of jasper.
> ---
>  libavcodec/jpeg2000dec.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 460a4ad95c..8d7c729530 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -1938,7 +1938,9 @@ static inline void 
> tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
>  int val = lrintf(*datap) + (1 << (cbps - 1));
>  \
>  /* DC level shift and clip see ISO 15444-1:2002 
> G.1.2 */  \
>  val  = av_clip(val, 0, (1 << cbps) - 1); 
>  \
> -*dst = val << (precision - cbps);
>  \
> +*dst = val << ((precision < 8 ? 8 : precision) - 
> cbps);   \
> +if (precision < 8)   
>  \
> +*dst |= *dst >> (8 - precision); 
>  \
>  datap++; 
>  \
>  dst += pixelsize;
>  \
>  }
>  \
> @@ -1947,7 +1949,9 @@ static inline void 
> tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
>  int val = *i_datap + (1 << (cbps - 1));  
>  \
>  /* DC level shift and clip see ISO 15444-1:2002 
> G.1.2 */  \
>  val  = av_clip(val, 0, (1 << cbps) - 1); 
>  \
> -*dst = val << (precision - cbps);
>  \
> +*dst = val << ((precision < 8 ? 8 : precision) - 
> cbps);   \
> +if (precision < 8)   
>  \
> +*dst |= *dst >> (8 - precision); 
>  \
>  i_datap++;   
>  \
>  dst += pixelsize;
>  \
>  }
>  \

the check should be outside the pixel loop, as precission does not change
between pixels, this is already a macro to avoid a 8/16 check. And it would
probably be hard for the compiler to figure out when it can remove which side

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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 2/2] avcodec/wmalosslessdec: Fix integer overflows in revert_inter_ch_decorr()

2020-04-26 Thread Michael Niedermayer
Fixes: signed integer overflow: -717241856 + -1434459904 cannot be represented 
in type 'int'
Fixes: 
21405/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5677143666458624

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 8885487980..66a04e7828 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -790,8 +790,8 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int 
tile_size)
 else if (s->is_channel_coded[0] || s->is_channel_coded[1]) {
 int icoef;
 for (icoef = 0; icoef < tile_size; icoef++) {
-s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 
1;
-s->channel_residues[1][icoef] += s->channel_residues[0][icoef];
+s->channel_residues[0][icoef] -= 
(unsigned)(s->channel_residues[1][icoef] >> 1);
+s->channel_residues[1][icoef] += (unsigned) 
s->channel_residues[0][icoef];
 }
 }
 }
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 1/2] avcodec/alacdsp: Fix invalid shift in append_extra_bits()

2020-04-26 Thread Michael Niedermayer
Fixes: left shift of negative value -1
Fixes: 
21390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-6242539519868928

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

diff --git a/libavcodec/alacdsp.c b/libavcodec/alacdsp.c
index ecbaedb067..9996eb4319 100644
--- a/libavcodec/alacdsp.c
+++ b/libavcodec/alacdsp.c
@@ -49,7 +49,7 @@ static void append_extra_bits(int32_t *buffer[2], int32_t 
*extra_bits_buffer[2],
 
 for (ch = 0; ch < channels; ch++)
 for (i = 0; i < nb_samples; i++)
-buffer[ch][i] = (buffer[ch][i] << extra_bits) | 
extra_bits_buffer[ch][i];
+buffer[ch][i] = ((unsigned)buffer[ch][i] << extra_bits) | 
extra_bits_buffer[ch][i];
 }
 
 av_cold void ff_alacdsp_init(ALACDSPContext *c)
-- 
2.17.1

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

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

[FFmpeg-devel] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2

2020-04-26 Thread David Manouchehri
Resubmit of a previous patch, not sure why the diff didn't come through.
From d125fea410dea1c2d4bd791a7472a72822de54a3 Mon Sep 17 00:00:00 2001
From: David Manouchehri 
Date: Sat, 4 Nov 2017 16:32:41 -0400
Subject: [PATCH] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.

Signed-off-by: David Manouchehri 
---
 libavdevice/v4l2enc.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index 1c36f81f90..f89ff50dbb 100644
--- a/libavdevice/v4l2enc.c
+++ b/libavdevice/v4l2enc.c
@@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1)
 }
 
 if (s1->nb_streams != 1 ||
-s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
-s1->streams[0]->codecpar->codec_id   != AV_CODEC_ID_RAWVIDEO) {
+s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
 av_log(s1, AV_LOG_ERROR,
"V4L2 output device supports only a single raw video stream\n");
 return AVERROR(EINVAL);
@@ -56,7 +55,13 @@ static av_cold int write_header(AVFormatContext *s1)
 
 par = s1->streams[0]->codecpar;
 
-v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+if(s1->streams[0]->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
+v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+}
+else {
+v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id);
+}
+
 if (!v4l2_pixfmt) { // XXX: try to force them one by one?
 av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n",
av_get_pix_fmt_name(par->format));
-- 
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] avformat/hls: disable persistent HTTP connections by default w/ schannel

2020-04-26 Thread Jan Ekström
This TLS implementation has always had issues with the way that
libavformat implemented persistency, yet nobody seemed to be able to
figure out why. It currently can lead to completely stuck playback,
so disable it by default.

Additionally, update the documentation to match the new behavior.
---
 doc/demuxers.texi | 3 ++-
 libavformat/hls.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 3c15ab9eee..35920af32d 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -337,7 +337,8 @@ Default value is 1000.
 
 @item http_persistent
 Use persistent HTTP connections. Applicable only for HTTP streams.
-Enabled by default.
+Enabled by default, except when the Windows schannel TLS implementation
+is utilized.
 
 @item http_multiple
 Use multiple HTTP connections for downloading HTTP segments.
diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..f709f0c890 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2343,7 +2343,7 @@ static const AVOption hls_options[] = {
 {"m3u8_hold_counters", "The maximum number of times to load m3u8 when it 
refreshes without new segments",
 OFFSET(m3u8_hold_counters), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, 
INT_MAX, FLAGS},
 {"http_persistent", "Use persistent HTTP connections",
-OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
+OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = !CONFIG_SCHANNEL}, 
0, 1, FLAGS },
 {"http_multiple", "Use multiple HTTP connections for fetching segments",
 OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
 {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 
= auto",
-- 
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] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2

2020-04-26 Thread David Manouchehri
Thanks for catching that bug! I tested rawvideo again this time, and
it works as expected with this new patch.
From d125fea410dea1c2d4bd791a7472a72822de54a3 Mon Sep 17 00:00:00 2001
From: David Manouchehri 
Date: Sat, 4 Nov 2017 16:32:41 -0400
Subject: [PATCH] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.

Signed-off-by: David Manouchehri 
---
 libavdevice/v4l2enc.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index 1c36f81f90..f89ff50dbb 100644
--- a/libavdevice/v4l2enc.c
+++ b/libavdevice/v4l2enc.c
@@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1)
 }
 
 if (s1->nb_streams != 1 ||
-s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
-s1->streams[0]->codecpar->codec_id   != AV_CODEC_ID_RAWVIDEO) {
+s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
 av_log(s1, AV_LOG_ERROR,
"V4L2 output device supports only a single raw video stream\n");
 return AVERROR(EINVAL);
@@ -56,7 +55,13 @@ static av_cold int write_header(AVFormatContext *s1)
 
 par = s1->streams[0]->codecpar;
 
-v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+if(s1->streams[0]->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
+v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+}
+else {
+v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id);
+}
+
 if (!v4l2_pixfmt) { // XXX: try to force them one by one?
 av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n",
av_get_pix_fmt_name(par->format));
-- 
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 v3 4/4] libavutil/qsv: enabling d3d11va support

2020-04-26 Thread Soft Works
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Mark Thompson
> Sent: Sunday, April 26, 2020 8:54 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v3 4/4] libavutil/qsv: enabling d3d11va
> support
> 
> On 24/04/2020 15:52, artem.ga...@gmail.com wrote:
> > From: Artem Galin 
> >
> > Makes selection of d3d11va device type by default and over DirectX 9,
> > which is still supported but requires explicit selection.
> 
> ... which might break users with older drivers/systems.  Some comment on
> exactly which setups are broken would be helpful here.

I have done some investigation on this question: 
https://github.com/softworkz/ffmpeg_dx11/issues/1

A short summary: 

- D3D11 will fail for Gen 3 Intel CPUs

- D3D11 will fail for Gen 4 and Gen 5 Intel CPUs as long as DX11 array textures 
are used
  (to get these working, the D3D11 hw context needs to be extended to support 
non-array textures)

- For all newer CPUs: For all drivers that are older than 14-16 months, D3D11 
may fail
  (except when implementing support for non-array DX11 textures)

Note: by "working" or "fail" I'm considering the full set of hw features 
including VPP filters.
Simple decoding or encoding might still work in cases where I wrote "fail".


An additional objection I have is about the non-deterministic selection between 
D3D9 and DX11.
The -qsv_device parameter allows to specify the device numer/Index of a 
graphics adapter to use.

On Windows, the numbering graphic adapters is very different between D3D9 and 
DX11 (=> DXGI).
You could roughly say that D3D9 is counting by connected displays while DXGI is 
counting by 
Physical device.

As long as there is no way to specify whether to enforce D3D9 or DX11, it is 
impossible to know
which adapter ID should be specified when the implementation makes an internal 
decision whether
to select D3D9 or DX11. In that context, defaulting to DX11 will break 
applications that are 
specifying D3D9 adapter IDs.

There needs to be a deterministic and reliable behavior which can be controlled 
from the 
command line. The proposed method for selecting D3D9 is not sufficient from my 
point of view
because the QSV codecs are standalone codecs and intended to work without 
dealing with explicit
hw context creation. For the other half, there should also be a way to 
explicitly select "DX11-or-fail". 

IMO there should be a global command line option to explicitly choose between 
D3D9 or DX11.
(global, because there's no way to mix the two).


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".

[FFmpeg-devel] [PATCH] avfilter/af_loudnorm: Don't mix dB and linear values when calculating linear offset with inputs <3s

2020-04-26 Thread Sebastian Dröge
From: Sebastian Dröge 

s->target_i and global are in dB but s->target_tp and true_peak are
linear. Instead of mixing these in the calculations, convert the former
first to have all following calculations in the same unit.
---
 libavfilter/af_loudnorm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 314b25fa39..8e3cdc36db 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -453,10 +453,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 true_peak = tmp;
 }
 
-offset= s->target_i - global;
-offset_tp = true_peak + offset;
+offset= pow(10., (s->target_i - global) / 20.);
+offset_tp = true_peak * offset;
 s->offset = offset_tp < s->target_tp ? offset : s->target_tp - 
true_peak;
-s->offset = pow(10., s->offset / 20.);
 s->frame_type = LINEAR_MODE;
 }
 
-- 
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".

[FFmpeg-devel] [PATCH 14/14] [inline assembly] add mmx clobbers to cavsdsp

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/cavsdsp.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index becb3a4808..b1b2c7b069 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -166,7 +166,8 @@ static void cavs_idct8_add_sse2(uint8_t *dst, int16_t 
*block, ptrdiff_t stride)
 : "+a"(src), "+c"(dst)\
 : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\
   NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\
-: "memory"\
+: "memory" MMX_CLOBBERS(, "mm0", "mm1", "mm2", "mm3",\
+   "mm4", "mm5", "mm6", "mm7")  \
  );\
  if(h==16){\
 __asm__ volatile(\
@@ -182,7 +183,8 @@ static void cavs_idct8_add_sse2(uint8_t *dst, int16_t 
*block, ptrdiff_t stride)
: "+a"(src), "+c"(dst)\
: "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\
  NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\
-   : "memory"\
+   : "memory" MMX_CLOBBERS(, "mm0", "mm1", "mm2", "mm3",\
+  "mm4", "mm5", "mm6", "mm7")  \
 );\
  }\
  src += 4-(h+5)*srcStride;\
@@ -235,7 +237,8 @@ static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, 
const uint8_t *src, ptr
 : "+a"(src), "+c"(dst), "+m"(h)\
 : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
   NAMED_CONSTRAINTS_ADD(ff_pw_4,ff_pw_5)\
-: "memory"\
+: "memory" MMX_CLOBBERS(, "mm0", "mm1", "mm2", "mm3",\
+   "mm4", "mm5", "mm6", "mm7")\
 );\
 }\
 \
-- 
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 11/14] [inline assembly] add memory to mpegaudiodsp

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/mpegaudiodsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/mpegaudiodsp.c b/libavcodec/x86/mpegaudiodsp.c
index 10b9e814d5..83457dfbb3 100644
--- a/libavcodec/x86/mpegaudiodsp.c
+++ b/libavcodec/x86/mpegaudiodsp.c
@@ -103,7 +103,7 @@ static void apply_window(const float *buf, const float 
*win1,
 "jl  1b   \n\t"
 :"+"(count)
 :"r"(win1a), "r"(win2a), "r"(bufa), "r"(sum1a), "r"(sum2a)
-XMM_CLOBBERS_ONLY("xmm0", "xmm1", "xmm2", "xmm4")
+   :"memory" XMM_CLOBBERS(, "xmm0", "xmm1", "xmm2", "xmm4")
 );
 
 #undef MULT
-- 
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 10/14] [inline assembly] add xmm clobbers to mpegaudiodsp

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/mpegaudiodsp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/x86/mpegaudiodsp.c b/libavcodec/x86/mpegaudiodsp.c
index f46a5c4f3d..10b9e814d5 100644
--- a/libavcodec/x86/mpegaudiodsp.c
+++ b/libavcodec/x86/mpegaudiodsp.c
@@ -103,6 +103,7 @@ static void apply_window(const float *buf, const float 
*win1,
 "jl  1b   \n\t"
 :"+"(count)
 :"r"(win1a), "r"(win2a), "r"(bufa), "r"(sum1a), "r"(sum2a)
+XMM_CLOBBERS_ONLY("xmm0", "xmm1", "xmm2", "xmm4")
 );
 
 #undef MULT
@@ -137,7 +138,7 @@ static void apply_window_mp3(float *in, float *win, int 
*unused, float *out,
 "movaps   %%xmm2,  96(%1) \n\t" \
 "movaps   %%xmm3, 112(%1) \n\t"
 ::"r"(in), "r"(in+512)
-:"memory"
+:"memory" XMM_CLOBBERS(, "xmm0", "xmm1", "xmm2", "xmm3")
 );
 
 apply_window(in + 16, win , win + 512, suma, sumc, 16);
@@ -169,7 +170,7 @@ static void apply_window_mp3(float *in, float *win, int 
*unused, float *out,
 
 :"+"(out)
 :"r"([0]), "r"([0]), "r"([0]), "r"([0])
-:"memory"
+:"memory" XMM_CLOBBERS(, "xmm0")
 );
 out += 16*incr;
 } else {
-- 
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 13/14] [inline assembly] add memory to lpc

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

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

diff --git a/libavcodec/x86/lpc.c b/libavcodec/x86/lpc.c
index 6789027277..0b32bd1bf1 100644
--- a/libavcodec/x86/lpc.c
+++ b/libavcodec/x86/lpc.c
@@ -73,7 +73,7 @@ static void lpc_apply_welch_window_sse2(const int32_t *data, 
int len,
 :"+"(i), "+"(j)
 :"r"(w_data+n2), "r"(data+n2), "m"(c), "r"(len)
  NAMED_CONSTRAINTS_ARRAY_ADD(pd_1,pd_2)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+:"memory" XMM_CLOBBERS(, "%xmm0", "%xmm1", "%xmm2", "%xmm3",
 "%xmm5", "%xmm6", "%xmm7")
 );
 #undef WELCH
@@ -143,7 +143,7 @@ static void lpc_compute_autocorr_sse2(const double *data, 
int len, int lag,
 :"+"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
 :"r"(data+len), "r"(data+len-j)
  NAMED_CONSTRAINTS_ARRAY_ADD(pd_1)
-XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm3", "%xmm4")
+   :"memory" XMM_CLOBBERS(, "%xmm0", "%xmm1", "%xmm3", "%xmm4")
 );
 }
 }
-- 
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 06/14] [inline assembly] add mmx/xmm clobbers in fdct.c

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/fdct.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/x86/fdct.c b/libavcodec/x86/fdct.c
index 112566ded0..2635d58cbf 100644
--- a/libavcodec/x86/fdct.c
+++ b/libavcodec/x86/fdct.c
@@ -288,7 +288,7 @@ TABLE_SSE2
 
 #define S(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
 
-#define FDCT_COL(cpu, mm, mov)\
+#define FDCT_COL(cpu, mm, mov, MM) \
 static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, 
int offset)\
 {\
 __asm__ volatile (\
@@ -369,11 +369,13 @@ static av_always_inline void fdct_col_##cpu(const int16_t 
*in, int16_t *out, int
 #mov"%%"#mm"3,   112(%3) \n\t" \
 : \
 : "r" (in  + offset), "r" (fdct_tg_all_16), "r" (fdct_one_corr), \
-  "r" (out + offset), "r" (ocos_4_16)); \
+  "r" (out + offset), "r" (ocos_4_16) \
+   MM##_CLOBBERS_ONLY(#mm"0", #mm"1", #mm"2", #mm"3", \
+  #mm"4", #mm"5", #mm"6", #mm"7") );   \
 }
 
-FDCT_COL(mmx, mm, movq)
-FDCT_COL(sse2, xmm, movdqa)
+FDCT_COL(mmx, mm, movq, MMX)
+FDCT_COL(sse2, xmm, movdqa, XMM)
 
 static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
 {
@@ -484,7 +486,9 @@ static av_always_inline void fdct_row_mmxext(const int16_t 
*in, int16_t *out,
 "movq  %%mm3,  (%3) \n\t"
 "movq  %%mm7, 8(%3) \n\t"
 :
-: "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
+: "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)
+ MMX_CLOBBERS_ONLY("%mm0", "%mm1", "%mm2", "%mm3",
+"%mm4", "%mm5", "%mm6", "%mm7") );
 }
 
 static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, 
const int16_t *table)
@@ -535,7 +539,9 @@ static av_always_inline void fdct_row_mmx(const int16_t 
*in, int16_t *out, const
 "movq  %%mm3, 0(%3) \n\t"
 "movq  %%mm7, 8(%3) \n\t"
 :
-: "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
+: "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)
+ MMX_CLOBBERS_ONLY("%mm0", "%mm1", "%mm2", "%mm3",
+"%mm4", "%mm5", "%mm6", "%mm7") );
 }
 
 void ff_fdct_mmx(int16_t *block)
-- 
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 09/14] [inline assembly] add memory to mpegvideoenc

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/mpegvideoenc_qns_template.c |  4 ++--
 libavcodec/x86/mpegvideoencdsp_init.c  | 10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/x86/mpegvideoenc_qns_template.c 
b/libavcodec/x86/mpegvideoenc_qns_template.c
index 96325fd8f8..f1728de01e 100644
--- a/libavcodec/x86/mpegvideoenc_qns_template.c
+++ b/libavcodec/x86/mpegvideoenc_qns_template.c
@@ -70,7 +70,7 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t 
weight[64], int16_t basis[
 
 : "+r" (i)
 : "r"(basis), "r"(rem), "r"(weight), "g"(scale) COMMA_SET_RND_IN
- MMX_CLOBBERS_ONLY("mm0", "mm1", "mm5", "mm7"
+   : "memory"  MMX_CLOBBERS(, "mm0", "mm1", "mm5", "mm7"
SET_RND_CLOBBER(, "mm6"))
 );
 return i;
@@ -102,7 +102,7 @@ static void DEF(add_8x8basis)(int16_t rem[64], int16_t 
basis[64], int scale)
 
 : "+r" (i)
 : "r"(basis), "r"(rem), "g"(scale) COMMA_SET_RND_IN
- MMX_CLOBBERS_ONLY("mm0", "mm1", "mm5"
+   : "memory" MMX_CLOBBERS(, "mm0", "mm1", "mm5"
SET_RND_CLOBBER(, "mm6"))
 );
 }else{
diff --git a/libavcodec/x86/mpegvideoencdsp_init.c 
b/libavcodec/x86/mpegvideoencdsp_init.c
index 8430ec62ea..4914f3a96b 100644
--- a/libavcodec/x86/mpegvideoencdsp_init.c
+++ b/libavcodec/x86/mpegvideoencdsp_init.c
@@ -146,7 +146,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 : "+r" (ptr)
 : "r" ((x86_reg) wrap), "r" ((x86_reg) width),
   "r" (ptr + wrap * height)
- MMX_CLOBBERS_ONLY("mm0", "mm1") );
+   : "memory" MMX_CLOBBERS(, "mm0", "mm1") );
 } else if (w == 16) {
 __asm__ volatile (
 "1: \n\t"
@@ -167,7 +167,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 "jb1b   \n\t"
 : "+r"(ptr)
 : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
- MMX_CLOBBERS_ONLY("mm0", "mm1") );
+   : "memory" MMX_CLOBBERS(, "mm0", "mm1") );
 } else {
 av_assert1(w == 4);
 __asm__ volatile (
@@ -187,7 +187,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 : "+r" (ptr)
 : "r" ((x86_reg) wrap), "r" ((x86_reg) width),
   "r" (ptr + wrap * height)
- MMX_CLOBBERS_ONLY("mm0", "mm1") );
+   : "memory" MMX_CLOBBERS(, "mm0", "mm1") );
 }
 
 /* top and bottom (and hopefully also the corners) */
@@ -208,7 +208,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 : "r" ((x86_reg) buf - (x86_reg) ptr - w),
   "r" ((x86_reg) - wrap), "r" ((x86_reg) - wrap * 3),
   "r" (ptr + width + 2 * w)
- MMX_CLOBBERS_ONLY("mm0") );
+   : "memory" MMX_CLOBBERS(, "mm0") );
 }
 }
 
@@ -229,7 +229,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 : "r" ((x86_reg) last_line - (x86_reg) ptr - w),
   "r" ((x86_reg) wrap), "r" ((x86_reg) wrap * 3),
   "r" (ptr + width + 2 * w)
- MMX_CLOBBERS_ONLY("mm0") );
+   : "memory" MMX_CLOBBERS(, "mm0") );
 }
 }
 }
-- 
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 12/14] [inline assembly] add xmm clobbers to lpc

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/lpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/lpc.c b/libavcodec/x86/lpc.c
index 6c72e21bac..6789027277 100644
--- a/libavcodec/x86/lpc.c
+++ b/libavcodec/x86/lpc.c
@@ -118,7 +118,8 @@ static void lpc_compute_autocorr_sse2(const double *data, 
int len, int lag,
 :"+"(i)
 :"r"(autoc+j), "r"(data+len), "r"(data+len-j)
  NAMED_CONSTRAINTS_ARRAY_ADD(pd_1)
-:"memory"
+:"memory" XMM_CLOBBERS(, "%xmm0", "%xmm1", "%xmm2",
+  "%xmm3", "%xmm4", "%xmm5")
 );
 } else {
 __asm__ volatile(
@@ -142,6 +143,7 @@ static void lpc_compute_autocorr_sse2(const double *data, 
int len, int lag,
 :"+"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
 :"r"(data+len), "r"(data+len-j)
  NAMED_CONSTRAINTS_ARRAY_ADD(pd_1)
+XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm3", "%xmm4")
 );
 }
 }
-- 
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 08/14] [inline assembly] add mmx clobbers to mpegvideoenc

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/mpegvideoenc_qns_template.c | 12 +---
 libavcodec/x86/mpegvideoencdsp_init.c  | 32 ++
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/libavcodec/x86/mpegvideoenc_qns_template.c 
b/libavcodec/x86/mpegvideoenc_qns_template.c
index 882d486205..96325fd8f8 100644
--- a/libavcodec/x86/mpegvideoenc_qns_template.c
+++ b/libavcodec/x86/mpegvideoenc_qns_template.c
@@ -39,8 +39,8 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t 
weight[64], int16_t basis[
 av_assert2(FFABS(scale) < MAX_ABS);
 scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
 
-SET_RND(mm6);
 __asm__ volatile(
+   SET_RND_TPL(mm6)
 "pxor %%mm7, %%mm7  \n\t"
 "movd  %4, %%mm5\n\t"
 "punpcklwd %%mm5, %%mm5 \n\t"
@@ -69,7 +69,9 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t 
weight[64], int16_t basis[
 "movd %%mm7, %0 \n\t"
 
 : "+r" (i)
-: "r"(basis), "r"(rem), "r"(weight), "g"(scale)
+: "r"(basis), "r"(rem), "r"(weight), "g"(scale) COMMA_SET_RND_IN
+ MMX_CLOBBERS_ONLY("mm0", "mm1", "mm5", "mm7"
+   SET_RND_CLOBBER(, "mm6"))
 );
 return i;
 }
@@ -80,8 +82,8 @@ static void DEF(add_8x8basis)(int16_t rem[64], int16_t 
basis[64], int scale)
 
 if(FFABS(scale) < MAX_ABS){
 scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
-SET_RND(mm6);
 __asm__ volatile(
+   SET_RND_TPL(mm6)
 "movd  %3, %%mm5\n\t"
 "punpcklwd %%mm5, %%mm5 \n\t"
 "punpcklwd %%mm5, %%mm5 \n\t"
@@ -99,7 +101,9 @@ static void DEF(add_8x8basis)(int16_t rem[64], int16_t 
basis[64], int scale)
 " jb 1b \n\t"
 
 : "+r" (i)
-: "r"(basis), "r"(rem), "g"(scale)
+: "r"(basis), "r"(rem), "g"(scale) COMMA_SET_RND_IN
+ MMX_CLOBBERS_ONLY("mm0", "mm1", "mm5"
+   SET_RND_CLOBBER(, "mm6"))
 );
 }else{
 for(i=0; i<8*8; i++){
diff --git a/libavcodec/x86/mpegvideoencdsp_init.c 
b/libavcodec/x86/mpegvideoencdsp_init.c
index 532836cec9..8430ec62ea 100644
--- a/libavcodec/x86/mpegvideoencdsp_init.c
+++ b/libavcodec/x86/mpegvideoencdsp_init.c
@@ -51,17 +51,26 @@ int ff_pix_norm1_sse2(uint8_t *pix, int line_size);
 "psraw  $1, " #y "  \n\t"
 #define DEF(x) x ## _mmx
 #define SET_RND MOVQ_WONE
+#define SET_RND_TPL MOVQ_WONE_TPL
+#define COMMA_SET_RND_IN
+#define SET_RND_CLOBBER(...) __VA_ARGS__
 #define SCALE_OFFSET 1
 
 #include "mpegvideoenc_qns_template.c"
 
 #undef DEF
 #undef SET_RND
+#undef SET_RND_TPL
+#undef COMMA_SET_RND_IN
+#undef SET_RND_CLOBBER
 #undef SCALE_OFFSET
 #undef PMULHRW
 
 #define DEF(x) x ## _3dnow
 #define SET_RND(x)
+#define SET_RND_TPL(x)
+#define COMMA_SET_RND_IN
+#define SET_RND_CLOBBER(...)
 #define SCALE_OFFSET 0
 #define PMULHRW(x, y, s, o) \
 "pmulhrw " #s ", " #x " \n\t"   \
@@ -71,6 +80,9 @@ int ff_pix_norm1_sse2(uint8_t *pix, int line_size);
 
 #undef DEF
 #undef SET_RND
+#undef SET_RND_TPL
+#undef COMMA_SET_RND_IN
+#undef SET_RND_CLOBBER
 #undef SCALE_OFFSET
 #undef PMULHRW
 
@@ -78,6 +90,9 @@ int ff_pix_norm1_sse2(uint8_t *pix, int line_size);
 #undef PHADDD
 #define DEF(x) x ## _ssse3
 #define SET_RND(x)
+#define SET_RND_TPL(x)
+#define COMMA_SET_RND_IN
+#define SET_RND_CLOBBER(...)
 #define SCALE_OFFSET -1
 
 #define PHADDD(a, t)\
@@ -93,6 +108,9 @@ int ff_pix_norm1_sse2(uint8_t *pix, int line_size);
 
 #undef DEF
 #undef SET_RND
+#undef SET_RND_TPL
+#undef COMMA_SET_RND_IN
+#undef SET_RND_CLOBBER
 #undef SCALE_OFFSET
 #undef PMULHRW
 #undef PHADDD
@@ -127,7 +145,8 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 "jb1b   \n\t"
 : "+r" (ptr)
 : "r" ((x86_reg) wrap), "r" ((x86_reg) width),
-  "r" (ptr + wrap * height));
+  "r" (ptr + wrap * height)
+ MMX_CLOBBERS_ONLY("mm0", "mm1") );
 } else if (w == 16) {
 __asm__ volatile (
 "1: \n\t"
@@ -148,7 +167,7 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 "jb1b   \n\t"
 : "+r"(ptr)
 : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
-);
+ MMX_CLOBBERS_ONLY("mm0", "mm1") );
 } else {
 av_assert1(w == 4);
 __asm__ volatile (
@@ -167,7 +186,8 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int 
width, int height,
 "jb1b   \n\t"
 : "+r" (ptr)
 : "r" ((x86_reg) wrap), "r" ((x86_reg) width),
-  "r" (ptr + wrap * height));
+   

[FFmpeg-devel] [PATCH 07/14] [inline assembly] add memory in fdct.c

2020-04-26 Thread frederic . recoules
From: Frédéric Recoules 

---
 libavcodec/x86/fdct.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/x86/fdct.c b/libavcodec/x86/fdct.c
index 2635d58cbf..975e5e7769 100644
--- a/libavcodec/x86/fdct.c
+++ b/libavcodec/x86/fdct.c
@@ -370,7 +370,7 @@ static av_always_inline void fdct_col_##cpu(const int16_t 
*in, int16_t *out, int
 : \
 : "r" (in  + offset), "r" (fdct_tg_all_16), "r" (fdct_one_corr), \
   "r" (out + offset), "r" (ocos_4_16) \
-   MM##_CLOBBERS_ONLY(#mm"0", #mm"1", #mm"2", #mm"3", \
+   : "memory" MM##_CLOBBERS(, #mm"0", #mm"1", #mm"2", #mm"3",  \
   #mm"4", #mm"5", #mm"6", #mm"7") );   \
 }
 
@@ -437,7 +437,7 @@ static av_always_inline void fdct_row_sse2(const int16_t 
*in, int16_t *out)
 :
 : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2),
   "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
-  XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+: "memory" XMM_CLOBBERS(, "%xmm0", "%xmm1", "%xmm2", "%xmm3",
 "%xmm4", "%xmm5", "%xmm6", "%xmm7")
 );
 }
@@ -487,7 +487,7 @@ static av_always_inline void fdct_row_mmxext(const int16_t 
*in, int16_t *out,
 "movq  %%mm7, 8(%3) \n\t"
 :
 : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)
- MMX_CLOBBERS_ONLY("%mm0", "%mm1", "%mm2", "%mm3",
+   : "memory" MMX_CLOBBERS(, "%mm0", "%mm1", "%mm2", "%mm3",
 "%mm4", "%mm5", "%mm6", "%mm7") );
 }
 
@@ -540,7 +540,7 @@ static av_always_inline void fdct_row_mmx(const int16_t 
*in, int16_t *out, const
 "movq  %%mm7, 8(%3) \n\t"
 :
 : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)
- MMX_CLOBBERS_ONLY("%mm0", "%mm1", "%mm2", "%mm3",
+   : "memory" MMX_CLOBBERS(, "%mm0", "%mm1", "%mm2", "%mm3",
 "%mm4", "%mm5", "%mm6", "%mm7") );
 }
 
-- 
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 v3 3/4] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair

2020-04-26 Thread Max Dmitrichenko
On Sun, Apr 26, 2020 at 8:31 PM Mark Thompson  wrote:

> On 24/04/2020 15:52, artem.ga...@gmail.com wrote:
> > From: Artem Galin 
> >
> > Adding DX11 relevant device type checks and adjusting callbacks with
> > proper MediaSDK pair type support.
> >
> > Extending structure for proper MediaSDK pair type support.
> >
> > Signed-off-by: Artem Galin 
> > ---
> >  libavcodec/qsv.c  | 66 +++
> >  libavcodec/qsv_internal.h |  1 +
> >  2 files changed, 54 insertions(+), 13 deletions(-)
> >
> > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> > index db98c75073..35e62417f6 100644
> > --- a/libavcodec/qsv.c
> > +++ b/libavcodec/qsv.c
> > @@ -36,6 +36,8 @@
> >  #include "avcodec.h"
> >  #include "qsv_internal.h"
> >
> > +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
> > +
> >  #if QSV_VERSION_ATLEAST(1, 12)
> >  #include "mfx/mfxvp8.h"
> >  #endif
> > @@ -221,8 +223,15 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx,
> QSVFrame *frame)
> >  int i;
> >  for (i = 0; i < ctx->nb_mids; i++) {
> >  QSVMid *mid = >mids[i];
> > +#if CONFIG_VAAPI
> >  if (mid->handle == frame->surface.Data.MemId)
> >  return i;
> > +#else
> > +mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId;
> > +if ((mid->handle_pair.first == pair->first) &&
> > +(mid->handle_pair.second == pair->second))
> > +return i;
> > +#endif
>
> Is there any reason not to pass around an mfxHDLPair on Linux as well?
> All the #ifdefs you're adding here are not fun.
>
>
Linux doesnt rely on .second field the same as DX11



> >  }
> >  return AVERROR_BUG;
> >  }
> > @@ -362,7 +371,11 @@ static int ff_qsv_set_display_handle(AVCodecContext
> *avctx, QSVSession *qs)
> >  int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
> >   const char *load_plugins, int gpu_copy)
> >  {
> > +#if CONFIG_D3D11VA
> > +mfxIMPL  impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
>
> Does that still do the right thing on systems where only D3D9 works?
>
>
yes, it is only a hint for D11 when possible.


> > ...
>
> - Mark
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



and thanks for reviews, Mark

regards
Max
___
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] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2

2020-04-26 Thread Mark Thompson
On 26/04/2020 19:08, David Manouchehri wrote:
> This patch allows you to output non-rawvideos to V4L2, which can be quite
> helpful at times when you'd like to offer a compressed source (see example
> usage below).
> 
> ffmpeg -vaapi_device /dev/dri/renderD129 -f v4l2 -input_format yuyv422 -i
> /dev/video2 -f v4l2 -vf 'format=nv12,hwupload' -c:v h264_vaapi /dev/video4
> 
> From ce5f0ebd8e1d40b0f876b0d1b0b0cf564389b874 Mon Sep 17 00:00:00 2001
> From: Roger 
> Date: Sat, 4 Nov 2017 16:32:41 -0400
> Subject: [PATCH] avdevice/v4l2enc: Allow writing h264 to v4l2.
> 
> Signed-off-by: David Manouchehri 
> ---
>  libavdevice/v4l2enc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
> index 1c36f81f90..afbd94f8da 100644
> --- a/libavdevice/v4l2enc.c
> +++ b/libavdevice/v4l2enc.c
> @@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1)
>  }
>  
>  if (s1->nb_streams != 1 ||
> -s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
> -s1->streams[0]->codecpar->codec_id   != AV_CODEC_ID_RAWVIDEO) {
> +s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
>  av_log(s1, AV_LOG_ERROR,
> "V4L2 output device supports only a single raw video 
> stream\n");
>  return AVERROR(EINVAL);
> @@ -56,7 +55,7 @@ static av_cold int write_header(AVFormatContext *s1)
>  
>  par = s1->streams[0]->codecpar;
>  
> -v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
> +v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, 
> s1->streams[0]->codecpar->codec_id);

I think you only want NONE for non-RAWVIDEO - the raw formats still need to be 
mapped.

>  if (!v4l2_pixfmt) { // XXX: try to force them one by one?
>  av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for 
> %s\n",
> av_get_pix_fmt_name(par->format));
> -- 
> 2.17.1
> 

Seems like a nice change!

Thanks,

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

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

Re: [FFmpeg-devel] [PATCH v3 4/4] libavutil/qsv: enabling d3d11va support

2020-04-26 Thread Mark Thompson
On 24/04/2020 15:52, artem.ga...@gmail.com wrote:
> From: Artem Galin 
> 
> Makes selection of d3d11va device type by default and over DirectX 9,
> which is still supported but requires explicit selection.

... which might break users with older drivers/systems.  Some comment on 
exactly which setups are broken would be helpful here.

> This enables usage of non-powered/headless GPU, better HDR support.
> Pool of resources is allocated as one texture with array of slices.
> 
> Added d3d11va device selection by vendor id.
> Example: --init_hw_device d3d11va:,vendor=0x8086
> 
> DirectX 9 usage.
> Example: --init_hw_device qsv:hw,child_device_type=dxva2
> 
> Signed-off-by: Artem Galin 
> ---
>  libavutil/hwcontext_d3d11va.c |  82 +++-
>  libavutil/hwcontext_d3d11va.h |   8 +
>  libavutil/hwcontext_qsv.c | 363 +++---
>  3 files changed, 379 insertions(+), 74 deletions(-)

Please split this patch into the different changes.  There are at least three 
separate things here:

- Adding more texture information to the D3D11 hwcontext API.
- Adding the vendor option to D3D11 device creation.
- Supporting D3D11 in libmfx hwcontext.

Since the first one is an external API change it probably wants more 
explanation as to why it is wanted and the effects on compatibility.

> diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
> index c8ae58f908..c5e127aadb 100644
> --- a/libavutil/hwcontext_d3d11va.c
> +++ b/libavutil/hwcontext_d3d11va.c
> @@ -72,7 +72,7 @@ static av_cold void load_functions(void)
>  }
>  
>  typedef struct D3D11VAFramesContext {
> -int nb_surfaces_used;
> +size_t nb_surfaces;
>  
>  DXGI_FORMAT format;
>  
> @@ -112,6 +112,8 @@ static void d3d11va_frames_uninit(AVHWFramesContext *ctx)
>  if (s->staging_texture)
>  ID3D11Texture2D_Release(s->staging_texture);
>  s->staging_texture = NULL;
> +
> +av_freep(_hwctx->texture_infos);
>  }
>  
>  static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx,
> @@ -152,8 +154,9 @@ static void free_texture(void *opaque, uint8_t *data)
>  av_free(data);
>  }
>  
> -static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index)
> +static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D 
> *tex, int index)
>  {
> +AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx;
>  AVBufferRef *buf;
>  AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc));
>  if (!desc) {
> @@ -161,6 +164,10 @@ static AVBufferRef *wrap_texture_buf(ID3D11Texture2D 
> *tex, int index)
>  return NULL;
>  }
>  
> +frames_hwctx->texture_infos[frames_hwctx->nb_surfaces_used].texture = 
> tex;
> +frames_hwctx->texture_infos[frames_hwctx->nb_surfaces_used].index = 
> index;
> +frames_hwctx->nb_surfaces_used++;
> +
>  desc->texture = tex;
>  desc->index   = index;
>  
> @@ -199,13 +206,12 @@ static AVBufferRef 
> *d3d11va_alloc_single(AVHWFramesContext *ctx)
>  return NULL;
>  }
>  
> -return wrap_texture_buf(tex, 0);
> +return wrap_texture_buf(ctx, tex, 0);
>  }
>  
>  static AVBufferRef *d3d11va_pool_alloc(void *opaque, int size)
>  {
>  AVHWFramesContext*ctx = (AVHWFramesContext*)opaque;
> -D3D11VAFramesContext   *s = ctx->internal->priv;
>  AVD3D11VAFramesContext *hwctx = ctx->hwctx;
>  D3D11_TEXTURE2D_DESC  texDesc;
>  
> @@ -214,13 +220,13 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, 
> int size)
>  
>  ID3D11Texture2D_GetDesc(hwctx->texture, );
>  
> -if (s->nb_surfaces_used >= texDesc.ArraySize) {
> +if (hwctx->nb_surfaces_used >= texDesc.ArraySize) {
>  av_log(ctx, AV_LOG_ERROR, "Static surface pool size exceeded.\n");
>  return NULL;
>  }
>  
>  ID3D11Texture2D_AddRef(hwctx->texture);
> -return wrap_texture_buf(hwctx->texture, s->nb_surfaces_used++);
> +return wrap_texture_buf(ctx, hwctx->texture, hwctx->nb_surfaces_used);
>  }
>  
>  static int d3d11va_frames_init(AVHWFramesContext *ctx)
> @@ -267,7 +273,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
>  av_log(ctx, AV_LOG_ERROR, "User-provided texture has mismatching 
> parameters\n");
>  return AVERROR(EINVAL);
>  }
> -} else if (texDesc.ArraySize > 0) {
> +} else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && 
> texDesc.ArraySize > 0) {
>  hr = ID3D11Device_CreateTexture2D(device_hwctx->device, , 
> NULL, >texture);
>  if (FAILED(hr)) {
>  av_log(ctx, AV_LOG_ERROR, "Could not create the texture 
> (%lx)\n", (long)hr);
> @@ -275,6 +281,12 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
>  }
>  }
>  
> +hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, 
> sizeof(*hwctx->texture_infos));
> +if (!hwctx->texture_infos)
> +return AVERROR(ENOMEM);
> +
> +s->nb_surfaces = ctx->initial_pool_size;
> +
>  

Re: [FFmpeg-devel] [PATCH v3 3/4] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair

2020-04-26 Thread Mark Thompson
On 24/04/2020 15:52, artem.ga...@gmail.com wrote:
> From: Artem Galin 
> 
> Adding DX11 relevant device type checks and adjusting callbacks with
> proper MediaSDK pair type support.
> 
> Extending structure for proper MediaSDK pair type support.
> 
> Signed-off-by: Artem Galin 
> ---
>  libavcodec/qsv.c  | 66 +++
>  libavcodec/qsv_internal.h |  1 +
>  2 files changed, 54 insertions(+), 13 deletions(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index db98c75073..35e62417f6 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -36,6 +36,8 @@
>  #include "avcodec.h"
>  #include "qsv_internal.h"
>  
> +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
> +
>  #if QSV_VERSION_ATLEAST(1, 12)
>  #include "mfx/mfxvp8.h"
>  #endif
> @@ -221,8 +223,15 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, 
> QSVFrame *frame)
>  int i;
>  for (i = 0; i < ctx->nb_mids; i++) {
>  QSVMid *mid = >mids[i];
> +#if CONFIG_VAAPI
>  if (mid->handle == frame->surface.Data.MemId)
>  return i;
> +#else
> +mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId;
> +if ((mid->handle_pair.first == pair->first) &&
> +(mid->handle_pair.second == pair->second))
> +return i;
> +#endif

Is there any reason not to pass around an mfxHDLPair on Linux as well?  All the 
#ifdefs you're adding here are not fun.

>  }
>  return AVERROR_BUG;
>  }
> @@ -362,7 +371,11 @@ static int ff_qsv_set_display_handle(AVCodecContext 
> *avctx, QSVSession *qs)
>  int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
>   const char *load_plugins, int gpu_copy)
>  {
> +#if CONFIG_D3D11VA
> +mfxIMPL  impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;

Does that still do the right thing on systems where only D3D9 works?

> ...

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

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

Re: [FFmpeg-devel] [PATCH 2/2] lavfi/vaapi: add more factors when using VAProcColorStandardExplicit

2020-04-26 Thread Mark Thompson
On 26/04/2020 04:02, Fei Wang wrote:
> Use VAProcColorStandardExplicit only if the color properties all
> specificed.
> 
> Signed-off-by: Fei Wang 
> ---
>  libavfilter/vaapi_vpp.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
> index 6ffc09d..e1d3373 100644
> --- a/libavfilter/vaapi_vpp.c
> +++ b/libavfilter/vaapi_vpp.c
> @@ -278,10 +278,14 @@ static void 
> vaapi_vpp_fill_colour_standard(VAAPIColourProperties *props,
>  // use them and avoid doing any mapping.  (The driver may not support
>  // some particular code point, but it still has enough information to
>  // make a better fallback choice than we do in that case.)
> -for (i = 0; i < nb_vacs; i++) {
> -if (vacs[i] == VAProcColorStandardExplicit) {
> -props->va_color_standard = VAProcColorStandardExplicit;
> -return;
> +if ((props->colorspace != AVCOL_SPC_UNSPECIFIED) &&
> +(props->color_trc != AVCOL_TRC_UNSPECIFIED) &&
> +(props->color_primaries != AVCOL_PRI_UNSPECIFIED)) {
> +for (i = 0; i < nb_vacs; i++) {
> +if (vacs[i] == VAProcColorStandardExplicit) {
> +props->va_color_standard = VAProcColorStandardExplicit;
> +return;
> +}
>  }
>  }
>  #endif

This seems like it's throwing away information in a way you don't want.  For 
example, suppose the input was decoded from VP9: in that case you only know the 
matrix coefficients (props->colorspace) and the other values will be 
unspecified, but that's still better to know than nothing at all.

Alternatively: if you think this should be handled at a layer above VAAPI, 
maybe it should say that in the libva documentation?  Then here we would want 
to guess the other values and fill them in.

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

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

Re: [FFmpeg-devel] [PATCH v3 1/4] fftools/qsv: enabling d3d11va/dxva2 device selection

2020-04-26 Thread Mark Thompson
On 24/04/2020 15:52, artem.ga...@gmail.com wrote:
> From: Artem Galin 
> 
> child_device_type argument is responsible for selection.
> 
> Usage examples: -init_hw_device qsv:hw,child_device_type=d3d11va
> -init_hw_device qsv:hw,child_device_type=dxva2
> 
> Signed-off-by: Artem Galin 
> ---
>  fftools/ffmpeg_opt.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 680f0f1dfb..de5bc51bee 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -565,7 +565,17 @@ static int opt_init_hw_device(void *optctx, const char 
> *opt, const char *arg)
>  printf("\n");
>  exit_program(0);
>  } else {
> -return hw_device_init_from_string(arg, NULL);
> +HWDevice *dev;
> +int err;
> +if (!arg)
> +return AVERROR(ENOMEM);
> +err = hw_device_init_from_string(arg, );
> +if (err < 0)
> +return err;
> +hw_device_ctx = av_buffer_ref(dev->device_ref);
> +if (!hw_device_ctx)
> +return AVERROR(ENOMEM);
> +return 0;
>  }
>  }

I fixed the setup which was making you want to hack devices like this.  See 
.

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

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

Re: [FFmpeg-devel] [PATCH 1/2] lavfi/vaapi: check avaliable before set color properties

2020-04-26 Thread Mark Thompson
On 26/04/2020 04:02, Fei Wang wrote:
> If the color proerties is UNSPECIFIED(enum value is 2), do not pass
> the invalid value to driver.
> 
> Signed-off-by: Fei Wang 
> ---
>  libavfilter/vaapi_vpp.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
> index b5b245c..6ffc09d 100644
> --- a/libavfilter/vaapi_vpp.c
> +++ b/libavfilter/vaapi_vpp.c
> @@ -493,18 +493,18 @@ static int vaapi_vpp_colour_properties(AVFilterContext 
> *avctx,
>  .chroma_sample_location   = input_props.va_chroma_sample_location,
>  .color_range  = input_props.va_color_range,
>  #if VA_CHECK_VERSION(1, 3, 0)
> -.colour_primaries = input_props.color_primaries,
> -.transfer_characteristics = input_props.color_trc,
> -.matrix_coefficients  = input_props.colorspace,
> +.colour_primaries = (input_props.color_primaries == 
> AVCOL_PRI_UNSPECIFIED ? 0 : input_props.color_primaries),
> +.transfer_characteristics = (input_props.color_trc == 
> AVCOL_TRC_UNSPECIFIED ? 0 : input_props.color_trc),
> +.matrix_coefficients  = (input_props.colorspace == 
> AVCOL_SPC_UNSPECIFIED ? 0 : input_props.colorspace),
>  #endif
>  };
>  params->output_color_properties = (VAProcColorProperties) {
>  .chroma_sample_location   = output_props.va_chroma_sample_location,
>  .color_range  = output_props.va_color_range,
>  #if VA_CHECK_VERSION(1, 3, 0)
> -.colour_primaries = output_props.color_primaries,
> -.transfer_characteristics = output_props.color_trc,
> -.matrix_coefficients  = output_props.colorspace,
> +.colour_primaries = (input_props.color_primaries == 
> AVCOL_PRI_UNSPECIFIED ? 0 : input_props.color_primaries),
> +.transfer_characteristics = (input_props.color_trc == 
> AVCOL_TRC_UNSPECIFIED ? 0 : input_props.color_trc),
> +.matrix_coefficients  = (input_props.colorspace == 
> AVCOL_SPC_UNSPECIFIED ? 0 : input_props.colorspace),
>  #endif
>  };
>  #endif

Um, unspecified (that is, 2) should be exactly what we want when we don't know 
what it should be?  Zero is reserved for future use by H.273 / 
ISO-whatever-it-is, so zero is not valid.

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

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

[FFmpeg-devel] [PATCH] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2

2020-04-26 Thread David Manouchehri
This patch allows you to output non-rawvideos to V4L2, which can be quite
helpful at times when you'd like to offer a compressed source (see example
usage below).

ffmpeg -vaapi_device /dev/dri/renderD129 -f v4l2 -input_format yuyv422 -i
/dev/video2 -f v4l2 -vf 'format=nv12,hwupload' -c:v h264_vaapi /dev/video4
From ce5f0ebd8e1d40b0f876b0d1b0b0cf564389b874 Mon Sep 17 00:00:00 2001
From: Roger 
Date: Sat, 4 Nov 2017 16:32:41 -0400
Subject: [PATCH] avdevice/v4l2enc: Allow writing h264 to v4l2.

Signed-off-by: David Manouchehri 
---
 libavdevice/v4l2enc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index 1c36f81f90..afbd94f8da 100644
--- a/libavdevice/v4l2enc.c
+++ b/libavdevice/v4l2enc.c
@@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1)
 }
 
 if (s1->nb_streams != 1 ||
-s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
-s1->streams[0]->codecpar->codec_id   != AV_CODEC_ID_RAWVIDEO) {
+s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
 av_log(s1, AV_LOG_ERROR,
"V4L2 output device supports only a single raw video stream\n");
 return AVERROR(EINVAL);
@@ -56,7 +55,7 @@ static av_cold int write_header(AVFormatContext *s1)
 
 par = s1->streams[0]->codecpar;
 
-v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id);
 if (!v4l2_pixfmt) { // XXX: try to force them one by one?
 av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n",
av_get_pix_fmt_name(par->format));
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH 1/8] lavc: Rename hwaccel.h to hwconfig.h

2020-04-26 Thread Mark Thompson
On 19/04/2020 15:21, Zhong Li wrote:
> Mark Thompson  于2020年4月13日周一 下午11:34写道:
>>
>> All of these encoders can accept libmfx surfaces directly in a hardware
>> frames context, or they can accept software frames if a suitable device
>> is supplied to use.
>> ---
>>  libavcodec/qsvenc.c   | 7 +++
>>  libavcodec/qsvenc.h   | 3 +++
>>  libavcodec/qsvenc_h264.c  | 1 +
>>  libavcodec/qsvenc_hevc.c  | 1 +
>>  libavcodec/qsvenc_jpeg.c  | 1 +
>>  libavcodec/qsvenc_mpeg2.c | 1 +
>>  libavcodec/qsvenc_vp9.c   | 1 +
>>  7 files changed, 15 insertions(+)
>>
>>...
> 
> LGTM
> 
On 23/04/2020 10:22, Lynne wrote:
> Apr 13, 2020, 16:33 by s...@jkqxz.net:
> 
>> This already applied to decoders as well as hwaccels, and adding encoder
>> support was going to make the name even more inaccurate.
>> ---
>>  libavcodec/cuviddec.c| 2 +-
>>  libavcodec/decode.c  | 2 +-
>>  libavcodec/h263dec.c | 2 +-
>>  libavcodec/h264dec.c | 2 +-
>>  libavcodec/hevcdec.c | 2 +-
>>  libavcodec/{hwaccel.h => hwconfig.h} | 6 +++---
>>  libavcodec/mediacodecdec.c   | 2 +-
>>  libavcodec/mjpegdec.c| 2 +-
>>  libavcodec/mmaldec.c | 2 +-
>>  libavcodec/mpeg12dec.c   | 2 +-
>>  libavcodec/mpeg4videodec.c   | 2 +-
>>  libavcodec/pthread_frame.c   | 2 +-
>>  libavcodec/qsvdec.h  | 2 +-
>>  libavcodec/rkmppdec.c| 2 +-
>>  libavcodec/utils.c   | 2 +-
>>  libavcodec/vaapi_h264.c  | 2 +-
>>  libavcodec/vaapi_hevc.c  | 2 +-
>>  libavcodec/vaapi_mjpeg.c | 2 +-
>>  libavcodec/vaapi_mpeg2.c | 2 +-
>>  libavcodec/vaapi_mpeg4.c | 2 +-
>>  libavcodec/vaapi_vc1.c   | 2 +-
>>  libavcodec/vaapi_vp8.c   | 2 +-
>>  libavcodec/vaapi_vp9.c   | 2 +-
>>  libavcodec/vc1dec.c  | 2 +-
>>  libavcodec/vdpau_h264.c  | 2 +-
>>  libavcodec/vdpau_hevc.c  | 2 +-
>>  libavcodec/vdpau_mpeg12.c| 2 +-
>>  libavcodec/vdpau_mpeg4.c | 2 +-
>>  libavcodec/vdpau_vc1.c   | 2 +-
>>  libavcodec/vdpau_vp9.c   | 2 +-
>>  libavcodec/vp8.c | 2 +-
>>  libavcodec/vp9.c | 2 +-
>>  32 files changed, 34 insertions(+), 34 deletions(-)
>>  rename libavcodec/{hwaccel.h => hwconfig.h} (97%)
>>
> 
> patchset reviewed, LGTM
> I can't believe this hasn't been implemented yet. The only way to guess what 
> the encoder needs
> currently is by tokenizing the name with an underscore and giving the last 
> part to av_hwdevice_find_type_by_name, and av_get_pix_fmt, which is beyond 
> ridiculous and fragile.
> 
> I kind of need this, so could you push this soon? Its already been 10 days on 
> the ML.

Applied, except the NVENC part which I can't test.

Thanks,

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

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

Re: [FFmpeg-devel] [PATCH 5/8] lavc/nvenc: Add hardware config metadata

2020-04-26 Thread Mark Thompson
On 13/04/2020 17:48, Dennis Mungai wrote:
> On Mon, 13 Apr 2020 at 18:34, Mark Thompson  wrote:
> 
>> NOT TESTED.
>> ---
>> Needs someone with suitable hardware to try it.
>>
>> With this and the relevant ffmpeg patches, existing stuff should continue
>> to work and you should also be able to choose between multiple devices for
>> a standalone encoder with things like:
>>
>> ffmpeg -init_hw_device cuda:2 ... -c:v nvenc ...
>> ffmpeg -init_hw_device d3d11:2 ... -c:v nvenc ...
>>
>>
>>  libavcodec/nvenc.c  | 11 +++
>>  libavcodec/nvenc.h  |  1 +
>>  libavcodec/nvenc_h264.c |  1 +
>>  libavcodec/nvenc_hevc.c |  1 +
>>  4 files changed, 14 insertions(+)
>>
>> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
>> index 9a96bf2bba..b0cd8874ee 100644
>> --- a/libavcodec/nvenc.c
>> +++ b/libavcodec/nvenc.c
>> @@ -30,6 +30,7 @@
>>  #include "libavutil/avassert.h"
>>  #include "libavutil/mem.h"
>>  #include "libavutil/pixdesc.h"
>> +#include "hwconfig.h"
>>  #include "internal.h"
>>
>>  #define CHECK_CU(x) FF_CUDA_CHECK_DL(avctx, dl_fn->cuda_dl, x)
>> @@ -55,6 +56,16 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
>>  AV_PIX_FMT_NONE
>>  };
>>
>> +const AVCodecHWConfigInternal *ff_nvenc_hw_configs[] = {
>> +HW_CONFIG_ENCODER_FRAMES(CUDA,  CUDA),
>> +HW_CONFIG_ENCODER_DEVICE(NONE,  CUDA),
>> +#if CONFIG_D3D11VA
>> +HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11),
>> +HW_CONFIG_ENCODER_DEVICE(NONE,  D3D11),
>> +#endif
>> +NULL,
>> +};
>> +
>>  #define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010|| \
>>  pix_fmt == AV_PIX_FMT_P016|| \
>>  pix_fmt == AV_PIX_FMT_YUV444P16)
>> diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
>> index c44c81e675..c80332d914 100644
>> --- a/libavcodec/nvenc.h
>> +++ b/libavcodec/nvenc.h
>> @@ -217,5 +217,6 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx,
>> AVPacket *pkt,
>>  void ff_nvenc_encode_flush(AVCodecContext *avctx);
>>
>>  extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
>> +extern const AVCodecHWConfigInternal *ff_nvenc_hw_configs[];
>>
>>  #endif /* AVCODEC_NVENC_H */
>> diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
>> index 479155fe15..6d82422308 100644
>> --- a/libavcodec/nvenc_h264.c
>> +++ b/libavcodec/nvenc_h264.c
>> @@ -248,4 +248,5 @@ AVCodec ff_h264_nvenc_encoder = {
>>  .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>>  .pix_fmts   = ff_nvenc_pix_fmts,
>>  .wrapper_name   = "nvenc",
>> +.hw_configs = ff_nvenc_hw_configs,
>>  };
>> diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
>> index 7c9b3848f1..58d5265977 100644
>> --- a/libavcodec/nvenc_hevc.c
>> +++ b/libavcodec/nvenc_hevc.c
>> @@ -206,4 +206,5 @@ AVCodec ff_hevc_nvenc_encoder = {
>>  .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
>>  .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>>  .wrapper_name   = "nvenc",
>> +.hw_configs = ff_nvenc_hw_configs,
>>  };
>> --
>> 2.25.1
>>
>>
>>
> What type of hardware is considered "suitable"? Systems with multiple
> NVENC-capable GPUs?

Something supporting CUDA, NVENC and D3D11.

> Also, provide a sample command line extending on the examples above that
> you'd like tested and I'll report back with results.

Create CUDA and D3D11 devices and make sure that they get passed to an NVENC 
encoder.  Since NVENC chooses a device itself if not given one, I think you 
would need to stop it in a debugger to make sure that the right thing happened.

Thanks,

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

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

[FFmpeg-devel] ffmpeg.org down

2020-04-26 Thread Tom Needham
This is probably off-topic for this mailing list, but I wasn't sure where
to post this.

ffmpeg.org seems to be down for me at the moment and all connections are
timing out, is there any in progress maintenance/issues currently?

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

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_h265_syntax_template: Check num_negative/positive_pics when inter_ref_pic_set_prediction_flag is set

2020-04-26 Thread Michael Niedermayer
On Sun, Apr 05, 2020 at 12:38:42AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 20446/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5707770718584832
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/cbs_h265_syntax_template.c | 4 
>  1 file changed, 4 insertions(+)

will apply

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

Avoid a single point of failure, be that a person or equipment.


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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture()

2020-04-26 Thread Michael Niedermayer
On Thu, Feb 06, 2020 at 02:45:49PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (105sec -> 1sec)
> Fixes: 
> 20479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5769846937878528
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/intrax8.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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_v360: adjustment out_pad and in_pad maximum value to 1/10

2020-04-26 Thread Steven Liu


> 2020年4月21日 下午10:54,Steven Liu  写道:
> 
> Because not every user know about in_pad and out_pad reasonable value range
> so maybe try to set 1.0, but setting 1.0 is so hugh to get an fatal error.
> 
> Suggested-by: Paul B Mahol 
> Signed-off-by: Steven Liu 
> ---
> doc/filters.texi  | 1 +
> libavfilter/vf_v360.c | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 80c33f5edb..740aba0642 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -18956,6 +18956,7 @@ No padding.
> @end table
> 
> Default value is @b{@samp{0}}.
> +Maximum value is @b{@samp{0.1}}.
> 
> @item fin_pad
> @item fout_pad
> diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
> index ebc281dfca..e5b75c7226 100644
> --- a/libavfilter/vf_v360.c
> +++ b/libavfilter/vf_v360.c
> @@ -133,8 +133,8 @@ static const AVOption v360_options[] = {
> {"out_forder", "output cubemap face order", OFFSET(out_forder), 
> AV_OPT_TYPE_STRING, {.str="rludfb"},0, NB_DIRECTIONS-1, FLAGS, 
> "out_forder"},
> {   "in_frot", "input cubemap face rotation",  OFFSET(in_frot), 
> AV_OPT_TYPE_STRING, {.str="00"},0, NB_DIRECTIONS-1, FLAGS, 
> "in_frot"},
> {  "out_frot", "output cubemap face rotation",OFFSET(out_frot), 
> AV_OPT_TYPE_STRING, {.str="00"},0, NB_DIRECTIONS-1, FLAGS, 
> "out_frot"},
> -{"in_pad", "percent input cubemap pads",OFFSET(in_pad), 
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 1.f,TFLAGS, 
> "in_pad"},
> -{   "out_pad", "percent output cubemap pads",  OFFSET(out_pad), 
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 1.f,TFLAGS, 
> "out_pad"},
> +{"in_pad", "percent input cubemap pads",OFFSET(in_pad), 
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 0.1,TFLAGS, 
> "in_pad"},
> +{   "out_pad", "percent output cubemap pads",  OFFSET(out_pad), 
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},   0.f, 0.1,TFLAGS, 
> "out_pad"},
> {   "fin_pad", "fixed input cubemap pads", OFFSET(fin_pad), 
> AV_OPT_TYPE_INT,{.i64=0},   0, 100,TFLAGS, 
> "fin_pad"},
> {  "fout_pad", "fixed output cubemap pads",   OFFSET(fout_pad), 
> AV_OPT_TYPE_INT,{.i64=0},   0, 100,TFLAGS, 
> "fout_pad"},
> {   "yaw", "yaw rotation", OFFSET(yaw), 
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},-180.f,   180.f,TFLAGS, 
> "yaw"},
> -- 
> 2.25.0
> 


Ping

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] lavf/mp3enc: fix ID3v1 year metadata setting issue

2020-04-26 Thread myp...@gmail.com
On Wed, Apr 22, 2020 at 3:57 PM Jun Zhao  wrote:
>
> From: Jun Zhao 
>
> Follow the http://id3.org/ID3v1, setting the year metadata
> for ID3v1.
>
> fix #8623
>
> Signed-off-by: Jun Zhao 
> ---
>  libavformat/mp3enc.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index 34b753f..14d4b6e 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -45,6 +45,7 @@ static int id3v1_set_string(AVFormatContext *s, const char 
> *key,
>  return !!tag;
>  }
>
> +// refer to: http://id3.org/ID3v1
>  static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
>  {
>  AVDictionaryEntry *tag;
> @@ -58,7 +59,17 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t 
> *buf)
>  count += id3v1_set_string(s, "TIT2",buf +  3, 30 + 1);   //title
>  count += id3v1_set_string(s, "TPE1",buf + 33, 30 + 1);   
> //author|artist
>  count += id3v1_set_string(s, "TALB",buf + 63, 30 + 1);   //album
> -count += id3v1_set_string(s, "TDRC",buf + 93,  4 + 1);   //date
> +if ((tag = av_dict_get(s->metadata, "TYER", NULL, 0))) { //year
> +av_strlcpy(buf + 93, tag->value, 4 + 1);
> +count++;
> +} else if ((tag = av_dict_get(s->metadata, "TDRC", NULL, 0))) {
> +av_strlcpy(buf + 93, tag->value, 4 + 1);
> +count++;
> +} else if ((tag = av_dict_get(s->metadata, "TDAT", NULL, 0))) {
> +av_strlcpy(buf + 93, tag->value, 4 + 1);
> +count++;
> +}
> +
>  count += id3v1_set_string(s, "comment", buf + 97, 30 + 1);
>  if ((tag = av_dict_get(s->metadata, "TRCK", NULL, 0))) { //track
>  buf[125] = 0;
> --
> 2.7.4
>
ping ?
___
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 v1] avformat/movenc: cosmetics

2020-04-26 Thread Michael Niedermayer
On Sat, Apr 25, 2020 at 10:29:03PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavformat/movenc.c | 138 +--
>  1 file changed, 69 insertions(+), 69 deletions(-)

will apply

thx

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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 v1 4/6] avformat/dashenc: use av_reallocp_array()

2020-04-26 Thread Jeyapal, Karthick

On 4/26/20 3:19 PM, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  libavformat/dashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 96c0ea3..e3e187c 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1731,7 +1731,7 @@ static int add_segment(OutputStream *os, const char 
> *file,
>  Segment *seg;
>  if (os->nb_segments >= os->segments_size) {
>  os->segments_size = (os->segments_size + 1) * 2;
> -if ((err = av_reallocp(>segments, sizeof(*os->segments) *
> +if ((err = av_reallocp_array(>segments, sizeof(*os->segments),
> os->segments_size)) < 0) {
>  os->segments_size = 0;
>  os->nb_segments = 0;
LGTM

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

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

Re: [FFmpeg-devel] [PATCH v1 3/6] avformat/dashenc: use local variable and avoid calculate duration multiple times

2020-04-26 Thread Jeyapal, Karthick

On 4/26/20 3:19 PM, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  libavformat/dashenc.c | 14 +-
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 5fbe4dd..96c0ea3 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1916,6 +1916,7 @@ static int dash_flush(AVFormatContext *s, int final, 
> int stream)
>  OutputStream *os = >streams[i];
>  AVStream *st = s->streams[i];
>  int range_length, index_length = 0;
> +int64_t duration;
>  
>  if (!os->packets_written)
>  continue;
> @@ -1955,23 +1956,18 @@ static int dash_flush(AVFormatContext *s, int final, 
> int stream)
>  }
>  }
>  
> -os->last_duration = FFMAX(os->last_duration, 
> av_rescale_q(os->max_pts - os->start_pts,
> -  
> st->time_base,
> -  
> AV_TIME_BASE_Q));
> +duration = av_rescale_q(os->max_pts - os->start_pts, st->time_base, 
> AV_TIME_BASE_Q);
> +os->last_duration = FFMAX(os->last_duration, duration);
>  
>  if (!os->muxer_overhead && os->max_pts > os->start_pts)
>  os->muxer_overhead = ((int64_t) (range_length - 
> os->total_pkt_size) *
> -  8 * AV_TIME_BASE) /
> - av_rescale_q(os->max_pts - os->start_pts,
> -  st->time_base, AV_TIME_BASE_Q);
> +  8 * AV_TIME_BASE) / duration;
>  os->total_pkt_size = 0;
>  os->total_pkt_duration = 0;
>  
>  if (!os->bit_rate) {
>  // calculate average bitrate of first segment
> -int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
> av_rescale_q(os->max_pts - os->start_pts,
> - 
>   st->time_base,
> - 
>   AV_TIME_BASE_Q);
> +int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
> duration;
>  if (bitrate >= 0)
>  os->bit_rate = bitrate;
>  }
LGTM

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

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

Re: [FFmpeg-devel] [PATCH v1 2/6] avformat/dashenc: cosmetics

2020-04-26 Thread Jeyapal, Karthick

On 4/26/20 3:19 PM, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  libavformat/dashenc.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b082536..5fbe4dd 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -2149,22 +2149,22 @@ static int dash_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  av_compare_ts(elapsed_duration, st->time_base,
>seg_end_duration, AV_TIME_BASE_Q) >= 0) {
>  if (!c->has_video || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) 
> {
> -c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
> -st->time_base,
> -AV_TIME_BASE_Q);
> -c->total_duration = av_rescale_q(pkt->pts - os->first_pts,
> - st->time_base,
> - AV_TIME_BASE_Q);
> -
> -if ((!c->use_timeline || !c->use_template) && os->last_duration) {
> -if (c->last_duration < os->last_duration*9/10 ||
> -c->last_duration > os->last_duration*11/10) {
> -av_log(s, AV_LOG_WARNING,
> -   "Segment durations differ too much, enable 
> use_timeline "
> -   "and use_template, or keep a stricter keyframe 
> interval\n");
> +c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
> +st->time_base,
> +AV_TIME_BASE_Q);
> +c->total_duration = av_rescale_q(pkt->pts - os->first_pts,
> +st->time_base,
> +AV_TIME_BASE_Q);
> +
> +if ((!c->use_timeline || !c->use_template) && os->last_duration) 
> {
> +if (c->last_duration < os->last_duration*9/10 ||
> +c->last_duration > os->last_duration*11/10) {
> +av_log(s, AV_LOG_WARNING,
> +"Segment durations differ too much, enable 
> use_timeline "
> +"and use_template, or keep a stricter keyframe 
> interval\n");
> +}
>  }
>  }
> -}
>  
>  if (c->write_prft && os->producer_reference_time.wallclock && 
> !os->producer_reference_time_str[0])
>  format_date(os->producer_reference_time_str,

LGTM.

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

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

Re: [FFmpeg-devel] [PATCH v3] libavcodec/libx264: fix reference frame computation based on level

2020-04-26 Thread Josh Brewster
> > > I only made sure that the level was positive because its initial
> > > value was -1.
> > >
> > > > else if (x4->params.i_level_idc >= 0) {
> > > > Let me know if I need to reject 0 too. It seemed like premature 
> > > > optimization
> > > > as the level simply wouldn't be present in x264_levels.
> >
> > I'd say yes, level_idc = 0 is possible but invalid by PARSE_X264_OPT(), 
> > which seems
> > make no sense to calculate refs from x264_levels[] table.
> >
> > -   Linjie
>
> Changed to > 0, thanks.

Hi, is there anything else I need to do to have this merged?
___
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 v1] MAINTAINERS: add myself to the general developers list

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
I have actively contributed to FFmpeg in the past year and should be familiar
with the entire code base and the rules of the developers. Up to now, more than
one hundred patches have been accepted and pushed with the help of other 
developers. However, some reviewed patches have not been pushed yet, so I am
glad to request push access to the FFmpeg repository so that I can push them
by the developer rules. I think being a committer is a duty, I prefer to submit
any patch to ML for review to avoid making mistakes.

Please the core team give comments or vote for my request.

 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e19d1ee586..06956f8741 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -564,6 +564,7 @@ Joakim Plate
 Jun Zhao
 Kieran Kunhya
 Kirill Gavrilov
+Limin Wang
 Martin Storsjö
 Panagiotis Issaris
 Pedro Arthur
-- 
2.21.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] [PATCH v1 5/6] avformat/smoothstreamingenc: use av_reallocp_array()

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/smoothstreamingenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 0e4f531..d10d5d1 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -464,7 +464,7 @@ static int add_fragment(OutputStream *os, const char *file, 
const char *infofile
 Fragment *frag;
 if (os->nb_fragments >= os->fragments_size) {
 os->fragments_size = (os->fragments_size + 1) * 2;
-if ((err = av_reallocp(>fragments, sizeof(*os->fragments) *
+if ((err = av_reallocp_array(>fragments, sizeof(*os->fragments),
os->fragments_size)) < 0) {
 os->fragments_size = 0;
 os->nb_fragments = 0;
-- 
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] [PATCH v1 4/6] avformat/dashenc: use av_reallocp_array()

2020-04-26 Thread lance . lmwang
From: Limin Wang 

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 96c0ea3..e3e187c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1731,7 +1731,7 @@ static int add_segment(OutputStream *os, const char *file,
 Segment *seg;
 if (os->nb_segments >= os->segments_size) {
 os->segments_size = (os->segments_size + 1) * 2;
-if ((err = av_reallocp(>segments, sizeof(*os->segments) *
+if ((err = av_reallocp_array(>segments, sizeof(*os->segments),
os->segments_size)) < 0) {
 os->segments_size = 0;
 os->nb_segments = 0;
-- 
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] [PATCH v1 2/6] avformat/dashenc: cosmetics

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/dashenc.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index b082536..5fbe4dd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2149,22 +2149,22 @@ static int dash_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 av_compare_ts(elapsed_duration, st->time_base,
   seg_end_duration, AV_TIME_BASE_Q) >= 0) {
 if (!c->has_video || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
-c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
-st->time_base,
-AV_TIME_BASE_Q);
-c->total_duration = av_rescale_q(pkt->pts - os->first_pts,
- st->time_base,
- AV_TIME_BASE_Q);
-
-if ((!c->use_timeline || !c->use_template) && os->last_duration) {
-if (c->last_duration < os->last_duration*9/10 ||
-c->last_duration > os->last_duration*11/10) {
-av_log(s, AV_LOG_WARNING,
-   "Segment durations differ too much, enable use_timeline 
"
-   "and use_template, or keep a stricter keyframe 
interval\n");
+c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
+st->time_base,
+AV_TIME_BASE_Q);
+c->total_duration = av_rescale_q(pkt->pts - os->first_pts,
+st->time_base,
+AV_TIME_BASE_Q);
+
+if ((!c->use_timeline || !c->use_template) && os->last_duration) {
+if (c->last_duration < os->last_duration*9/10 ||
+c->last_duration > os->last_duration*11/10) {
+av_log(s, AV_LOG_WARNING,
+"Segment durations differ too much, enable 
use_timeline "
+"and use_template, or keep a stricter keyframe 
interval\n");
+}
 }
 }
-}
 
 if (c->write_prft && os->producer_reference_time.wallclock && 
!os->producer_reference_time_str[0])
 format_date(os->producer_reference_time_str,
-- 
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] [PATCH v1 6/6] avformat/rtmpproto: use av_reallocp_array()

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/rtmpproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 42aacbd..e23426b 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -163,7 +163,7 @@ static int add_tracked_method(RTMPContext *rt, const char 
*name, int id)
 
 if (rt->nb_tracked_methods + 1 > rt->tracked_methods_size) {
 rt->tracked_methods_size = (rt->nb_tracked_methods + 1) * 2;
-if ((err = av_reallocp(>tracked_methods, rt->tracked_methods_size *
+if ((err = av_reallocp_array(>tracked_methods, 
rt->tracked_methods_size,
sizeof(*rt->tracked_methods))) < 0) {
 rt->nb_tracked_methods = 0;
 rt->tracked_methods_size = 0;
-- 
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] [PATCH v1 1/6] fftools/ffmpeg: use local variable with same contents directly

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 fftools/ffmpeg.c | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d896b14..d2b0e71 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -501,32 +501,37 @@ static void ffmpeg_cleanup(int ret)
 FilterGraph *fg = filtergraphs[i];
 avfilter_graph_free(>graph);
 for (j = 0; j < fg->nb_inputs; j++) {
-while (av_fifo_size(fg->inputs[j]->frame_queue)) {
+InputFilter *ifilter = fg->inputs[j];
+struct InputStream *ist = ifilter->ist;
+
+while (av_fifo_size(ifilter->frame_queue)) {
 AVFrame *frame;
-av_fifo_generic_read(fg->inputs[j]->frame_queue, ,
+av_fifo_generic_read(ifilter->frame_queue, ,
  sizeof(frame), NULL);
 av_frame_free();
 }
-av_fifo_freep(>inputs[j]->frame_queue);
-if (fg->inputs[j]->ist->sub2video.sub_queue) {
-while (av_fifo_size(fg->inputs[j]->ist->sub2video.sub_queue)) {
+av_fifo_freep(>frame_queue);
+if (ist->sub2video.sub_queue) {
+while (av_fifo_size(ist->sub2video.sub_queue)) {
 AVSubtitle sub;
-
av_fifo_generic_read(fg->inputs[j]->ist->sub2video.sub_queue,
+av_fifo_generic_read(ist->sub2video.sub_queue,
  , sizeof(sub), NULL);
 avsubtitle_free();
 }
-av_fifo_freep(>inputs[j]->ist->sub2video.sub_queue);
+av_fifo_freep(>sub2video.sub_queue);
 }
-av_buffer_unref(>inputs[j]->hw_frames_ctx);
-av_freep(>inputs[j]->name);
+av_buffer_unref(>hw_frames_ctx);
+av_freep(>name);
 av_freep(>inputs[j]);
 }
 av_freep(>inputs);
 for (j = 0; j < fg->nb_outputs; j++) {
-av_freep(>outputs[j]->name);
-av_freep(>outputs[j]->formats);
-av_freep(>outputs[j]->channel_layouts);
-av_freep(>outputs[j]->sample_rates);
+OutputFilter *ofilter = fg->outputs[j];
+
+av_freep(>name);
+av_freep(>formats);
+av_freep(>channel_layouts);
+av_freep(>sample_rates);
 av_freep(>outputs[j]);
 }
 av_freep(>outputs);
-- 
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] [PATCH v1 3/6] avformat/dashenc: use local variable and avoid calculate duration multiple times

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/dashenc.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5fbe4dd..96c0ea3 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1916,6 +1916,7 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 OutputStream *os = >streams[i];
 AVStream *st = s->streams[i];
 int range_length, index_length = 0;
+int64_t duration;
 
 if (!os->packets_written)
 continue;
@@ -1955,23 +1956,18 @@ static int dash_flush(AVFormatContext *s, int final, 
int stream)
 }
 }
 
-os->last_duration = FFMAX(os->last_duration, av_rescale_q(os->max_pts 
- os->start_pts,
-  
st->time_base,
-  
AV_TIME_BASE_Q));
+duration = av_rescale_q(os->max_pts - os->start_pts, st->time_base, 
AV_TIME_BASE_Q);
+os->last_duration = FFMAX(os->last_duration, duration);
 
 if (!os->muxer_overhead && os->max_pts > os->start_pts)
 os->muxer_overhead = ((int64_t) (range_length - 
os->total_pkt_size) *
-  8 * AV_TIME_BASE) /
- av_rescale_q(os->max_pts - os->start_pts,
-  st->time_base, AV_TIME_BASE_Q);
+  8 * AV_TIME_BASE) / duration;
 os->total_pkt_size = 0;
 os->total_pkt_duration = 0;
 
 if (!os->bit_rate) {
 // calculate average bitrate of first segment
-int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
av_rescale_q(os->max_pts - os->start_pts,
-   
st->time_base,
-   
AV_TIME_BASE_Q);
+int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
duration;
 if (bitrate >= 0)
 os->bit_rate = bitrate;
 }
-- 
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] [PATCH 2/2] dnn-layer-mathbinary-test: add unit test for minimum

2020-04-26 Thread Guo, Yejun
Signed-off-by: Guo, Yejun 
---
 tests/dnn/dnn-layer-mathbinary-test.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tests/dnn/dnn-layer-mathbinary-test.c 
b/tests/dnn/dnn-layer-mathbinary-test.c
index f67c0f2..e7f8f85 100644
--- a/tests/dnn/dnn-layer-mathbinary-test.c
+++ b/tests/dnn/dnn-layer-mathbinary-test.c
@@ -38,6 +38,8 @@ static float get_expected(float f1, float f2, 
DNNMathBinaryOperation op)
 return f1 * f2;
 case DMBO_REALDIV:
 return f1 / f2;
+case DMBO_MINIMUM:
+return (f1 < f2) ? f1 : f2;
 default:
 av_assert0(!"not supported yet");
 return 0.f;
@@ -200,5 +202,8 @@ int main(int argc, char **argv)
 if (test(DMBO_REALDIV))
 return 1;
 
+if (test(DMBO_MINIMUM))
+return 1;
+
 return 0;
 }
-- 
2.7.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 1/2] dnn/native: add native support for minimum

2020-04-26 Thread Guo, Yejun
it can be tested with model file generated with below python script:
import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.minimum(0.7, x)
x2 = tf.maximum(x1, 0.4)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, 
['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun 
---
 libavfilter/dnn/dnn_backend_native_layer_mathbinary.c | 13 +
 libavfilter/dnn/dnn_backend_native_layer_mathbinary.h |  1 +
 tools/python/convert_from_tensorflow.py   | 11 +++
 tools/python/convert_header.py|  2 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c 
b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
index c32a042..edc389d 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
@@ -150,6 +150,19 @@ int dnn_execute_layer_math_binary(DnnOperand *operands, 
const int32_t *input_ope
 }
 }
 return 0;
+case DMBO_MINIMUM:
+if (params->input0_broadcast || params->input1_broadcast) {
+for (int i = 0; i < dims_count; ++i) {
+dst[i] = FFMIN(params->v, src[i]);
+}
+} else {
+const DnnOperand *input1 = [input_operand_indexes[1]];
+const float *src1 = input1->data;
+for (int i = 0; i < dims_count; ++i) {
+dst[i] = FFMIN(src[i], src1[i]);
+}
+}
+return 0;
 default:
 return -1;
 }
diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.h 
b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
index 2ffbb66..f3dbbeb 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.h
@@ -35,6 +35,7 @@ typedef enum {
 DMBO_ADD = 1,
 DMBO_MUL = 2,
 DMBO_REALDIV = 3,
+DMBO_MINIMUM = 4,
 DMBO_COUNT
 } DNNMathBinaryOperation;
 
diff --git a/tools/python/convert_from_tensorflow.py 
b/tools/python/convert_from_tensorflow.py
index a0fdad2..1c20891 100644
--- a/tools/python/convert_from_tensorflow.py
+++ b/tools/python/convert_from_tensorflow.py
@@ -71,7 +71,7 @@ class TFConverter:
 self.conv2d_scope_names = set()
 self.conv2d_scopename_inputname_dict = {}
 self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 
'Maximum':4, 'MathBinary':5}
-self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3}
+self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 
'Minimum':4}
 self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2}
 self.name_operand_dict = {}
 
@@ -305,15 +305,10 @@ class TFConverter:
 self.dump_mirrorpad_to_file(node, f)
 elif node.op == 'Maximum':
 self.dump_maximum_to_file(node, f)
-elif node.op == 'Sub':
-self.dump_mathbinary_to_file(node, f)
-elif node.op == 'Add':
-self.dump_mathbinary_to_file(node, f)
-elif node.op == 'Mul':
-self.dump_mathbinary_to_file(node, f)
-elif node.op == 'RealDiv':
+elif node.op in self.mathbin2code:
 self.dump_mathbinary_to_file(node, f)
 
+
 def dump_operands_to_file(self, f):
 operands = sorted(self.name_operand_dict.values())
 for operand in operands:
diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py
index 75d1ce8..e692a5e 100644
--- a/tools/python/convert_header.py
+++ b/tools/python/convert_header.py
@@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE'
 major = 1
 
 # increase minor when we don't have to re-convert the model file
-minor = 4
+minor = 5
-- 
2.7.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/2] avcodec/decode: remove DecodeFilterContext

2020-04-26 Thread Marton Balint
The only remaining field was the decode bsf, it is now moved to
AVCodecInternal.

Signed-off-by: Marton Balint 
---
 libavcodec/cuviddec.c |  2 +-
 libavcodec/decode.c   | 21 +
 libavcodec/internal.h |  6 +-
 3 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 13a7db10cd..1d6895fa39 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -946,7 +946,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
 }
 
 if (avctx->codec->bsfs) {
-const AVCodecParameters *par = avctx->internal->filter.bsf->par_out;
+const AVCodecParameters *par = avctx->internal->bsf->par_out;
 ctx->cuparse_ext.format.seqhdr_data_length = par->extradata_size;
 memcpy(ctx->cuparse_ext.raw_seqhdr_data,
par->extradata,
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 576efd0e49..631894d8ea 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -204,13 +204,12 @@ static int unrefcount_frame(AVCodecInternal *avci, 
AVFrame *frame)
 int ff_decode_bsfs_init(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
-DecodeFilterContext *s = >filter;
 int ret;
 
-if (s->bsf)
+if (avci->bsf)
 return 0;
 
-ret = av_bsf_list_parse_str(avctx->codec->bsfs, >bsf);
+ret = av_bsf_list_parse_str(avctx->codec->bsfs, >bsf);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Error parsing decoder bitstream filters 
'%s': %s\n", avctx->codec->bsfs, av_err2str(ret));
 if (ret != AVERROR(ENOMEM))
@@ -221,12 +220,12 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
 /* We do not currently have an API for passing the input timebase into 
decoders,
  * but no filters used here should actually need it.
  * So we make up some plausible-looking number (the MPEG 90kHz timebase) */
-s->bsf->time_base_in = (AVRational){ 1, 9 };
-ret = avcodec_parameters_from_context(s->bsf->par_in, avctx);
+avci->bsf->time_base_in = (AVRational){ 1, 9 };
+ret = avcodec_parameters_from_context(avci->bsf->par_in, avctx);
 if (ret < 0)
 goto fail;
 
-ret = av_bsf_init(s->bsf);
+ret = av_bsf_init(avci->bsf);
 if (ret < 0)
 goto fail;
 
@@ -244,7 +243,7 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt)
 if (avci->draining)
 return AVERROR_EOF;
 
-ret = av_bsf_receive_packet(avci->filter.bsf, pkt);
+ret = av_bsf_receive_packet(avci->bsf, pkt);
 if (ret == AVERROR_EOF)
 avci->draining = 1;
 if (ret < 0)
@@ -605,7 +604,7 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext 
*avctx, const AVPacke
 return ret;
 }
 
-ret = av_bsf_send_packet(avci->filter.bsf, avci->buffer_pkt);
+ret = av_bsf_send_packet(avci->bsf, avci->buffer_pkt);
 if (ret < 0) {
 av_packet_unref(avci->buffer_pkt);
 return ret;
@@ -2001,7 +2000,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
 avctx->pts_correction_last_pts =
 avctx->pts_correction_last_dts = INT64_MIN;
 
-av_bsf_flush(avci->filter.bsf);
+av_bsf_flush(avci->bsf);
 
 if (!avctx->refcounted_frames)
 av_frame_unref(avci->to_free);
@@ -2009,7 +2008,5 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
 
 void ff_decode_bsfs_uninit(AVCodecContext *avctx)
 {
-DecodeFilterContext *s = >internal->filter;
-
-av_bsf_free(>bsf);
+av_bsf_free(>internal->bsf);
 }
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 35a15c9664..df82789cdc 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -113,10 +113,6 @@ typedef struct DecodeSimpleContext {
 AVFrame  *out_frame;
 } DecodeSimpleContext;
 
-typedef struct DecodeFilterContext {
-AVBSFContext *bsf;
-} DecodeFilterContext;
-
 typedef struct AVCodecInternal {
 /**
  * Whether the parent AVCodecContext is a copy of the context which had
@@ -139,7 +135,7 @@ typedef struct AVCodecInternal {
 void *thread_ctx;
 
 DecodeSimpleContext ds;
-DecodeFilterContext filter;
+AVBSFContext *bsf;
 
 /**
  * Properties (timestamps+side data) extracted from the last packet passed
-- 
2.16.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 1/2] avcodec/decode: use a single list bsf for codec decode bsfs

2020-04-26 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavcodec/cuviddec.c |   2 +-
 libavcodec/decode.c   | 162 +++---
 libavcodec/internal.h |   3 +-
 3 files changed, 23 insertions(+), 144 deletions(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 50dc8956c3..13a7db10cd 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -946,7 +946,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
 }
 
 if (avctx->codec->bsfs) {
-const AVCodecParameters *par = 
avctx->internal->filter.bsfs[avctx->internal->filter.nb_bsfs - 1]->par_out;
+const AVCodecParameters *par = avctx->internal->filter.bsf->par_out;
 ctx->cuparse_ext.format.seqhdr_data_length = par->extradata_size;
 memcpy(ctx->cuparse_ext.raw_seqhdr_data,
par->extradata,
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index d4bdb9b1c0..576efd0e49 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -205,100 +205,30 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
 DecodeFilterContext *s = >filter;
-const char *bsfs_str;
 int ret;
 
-if (s->nb_bsfs)
+if (s->bsf)
 return 0;
 
-bsfs_str = avctx->codec->bsfs ? avctx->codec->bsfs : "null";
-while (bsfs_str && *bsfs_str) {
-AVBSFContext **tmp;
-const AVBitStreamFilter *filter;
-char *bsf, *bsf_options_str, *bsf_name;
-
-bsf = av_get_token(_str, ",");
-if (!bsf) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-bsf_name = av_strtok(bsf, "=", _options_str);
-if (!bsf_name) {
-av_freep();
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
-filter = av_bsf_get_by_name(bsf_name);
-if (!filter) {
-av_log(avctx, AV_LOG_ERROR, "A non-existing bitstream filter %s "
-   "requested by a decoder. This is a bug, please report 
it.\n",
-   bsf_name);
-av_freep();
+ret = av_bsf_list_parse_str(avctx->codec->bsfs, >bsf);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Error parsing decoder bitstream filters 
'%s': %s\n", avctx->codec->bsfs, av_err2str(ret));
+if (ret != AVERROR(ENOMEM))
 ret = AVERROR_BUG;
-goto fail;
-}
-
-tmp = av_realloc_array(s->bsfs, s->nb_bsfs + 1, sizeof(*s->bsfs));
-if (!tmp) {
-av_freep();
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-s->bsfs = tmp;
-
-ret = av_bsf_alloc(filter, >bsfs[s->nb_bsfs]);
-if (ret < 0) {
-av_freep();
-goto fail;
-}
-s->nb_bsfs++;
-
-if (s->nb_bsfs == 1) {
-/* We do not currently have an API for passing the input timebase 
into decoders,
- * but no filters used here should actually need it.
- * So we make up some plausible-looking number (the MPEG 90kHz 
timebase) */
-s->bsfs[s->nb_bsfs - 1]->time_base_in = (AVRational){ 1, 9 };
-ret = avcodec_parameters_from_context(s->bsfs[s->nb_bsfs - 
1]->par_in,
-  avctx);
-} else {
-s->bsfs[s->nb_bsfs - 1]->time_base_in = s->bsfs[s->nb_bsfs - 
2]->time_base_out;
-ret = avcodec_parameters_copy(s->bsfs[s->nb_bsfs - 1]->par_in,
-  s->bsfs[s->nb_bsfs - 2]->par_out);
-}
-if (ret < 0) {
-av_freep();
-goto fail;
-}
-
-if (bsf_options_str && filter->priv_class) {
-const AVOption *opt = av_opt_next(s->bsfs[s->nb_bsfs - 
1]->priv_data, NULL);
-const char * shorthand[2] = {NULL};
-
-if (opt)
-shorthand[0] = opt->name;
-
-ret = av_opt_set_from_string(s->bsfs[s->nb_bsfs - 1]->priv_data, 
bsf_options_str, shorthand, "=", ":");
-if (ret < 0) {
-if (ret != AVERROR(ENOMEM)) {
-av_log(avctx, AV_LOG_ERROR, "Invalid options for bitstream 
filter %s "
-   "requested by the decoder. This is a bug, please 
report it.\n",
-   bsf_name);
-ret = AVERROR_BUG;
-}
-av_freep();
-goto fail;
-}
-}
-av_freep();
+goto fail;
+}
 
-ret = av_bsf_init(s->bsfs[s->nb_bsfs - 1]);
-if (ret < 0)
-goto fail;
+/* We do not currently have an API for passing the input timebase into 
decoders,
+ * but no filters used here should actually need it.
+ * So we make up some plausible-looking number (the MPEG 90kHz timebase) */
+s->bsf->time_base_in = (AVRational){ 1, 9 };
+ret = avcodec_parameters_from_context(s->bsf->par_in, avctx);
+if (ret < 0)
+

Re: [FFmpeg-devel] [PATCH] avcodec/decode: use a single list bsf for codec decode bsfs

2020-04-26 Thread Marton Balint



On Sat, 25 Apr 2020, James Almer wrote:


On 4/25/2020 7:11 PM, Marton Balint wrote:

Signed-off-by: Marton Balint 
---
 libavcodec/cuviddec.c |   2 +-
 libavcodec/decode.c   | 162 +++---
 libavcodec/internal.h |   3 +-
 3 files changed, 22 insertions(+), 145 deletions(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 50dc8956c3..13a7db10cd 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -946,7 +946,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
 }

 if (avctx->codec->bsfs) {
-const AVCodecParameters *par = 
avctx->internal->filter.bsfs[avctx->internal->filter.nb_bsfs - 1]->par_out;
+const AVCodecParameters *par = avctx->internal->filter.bsf->par_out;
 ctx->cuparse_ext.format.seqhdr_data_length = par->extradata_size;
 memcpy(ctx->cuparse_ext.raw_seqhdr_data,
par->extradata,
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index d4bdb9b1c0..167eaa6bb6 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -205,100 +205,28 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
 DecodeFilterContext *s = >filter;
-const char *bsfs_str;
 int ret;

-if (s->nb_bsfs)
+if (s->bsf)
 return 0;

-bsfs_str = avctx->codec->bsfs ? avctx->codec->bsfs : "null";


If i'm reading this right, if the string passed to
av_bsf_list_parse_str() results in no bsf being inserted to the list,
ff_list_bsf acts the same as if it was the null bsf, right?


Yes.




-while (bsfs_str && *bsfs_str) {
-AVBSFContext **tmp;
-const AVBitStreamFilter *filter;
-char *bsf, *bsf_options_str, *bsf_name;
-
-bsf = av_get_token(_str, ",");
-if (!bsf) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-bsf_name = av_strtok(bsf, "=", _options_str);
-if (!bsf_name) {
-av_freep();
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-
-filter = av_bsf_get_by_name(bsf_name);
-if (!filter) {
-av_log(avctx, AV_LOG_ERROR, "A non-existing bitstream filter %s "
-   "requested by a decoder. This is a bug, please report 
it.\n",
-   bsf_name);
-av_freep();
-ret = AVERROR_BUG;
-goto fail;
-}
-
-tmp = av_realloc_array(s->bsfs, s->nb_bsfs + 1, sizeof(*s->bsfs));
-if (!tmp) {
-av_freep();
-ret = AVERROR(ENOMEM);
-goto fail;
-}
-s->bsfs = tmp;
-
-ret = av_bsf_alloc(filter, >bsfs[s->nb_bsfs]);
-if (ret < 0) {
-av_freep();
-goto fail;
-}
-s->nb_bsfs++;
-
-if (s->nb_bsfs == 1) {
-/* We do not currently have an API for passing the input timebase 
into decoders,
- * but no filters used here should actually need it.
- * So we make up some plausible-looking number (the MPEG 90kHz 
timebase) */
-s->bsfs[s->nb_bsfs - 1]->time_base_in = (AVRational){ 1, 9 };
-ret = avcodec_parameters_from_context(s->bsfs[s->nb_bsfs - 
1]->par_in,
-  avctx);
-} else {
-s->bsfs[s->nb_bsfs - 1]->time_base_in = s->bsfs[s->nb_bsfs - 
2]->time_base_out;
-ret = avcodec_parameters_copy(s->bsfs[s->nb_bsfs - 1]->par_in,
-  s->bsfs[s->nb_bsfs - 2]->par_out);
-}
-if (ret < 0) {
-av_freep();
-goto fail;
-}
-
-if (bsf_options_str && filter->priv_class) {
-const AVOption *opt = av_opt_next(s->bsfs[s->nb_bsfs - 
1]->priv_data, NULL);
-const char * shorthand[2] = {NULL};
-
-if (opt)
-shorthand[0] = opt->name;
-
-ret = av_opt_set_from_string(s->bsfs[s->nb_bsfs - 1]->priv_data, bsf_options_str, 
shorthand, "=", ":");
-if (ret < 0) {
-if (ret != AVERROR(ENOMEM)) {
-av_log(avctx, AV_LOG_ERROR, "Invalid options for bitstream 
filter %s "
-   "requested by the decoder. This is a bug, please report 
it.\n",
-   bsf_name);
-ret = AVERROR_BUG;
-}
-av_freep();
-goto fail;
-}
-}
-av_freep();
+ret = av_bsf_list_parse_str(avctx->codec->bsfs, >bsf);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Error parsing decoder bitstream filters '%s': 
%s\n", avctx->codec->bsfs, av_err2str(ret));
+goto fail;


You should keep the AVERROR_BUG code from above. Decoders insert bsfs
with hardcoded arguments and they absolutely must be valid. Otherwise
it's a bug in our code.

Return ENOMEM if that was the reason av_bsf_list_parse_str() failed, 

[FFmpeg-devel] [PATCH] swscale/vscale: Increase type strictness

2020-04-26 Thread Andreas Rheinhardt
libswscale/vscale.c makes extensive use of function pointers and in
doing so it converts these function pointers to and from a pointer to
void. Yet this is actually against the C standard:
C90 only guarantees that one can convert a pointer to any incomplete
type or object type to void* and back with the result comparing equal
to the original which makes pointers to void generic pointers to
incomplete or object type. Yet C90 lacks a generic function pointer
type.
C99 additionally guarantees that a pointer to a function of one type may
be converted to a pointer to a function of another type and when
converting back with the original and the result comparing equal.
This makes any function pointer type a generic function pointer type.
Yet even this does not make pointers to void generic function pointers.

Both GCC and Clang emit warnings for this when in pedantic mode.

This commit fixes this by using a union that can hold one member of any
of the required function pointer types to store the function pointer.
This works even for C90.

Signed-off-by: Andreas Rheinhardt 
---
 libswscale/vscale.c | 51 ++---
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 72352dedb3..9ed227e908 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -25,7 +25,14 @@ typedef struct VScalerContext
 int32_t  *filter_pos;
 int filter_size;
 int isMMX;
-void *pfn;
+union {
+yuv2planar1_fn  yuv2planar1;
+yuv2planarX_fn  yuv2planarX;
+yuv2interleavedX_fn yuv2interleavedX;
+yuv2packed1_fn  yuv2packed1;
+yuv2packed2_fn  yuv2packed2;
+yuv2anyX_fn yuv2anyX;
+} pfn;
 yuv2packedX_fn yuv2packedX;
 } VScalerContext;
 
@@ -43,9 +50,9 @@ static int lum_planar_vscale(SwsContext *c, 
SwsFilterDescriptor *desc, int slice
 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : sliceY * 
inst->filter_size);
 
 if (inst->filter_size == 1)
-((yuv2planar1_fn)inst->pfn)((const int16_t*)src[0], dst[0], dstW, 
c->lumDither8, 0);
+inst->pfn.yuv2planar1((const int16_t*)src[0], dst[0], dstW, 
c->lumDither8, 0);
 else
-((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const 
int16_t**)src, dst[0], dstW, c->lumDither8, 0);
+inst->pfn.yuv2planarX(filter, inst->filter_size, (const int16_t**)src, 
dst[0], dstW, c->lumDither8, 0);
 
 if (desc->alpha) {
 int sp = first - desc->src->plane[3].sliceY;
@@ -55,9 +62,9 @@ static int lum_planar_vscale(SwsContext *c, 
SwsFilterDescriptor *desc, int slice
 uint16_t *filter = inst->filter[1] + (inst->isMMX ? 0 : sliceY * 
inst->filter_size);
 
 if (inst->filter_size == 1)
-((yuv2planar1_fn)inst->pfn)((const int16_t*)src[0], dst[0], dstW, 
c->lumDither8, 0);
+inst->pfn.yuv2planar1((const int16_t*)src[0], dst[0], dstW, 
c->lumDither8, 0);
 else
-((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const 
int16_t**)src, dst[0], dstW, c->lumDither8, 0);
+inst->pfn.yuv2planarX(filter, inst->filter_size, (const 
int16_t**)src, dst[0], dstW, c->lumDither8, 0);
 }
 
 return 1;
@@ -85,13 +92,13 @@ static int chr_planar_vscale(SwsContext *c, 
SwsFilterDescriptor *desc, int slice
 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * 
inst->filter_size);
 
 if (c->yuv2nv12cX) {
-((yuv2interleavedX_fn)inst->pfn)(c, filter, inst->filter_size, 
(const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
+inst->pfn.yuv2interleavedX(c, filter, inst->filter_size, (const 
int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
 } else if (inst->filter_size == 1) {
-((yuv2planar1_fn)inst->pfn)((const int16_t*)src1[0], dst1[0], 
dstW, c->chrDither8, 0);
-((yuv2planar1_fn)inst->pfn)((const int16_t*)src2[0], dst2[0], 
dstW, c->chrDither8, 3);
+inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, 
c->chrDither8, 0);
+inst->pfn.yuv2planar1((const int16_t*)src2[0], dst2[0], dstW, 
c->chrDither8, 3);
 } else {
-((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const 
int16_t**)src1, dst1[0], dstW, c->chrDither8, 0);
-((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const 
int16_t**)src2, dst2[0], dstW, c->chrDither8, inst->isMMX ? (c->uv_offx2 >> 1) 
: 3);
+inst->pfn.yuv2planarX(filter, inst->filter_size, (const 
int16_t**)src1, dst1[0], dstW, c->chrDither8, 0);
+inst->pfn.yuv2planarX(filter, inst->filter_size, (const 
int16_t**)src2, dst2[0], dstW, c->chrDither8, inst->isMMX ? (c->uv_offx2 >> 1) 
: 3);
 }
 }
 
@@ -125,13 +132,13 @@ static int packed_vscale(SwsContext *c, 
SwsFilterDescriptor *desc, int sliceY, i
 
 
 if (c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 1) { // unscaled RGB
-

Re: [FFmpeg-devel] [PATCH v4 0/9] Enhancement for libopenh264 encoder

2020-04-26 Thread Fu, Linjie
Hi,

> From: Fu, Linjie 
> Sent: Wednesday, April 15, 2020 12:54
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> Subject: [PATCH v4 0/9] Enhancement for libopenh264 encoder
> 
> Docs would be provided later.
> 
> Linjie Fu (9):
>   lavc/libopenh264enc: Add default qmin/qmax support
>   lavc/libopenh264enc: add default gop size and bit rate
>   lavc/libopenh264enc: add bit rate control select support
>   lavc/libopenh264enc: prompt slice number changing inside libopenh264
>   lavc/libopenh264enc: set slice_mode option to deprecated
> [v4]: move FF_API_OPENH264_SLICE_MODE to libavcodec/version.h
>   lavc/libopenh264enc: separate svc_encode_init() into several functions
>   lavc/libopenh264enc: add profile high option support
>   lavc/libopenh264enc: allow specifying the profile through
> AVCodecContext
>   lavc/libopenh264enc: Add coder option to replace cabac
> [v4]: move FF_API_OPENH264_CABAC to libavcodec/version.h
> 
>  libavcodec/libopenh264enc.c | 365 ++--
> 
>  libavcodec/version.h|   6 +
>  2 files changed, 259 insertions(+), 112 deletions(-)
> 
> --
> 2.7.4
Ping for this set.

- Linjie
___
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".