Re: [FFmpeg-devel] [PATCH 1/2] avdevice/decklink_dec: mark the field flag if framerate > 30FPS

2020-07-19 Thread Marton Balint



On Sun, 19 Jul 2020, lance.lmw...@gmail.com wrote:


On Sat, Jul 18, 2020 at 08:38:16PM +0200, Marton Balint wrote:



On Sat, 18 Jul 2020, lance.lmw...@gmail.com wrote:

> On Sat, Jul 18, 2020 at 09:44:03AM +0200, Marton Balint wrote:
> > 
> > 
> > On Sat, 18 Jul 2020, lance.lmw...@gmail.com wrote:
> > 
> > > On Fri, Jul 17, 2020 at 07:13:28PM +0200, Marton Balint wrote:

> > > > > > > > On Fri, 17 Jul 2020, lance.lmw...@gmail.com wrote:
> > > > > > > From: Limin Wang 
> > > > > > In SMPTE ST 12-1: 2014 Sec 12.2, we need to mark the frame flag
> > > > if the frame rate > 30FPS to
> > > > > avoid interoperability issues. It will be used by the encoder to 
identify even or odd frames
> > > > > and correctly calculate the frame number of the SEI TC.
> > > > > > This feature looks like it belongs to
> > av_timecode_get_smpte_from_framenum
> > > > and not into decklink. Also checking previous timecode and guessing
> > > > something is a hack, especially since you have the exact source 
timecode.
> > > If I understand correctly, it's not hacky, for the framerate > 30, the 
source timecode will be
> > > frame pair(it's limited by 2bits limit of frame number ten digital. Below 
is one exmaple for 50fps
> > > if you tested with SDI with TC.
> > > 00:00:00:24
> > > 00:00:00:24
> > > 00:00:00:25
> > > 00:00:00:25
> > > 00:00:00:00
> > > 00:00:00:00
> > 
> > Have you actually tested this with a real SDI signal containing timecode?
> 
> Yes, have tested with SDI playback by decklink UltraStudio 4K mini with TC enabled.


I still don't understand how this works. Isn't timecode in the SDI signal
also contain the so called "field bit" flag to support 50fps timecode? And
if it does, then why can't you query it from decklink? Timecode in SDI
signal is also supposed to be an SMPTE 12M timecode, so all the bits you
need should be in it, you should not need to guess anything. Therefore it
makes little sense to me that the DeckLink API does not provide a proper
timecode as string, unless the original capture you made with your
UltraStudio and which you played back also has a faulty timecode.
What generated the signal which you captured with UltraStudio? Not ffmpeg I
hope...


It's auto-generated by configure of UltraStudio.


You mean using XLR timecode input selection? I would not trust that with 
50fps...



I have tested with bmdTimecodeFieldMark
flag, it's not set as expected for testing. I have no clue how to get the flag as the API 
provide the TC string is same for the frame pair. Maybe I miss something.


I'd try to generate SDI video with timecode by some other means. E.g. 
using MediaExpress / DaVinci Resolve and a native 1080p50 file.


Regards,
Marton






Regards,
Marton


> 
> > 
> > Thanks,

> > Marton
> > 
> > > > That's why I check the last TC to get the frame is even or odd.

> > > > Why not use av_timecode_get_smpte_from_framenum(), for it's
> > calculated by the string TC by one time,
> > > so it lacks the information whether it's odd or even frame.
> > > > > > > Regards,
> > > > Marton
> > > > > > > > ---
> > > > > libavdevice/decklink_common.h |  1 +
> > > > > libavdevice/decklink_dec.cpp  | 14 ++
> > > > > 2 files changed, 15 insertions(+)
> > > > > > diff --git a/libavdevice/decklink_common.h
> > > > b/libavdevice/decklink_common.h
> > > > > index bd68c7b..8ddc411 100644
> > > > > --- a/libavdevice/decklink_common.h
> > > > > +++ b/libavdevice/decklink_common.h
> > > > > @@ -151,6 +151,7 @@ struct decklink_ctx {
> > > > > int channels;
> > > > > int audio_depth;
> > > > > unsigned long tc_seen;// used with option wait_for_tc
> > > > > +uint32_t last_tc;
> > > > > };
> > > > > > typedef enum { DIRECTION_IN, DIRECTION_OUT}
> > > > decklink_direction_t;
> > > > > diff --git a/libavdevice/decklink_dec.cpp 
b/libavdevice/decklink_dec.cpp
> > > > > index dde68ff..a60c01b 100644
> > > > > --- a/libavdevice/decklink_dec.cpp
> > > > > +++ b/libavdevice/decklink_dec.cpp
> > > > > @@ -884,12 +884,26 @@ HRESULT 
decklink_input_callback::VideoInputFrameArrived(
> > > > > int metadata_len;
> > > > > uint8_t* packed_metadata;
> > > > > AVTimecode tcr;
> > > > > +AVRational rate = 
ctx->video_st->r_frame_rate;
> > > > > > if (av_timecode_init_from_string(&tcr,
> > > > ctx->video_st->r_frame_rate, tc, ctx) >= 0) {
> > > > > uint32_t tc_data = 
av_timecode_get_smpte_from_framenum(&tcr, 0);
> > > > > int size = sizeof(uint32_t) * 4;
> > > > > uint32_t *sd = (uint32_t 
*)av_packet_new_side_data(&pkt, AV_PKT_DATA_S12M_TIMECODE, size);
> > > > > > +/* set the field flag if frame rate
> > > > > 30FPS */
> > > > > +/* Refer to SMPTE ST 12-1:2014 Sec 12.2 
*/
> > > > > +if (av_cmp_q(rate, (AVRational) {30, 1})

Re: [FFmpeg-devel] [PATCH v2 1/4] lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure

2020-07-19 Thread Linjie Fu
On Thu, Jun 18, 2020 at 1:36 PM Linjie Fu  wrote:
>
> On Tue, May 12, 2020 at 9:49 PM Linjie Fu  wrote:
> >
> > VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS is added to in the latest
> > libva (1.8.0) which matches the hardware behaviour:
> >
> > /** \brief Driver supports any number of rows per slice but they must be 
> > the same
> > *   for all slices except for the last one, which must be equal or 
> > smaller
> > *   to the previous slices. */
> >
> > And VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS is kind of deprecated for iHD
> > since it's somehow introduced in [1] however misleading from what we
> > actually handle, and one row per slice would not get a good quality.
> >
> > Caps query support in driver is WIP, and this would fix the multi slice
> > encoding for VAEntrypointEncSliceLP.
> >
> > [1]
> >
> > Signed-off-by: Linjie Fu 
> > ---
> >  libavcodec/vaapi_encode.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> > index cb05ebd..234618a 100644
> > --- a/libavcodec/vaapi_encode.c
> > +++ b/libavcodec/vaapi_encode.c
> > @@ -1888,6 +1888,9 @@ static av_cold int 
> > vaapi_encode_init_slice_structure(AVCodecContext *avctx)
> >  req_slices = avctx->slices;
> >  }
> >  if (slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS ||
> > +#if VA_CHECK_VERSION(1, 8, 0)
> > +slice_structure & VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS ||
> > +#endif
> >  slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS) {
> >  ctx->nb_slices  = req_slices;
> >  ctx->slice_size = ctx->slice_block_rows / ctx->nb_slices;
> > --
> > 2.7.4
>
> Full support is provided in libva[1] and media-driver[2], and we've
> observed it works for multi slice encoding for AVC. (300+ cases)
>
> Prefer to apply this soon with commit message refined.
>
Applied, thx.
Prefer to apply the reset of this patch set soon to support tile encoding.

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

Re: [FFmpeg-devel] [PATCH v2 3/3] libavcodec/jpeg2000dec: Support for PPM marker

2020-07-19 Thread Gautam Ramakrishnan
On Sun, Jul 19, 2020 at 12:05 PM Michael Niedermayer
 wrote:
>
> On Sat, Jul 18, 2020 at 06:46:22PM +0530, gautamr...@gmail.com wrote:
> > From: Gautam Ramakrishnan 
> >
> > This patch adds support for PPM marker for JPEG2000
> > decoder. It allows the samples p1_03.j2k and p1_05.j2k
> > to be decoded.
> > ---
> >  libavcodec/jpeg2000dec.c | 111 +++
> >  1 file changed, 101 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 5e9e97eb6a..e37f834afe 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -71,6 +71,7 @@ typedef struct Jpeg2000POC {
> >  typedef struct Jpeg2000TilePart {
> >  uint8_t tile_index; // Tile index who refers the 
> > tile-part
> >  const uint8_t *tp_end;
> > +GetByteContext header_tpg;  // bit stream of header if PPM 
> > header is used
> >  GetByteContext tpg; // bit stream in tile-part
> >  } Jpeg2000TilePart;
> >
> > @@ -102,6 +103,13 @@ typedef struct Jpeg2000DecoderContext {
> >  uint8_t cbps[4];// bits per sample in particular components
> >  uint8_t sgnd[4];// if a component is signed
> >  uint8_t properties[4];
> > +
> > +uint8_t has_ppm;
> > +uint8_t *packed_headers; // contains packed headers. Used only 
> > along with PPM marker
> > +int packed_headers_size;
> > +GetByteContext  packed_headers_stream;
>
> > +uint8_t in_tile_headers;
>
> in_tile_headers could be moved into a seperate patch before the ppm addition
> it could also be used for other things than ppm
Yep, makes sense, I shall change this.
>
>
>
> > +
> >  int cdx[4], cdy[4];
> >  int precision;
> >  int ncomponents;
> > @@ -928,6 +936,31 @@ static int get_plt(Jpeg2000DecoderContext *s, int n)
> >  return 0;
> >  }
> >
> > +static int get_ppm(Jpeg2000DecoderContext *s, int n)
> > +{
> > +void *new;
> > +
> > +if (n < 3) {
> > +av_log(s->avctx, AV_LOG_ERROR, "Invalid length for PPM data.\n");
> > +return AVERROR_INVALIDDATA;
> > +}
>
> > +s->has_ppm = 1;
>
> Is there a reason has_ppm is set before all error checks ?
> this leaves the possibility for has_ppm to be set but get_ppm failing
> it seems more consistant to me to only set it if get_ppm succeeded
I shall change this as well
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If the United States is serious about tackling the national security threats
> related to an insecure 5G network, it needs to rethink the extent to which it
> values corporate profits and government espionage over security.-Bruce 
> Schneier
> ___
> 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".



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

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

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: increase initial program date time precision

2020-07-19 Thread Steven Liu
Marton Balint  于2020年7月19日周日 上午6:04写道:
>
> Also query time only once, not for every variant stream, otherwise variant
> streams might get a slightly different initial program date time. And we can
> set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
> elsewhere.
>
> Signed-off-by: Marton Balint 
> ---
>  libavformat/hlsenc.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index df84e6487d..39ff1fa1e7 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
>  char *p = NULL;
>  int http_base_proto = ff_is_http_proto(s->url);
>  int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
> +double initial_program_date_time = av_gettime() / 100.0;
is it AV_TIME_BASE?
>
>  if (hls->use_localtime) {
>  pattern = get_default_pattern_localtime_fmt(s);
> @@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
>  vs->start_pts = AV_NOPTS_VALUE;
>  vs->end_pts   = AV_NOPTS_VALUE;
>  vs->current_segment_final_filename_fmt[0] = '\0';
> -
> -if (hls->flags & HLS_PROGRAM_DATE_TIME) {
> -time_t now0;
> -time(&now0);
> -vs->initial_prog_date_time = now0;
> -}
> +vs->initial_prog_date_time = initial_program_date_time;
>
>  for (j = 0; j < vs->nb_streams; j++) {
>  vs->has_video += vs->streams[j]->codecpar->codec_type == 
> AVMEDIA_TYPE_VIDEO;
> --
> 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 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 Committees results

2020-07-19 Thread Jean-Baptiste Kempf
Hello folks,

Here are the results of the Technical and Community committee elections.

Community committee:
--
https://vote.ffmpeg.org/cgi-bin/civs/results.pl?num_winners=5&id=E_8dc4c448379a9d54&algorithm=runoff

1. Jean-Baptiste Kempf  (Condorcet winner: wins contests with all other choices)
2. Thilo Borgman  loses to Jean-Baptiste Kempf by 17–12
3. James Almer  loses to Jean-Baptiste Kempf by 21–7, loses to Thilo Borgman by 
16–13
4. Carl Eugen Hoyos  loses to Jean-Baptiste Kempf by 24–5, loses to James Almer 
by 22–8
5. Dave Rice  loses to Jean-Baptiste Kempf by 25–5, loses to Carl Eugen Hoyos 
by 18–12

If one does withdraw, Steven Liu is the runner-up.


Technical committee: 
---
https://vote.ffmpeg.org/cgi-bin/civs/results.pl?num_winners=5&id=E_2b68eda608ba4cea&algorithm=runoff

1. Michael Niedermayer  (Condorcet winner: wins contests with all other choices)
2. James Almer  loses to Michael Niedermayer by 18–12
3. Anton Khirnov  loses to Michael Niedermayer by 17–13, loses to James Almer 
by 16–12
4. Martin Storsjö  loses to Michael Niedermayer by 19–8, loses to Anton Khirnov 
by 13–11
5. Mark Thompson  loses to Michael Niedermayer by 21–8, loses to Martin Storsjö 
by 17–8

If ones does withdraw, Hendrik Leppkes is the runner-up.


Notes:
- It's interesting to see that every algorithm gives the same results for the 
first 5 people, in both elections.
- 32 people voted for the CC, and 33 for the TC, making more than half of the 
voters. A few emails are bouncing, so we're a bit shorter than 52.


Congratulations on the winners.

jb

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: increase initial program date time precision

2020-07-19 Thread Zhao Zhili


> On Jul 19, 2020, at 5:20 PM, Steven Liu  wrote:
> 
> Marton Balint  于2020年7月19日周日 上午6:04写道:
>> 
>> Also query time only once, not for every variant stream, otherwise variant
>> streams might get a slightly different initial program date time. And we can
>> set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
>> elsewhere.
>> 
>> Signed-off-by: Marton Balint 
>> ---
>> libavformat/hlsenc.c | 8 ++--
>> 1 file changed, 2 insertions(+), 6 deletions(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index df84e6487d..39ff1fa1e7 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
>> char *p = NULL;
>> int http_base_proto = ff_is_http_proto(s->url);
>> int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
>> +double initial_program_date_time = av_gettime() / 100.0;
> is it AV_TIME_BASE?

According to the documentation of av_gettime, it's not related to AV_TIME_BASE.

/**
 * Get the current time in microseconds.
 */
int64_t av_gettime(void);

>> 
>> if (hls->use_localtime) {
>> pattern = get_default_pattern_localtime_fmt(s);
>> @@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
>> vs->start_pts = AV_NOPTS_VALUE;
>> vs->end_pts   = AV_NOPTS_VALUE;
>> vs->current_segment_final_filename_fmt[0] = '\0';
>> -
>> -if (hls->flags & HLS_PROGRAM_DATE_TIME) {
>> -time_t now0;
>> -time(&now0);
>> -vs->initial_prog_date_time = now0;
>> -}
>> +vs->initial_prog_date_time = initial_program_date_time;
>> 
>> for (j = 0; j < vs->nb_streams; j++) {
>> vs->has_video += vs->streams[j]->codecpar->codec_type == 
>> AVMEDIA_TYPE_VIDEO;
>> --
>> 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 mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

Re: [FFmpeg-devel] [PATCH v2 2/3] libavcodec/jpeg2000dec: Support for Parameterless Markers

2020-07-19 Thread Carl Eugen Hoyos
Am Sa., 18. Juli 2020 um 15:16 Uhr schrieb :
>
> From: Gautam Ramakrishnan 
>
> The JPEG2000 standard reserves marker values 0xFF30
> to 0xFF3F to be used as parameterless markers. This
> patch adds support to decode codestream with such
> markers.

> This allows decoding of p0_02.j2k.

I wonder if sample aspect ratio should be set for samples
with subsampling in the only component.

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

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

Re: [FFmpeg-devel] [RFC PATCH] libavcodec/libopenjpeg: pix fmt selection change

2020-07-19 Thread Gautam Ramakrishnan
On Sun, Jul 19, 2020 at 12:09 AM Carl Eugen Hoyos  wrote:
>
> Am Di., 9. Juni 2020 um 20:25 Uhr schrieb Carl Eugen Hoyos 
> :
> >
> > Am Di., 9. Juni 2020 um 19:12 Uhr schrieb Gautam Ramakrishnan
> > :
> > >
> > > On Tue, Jun 9, 2020 at 10:24 PM Carl Eugen Hoyos  
> > > wrote:
> > > >
> > > > Am Di., 9. Juni 2020 um 14:07 Uhr schrieb :
> > > > >
> > > > > From: Gautam Ramakrishnan 
> > > > >
> > > > > This patch makes selection of pix_fmt similar to
> > > > > that in the native decoder. This makes samples such
> > > > > as p0_05.j2k and p1_03.j2k decodable by libopenjpeg.
> > > >
> > > > Since both files are not YUVA420P, I am not sure if this
> > > > patch is a good idea, in any case, the commit message
> > > > mentioning the two files as reasons for this patch is wrong.
> > > >
> > > I am not sure what file format this is then.
> >
> > I failed to find out so far, possibly Bayer, CMYK seems less
> > likely to me.
>
> I believe it is YCCK, two components (CC, if I am right) are
> subsampled.
In that case, does this patch make sense. I kinda just tried to replicate
the native decoder



-- 
-
Gautam |
___
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] [RFC][GSoC][PATCH v1 6/6] ffplay: add av_packet_buffer_filter to filter packet buffer

2020-07-19 Thread Hongcheng Zhong
On Thu, 2020-07-16 at 18:11 +0200, Andreas Rheinhardt wrote:
> Hongcheng Zhong:
> > From: spartazhc 
> > 
> > hls_read_header will add all streams to s->internal->packet_buffer.
> > Use av_packet_buffer_filter to remove the AVPackets from other
> > streams that
> > are not needed, otherwise abr will allow them to be added to
> > ffplay's
> > packet_queue.
> > 
> > Signed-off-by: spartazhc 
> > ---
> >  fftools/ffplay.c | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> > index b17b75fa8f..832e97d910 100644
> > --- a/fftools/ffplay.c
> > +++ b/fftools/ffplay.c
> > @@ -3018,6 +3018,10 @@ static int read_thread(void *arg)
> >  
> >  /* clean packet list filled in hls_read_header if abr is
> > enabled */
> >  if (abr) {
> > +ret = av_packet_buffer_filter(ic, st_index);
> > +if (ret < 0) {
> > +av_log(NULL, AV_LOG_WARNING, "Failed to clean
> > av_packet\n");
> > +}
> >  is->abr_list = av_mallocz(sizeof(ABRList));
> >  ret = abr_init_list(is);
> >  if (ret < 0) {
> > 
> Do we need this new function at all? Can't we not just set
> AVStream.discard to AVDISCARD_ALL for the streams we don't want and
> modify av_read_frame() to make sure that it never outputs packets
> belonging to a stream that ought to be discarded?
> 
> - Andreas
> ___
I am not sure if it can be done elegantly. Currently in ffplay, all
stream packets will be added to packet list in ffplay's
read_thread avformat_find_stream_info (all these are before
AVDISCARD_ALL are set to streams). After this, ffplay will call
av_find_best_stream() to decide which stream to be reserved.

I tried to setup AVDISCARD flags after hls_read_header(), which will
prevent av_read_frame() to read other streams. But there are 2 problems

1. I can use variant's bandwidth only to determine which one is the
best stream, not av_find_best_stream(). It will cause problem if two
results are different, so I even need to disable av_find_best_stream().

2. Will cause warning "Could not find codec parameters for stream 2
(Video: h264, 1 reference frame ([27][0][0][0] / 0x001B), none):
unspecified size Consider increasing the value for the analyzeduration'
(0) and 'probesize' (500) options".

I have considered about it when I added this API. Adding an API is an
easy way to fix the problem, but not good enough.

Really need your advice here.

Regards,
Hongcheng

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

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

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: increase initial program date time precision

2020-07-19 Thread Steven Liu
Zhao Zhili  于2020年7月19日周日 下午6:26写道:
>
>
>
> > On Jul 19, 2020, at 5:20 PM, Steven Liu  wrote:
> >
> > Marton Balint  于2020年7月19日周日 上午6:04写道:
> >>
> >> Also query time only once, not for every variant stream, otherwise variant
> >> streams might get a slightly different initial program date time. And we 
> >> can
> >> set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
> >> elsewhere.
> >>
> >> Signed-off-by: Marton Balint 
> >> ---
> >> libavformat/hlsenc.c | 8 ++--
> >> 1 file changed, 2 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> >> index df84e6487d..39ff1fa1e7 100644
> >> --- a/libavformat/hlsenc.c
> >> +++ b/libavformat/hlsenc.c
> >> @@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
> >> char *p = NULL;
> >> int http_base_proto = ff_is_http_proto(s->url);
> >> int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
> >> +double initial_program_date_time = av_gettime() / 100.0;
> > is it AV_TIME_BASE?
>
> According to the documentation of av_gettime, it's not related to 
> AV_TIME_BASE.
>
> /**
>  * Get the current time in microseconds.
>  */
> int64_t av_gettime(void);
I saw
 /**
 * Internal time base represented as integer
 */

#define AV_TIME_BASE100
Do you mean cannot av_gettime() / AV_TIME_BASE?
>
> >>
> >> if (hls->use_localtime) {
> >> pattern = get_default_pattern_localtime_fmt(s);
> >> @@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
> >> vs->start_pts = AV_NOPTS_VALUE;
> >> vs->end_pts   = AV_NOPTS_VALUE;
> >> vs->current_segment_final_filename_fmt[0] = '\0';
> >> -
> >> -if (hls->flags & HLS_PROGRAM_DATE_TIME) {
> >> -time_t now0;
> >> -time(&now0);
> >> -vs->initial_prog_date_time = now0;
> >> -}
> >> +vs->initial_prog_date_time = initial_program_date_time;
> >>
> >> for (j = 0; j < vs->nb_streams; j++) {
> >> vs->has_video += vs->streams[j]->codecpar->codec_type == 
> >> AVMEDIA_TYPE_VIDEO;
> >> --
> >> 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 mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH v3 1/2] avcodec/put_bits: Parametrize bit buffer type

2020-07-19 Thread Paul B Mahol
Please revert immediately:

libavcodec/gif.c:347:40: warning: incompatible pointer types passing
'void (PutBitContext *, int, BitBuf)' (aka 'void (struct PutBitContext
*, int, unsigned long)') to parameter of type 'void (*)(struct
PutBitContext *, int, unsigned int)' [-Wincompatible-pointer-types]
   12, FF_LZW_GIF, put_bits);
   ^~~~
libavcodec/lzw.h:58:32: note: passing argument to parameter 'lzw_put_bits' here
void (*lzw_put_bits)(struct


On 7/19/20, Michael Niedermayer  wrote:
> On Sat, Jul 18, 2020 at 04:53:02PM +0200, Steinar H. Gunderson wrote:
>> Preparatory patch for making the bit buffer different size on different
>> platforms; make a typedef and make all the hardcoded sizes into
>> expressions
>> deriving from this size.
>>
>> No functional change; generated assembler is near-identical.
>> ---
>>  libavcodec/mpegvideo_enc.c |  2 +-
>>  libavcodec/put_bits.h  | 95 +-
>>  2 files changed, 53 insertions(+), 44 deletions(-)
>
> will apply patchset after some more tests
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If the United States is serious about tackling the national security threats
>
> related to an insecure 5G network, it needs to rethink the extent to which
> it
> values corporate profits and government espionage over security.-Bruce
> Schneier
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: increase initial program date time precision

2020-07-19 Thread Marton Balint



On Sun, 19 Jul 2020, Steven Liu wrote:


Zhao Zhili  于2020年7月19日周日 下午6:26写道:




> On Jul 19, 2020, at 5:20 PM, Steven Liu  wrote:
>
> Marton Balint  于2020年7月19日周日 上午6:04写道:
>>
>> Also query time only once, not for every variant stream, otherwise variant
>> streams might get a slightly different initial program date time. And we can
>> set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
>> elsewhere.
>>
>> Signed-off-by: Marton Balint 
>> ---
>> libavformat/hlsenc.c | 8 ++--
>> 1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index df84e6487d..39ff1fa1e7 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
>> char *p = NULL;
>> int http_base_proto = ff_is_http_proto(s->url);
>> int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
>> +double initial_program_date_time = av_gettime() / 100.0;
> is it AV_TIME_BASE?

According to the documentation of av_gettime, it's not related to AV_TIME_BASE.

/**
 * Get the current time in microseconds.
 */
int64_t av_gettime(void);

I saw
/**
* Internal time base represented as integer
*/

#define AV_TIME_BASE100
Do you mean cannot av_gettime() / AV_TIME_BASE?


av_gettime() is always microsec according to docs, even if AV_TIME_BASE is 
not 100. In practice however AV_TIME_BASE is assumed to be 100 in 
a lot of places, so one can't really change it.


IMHO it is cleaner to use 100.0 instead of AV_TIME_BASE, because 
AV_TIME_BASE is integer, so you'd have to use (double)AV_TIME_BASE and 
that would be ugly. So I'd rather keep 100.0.


Regards,
Marton



>>
>> if (hls->use_localtime) {
>> pattern = get_default_pattern_localtime_fmt(s);
>> @@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
>> vs->start_pts = AV_NOPTS_VALUE;
>> vs->end_pts   = AV_NOPTS_VALUE;
>> vs->current_segment_final_filename_fmt[0] = '\0';
>> -
>> -if (hls->flags & HLS_PROGRAM_DATE_TIME) {
>> -time_t now0;
>> -time(&now0);
>> -vs->initial_prog_date_time = now0;
>> -}
>> +vs->initial_prog_date_time = initial_program_date_time;
>>
>> for (j = 0; j < vs->nb_streams; j++) {
>> vs->has_video += vs->streams[j]->codecpar->codec_type == 
AVMEDIA_TYPE_VIDEO;
>> --
>> 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 mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

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

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

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

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

Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: increase initial program date time precision

2020-07-19 Thread Zhao Zhili


> On Jul 19, 2020, at 7:45 PM, Steven Liu  wrote:
> 
> Zhao Zhili  于2020年7月19日周日 下午6:26写道:
>> 
>> 
>> 
>>> On Jul 19, 2020, at 5:20 PM, Steven Liu  wrote:
>>> 
>>> Marton Balint  于2020年7月19日周日 上午6:04写道:
 
 Also query time only once, not for every variant stream, otherwise variant
 streams might get a slightly different initial program date time. And we 
 can
 set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
 elsewhere.
 
 Signed-off-by: Marton Balint 
 ---
 libavformat/hlsenc.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)
 
 diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
 index df84e6487d..39ff1fa1e7 100644
 --- a/libavformat/hlsenc.c
 +++ b/libavformat/hlsenc.c
 @@ -2704,6 +2704,7 @@ static int hls_init(AVFormatContext *s)
char *p = NULL;
int http_base_proto = ff_is_http_proto(s->url);
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
 +double initial_program_date_time = av_gettime() / 100.0;
>>> is it AV_TIME_BASE?
>> 
>> According to the documentation of av_gettime, it's not related to 
>> AV_TIME_BASE.
>> 
>> /**
>> * Get the current time in microseconds.
>> */
>> int64_t av_gettime(void);
> I saw
> /**
> * Internal time base represented as integer
> */
> 
> #define AV_TIME_BASE100
> Do you mean cannot av_gettime() / AV_TIME_BASE?

AV_TIME_BASE is an opaque time unit used by ffmpeg, it can be set to 9 in 
theory.
To get time in AV_TIME_BASE, it should be (ignore integer overflow)

av_gettime * AV_TIME_BASE / 100


>> 
 
if (hls->use_localtime) {
pattern = get_default_pattern_localtime_fmt(s);
 @@ -2798,12 +2799,7 @@ static int hls_init(AVFormatContext *s)
vs->start_pts = AV_NOPTS_VALUE;
vs->end_pts   = AV_NOPTS_VALUE;
vs->current_segment_final_filename_fmt[0] = '\0';
 -
 -if (hls->flags & HLS_PROGRAM_DATE_TIME) {
 -time_t now0;
 -time(&now0);
 -vs->initial_prog_date_time = now0;
 -}
 +vs->initial_prog_date_time = initial_program_date_time;
 
for (j = 0; j < vs->nb_streams; j++) {
vs->has_video += vs->streams[j]->codecpar->codec_type == 
 AVMEDIA_TYPE_VIDEO;
 --
 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 mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
Will apply.

On 7/18/20, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |  46 
>  libavfilter/Makefile |   2 +
>  libavfilter/allfilters.c |   2 +
>  libavfilter/vf_rblur.c   | 560 +++
>  4 files changed, 610 insertions(+)
>  create mode 100644 libavfilter/vf_rblur.c
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Nicolas George
Paul B Mahol (12020-07-19):
> Will apply.

Certainly not before Steinar has had time to review it and tell us
whether you addressed all the concerns.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Nicolas George  wrote:
> Paul B Mahol (12020-07-19):
>> Will apply.
>
> Certainly not before Steinar has had time to review it and tell us
> whether you addressed all the concerns.
>

I do not need to listen to you at all.
You all dislike me on discrimination basis and also object just for objecting.

When I have objections to any patches they are silently ignored, other
way around
is different as this patch yet again demonstrates.

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

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

[FFmpeg-devel] [PATCH] avcodec/lzw: adapt a function prototype using PutBitContext

2020-07-19 Thread James Almer
Fixes warnings introduced by c63c303a1f

Signed-off-by: James Almer 
---
Maybe gif should be benchmarked as well?

 libavcodec/lzw.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
index 6af8a6b83a..338b4ef623 100644
--- a/libavcodec/lzw.h
+++ b/libavcodec/lzw.h
@@ -32,7 +32,7 @@
 
 #include 
 
-struct PutBitContext;
+#include "put_bits.h"
 
 enum FF_LZW_MODES{
 FF_LZW_GIF,
@@ -55,7 +55,7 @@ extern const int ff_lzw_encode_state_size;
 
 void ff_lzw_encode_init(struct LZWEncodeState *s, uint8_t *outbuf, int outsize,
 int maxbits, enum FF_LZW_MODES mode,
-void (*lzw_put_bits)(struct PutBitContext *, int, 
unsigned int));
+void (*lzw_put_bits)(struct PutBitContext *, int, 
BitBuf));
 int ff_lzw_encode(struct LZWEncodeState * s, const uint8_t * inbuf, int 
insize);
 int ff_lzw_encode_flush(struct LZWEncodeState *s,
 void (*lzw_flush_put_bits)(struct PutBitContext *));
-- 
2.27.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] Defect #8801

2020-07-19 Thread John Rose

 Is your issue reproducible with current FFmpeg git head, the only version
 supported on this bug tracker?

As I'm a Newbie to this mailing list, I'm not sure that I'm doing it 
properly.

I was asked the above question by email from t...@avcodec.org.

As I stated in my defect report, I'm using ffmpeg 3.4.6. I don't know 
how to find out the version of ffmpeg on the current ffmpeg git head. 
Please advise me how to find that out and if it's different to the one 
I'm using how to change my ffmpeg version from that supplied by Ubuntu 
on Bionic (i.e. 18.04).


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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Jean-Baptiste Kempf
On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
> You all dislike me on discrimination basis and also object just for objecting.

Discriminate you based on what?
Noone has ever seen you, and therefore noone knows your gender, religion, skin 
color, race, or any other personal thing on you.

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Nicolas George
Paul B Mahol (12020-07-19):
> I do not need to listen to you at all.
> You all dislike me on discrimination basis and also object just for objecting.
> 
> When I have objections to any patches they are silently ignored, other
> way around
> is different as this patch yet again demonstrates.

I will not deny that the fact that I feel you have repeatedly abused me
and used similar tactics against me makes pay extra attention to cases
where I think you may abuse other contributors, and intervene if I think
it necessary. If I am at fault here, we now have a committee that can
put me right, and I welcome its judgement on my case.

But it does not excuse you for threatening to ignore Steinar's concerns.

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 03:58:32PM +0200, Nicolas George wrote:
>> Will apply.
> Certainly not before Steinar has had time to review it and tell us
> whether you addressed all the concerns.

The primary change that I see is the addition of bilinear filtering in the
polar to Cartesian step. This makes the filter even slower, but it also
increases the output quality significantly. There are still artifacts I've
never seen in any other implementation of radial blur, and that stem directly
from the choice of algorithm. The comment situation is unchanged, ie., there
are none.

If someone else thinks the patch as-is is acceptable, I won't block it,
in the interest of less hostility.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
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] Ticket 5012

2020-07-19 Thread Gautam Ramakrishnan
On Thu, Jul 16, 2020 at 11:45 PM Carl Eugen Hoyos  wrote:
>
> Am Do., 16. Juli 2020 um 19:42 Uhr schrieb Gautam Ramakrishnan
> :
>
> > How could I get access to some stream/file for testing this feature if
> > I implement this?
>
> GStreamer should allow you to test your implementation.
>
> Carl Eugen
So to clarify things, basically the enc version would take a compressed
codestream, and split it into RTP packets given in the RFC? Is there anything
more than that? Is there any documentation page I can refer to? I was not able
to find anything specific.



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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Steinar H. Gunderson  wrote:
> On Sun, Jul 19, 2020 at 03:58:32PM +0200, Nicolas George wrote:
>>> Will apply.
>> Certainly not before Steinar has had time to review it and tell us
>> whether you addressed all the concerns.
>
> The primary change that I see is the addition of bilinear filtering in the
> polar to Cartesian step. This makes the filter even slower, but it also
> increases the output quality significantly. There are still artifacts I've
> never seen in any other implementation of radial blur, and that stem
> directly
> from the choice of algorithm. The comment situation is unchanged, ie., there
> are none.
>
> If someone else thinks the patch as-is is acceptable, I won't block it,
> in the interest of less hostility.


Thanks for confirming you are being hostile.

>
> /* Steinar */
> --
> Homepage: https://www.sesse.net/
> ___
> 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] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Jean-Baptiste Kempf  wrote:
> On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
>> You all dislike me on discrimination basis and also object just for
>> objecting.
>
> Discriminate you based on what?
> Noone has ever seen you, and therefore noone knows your gender, religion,
> skin color, race, or any other personal thing on you.

You are now lying.
Mr. President you are indeed lying.

>
> --
> Jean-Baptiste Kempf -  President
> +33 672 704 734
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning

2020-07-19 Thread Steinar H. Gunderson
lzwenc stores a function pointer to either put_bits or put_bits_le.
Update the function pointer's prototype after the recent change.
---
 libavcodec/lzw.h| 4 +++-
 libavcodec/lzwenc.c | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
index 6af8a6b83a..400a479809 100644
--- a/libavcodec/lzw.h
+++ b/libavcodec/lzw.h
@@ -32,6 +32,8 @@
 
 #include 
 
+#include "put_bits.h"
+
 struct PutBitContext;
 
 enum FF_LZW_MODES{
@@ -55,7 +57,7 @@ extern const int ff_lzw_encode_state_size;
 
 void ff_lzw_encode_init(struct LZWEncodeState *s, uint8_t *outbuf, int outsize,
 int maxbits, enum FF_LZW_MODES mode,
-void (*lzw_put_bits)(struct PutBitContext *, int, 
unsigned int));
+void (*lzw_put_bits)(struct PutBitContext *, int, 
BitBuf));
 int ff_lzw_encode(struct LZWEncodeState * s, const uint8_t * inbuf, int 
insize);
 int ff_lzw_encode_flush(struct LZWEncodeState *s,
 void (*lzw_flush_put_bits)(struct PutBitContext *));
diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
index 03080ee587..c1b96905e8 100644
--- a/libavcodec/lzwenc.c
+++ b/libavcodec/lzwenc.c
@@ -60,7 +60,7 @@ typedef struct LZWEncodeState {
 int output_bytes;///< Number of written bytes
 int last_code;   ///< Value of last output code or LZW_PREFIX_EMPTY
 enum FF_LZW_MODES mode;  ///< TIFF or GIF
-void (*put_bits)(PutBitContext *, int, unsigned); ///< GIF is LE while 
TIFF is BE
+void (*put_bits)(PutBitContext *, int, BitBuf); ///< GIF is LE while TIFF 
is BE
 }LZWEncodeState;
 
 
@@ -201,7 +201,7 @@ static int writtenBytes(LZWEncodeState *s){
  */
 void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize,
 int maxbits, enum FF_LZW_MODES mode,
-void (*lzw_put_bits)(PutBitContext *, int, unsigned))
+void (*lzw_put_bits)(PutBitContext *, int, BitBuf))
 {
 s->clear_code = 256;
 s->end_code = 257;
-- 
2.20.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] avfilter: add radial and circular blur video filter

2020-07-19 Thread Jean-Baptiste Kempf
On Sun, 19 Jul 2020, at 18:14, Paul B Mahol wrote:
> On 7/19/20, Jean-Baptiste Kempf  wrote:
> > On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
> >> You all dislike me on discrimination basis and also object just for
> >> objecting.
> >
> > Discriminate you based on what?
> > Noone has ever seen you, and therefore noone knows your gender, religion,
> > skin color, race, or any other personal thing on you.
> 
> You are now lying.

How so?

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Nicolas George  wrote:
> Paul B Mahol (12020-07-19):
>> I do not need to listen to you at all.
>> You all dislike me on discrimination basis and also object just for
>> objecting.
>>
>> When I have objections to any patches they are silently ignored, other
>> way around
>> is different as this patch yet again demonstrates.
>
> I will not deny that the fact that I feel you have repeatedly abused me
> and used similar tactics against me makes pay extra attention to cases
> where I think you may abuse other contributors, and intervene if I think
> it necessary. If I am at fault here, we now have a committee that can
> put me right, and I welcome its judgement on my case.
>
> But it does not excuse you for threatening to ignore Steinar's concerns.

Who abused you? I even asked why one of your patches you posted are not applied.
I even vouched for untile filter to be applied.

But than you came so high and polite and threatens me for applying
against your blockage of my numerous patches out of pure hatred.

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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Jean-Baptiste Kempf  wrote:
> On Sun, 19 Jul 2020, at 18:14, Paul B Mahol wrote:
>> On 7/19/20, Jean-Baptiste Kempf  wrote:
>> > On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
>> >> You all dislike me on discrimination basis and also object just for
>> >> objecting.
>> >
>> > Discriminate you based on what?
>> > Noone has ever seen you, and therefore noone knows your gender,
>> > religion,
>> > skin color, race, or any other personal thing on you.
>>
>> You are now lying.
>
> How so?

You discriminate me just because I send big patches.
While you, in your deepest self could never do such thing.

>
> --
> Jean-Baptiste Kempf -  President
> +33 672 704 734
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
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] x11grab of screen/area produces mp4 file without streams

2020-07-19 Thread John Rose
/Is your issue reproducible with current FFmpeg git head, the only 
version //

// supported on this bug tracker? /

As I'm a Newbie to this mailing list, I'm not sure that I'm doing it 
properly.

I was asked the above question by email from t...@avcodec.org.

As I stated in my defect report, I'm using ffmpeg 3.4.6. I don't know 
how to find out the version of ffmpeg on the current ffmpeg git head. 
Please advise me how to find that out and if it's different to the one 
I'm using how to change my ffmpeg version from that supplied by Ubuntu 
on Bionic (i.e. 18.04).



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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Jean-Baptiste Kempf
On Sun, 19 Jul 2020, at 18:20, Paul B Mahol wrote:
> On 7/19/20, Jean-Baptiste Kempf  wrote:
> > On Sun, 19 Jul 2020, at 18:14, Paul B Mahol wrote:
> >> On 7/19/20, Jean-Baptiste Kempf  wrote:
> >> > On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
> >> >> You all dislike me on discrimination basis and also object just for
> >> >> objecting.
> >> >
> >> > Discriminate you based on what?
> >> > Noone has ever seen you, and therefore noone knows your gender,
> >> > religion,
> >> > skin color, race, or any other personal thing on you.
> >>
> >> You are now lying.
> >
> > How so?
> 
> You discriminate me just because I send big patches.

"Discrimination is the act of making distinctions between human beings based on 
the groups, classes, or other categories to which they are perceived to belong. 
"

I really doubt "sending big patches" fit the discrimination definition.

And even if it did, I really doubt that the push-back from "all of us"  you are 
seeing is because of discrimination, but more about your attitude towards 
others.

Here, Steinar gives a substantiated remark on your code, which could improve 
quality and speed, which matches the goal of this project.

Why not just apply what he did, and give us a better filter? 
This is not discrimination, just noone understand your points.

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec: add RPZA encoder

2020-07-19 Thread Paul B Mahol
Will apply soon.

On 7/16/20, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/rpzaenc.c   | 857 +
>  3 files changed, 859 insertions(+)
>  create mode 100644 libavcodec/rpzaenc.c
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Jean-Baptiste Kempf  wrote:
> On Sun, 19 Jul 2020, at 18:20, Paul B Mahol wrote:
>> On 7/19/20, Jean-Baptiste Kempf  wrote:
>> > On Sun, 19 Jul 2020, at 18:14, Paul B Mahol wrote:
>> >> On 7/19/20, Jean-Baptiste Kempf  wrote:
>> >> > On Sun, 19 Jul 2020, at 16:05, Paul B Mahol wrote:
>> >> >> You all dislike me on discrimination basis and also object just for
>> >> >> objecting.
>> >> >
>> >> > Discriminate you based on what?
>> >> > Noone has ever seen you, and therefore noone knows your gender,
>> >> > religion,
>> >> > skin color, race, or any other personal thing on you.
>> >>
>> >> You are now lying.
>> >
>> > How so?
>>
>> You discriminate me just because I send big patches.
>
> "Discrimination is the act of making distinctions between human beings based
> on the groups, classes, or other categories to which they are perceived to
> belong. "
>
> I really doubt "sending big patches" fit the discrimination definition.
>
> And even if it did, I really doubt that the push-back from "all of us"  you
> are seeing is because of discrimination, but more about your attitude
> towards others.
>
> Here, Steinar gives a substantiated remark on your code, which could improve
> quality and speed, which matches the goal of this project.
>
> Why not just apply what he did, and give us a better filter?
> This is not discrimination, just noone understand your points.

Dear Jean-Baptiste Kempf, if I knew how to implement what Steinar wish
I would do
it already. Clearly there is big miss-understanding here.

Steinar could implement such filter already if he knew how to do it.
I think he does not know that he does not know that algorithm.

The only thing I could propose which would make filter faster under
same parameters
is to cache all results of atan2f / sqrtf calls.

About radial blur center issues, i think Steinar is confusing radial
blur with zoom blur.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Jean-Baptiste Kempf
On Sun, 19 Jul 2020, at 18:37, Paul B Mahol wrote:
> > Here, Steinar gives a substantiated remark on your code, which could improve
> > quality and speed, which matches the goal of this project.
> >
> > Why not just apply what he did, and give us a better filter?
> > This is not discrimination, just noone understand your points.
> 
> Dear Jean-Baptiste Kempf, if I knew how to implement what Steinar wish
> I would do
> it already. Clearly there is big miss-understanding here.

You see, it would be simpler just to say that, in answer to Steinar, instead of 
starting a flamewar, noone knows the reason of.

> Steinar could implement such filter already if he knew how to do it.
> I think he does not know that he does not know that algorithm.

I think Steinar knows a bit about filters algorithms:
https://git.sesse.net/?p=movit;a=tree , but as all of us, he is human, so he 
can also make mistakes.



-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec: add RPZA encoder

2020-07-19 Thread James Almer
On 7/16/2020 11:54 AM, Paul B Mahol wrote:
> +if (!s->prev_frame->data[0]) {
> +s->first_frame = 1;
> +ret = ff_get_buffer(avctx, s->prev_frame, 0);

This is for decoders only. Fill format, width and height on
s->prev_frame then call av_frame_get_buffer() instead.

> +if (ret < 0)
> +return ret;
> +} else {
> +s->first_frame = 0;
> +}

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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread James Almer
On 7/19/2020 1:13 PM, Paul B Mahol wrote:
> On 7/19/20, Steinar H. Gunderson  wrote:
>> On Sun, Jul 19, 2020 at 03:58:32PM +0200, Nicolas George wrote:
 Will apply.
>>> Certainly not before Steinar has had time to review it and tell us
>>> whether you addressed all the concerns.
>>
>> The primary change that I see is the addition of bilinear filtering in the
>> polar to Cartesian step. This makes the filter even slower, but it also
>> increases the output quality significantly. There are still artifacts I've
>> never seen in any other implementation of radial blur, and that stem
>> directly
>> from the choice of algorithm. The comment situation is unchanged, ie., there
>> are none.
>>
>> If someone else thinks the patch as-is is acceptable, I won't block it,
>> in the interest of less hostility.
> 
> 
> Thanks for confirming you are being hostile.

He did no such thing.

Please Paul, if you can implement his suggestions then do so, and if you
can't then state as much and maybe explain why. But this entire
discussion thread is absurd and had no reason to happen.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 06:37:16PM +0200, Paul B Mahol wrote:
> About radial blur center issues, i think Steinar is confusing radial
> blur with zoom blur.

I must admit I don't know any such difference; this is one of many things
that would be useful to have in comments or the commit message (many such
effects have different variations under similar names). But I do not
believe this is relevant to the artifacts in the center, or the staircase
effect on the horizontal white lines -- no matter what you call an filter,
they are not inherent to the effect. Both are much less pronounced than in
the previous patch set, but still present.

For those who want to judge for themselves:

  https://storage.sesse.net/ffmpeg-radialblur3.png

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Steinar H. Gunderson  wrote:
> On Sun, Jul 19, 2020 at 06:37:16PM +0200, Paul B Mahol wrote:
>> About radial blur center issues, i think Steinar is confusing radial
>> blur with zoom blur.
>
> I must admit I don't know any such difference; this is one of many things
> that would be useful to have in comments or the commit message (many such
> effects have different variations under similar names). But I do not
> believe this is relevant to the artifacts in the center, or the staircase
> effect on the horizontal white lines -- no matter what you call an filter,
> they are not inherent to the effect. Both are much less pronounced than in
> the previous patch set, but still present.
>
> For those who want to judge for themselves:
>
>   https://storage.sesse.net/ffmpeg-radialblur3.png
>

I see nothing wrong with that image.

You still provided 0 valuable information for your perfect solution algorithm.

> /* Steinar */
> --
> Homepage: https://www.sesse.net/
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Paul B Mahol
On 7/2/20, Paul B Mahol  wrote:
> On 7/2/20, Nicolas George  wrote:
>> Paul B Mahol (12020-07-02):
>>> I think anyone agreed that change is ok so i gonna apply this.
>>
>> Absolutely not, and your intimidation tactics are unacceptable.
>
> You are not absolute judge in this matter.
>

I officially request technical committee to give final decision on this subject.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning

2020-07-19 Thread Hendrik Leppkes
On Sun, Jul 19, 2020 at 6:15 PM Steinar H. Gunderson
 wrote:
>
> lzwenc stores a function pointer to either put_bits or put_bits_le.
> Update the function pointer's prototype after the recent change.
> ---
>  libavcodec/lzw.h| 4 +++-
>  libavcodec/lzwenc.c | 4 ++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
> index 6af8a6b83a..400a479809 100644
> --- a/libavcodec/lzw.h
> +++ b/libavcodec/lzw.h
> @@ -32,6 +32,8 @@
>
>  #include 
>
> +#include "put_bits.h"
> +
>  struct PutBitContext;

This forward declaration is probably not needed anymore once you
include put_bits.h.

I do wonder if there was a concern with including the file before that
caused the original author to use the forward declaration though...

>
>  enum FF_LZW_MODES{
> @@ -55,7 +57,7 @@ extern const int ff_lzw_encode_state_size;
>
>  void ff_lzw_encode_init(struct LZWEncodeState *s, uint8_t *outbuf, int 
> outsize,
>  int maxbits, enum FF_LZW_MODES mode,
> -void (*lzw_put_bits)(struct PutBitContext *, int, 
> unsigned int));
> +void (*lzw_put_bits)(struct PutBitContext *, int, 
> BitBuf));
>  int ff_lzw_encode(struct LZWEncodeState * s, const uint8_t * inbuf, int 
> insize);
>  int ff_lzw_encode_flush(struct LZWEncodeState *s,
>  void (*lzw_flush_put_bits)(struct PutBitContext *));
> diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
> index 03080ee587..c1b96905e8 100644
> --- a/libavcodec/lzwenc.c
> +++ b/libavcodec/lzwenc.c
> @@ -60,7 +60,7 @@ typedef struct LZWEncodeState {
>  int output_bytes;///< Number of written bytes
>  int last_code;   ///< Value of last output code or 
> LZW_PREFIX_EMPTY
>  enum FF_LZW_MODES mode;  ///< TIFF or GIF
> -void (*put_bits)(PutBitContext *, int, unsigned); ///< GIF is LE while 
> TIFF is BE
> +void (*put_bits)(PutBitContext *, int, BitBuf); ///< GIF is LE while 
> TIFF is BE
>  }LZWEncodeState;
>
>
> @@ -201,7 +201,7 @@ static int writtenBytes(LZWEncodeState *s){
>   */
>  void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize,
>  int maxbits, enum FF_LZW_MODES mode,
> -void (*lzw_put_bits)(PutBitContext *, int, unsigned))
> +void (*lzw_put_bits)(PutBitContext *, int, BitBuf))
>  {
>  s->clear_code = 256;
>  s->end_code = 257;
> --
> 2.20.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 2/6] avformat/wc3movie: Cleanup on wc3_read_header() failure

2020-07-19 Thread Michael Niedermayer
Fixes: memleak
Fixes: 
23660/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6007508031504384

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/wc3movie.c | 32 +++-
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index c59b5bf6cc..76e945d261 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -139,10 +139,14 @@ static int wc3_read_header(AVFormatContext *s)
 /* load up the name */
 buffer = av_malloc(size+1);
 if (!buffer)
-return AVERROR(ENOMEM);
+if (!buffer) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 if ((ret = avio_read(pb, buffer, size)) != size) {
 av_freep(&buffer);
-return AVERROR(EIO);
+ret =  AVERROR(EIO);
+goto fail;
 }
 buffer[size] = 0;
 av_dict_set(&s->metadata, "title", buffer,
@@ -164,21 +168,26 @@ static int wc3_read_header(AVFormatContext *s)
 default:
 av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n",
av_fourcc2str(fourcc_tag));
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto fail;
 }
 
 fourcc_tag = avio_rl32(pb);
 /* chunk sizes are 16-bit aligned */
 size = (avio_rb32(pb) + 1) & (~1);
-if (avio_feof(pb))
-return AVERROR(EIO);
+if (avio_feof(pb)) {
+ret = AVERROR(EIO);
+goto fail;
+}
 
 } while (fourcc_tag != BRCH_TAG);
 
 /* initialize the decoder streams */
 st = avformat_new_stream(s, NULL);
-if (!st)
-return AVERROR(ENOMEM);
+if (!st) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
 wc3->video_stream_index = st->index;
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -188,8 +197,10 @@ static int wc3_read_header(AVFormatContext *s)
 st->codecpar->height = wc3->height;
 
 st = avformat_new_stream(s, NULL);
-if (!st)
-return AVERROR(ENOMEM);
+if (!st) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
 wc3->audio_stream_index = st->index;
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -204,6 +215,9 @@ static int wc3_read_header(AVFormatContext *s)
 st->codecpar->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
 
 return 0;
+fail:
+wc3_read_close(s);
+return ret;
 }
 
 static int wc3_read_packet(AVFormatContext *s,
-- 
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 4/6] avformat/cdg: Fix integer overflow in duration computation

2020-07-19 Thread Michael Niedermayer
Fixes: signed integer overflow: 8398407 * 300 cannot be represented in type 
'int'
Fixes: 
23914/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4702539290509312

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

diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 05cac6e528..f933819d57 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s)
 if (ret < 0) {
 av_log(s, AV_LOG_WARNING, "Cannot calculate duration as file size 
cannot be determined\n");
 } else
-vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
+vst->duration = (ret * (int64_t)vst->time_base.den) / (CDG_PACKET_SIZE 
* 300);
 
 return 0;
 }
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 5/6] avformat/subviewerdec: fail on AV_NOPTS_VALUE

2020-07-19 Thread Michael Niedermayer
Such values are not supported by ff_subtitles_queue*

Fixes: signed integer overflow: 10 - -9223372036854775808 cannot be represented 
in type 'long'
Fixes: 
24193/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5714901855895552

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

diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c
index fdca3a4820..5c2fe676f1 100644
--- a/libavformat/subviewerdec.c
+++ b/libavformat/subviewerdec.c
@@ -148,6 +148,10 @@ static int subviewer_read_header(AVFormatContext *s)
 new_event = 1;
 pos = avio_tell(s->pb);
 } else if (*line) {
+if (pts_start == AV_NOPTS_VALUE) {
+res = AVERROR_INVALIDDATA;
+goto end;
+}
 if (!new_event) {
 sub = ff_subtitles_queue_insert(&subviewer->q, "\n", 1, 1);
 if (!sub) {
-- 
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/6] avformat/wc3movie: Move wc3_read_close() up

2020-07-19 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavformat/wc3movie.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 657700..c59b5bf6cc 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -73,6 +73,16 @@ typedef struct Wc3DemuxContext {
 
 } Wc3DemuxContext;
 
+static int wc3_read_close(AVFormatContext *s)
+{
+Wc3DemuxContext *wc3 = s->priv_data;
+
+if (wc3->vpkt.size > 0)
+av_packet_unref(&wc3->vpkt);
+
+return 0;
+}
+
 static int wc3_probe(const AVProbeData *p)
 {
 if (p->buf_size < 12)
@@ -286,16 +296,6 @@ static int wc3_read_packet(AVFormatContext *s,
 return ret;
 }
 
-static int wc3_read_close(AVFormatContext *s)
-{
-Wc3DemuxContext *wc3 = s->priv_data;
-
-if (wc3->vpkt.size > 0)
-av_packet_unref(&wc3->vpkt);
-
-return 0;
-}
-
 AVInputFormat ff_wc3_demuxer = {
 .name   = "wc3movie",
 .long_name  = NULL_IF_CONFIG_SMALL("Wing Commander III movie"),
-- 
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 6/6] tools:target_dem_fuzzer: Split into a fuzzer fuzzing at the protocol level and one fuzzing a fixed demuxer input

2020-07-19 Thread Michael Niedermayer
This should improve coverage and should improve the efficiency of seed files

Signed-off-by: Michael Niedermayer 
---
 Makefile  | 3 +++
 tools/Makefile| 5 -
 tools/target_dem_fuzzer.c | 9 -
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 45a22b0cb3..6a0dabfc5a 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,9 @@ tools/target_bsf_%_fuzzer$(EXESUF): 
tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS)
 tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) 
$(LIBFUZZER_PATH)
 
+tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o 
$(FF_DEP_LIBS)
+   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) 
$(LIBFUZZER_PATH)
+
 tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
 tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
 tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
diff --git a/tools/Makefile b/tools/Makefile
index 001093105b..88d64ce6d2 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -9,7 +9,10 @@ tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c
$(COMPILE_C) -DFFMPEG_BSF=$*
 
 tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c
-   $(COMPILE_C)
+   $(COMPILE_C) -DIO_FLAT=1
+
+tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c
+   $(COMPILE_C) -DIO_FLAT=0
 
 OUTDIRS += tools
 
diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c
index b8356c5aa1..eefb5c5fa3 100644
--- a/tools/target_dem_fuzzer.c
+++ b/tools/target_dem_fuzzer.c
@@ -76,6 +76,10 @@ static int64_t io_seek(void *opaque, int64_t offset, int 
whence)
 }
 if (offset < 0 || offset > c->filesize)
 return -1;
+if (IO_FLAT) {
+c->fuzz  += offset - c->pos;
+c->fuzz_size -= offset - c->pos;
+}
 c->pos = offset;
 return 0;
 }
@@ -110,7 +114,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 if (!avfmt)
 error("Failed avformat_alloc_context()");
 
-if (size > 2048) {
+if (IO_FLAT) {
+seekable = 1;
+io_buffer_size = size;
+} else if (size > 2048) {
 int flags;
 char extension[64];
 
-- 
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 3/6] avformat/sbgdec: Check for overflow in parse_timestamp()

2020-07-19 Thread Michael Niedermayer
Fixes: signed integer overflow: 339867072 + 9195561788997000192 cannot 
be represented in type 'long'
Fixes: 
23790/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554232198266880

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

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index de1de271bb..c11244ef3d 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -474,6 +474,8 @@ static int parse_timestamp(struct sbg_parser *p,
 while (lex_char(p, '+')) {
 if (!lex_time(p, &dt))
 return AVERROR_INVALIDDATA;
+if (av_sat_add64(rel, dt) - dt != rel)
+return AVERROR_INVALIDDATA;
 rel += dt;
 r = 1;
 }
-- 
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 2/6] avformat/wc3movie: Cleanup on wc3_read_header() failure

2020-07-19 Thread James Almer
On 7/19/2020 2:42 PM, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: 
> 23660/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6007508031504384
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/wc3movie.c | 32 +++-
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
> index c59b5bf6cc..76e945d261 100644
> --- a/libavformat/wc3movie.c
> +++ b/libavformat/wc3movie.c
> @@ -139,10 +139,14 @@ static int wc3_read_header(AVFormatContext *s)
>  /* load up the name */
>  buffer = av_malloc(size+1);
>  if (!buffer)
> -return AVERROR(ENOMEM);
> +if (!buffer) {
> +ret = AVERROR(ENOMEM);
> +goto fail;
> +}
>  if ((ret = avio_read(pb, buffer, size)) != size) {
>  av_freep(&buffer);
> -return AVERROR(EIO);
> +ret =  AVERROR(EIO);
> +goto fail;
>  }
>  buffer[size] = 0;
>  av_dict_set(&s->metadata, "title", buffer,
> @@ -164,21 +168,26 @@ static int wc3_read_header(AVFormatContext *s)
>  default:
>  av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n",
> av_fourcc2str(fourcc_tag));
> -return AVERROR_INVALIDDATA;
> +ret = AVERROR_INVALIDDATA;
> +goto fail;
>  }
>  
>  fourcc_tag = avio_rl32(pb);
>  /* chunk sizes are 16-bit aligned */
>  size = (avio_rb32(pb) + 1) & (~1);
> -if (avio_feof(pb))
> -return AVERROR(EIO);
> +if (avio_feof(pb)) {
> +ret = AVERROR(EIO);
> +goto fail;
> +}
>  
>  } while (fourcc_tag != BRCH_TAG);
>  
>  /* initialize the decoder streams */
>  st = avformat_new_stream(s, NULL);
> -if (!st)
> -return AVERROR(ENOMEM);
> +if (!st) {
> +ret = AVERROR(ENOMEM);
> +goto fail;
> +}
>  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
>  wc3->video_stream_index = st->index;
>  st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> @@ -188,8 +197,10 @@ static int wc3_read_header(AVFormatContext *s)
>  st->codecpar->height = wc3->height;
>  
>  st = avformat_new_stream(s, NULL);
> -if (!st)
> -return AVERROR(ENOMEM);
> +if (!st) {
> +ret = AVERROR(ENOMEM);
> +goto fail;
> +}
>  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
>  wc3->audio_stream_index = st->index;
>  st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> @@ -204,6 +215,9 @@ static int wc3_read_header(AVFormatContext *s)
>  st->codecpar->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
>  
>  return 0;
> +fail:
> +wc3_read_close(s);

Wouldn't it be better to instead make avformat_open_input() call
iformat->read_close() on iformat->read_header() failure?

It may require ensuring all demuxers behave nice with it, but the end
result would be a lot cleaner.

> +return ret;
>  }
>  
>  static int wc3_read_packet(AVFormatContext *s,
> 

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

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

Re: [FFmpeg-devel] [PATCH 3/6] avformat/sbgdec: Check for overflow in parse_timestamp()

2020-07-19 Thread Nicolas George
Michael Niedermayer (12020-07-19):
> Fixes: signed integer overflow: 339867072 + 9195561788997000192 
> cannot be represented in type 'long'
> Fixes: 
> 23790/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554232198266880
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/sbgdec.c | 2 ++
>  1 file changed, 2 insertions(+)

No objection.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH 2/6] avformat/wc3movie: Cleanup on wc3_read_header() failure

2020-07-19 Thread Andreas Rheinhardt
James Almer:
> On 7/19/2020 2:42 PM, Michael Niedermayer wrote:
>> Fixes: memleak
>> Fixes: 
>> 23660/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6007508031504384
>>
>> Found-by: continuous fuzzing process 
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavformat/wc3movie.c | 32 +++-
>>  1 file changed, 23 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
>> index c59b5bf6cc..76e945d261 100644
>> --- a/libavformat/wc3movie.c
>> +++ b/libavformat/wc3movie.c
>> @@ -139,10 +139,14 @@ static int wc3_read_header(AVFormatContext *s)
>>  /* load up the name */
>>  buffer = av_malloc(size+1);
>>  if (!buffer)
>> -return AVERROR(ENOMEM);
>> +if (!buffer) {
>> +ret = AVERROR(ENOMEM);
>> +goto fail;
>> +}
>>  if ((ret = avio_read(pb, buffer, size)) != size) {
>>  av_freep(&buffer);
>> -return AVERROR(EIO);
>> +ret =  AVERROR(EIO);
>> +goto fail;
>>  }
>>  buffer[size] = 0;
>>  av_dict_set(&s->metadata, "title", buffer,
>> @@ -164,21 +168,26 @@ static int wc3_read_header(AVFormatContext *s)
>>  default:
>>  av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n",
>> av_fourcc2str(fourcc_tag));
>> -return AVERROR_INVALIDDATA;
>> +ret = AVERROR_INVALIDDATA;
>> +goto fail;
>>  }
>>  
>>  fourcc_tag = avio_rl32(pb);
>>  /* chunk sizes are 16-bit aligned */
>>  size = (avio_rb32(pb) + 1) & (~1);
>> -if (avio_feof(pb))
>> -return AVERROR(EIO);
>> +if (avio_feof(pb)) {
>> +ret = AVERROR(EIO);
>> +goto fail;
>> +}
>>  
>>  } while (fourcc_tag != BRCH_TAG);
>>  
>>  /* initialize the decoder streams */
>>  st = avformat_new_stream(s, NULL);
>> -if (!st)
>> -return AVERROR(ENOMEM);
>> +if (!st) {
>> +ret = AVERROR(ENOMEM);
>> +goto fail;
>> +}
>>  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
>>  wc3->video_stream_index = st->index;
>>  st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
>> @@ -188,8 +197,10 @@ static int wc3_read_header(AVFormatContext *s)
>>  st->codecpar->height = wc3->height;
>>  
>>  st = avformat_new_stream(s, NULL);
>> -if (!st)
>> -return AVERROR(ENOMEM);
>> +if (!st) {
>> +ret = AVERROR(ENOMEM);
>> +goto fail;
>> +}
>>  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
>>  wc3->audio_stream_index = st->index;
>>  st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
>> @@ -204,6 +215,9 @@ static int wc3_read_header(AVFormatContext *s)
>>  st->codecpar->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
>>  
>>  return 0;
>> +fail:
>> +wc3_read_close(s);
> 
> Wouldn't it be better to instead make avformat_open_input() call
> iformat->read_close() on iformat->read_header() failure?
> 
> It may require ensuring all demuxers behave nice with it, but the end
> result would be a lot cleaner.
> 

Problem is: Not all input devices behave nice and it is possible to use
an older libavdevice together with a newer libavformat. You might
remember the patchset where I added a flag to AVInputFormat for this
purpose. I'll resend it soon.

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

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

Re: [FFmpeg-devel] [PATCH 2/6] avformat/wc3movie: Cleanup on wc3_read_header() failure

2020-07-19 Thread Nicolas George
Andreas Rheinhardt (12020-07-19):
>   it is possible to use
> an older libavdevice together with a newer libavformat.

I move we make it impossible.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] Ticket 5012

2020-07-19 Thread Thomas Volkert
Hi,

On 19.07.2020 18:10, Gautam Ramakrishnan wrote:
> On Thu, Jul 16, 2020 at 11:45 PM Carl Eugen Hoyos  wrote:
>> Am Do., 16. Juli 2020 um 19:42 Uhr schrieb Gautam Ramakrishnan
>> :
>>
>>> How could I get access to some stream/file for testing this feature if
>>> I implement this?
>> GStreamer should allow you to test your implementation.
>>
>> Carl Eugen
> So to clarify things, basically the enc version would take a compressed
> codestream, and split it into RTP packets given in the RFC? Is there anything
> more than that? Is there any documentation page I can refer to? I was not able
> to find anything specific.


Do you mean the RFC itself?
-> https://tools.ietf.org/html/rfc5371


Alternatively to GStreamer you can use Live555 to test your
implementation. I would start with the receiver and then continue with
the sender part.
Live555 source code for handling this payload:

->
https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSink.cpp

->
https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSource.cpp


Best regards.

___
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Paul B Mahol
On 7/19/20, Paul B Mahol  wrote:
> On 7/2/20, Paul B Mahol  wrote:
>> On 7/2/20, Nicolas George  wrote:
>>> Paul B Mahol (12020-07-02):
 I think anyone agreed that change is ok so i gonna apply this.
>>>
>>> Absolutely not, and your intimidation tactics are unacceptable.
>>
>> You are not absolute judge in this matter.
>>
>
> I officially request technical committee to give final decision on this
> subject.
>

Can I get confirmation that this will be dealt with in near future?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 07:32:18PM +0200, Paul B Mahol wrote:
> I see nothing wrong with that image.

Let me provide some zooms. First, center artifacts (the “flower” should not
be there):

  http://storage.sesse.net/ffmpeg-radialblur3-zoom1.png

Then, staircase/uneven horizontal line near the edge (the line should not
wobble up and down):

  http://storage.sesse.net/ffmpeg-radialblur3-zoom2.png

> You still provided 0 valuable information for your perfect solution algorithm.

I haven't claimed any perfect solutions, but I have suggested two different
algorithms with details that I both believe would be more performant and
sport higher output quality (actually three, but the last one was not with
a lot of details). Could you suggest which information you would regard as
valuable?

Here's the source code for GIMP's zoom blur implementation, which works
without any similar artifacts, and has no trigonometry per-pixel:

  
https://gitlab.gnome.org/GNOME/gegl/-/blob/master/operations/common-gpl3+/motion-blur-zoom.c#L160

If you can explain what you mean the difference between radial and zoom blur
is, it would probably be possible to adapt the idea.

It also has a somewhat more efficient implementation of bilinear filtering
than in your patch (three multiplies instead of eight, and also fewer
add/sub), although it's likely that a fixed-point implementation would save
yet more time if you're interested in trying that.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 07:37:15PM +0200, Paul B Mahol wrote:
> I officially request technical committee to give final decision on this 
> subject.

I will reiterate that I do not intend to block this patch if you can get some
other developer to approve it.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 08:07:27PM +0200, Steinar H. Gunderson wrote:
>> I officially request technical committee to give final decision on this 
>> subject.
> I will reiterate that I do not intend to block this patch if you can get some
> other developer to approve it.

I'm sorry, I replied to the wrong thread.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Nicolas George
Steinar H. Gunderson (12020-07-19):
> I will reiterate that I do not intend to block this patch if you can get some
> other developer to approve it.

You are confusing two discussions. I am blocking this patch, because it
makes an important and shared code path significantly more complex, for
the sake of two filters that can be implemented in a simpler way without
it. I am happy to provide details to help the committee decide if
necessary.

Regards,

-- 
  Nicolas George


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

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

Re: [FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning

2020-07-19 Thread Andreas Rheinhardt
Hendrik Leppkes:
> On Sun, Jul 19, 2020 at 6:15 PM Steinar H. Gunderson
>  wrote:
>>
>> lzwenc stores a function pointer to either put_bits or put_bits_le.
>> Update the function pointer's prototype after the recent change.
>> ---
>>  libavcodec/lzw.h| 4 +++-
>>  libavcodec/lzwenc.c | 4 ++--
>>  2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
>> index 6af8a6b83a..400a479809 100644
>> --- a/libavcodec/lzw.h
>> +++ b/libavcodec/lzw.h
>> @@ -32,6 +32,8 @@
>>
>>  #include 
>>
>> +#include "put_bits.h"
>> +
>>  struct PutBitContext;
> 
> This forward declaration is probably not needed anymore once you
> include put_bits.h.
> 
> I do wonder if there was a concern with including the file before that
> caused the original author to use the forward declaration though...
> 

The reason is probably that gif and tiff (the two users of this) use
different endianness (gif uses LE). A scenario like

#include "lzw.h"
#define BITSTREAM_WRITER_LE
#include "put_bits.h"

would be silently broken by this patch (the bitstream writer would be
big-endian).

Notice that gif.c defines BITSTREAM_WRITER_LE before including anything.

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

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

Re: [FFmpeg-devel] Ticket 5012

2020-07-19 Thread Gautam Ramakrishnan
On Sun, Jul 19, 2020 at 11:33 PM Thomas Volkert  wrote:
>
> Hi,
>
> On 19.07.2020 18:10, Gautam Ramakrishnan wrote:
> > On Thu, Jul 16, 2020 at 11:45 PM Carl Eugen Hoyos  
> > wrote:
> >> Am Do., 16. Juli 2020 um 19:42 Uhr schrieb Gautam Ramakrishnan
> >> :
> >>
> >>> How could I get access to some stream/file for testing this feature if
> >>> I implement this?
> >> GStreamer should allow you to test your implementation.
> >>
> >> Carl Eugen
> > So to clarify things, basically the enc version would take a compressed
> > codestream, and split it into RTP packets given in the RFC? Is there 
> > anything
> > more than that? Is there any documentation page I can refer to? I was not 
> > able
> > to find anything specific.
>
>
> Do you mean the RFC itself?
> -> https://tools.ietf.org/html/rfc5371
>
Yes
>
> Alternatively to GStreamer you can use Live555 to test your
> implementation. I would start with the receiver and then continue with
> the sender part.
> Live555 source code for handling this payload:
>
> ->
> https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSink.cpp
>
> ->
> https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSource.cpp
>
>
Thanks a lot for these, will be very helpful

Additionally, what I understand is that the packetisation is of 3 types,
main header, tile part header and codestream packets.
However, if I understand it correctly, the rtp encoder provides an encoded
j2k codestream. To get the codestream packets from this, the codestream will
have to be decoded. Any suggestions on how to solve this? It does not make sense
to decode a codestream for this purpose. Can the tile part packets be
dumped from the
encoder itself?



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

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

Re: [FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 07:48:47PM +0200, Andreas Rheinhardt wrote:
> The reason is probably that gif and tiff (the two users of this) use
> different endianness (gif uses LE). A scenario like
> 
> #include "lzw.h"
> #define BITSTREAM_WRITER_LE
> #include "put_bits.h"
> 
> would be silently broken by this patch (the bitstream writer would be
> big-endian).
> 
> Notice that gif.c defines BITSTREAM_WRITER_LE before including anything.

Yes, it's a bit tricky. I'm not convinced having a header silently behave
differently depending on a macro being set is a good idea... Perhaps I
should simply take out BITSTREAM_WRITER_LE from gif.c and replace it with
using put_bits_le?

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Steinar H. Gunderson  wrote:
> On Sun, Jul 19, 2020 at 07:32:18PM +0200, Paul B Mahol wrote:
>> I see nothing wrong with that image.
>
> Let me provide some zooms. First, center artifacts (the “flower” should not
> be there):
>
>   http://storage.sesse.net/ffmpeg-radialblur3-zoom1.png
>
> Then, staircase/uneven horizontal line near the edge (the line should not
> wobble up and down):
>
>   http://storage.sesse.net/ffmpeg-radialblur3-zoom2.png

Huh, since when we look at such small differences?

>
>> You still provided 0 valuable information for your perfect solution
>> algorithm.
>
> I haven't claimed any perfect solutions, but I have suggested two different
> algorithms with details that I both believe would be more performant and
> sport higher output quality (actually three, but the last one was not with
> a lot of details). Could you suggest which information you would regard as
> valuable?
>
> Here's the source code for GIMP's zoom blur implementation, which works
> without any similar artifacts, and has no trigonometry per-pixel:
>
>
> https://gitlab.gnome.org/GNOME/gegl/-/blob/master/operations/common-gpl3+/motion-blur-zoom.c#L160
>
> If you can explain what you mean the difference between radial and zoom blur
> is, it would probably be possible to adapt the idea.

That algorithm is very slow for big lengths, it takes ages to process
single small image.

>
> It also has a somewhat more efficient implementation of bilinear filtering
> than in your patch (three multiplies instead of eight, and also fewer
> add/sub), although it's likely that a fixed-point implementation would save
> yet more time if you're interested in trying that.

Such micro-optimizations could be added any time later.
___
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/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples

2020-07-19 Thread Paul B Mahol
On 7/19/20, Nicolas George  wrote:
> Steinar H. Gunderson (12020-07-19):
>> I will reiterate that I do not intend to block this patch if you can get
>> some
>> other developer to approve it.
>
> You are confusing two discussions. I am blocking this patch, because it
> makes an important and shared code path significantly more complex, for
> the sake of two filters that can be implemented in a simpler way without
> it. I am happy to provide details to help the committee decide if
> necessary.

It is not just two filters, there are numerous other filters that
currently uses hacks.
And you never provided any solution to such simple way approach.

You think that you defacto know all about libavfilters but your
knowledge is extremely biased and limited.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 08:20:40PM +0200, Paul B Mahol wrote:
>> If you can explain what you mean the difference between radial and zoom blur
>> is, it would probably be possible to adapt the idea.
> That algorithm is very slow for big lengths, it takes ages to process
> single small image.

Yes, this is the non-recursive version, which is O(n) in the number of
samples. This is why I recommended the recursive version, which is O(log n)
in the number of samples and thus avoids the problem with big lengths.
It is fairly straightforward to convert one to the other.

>> It also has a somewhat more efficient implementation of bilinear filtering
>> than in your patch (three multiplies instead of eight, and also fewer
>> add/sub), although it's likely that a fixed-point implementation would save
>> yet more time if you're interested in trying that.
> Such micro-optimizations could be added any time later.

Sure.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning

2020-07-19 Thread Steinar H. Gunderson
lzwenc stores a function pointer to either put_bits or put_bits_le;
however, after the recent change, the function pointer's prototype
would depend on BitBuf. BitBuf is defined in put_bits.h, whose
definition depends on whether BITSTREAM_WRITER_LE is #defined or not.
For safety, we set a boolean flag for little/big endian instead,
which also allows the definition to be inlined.
---
 libavcodec/gif.c |  4 ++--
 libavcodec/lzw.h |  6 ++
 libavcodec/lzwenc.c  | 28 ++--
 libavcodec/tiffenc.c |  4 ++--
 4 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index e2242d0438..e92dfa65d7 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -344,7 +344,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
 bytestream_put_byte(bytestream, 0x08);
 
 ff_lzw_encode_init(s->lzw, s->buf, s->buf_size,
-   12, FF_LZW_GIF, put_bits);
+   12, FF_LZW_GIF, 1);
 
 ptr = buf + y_start*linesize + x_start;
 if (honor_transparency) {
@@ -366,7 +366,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
 ptr += linesize;
 }
 }
-len += ff_lzw_encode_flush(s->lzw, flush_put_bits);
+len += ff_lzw_encode_flush(s->lzw);
 
 ptr = s->buf;
 while (len > 0) {
diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
index 6af8a6b83a..dae4d05225 100644
--- a/libavcodec/lzw.h
+++ b/libavcodec/lzw.h
@@ -54,10 +54,8 @@ struct LZWEncodeState;
 extern const int ff_lzw_encode_state_size;
 
 void ff_lzw_encode_init(struct LZWEncodeState *s, uint8_t *outbuf, int outsize,
-int maxbits, enum FF_LZW_MODES mode,
-void (*lzw_put_bits)(struct PutBitContext *, int, 
unsigned int));
+int maxbits, enum FF_LZW_MODES mode, int 
little_endian);
 int ff_lzw_encode(struct LZWEncodeState * s, const uint8_t * inbuf, int 
insize);
-int ff_lzw_encode_flush(struct LZWEncodeState *s,
-void (*lzw_flush_put_bits)(struct PutBitContext *));
+int ff_lzw_encode_flush(struct LZWEncodeState *s);
 
 #endif /* AVCODEC_LZW_H */
diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
index 03080ee587..e693d74272 100644
--- a/libavcodec/lzwenc.c
+++ b/libavcodec/lzwenc.c
@@ -60,7 +60,7 @@ typedef struct LZWEncodeState {
 int output_bytes;///< Number of written bytes
 int last_code;   ///< Value of last output code or LZW_PREFIX_EMPTY
 enum FF_LZW_MODES mode;  ///< TIFF or GIF
-void (*put_bits)(PutBitContext *, int, unsigned); ///< GIF is LE while 
TIFF is BE
+int little_endian;   ///< GIF is LE while TIFF is BE
 }LZWEncodeState;
 
 
@@ -113,7 +113,10 @@ static inline int hashOffset(const int head)
 static inline void writeCode(LZWEncodeState * s, int c)
 {
 av_assert2(0 <= c && c < 1 << s->bits);
-s->put_bits(&s->pb, s->bits, c);
+if (s->little_endian)
+put_bits_le(&s->pb, s->bits, c);
+else
+put_bits(&s->pb, s->bits, c);
 }
 
 
@@ -200,8 +203,7 @@ static int writtenBytes(LZWEncodeState *s){
  * @param maxbits Maximum length of code
  */
 void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize,
-int maxbits, enum FF_LZW_MODES mode,
-void (*lzw_put_bits)(PutBitContext *, int, unsigned))
+int maxbits, enum FF_LZW_MODES mode, int little_endian)
 {
 s->clear_code = 256;
 s->end_code = 257;
@@ -214,7 +216,7 @@ void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, 
int outsize,
 s->last_code = LZW_PREFIX_EMPTY;
 s->bits = 9;
 s->mode = mode;
-s->put_bits = lzw_put_bits;
+s->little_endian = little_endian;
 }
 
 /**
@@ -257,16 +259,22 @@ int ff_lzw_encode(LZWEncodeState * s, const uint8_t * 
inbuf, int insize)
  * @param s LZW state
  * @return Number of bytes written or -1 on error
  */
-int ff_lzw_encode_flush(LZWEncodeState *s,
-void (*lzw_flush_put_bits)(PutBitContext *))
+int ff_lzw_encode_flush(LZWEncodeState *s)
 {
 if (s->last_code != -1)
 writeCode(s, s->last_code);
 writeCode(s, s->end_code);
-if (s->mode == FF_LZW_GIF)
-s->put_bits(&s->pb, 1, 0);
+if (s->little_endian) {
+if (s->mode == FF_LZW_GIF)
+put_bits_le(&s->pb, 1, 0);
 
-lzw_flush_put_bits(&s->pb);
+flush_put_bits_le(&s->pb);
+} else {
+if (s->mode == FF_LZW_GIF)
+put_bits(&s->pb, 1, 0);
+
+flush_put_bits(&s->pb);
+}
 s->last_code = -1;
 
 return writtenBytes(s);
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index a122f51de4..6661e59d31 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -421,7 +421,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 if (s->compr == TIFF_LZW) {
 ff_lzw_encode_init(s->lzws, ptr,
s->buf_size -

Re: [FFmpeg-devel] Ticket 5012

2020-07-19 Thread Carl Eugen Hoyos
Am So., 19. Juli 2020 um 20:18 Uhr schrieb Gautam Ramakrishnan
:
>
> On Sun, Jul 19, 2020 at 11:33 PM Thomas Volkert  wrote:
> >
> > Hi,
> >
> > On 19.07.2020 18:10, Gautam Ramakrishnan wrote:
> > > On Thu, Jul 16, 2020 at 11:45 PM Carl Eugen Hoyos  
> > > wrote:
> > >> Am Do., 16. Juli 2020 um 19:42 Uhr schrieb Gautam Ramakrishnan
> > >> :
> > >>
> > >>> How could I get access to some stream/file for testing this feature if
> > >>> I implement this?
> > >> GStreamer should allow you to test your implementation.
> > >>
> > >> Carl Eugen
> > > So to clarify things, basically the enc version would take a compressed
> > > codestream, and split it into RTP packets given in the RFC? Is there 
> > > anything
> > > more than that? Is there any documentation page I can refer to? I was not 
> > > able
> > > to find anything specific.
> >
> >
> > Do you mean the RFC itself?
> > -> https://tools.ietf.org/html/rfc5371
> >
> Yes
> >
> > Alternatively to GStreamer you can use Live555 to test your
> > implementation. I would start with the receiver and then continue with
> > the sender part.
> > Live555 source code for handling this payload:
> >
> > ->
> > https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSink.cpp
> >
> > ->
> > https://github.com/ThomasVolkert/live555/blob/master/liveMedia/JPEG2000VideoRTPSource.cpp
> >
> >
> Thanks a lot for these, will be very helpful
>
> Additionally, what I understand is that the packetisation is of 3 types,
> main header, tile part header and codestream packets.
> However, if I understand it correctly, the rtp encoder provides an encoded
> j2k codestream. To get the codestream packets from this, the codestream will
> have to be decoded. Any suggestions on how to solve this? It does not make 
> sense
> to decode a codestream for this purpose. Can the tile part packets be
> dumped from the encoder itself?

Did you already look into the rtp muxer / demuxer for jpeg or other formats?
I wonder if that would answer your questions.

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

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Steinar H. Gunderson  wrote:
> On Sun, Jul 19, 2020 at 08:20:40PM +0200, Paul B Mahol wrote:
>>> If you can explain what you mean the difference between radial and zoom
>>> blur
>>> is, it would probably be possible to adapt the idea.
>> That algorithm is very slow for big lengths, it takes ages to process
>> single small image.
>
> Yes, this is the non-recursive version, which is O(n) in the number of
> samples. This is why I recommended the recursive version, which is O(log n)
> in the number of samples and thus avoids the problem with big lengths.
> It is fairly straightforward to convert one to the other.

Really? How so?

>
>>> It also has a somewhat more efficient implementation of bilinear
>>> filtering
>>> than in your patch (three multiplies instead of eight, and also fewer
>>> add/sub), although it's likely that a fixed-point implementation would
>>> save
>>> yet more time if you're interested in trying that.
>> Such micro-optimizations could be added any time later.
>
> Sure.
>
> /* Steinar */
> --
> Homepage: https://www.sesse.net/
> ___
> 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] avfilter: add radial and circular blur video filter

2020-07-19 Thread Steinar H. Gunderson
On Sun, Jul 19, 2020 at 09:02:30PM +0200, Paul B Mahol wrote:
>> Yes, this is the non-recursive version, which is O(n) in the number of
>> samples. This is why I recommended the recursive version, which is O(log n)
>> in the number of samples and thus avoids the problem with big lengths.
>> It is fairly straightforward to convert one to the other.
> Really? How so?

As previously mentioned, you do two samples, then save to a temporary buffer,
two samples from that buffer with half the distance and so on until your
samples are only one pixel apart.

You can also try doing three or four samples at a time instead of two;
experiment a bit and see what gives the best performance.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Steinar H. Gunderson  wrote:
> On Sun, Jul 19, 2020 at 09:02:30PM +0200, Paul B Mahol wrote:
>>> Yes, this is the non-recursive version, which is O(n) in the number of
>>> samples. This is why I recommended the recursive version, which is O(log
>>> n)
>>> in the number of samples and thus avoids the problem with big lengths.
>>> It is fairly straightforward to convert one to the other.
>> Really? How so?
>
> As previously mentioned, you do two samples, then save to a temporary
> buffer,
> two samples from that buffer with half the distance and so on until your
> samples are only one pixel apart.
>
> You can also try doing three or four samples at a time instead of two;
> experiment a bit and see what gives the best performance.

This is very slow.

>
> /* Steinar */
> --
> Homepage: https://www.sesse.net/
> ___
> 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] Defect #8801

2020-07-19 Thread Carl Eugen Hoyos
Am So., 19. Juli 2020 um 16:38 Uhr schrieb John Rose
:
>
>   Is your issue reproducible with current FFmpeg git head, the only version
>   supported on this bug tracker?
>
> As I'm a Newbie to this mailing list, I'm not sure that I'm doing it
> properly.
> I was asked the above question by email from t...@avcodec.org.

You write elsewhere that this email suggested to post on ffmpeg-devel
(which is very surprising and really not what the bug tracker should
suggest).

Can you do me a favor and forward the mail that you received to my
email address?
ceffm...@gmail.com

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi |  46 
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   2 +
 libavfilter/vf_rblur.c   | 558 +++
 4 files changed, 608 insertions(+)
 create mode 100644 libavfilter/vf_rblur.c

diff --git a/doc/filters.texi b/doc/filters.texi
index a2c31ff610..62705db984 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7231,6 +7231,29 @@ Set planes to filter. Default value is to filter all
 planes except alpha plane.
 @end table
 
+@section cblur
+Apply a circular blur filter.
+
+The filter accepts the following options:
+
+@table @option
+@item centerx, centery
+Set central point position of circular blur. Default is @code{0.5}.
+
+@item amount
+Set amount of circular blur. Default is @code{0.03}.
+
+@item planes
+Set which planes to filter. By default all planes are filtered.
+@end table
+
+@subsection Commands
+This filter supports same @ref{commands} as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @section chromahold
 Remove all color information for all colors except for certain one.
 
@@ -15768,6 +15791,29 @@ less than @code{0}, the filter will try to use a good 
random seed on a
 best effort basis.
 @end table
 
+@section rblur
+Apply a radial blur filter.
+
+The filter accepts the following options:
+
+@table @option
+@item centerx, centery
+Set central point position of radial blur. Default is @code{0.5}.
+
+@item amount
+Set amount of radial blur. Default is @code{0.03}.
+
+@item planes
+Set which planes to filter. By default all planes are filtered.
+@end table
+
+@subsection Commands
+This filter supports same @ref{commands} as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @section readeia608
 
 Read closed captioning (EIA-608) information from the top lines of a video 
frame.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 33dcc69392..30f2abf9e2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -180,6 +180,7 @@ OBJS-$(CONFIG_BOXBLUR_OPENCL_FILTER) += 
vf_avgblur_opencl.o opencl.o \
 opencl/avgblur.o boxblur.o
 OBJS-$(CONFIG_BWDIF_FILTER)  += vf_bwdif.o yadif_common.o
 OBJS-$(CONFIG_CAS_FILTER)+= vf_cas.o
+OBJS-$(CONFIG_CBLUR_FILTER)  += vf_rblur.o
 OBJS-$(CONFIG_CHROMABER_VULKAN_FILTER)   += vf_chromaber_vulkan.o vulkan.o
 OBJS-$(CONFIG_CHROMAHOLD_FILTER) += vf_chromakey.o
 OBJS-$(CONFIG_CHROMAKEY_FILTER)  += vf_chromakey.o
@@ -358,6 +359,7 @@ OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o 
framesync.o
 OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o
 OBJS-$(CONFIG_QP_FILTER) += vf_qp.o
 OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o
+OBJS-$(CONFIG_RBLUR_FILTER)  += vf_rblur.o
 OBJS-$(CONFIG_READEIA608_FILTER) += vf_readeia608.o
 OBJS-$(CONFIG_READVITC_FILTER)   += vf_readvitc.o
 OBJS-$(CONFIG_REALTIME_FILTER)   += f_realtime.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b896a76c9e..38279a44eb 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -171,6 +171,7 @@ extern AVFilter ff_vf_boxblur;
 extern AVFilter ff_vf_boxblur_opencl;
 extern AVFilter ff_vf_bwdif;
 extern AVFilter ff_vf_cas;
+extern AVFilter ff_vf_cblur;
 extern AVFilter ff_vf_chromahold;
 extern AVFilter ff_vf_chromakey;
 extern AVFilter ff_vf_chromanr;
@@ -341,6 +342,7 @@ extern AVFilter ff_vf_psnr;
 extern AVFilter ff_vf_pullup;
 extern AVFilter ff_vf_qp;
 extern AVFilter ff_vf_random;
+extern AVFilter ff_vf_rblur;
 extern AVFilter ff_vf_readeia608;
 extern AVFilter ff_vf_readvitc;
 extern AVFilter ff_vf_realtime;
diff --git a/libavfilter/vf_rblur.c b/libavfilter/vf_rblur.c
new file mode 100644
index 00..a828f9ea2d
--- /dev/null
+++ b/libavfilter/vf_rblur.c
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 2020 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#inc

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Paul B Mahol
On 7/19/20, Paul B Mahol  wrote:
> On 7/19/20, Steinar H. Gunderson  wrote:
>> On Sun, Jul 19, 2020 at 09:02:30PM +0200, Paul B Mahol wrote:
 Yes, this is the non-recursive version, which is O(n) in the number of
 samples. This is why I recommended the recursive version, which is
 O(log
 n)
 in the number of samples and thus avoids the problem with big lengths.
 It is fairly straightforward to convert one to the other.
>>> Really? How so?
>>
>> As previously mentioned, you do two samples, then save to a temporary
>> buffer,
>> two samples from that buffer with half the distance and so on until your
>> samples are only one pixel apart.
>>
>> You can also try doing three or four samples at a time instead of two;
>> experiment a bit and see what gives the best performance.
>
> This is very slow.
>

Also I fixed silly center artifacts in rblur implementation.

Speed here on historic CPU for hd720 is 12-13 frames per second for 23
fps video with slice threading enabled on 4 core CPU.

This could be made even faster at expense of more memory usage.
I really doubt there is faster algorithm that needs less memory but
with no quality drop.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v3] avcodec/v4l2_m2m: adapt to call close() on init fail

2020-07-19 Thread Andriy Gelman
From: Andriy Gelman 

This fixes several mem leaks when init of encoder/decoder failed.

Fixes ticket #8285

Signed-off-by: Andriy Gelman 
---

- Changes in v3
rebased and moved av_packet_unref(&s->buf_pkt) to v4l2_m2m_destroy_context()
to be consistent with another patch

 libavcodec/v4l2_m2m.c |  6 ++
 libavcodec/v4l2_m2m_dec.c | 10 ++
 libavcodec/v4l2_m2m_enc.c |  1 +
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index d8d872ea09..944c1a2823 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -330,6 +330,7 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t 
*context)
 
 close(s->fd);
 av_frame_free(&s->frame);
+av_packet_unref(&s->buf_pkt);
 
 av_free(s);
 }
@@ -339,6 +340,10 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
 V4L2m2mContext *s = priv->context;
 int ret;
 
+if (!s)
+return 0;
+
+if (s->fd >= 0) {
 ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
 if (ret)
 av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", 
s->output.name);
@@ -346,6 +351,7 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
 ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);
 if (ret)
 av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", 
s->capture.name);
+}
 
 ff_v4l2_context_release(&s->output);
 
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index b038efed9c..ab07c0a24a 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -205,9 +205,6 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
 ret = ff_v4l2_m2m_codec_init(priv);
 if (ret) {
 av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n");
-s->self_ref = NULL;
-av_buffer_unref(&priv->context_ref);
-
 return ret;
 }
 
@@ -216,10 +213,7 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
 
 static av_cold int v4l2_decode_close(AVCodecContext *avctx)
 {
-V4L2m2mPriv *priv = avctx->priv_data;
-V4L2m2mContext *s = priv->context;
-av_packet_unref(&s->buf_pkt);
-return ff_v4l2_m2m_codec_end(priv);
+return ff_v4l2_m2m_codec_end(avctx->priv_data);
 }
 
 #define OFFSET(x) offsetof(V4L2m2mPriv, x)
@@ -254,7 +248,7 @@ static const AVOption options[] = {
 .close  = v4l2_decode_close, \
 .bsfs   = bsf_name, \
 .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | 
AV_CODEC_CAP_AVOID_PROBING, \
-.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \
+.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS | 
FF_CODEC_CAP_INIT_CLEANUP, \
 .wrapper_name   = "v4l2m2m", \
 }
 
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index 56df4286ad..af0ed1e306 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -429,6 +429,7 @@ static const AVCodecDefault v4l2_m2m_defaults[] = {
 .close  = v4l2_encode_close, \
 .defaults   = v4l2_m2m_defaults, \
 .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, \
 .wrapper_name   = "v4l2m2m", \
 }
 
-- 
2.27.0

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

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

Re: [FFmpeg-devel] [PATCH 2/6] avformat/wc3movie: Cleanup on wc3_read_header() failure

2020-07-19 Thread Michael Niedermayer
On Sun, Jul 19, 2020 at 02:50:45PM -0300, James Almer wrote:
> On 7/19/2020 2:42 PM, Michael Niedermayer wrote:
> > Fixes: memleak
> > Fixes: 
> > 23660/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6007508031504384
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/wc3movie.c | 32 +++-
> >  1 file changed, 23 insertions(+), 9 deletions(-)
> > 
> > diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
> > index c59b5bf6cc..76e945d261 100644
> > --- a/libavformat/wc3movie.c
> > +++ b/libavformat/wc3movie.c
> > @@ -139,10 +139,14 @@ static int wc3_read_header(AVFormatContext *s)
> >  /* load up the name */
> >  buffer = av_malloc(size+1);
> >  if (!buffer)
> > -return AVERROR(ENOMEM);
> > +if (!buffer) {
> > +ret = AVERROR(ENOMEM);
> > +goto fail;
> > +}
> >  if ((ret = avio_read(pb, buffer, size)) != size) {
> >  av_freep(&buffer);
> > -return AVERROR(EIO);
> > +ret =  AVERROR(EIO);
> > +goto fail;
> >  }
> >  buffer[size] = 0;
> >  av_dict_set(&s->metadata, "title", buffer,
> > @@ -164,21 +168,26 @@ static int wc3_read_header(AVFormatContext *s)
> >  default:
> >  av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n",
> > av_fourcc2str(fourcc_tag));
> > -return AVERROR_INVALIDDATA;
> > +ret = AVERROR_INVALIDDATA;
> > +goto fail;
> >  }
> >  
> >  fourcc_tag = avio_rl32(pb);
> >  /* chunk sizes are 16-bit aligned */
> >  size = (avio_rb32(pb) + 1) & (~1);
> > -if (avio_feof(pb))
> > -return AVERROR(EIO);
> > +if (avio_feof(pb)) {
> > +ret = AVERROR(EIO);
> > +goto fail;
> > +}
> >  
> >  } while (fourcc_tag != BRCH_TAG);
> >  
> >  /* initialize the decoder streams */
> >  st = avformat_new_stream(s, NULL);
> > -if (!st)
> > -return AVERROR(ENOMEM);
> > +if (!st) {
> > +ret = AVERROR(ENOMEM);
> > +goto fail;
> > +}
> >  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
> >  wc3->video_stream_index = st->index;
> >  st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> > @@ -188,8 +197,10 @@ static int wc3_read_header(AVFormatContext *s)
> >  st->codecpar->height = wc3->height;
> >  
> >  st = avformat_new_stream(s, NULL);
> > -if (!st)
> > -return AVERROR(ENOMEM);
> > +if (!st) {
> > +ret = AVERROR(ENOMEM);
> > +goto fail;
> > +}
> >  avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
> >  wc3->audio_stream_index = st->index;
> >  st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> > @@ -204,6 +215,9 @@ static int wc3_read_header(AVFormatContext *s)
> >  st->codecpar->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
> >  
> >  return 0;
> > +fail:
> > +wc3_read_close(s);
> 
> Wouldn't it be better to instead make avformat_open_input() call
> iformat->read_close() on iformat->read_header() failure?
> 
> It may require ensuring all demuxers behave nice with it, 

> but the end
> result would be a lot cleaner.

yes, certainly.

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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 v2 1/2] avformat: Redo cleanup of demuxer upon read_header() failure

2020-07-19 Thread Andreas Rheinhardt
If reading the header fails, the demuxer's read_close() function (if
existing) is not called automatically; instead several demuxers call it
via "goto fail" in read_header().

This commit intends to change this by adding a flag to AVInputFormat
that can be used to set on a per-AVInputFormat basis whether read_close()
should be called generically after an error during read_header().

The flag controlling this behaviour needs to be added because it might
be unsafe to call read_close() generally (e.g. this might lead to
read_close() being called twice and this might e.g. lead to double-frees
if av_free() is used instead of av_freep(); or a size field has not
been reset after freeing the elements (see the mov demuxer for an
example of this)). Yet the intention is to check and fix all demuxers
and make the flag redundant in the medium run.

The flag itself is non-public (it resides in libavformat/internal.h),
but it has been added to the ordinary (i.e. public) flags field of
AVInputFormat, because there is no field for internal flags and adding
one is not possible, because libavdevice also defines AVInputFormats
and so there is the possibility that a newer libavformat is used
together with an older libavdevice that would then lack the new field
for internal flags. When it has become redundant, it can be removed again
at the next major version bump.

Signed-off-by: Andreas Rheinhardt 
---
This is an updated version of my initial patch [1]. I have also rebased
the whole set of patches following it (with the exception of the w3c
patch in the next patch they no longer fix a memleak; instead they now
only set the flag and remove the manual calls to read_close). Should I
resend the other patches, too?

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258830.html

 libavformat/internal.h |  6 ++
 libavformat/utils.c| 11 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 17a6ab07d3..b7441a5959 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -39,6 +39,12 @@
 #define hex_dump_debug(class, buf, size) do { if (0) 
av_hex_dump_log(class, AV_LOG_DEBUG, buf, size); } while(0)
 #endif
 
+/** Internal flag that is part of AVInputFormat.flags due to
+ *  ABI restrictions that forbid adding a new flags_internal
+ *  to AVInputFormat. */
+#define AVFMT_HEADER_CLEANUP 0x4000 /**< read_close() should be called
+ on read_header() failure */
+
 typedef struct AVCodecTag {
 enum AVCodecID id;
 unsigned int tag;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 807d9f10cb..2148a03497 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -396,8 +396,12 @@ int av_demuxer_open(AVFormatContext *ic) {
 
 if (ic->iformat->read_header) {
 err = ic->iformat->read_header(ic);
-if (err < 0)
+if (err < 0) {
+if (ic->iformat->read_close &&
+ic->iformat->flags & AVFMT_HEADER_CLEANUP)
+ic->iformat->read_close(ic);
 return err;
+}
 }
 
 if (ic->pb && !ic->internal->data_offset)
@@ -624,8 +628,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 
 if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)
-if ((ret = s->iformat->read_header(s)) < 0)
+if ((ret = s->iformat->read_header(s)) < 0) {
+if (s->iformat->flags & AVFMT_HEADER_CLEANUP)
+goto close;
 goto fail;
+}
 
 if (!s->metadata) {
 s->metadata = s->internal->id3v2_meta;
-- 
2.20.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 v2 2/2] avformat/wc3movie: Fix memleak upon read_header failure

2020-07-19 Thread Andreas Rheinhardt
wc3_read_header() might fail after having read some data into a packet
in which case this data would leak. Fix this by setting the
AVFMT_HEADER_CLEANUP flag that ensures that the demuxer's read_close
function is called (it unrefs the packet) if reading the header failed.

Fixes: memleak
Fixes: 
23660/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6007508031504384

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Andreas Rheinhardt 
---
Michael, can you confirm that this fixes the memleak?

 libavformat/wc3movie.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 657700..ebe2196052 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -299,6 +299,7 @@ static int wc3_read_close(AVFormatContext *s)
 AVInputFormat ff_wc3_demuxer = {
 .name   = "wc3movie",
 .long_name  = NULL_IF_CONFIG_SMALL("Wing Commander III movie"),
+.flags  = AVFMT_HEADER_CLEANUP,
 .priv_data_size = sizeof(Wc3DemuxContext),
 .read_probe = wc3_probe,
 .read_header= wc3_read_header,
-- 
2.20.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/4] avformat/au: Store strings instead of pointers to strings in array

2020-07-19 Thread Alexander Strasser
Hi Andreas,

no objections for the patchset as a whole.

Just for the first in the series I have some questions.

The commit message is:

avformat/au: Store strings instead of pointers to strings in array

This tells the what, but not the why.


On 2020-07-17 13:14 +0200, Andreas Rheinhardt wrote:
> Andreas Rheinhardt:
> > Signed-off-by: Andreas Rheinhardt 
> > ---
> >  libavformat/au.c | 13 ++---
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/au.c b/libavformat/au.c
> > index f92863e400..b419c9ed95 100644
> > --- a/libavformat/au.c
> > +++ b/libavformat/au.c
> > @@ -68,13 +68,13 @@ static int au_probe(const AVProbeData *p)
> >
> >  static int au_read_annotation(AVFormatContext *s, int size)
> >  {
> > -static const char * keys[] = {
> > +static const char keys[][7] = {
> >  "title",
> >  "artist",
> >  "album",
> >  "track",
> >  "genre",
> > -NULL };
> > +};

Sorry, I couldn't test myself but wouldn't just

static const char * keys[] = {
"title",
"artist",
"album",
"track",
"genre",
};

have been the better choice with the same benefits?

I'm not sure without looking up the C standard and writing some
little test programs. From my guts I would say it's equivalent,
but the syntax is more convenient this way.

That's also another issue with the commit message, since I don't
think it is true that in your version strings are stored in the
array. No offense intended and I sure might be mistaken.


> >  AVIOContext *pb = s->pb;
> >  enum { PARSE_KEY, PARSE_VALUE, PARSE_FINISHED } state = PARSE_KEY;
> >  char c;
> > @@ -107,7 +107,7 @@ static int au_read_annotation(AVFormatContext *s, int 
> > size)
> >  av_log(s, AV_LOG_ERROR, "Memory error while parsing AU 
> > metadata.\n");
> >  } else {
> >  av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
> > -for (i = 0; keys[i] != NULL && key != NULL; i++) {
> > +for (i = 0; i < FF_ARRAY_ELEMS(keys) && key != NULL; 
> > i++) {
> >  if (av_strcasecmp(keys[i], key) == 0) {
> >  av_dict_set(&(s->metadata), keys[i], value, 
> > AV_DICT_DONT_STRDUP_VAL);
> >  av_freep(&key);
> > @@ -243,14 +243,13 @@ typedef struct AUContext {
> >
> >  static int au_get_annotations(AVFormatContext *s, char **buffer)
> >  {
> > -static const char * keys[] = {
> > +static const char keys[][7] = {
> >  "Title",
> >  "Artist",
> >  "Album",
> >  "Track",
> >  "Genre",
> > -NULL };
> > -int i;
> > +};
> >  int cnt = 0;
> >  AVDictionary *m = s->metadata;
> >  AVDictionaryEntry *t = NULL;
> > @@ -258,7 +257,7 @@ static int au_get_annotations(AVFormatContext *s, char 
> > **buffer)
> >
> >  av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
> >
> > -for (i = 0; keys[i] != NULL; i++) {
> > +for (int i = 0; i < FF_ARRAY_ELEMS(keys); i++) {
> >  t = av_dict_get(m, keys[i], NULL, 0);
> >  if (t != NULL) {
> >  if (cnt++)
> >
> Will apply this patchset tomorrow unless there are objections.

No problem if I was to late to reply. Just got to read this mail now.


Best regards,
  Alexander
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avfilter: add radial and circular blur video filter

2020-07-19 Thread Alexander Strasser
Hi all,

this mail thread has turned into an example of exactly what I would
not like to see in a patch discussion!

It doesn't really respect the first sentence of our code of conduct:

Be friendly and respectful towards others and third parties.


Furthermore it discourages testing, code reviews and discussions on
patch sets, which I think is destructive in its own. Especially having
people compile and test the patches sent to the list, is not something
that happens for every patch set and should normally be welcomed and
appreciated.

From what I feel myself and from what I have read recently on this
list from other people in another thread, these kinds of mails makes
people feel uncomfortable to contribute or to even keep reading this
mailing list.

As I interpret the last email, the patch set was resubmitted and the
discussion is reset now. I hope this can continue in a good way now.


[...]

  Alexander
___
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 v5] avdevice/xcbgrab: check return values of xcb query functions

2020-07-19 Thread Alexander Strasser
On 2020-07-16 23:54 -0400, Andriy Gelman wrote:
> On Tue, 14. Jul 14:14, Moritz Barsnick wrote:
[...]
> > Subject: [PATCH] avdevice/xcbgrab: check return values of xcb query 
> > functions
> >
> > Fixes #7312, segmentation fault on close of X11 server
> >
> > xcb_query_pointer_reply() and xcb_get_geometry_reply() can return NULL
> > if e.g. the X server closes or the connection is lost. This needs to
> > be checked in order to cleanly exit, because the returned pointers are
> > dereferenced later.
> >
> > Furthermore, their return values need to be free()d, also in error
> > code paths.
> >
> > Signed-off-by: Moritz Barsnick 
> > ---
> >  libavdevice/xcbgrab.c | 13 -
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
> > index 6f6b2dbf15..8bc320d055 100644
> > --- a/libavdevice/xcbgrab.c
> > +++ b/libavdevice/xcbgrab.c
> > @@ -346,8 +346,10 @@ static void xcbgrab_draw_mouse(AVFormatContext *s, 
> > AVPacket *pkt,
> >  return;
> >
>
> >  cursor = xcb_xfixes_get_cursor_image_cursor_image(ci);
> > -if (!cursor)
> > +if (!cursor) {
> > +free(ci);
> >  return;
> > +}
>
> This check seems dead code. Looking at xcb sources, cursor is just an offset 
> in
> memory from ci so I don't think it can be null here.

It's great to look at the sources, but I don't think we should turn
an implementation snapshot into a guarantee.

I guess it's safer to keep the check, if there is no documentation
about this being always non-NULL.

I'm not entirely sure how well this is documented. Surely some of
functions definitely return NULL sometimes, which was the reason to
submit this patch, I would probably only assume non-NULL returns for
functions where that is explicitly documented.


[...]

  Alexander
___
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] avcodec/v4l2_m2m: adapt to call close() on init fail

2020-07-19 Thread Andriy Gelman
On Sun, 19. Jul 15:36, Andriy Gelman wrote:
> From: Andriy Gelman 
> 
> This fixes several mem leaks when init of encoder/decoder failed.
> 
> Fixes ticket #8285
> 
> Signed-off-by: Andriy Gelman 
> ---
> 
> - Changes in v3
> rebased and moved av_packet_unref(&s->buf_pkt) to v4l2_m2m_destroy_context()
> to be consistent with another patch
> 
>  libavcodec/v4l2_m2m.c |  6 ++
>  libavcodec/v4l2_m2m_dec.c | 10 ++
>  libavcodec/v4l2_m2m_enc.c |  1 +
>  3 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
> index d8d872ea09..944c1a2823 100644
> --- a/libavcodec/v4l2_m2m.c
> +++ b/libavcodec/v4l2_m2m.c
> @@ -330,6 +330,7 @@ static void v4l2_m2m_destroy_context(void *opaque, 
> uint8_t *context)
>  
>  close(s->fd);
>  av_frame_free(&s->frame);
> +av_packet_unref(&s->buf_pkt);
>  
>  av_free(s);
>  }
> @@ -339,6 +340,10 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
>  V4L2m2mContext *s = priv->context;
>  int ret;
>  
> +if (!s)
> +return 0;
> +
> +if (s->fd >= 0) {
>  ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
>  if (ret)
>  av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", 
> s->output.name);
> @@ -346,6 +351,7 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
>  ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);
>  if (ret)
>  av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", 
> s->capture.name);
> +}
>  
>  ff_v4l2_context_release(&s->output);
>  
> diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> index b038efed9c..ab07c0a24a 100644
> --- a/libavcodec/v4l2_m2m_dec.c
> +++ b/libavcodec/v4l2_m2m_dec.c
> @@ -205,9 +205,6 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
>  ret = ff_v4l2_m2m_codec_init(priv);
>  if (ret) {
>  av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n");
> -s->self_ref = NULL;
> -av_buffer_unref(&priv->context_ref);
> -
>  return ret;
>  }
>  
> @@ -216,10 +213,7 @@ static av_cold int v4l2_decode_init(AVCodecContext 
> *avctx)
>  
>  static av_cold int v4l2_decode_close(AVCodecContext *avctx)
>  {
> -V4L2m2mPriv *priv = avctx->priv_data;
> -V4L2m2mContext *s = priv->context;
> -av_packet_unref(&s->buf_pkt);
> -return ff_v4l2_m2m_codec_end(priv);
> +return ff_v4l2_m2m_codec_end(avctx->priv_data);
>  }
>  
>  #define OFFSET(x) offsetof(V4L2m2mPriv, x)
> @@ -254,7 +248,7 @@ static const AVOption options[] = {
>  .close  = v4l2_decode_close, \
>  .bsfs   = bsf_name, \
>  .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | 
> AV_CODEC_CAP_AVOID_PROBING, \
> -.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS, \
> +.caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS | 
> FF_CODEC_CAP_INIT_CLEANUP, \
>  .wrapper_name   = "v4l2m2m", \
>  }
>  
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 56df4286ad..af0ed1e306 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -429,6 +429,7 @@ static const AVCodecDefault v4l2_m2m_defaults[] = {
>  .close  = v4l2_encode_close, \
>  .defaults   = v4l2_m2m_defaults, \
>  .capabilities   = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
> +.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, \
>  .wrapper_name   = "v4l2m2m", \
>  }
>  

Will apply this version soon if no one objects.

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

Re: [FFmpeg-devel] [PATCH 1/4] avformat/au: Store strings instead of pointers to strings in array

2020-07-19 Thread Andreas Rheinhardt
Alexander Strasser:
> Hi Andreas,
> 
> no objections for the patchset as a whole.
> 
> Just for the first in the series I have some questions.
> 
> The commit message is:
> 
> avformat/au: Store strings instead of pointers to strings in array
> 
> This tells the what, but not the why.
> 
I thought the why to be obvious. See below.
> 
> On 2020-07-17 13:14 +0200, Andreas Rheinhardt wrote:
>> Andreas Rheinhardt:
>>> Signed-off-by: Andreas Rheinhardt 
>>> ---
>>>  libavformat/au.c | 13 ++---
>>>  1 file changed, 6 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/libavformat/au.c b/libavformat/au.c
>>> index f92863e400..b419c9ed95 100644
>>> --- a/libavformat/au.c
>>> +++ b/libavformat/au.c
>>> @@ -68,13 +68,13 @@ static int au_probe(const AVProbeData *p)
>>>
>>>  static int au_read_annotation(AVFormatContext *s, int size)
>>>  {
>>> -static const char * keys[] = {
>>> +static const char keys[][7] = {
>>>  "title",
>>>  "artist",
>>>  "album",
>>>  "track",
>>>  "genre",
>>> -NULL };
>>> +};
> 
> Sorry, I couldn't test myself but wouldn't just
> 
> static const char * keys[] = {
> "title",
> "artist",
> "album",
> "track",
> "genre",
> };
> 
> have been the better choice with the same benefits?
> 
> I'm not sure without looking up the C standard and writing some
> little test programs. From my guts I would say it's equivalent,
> but the syntax is more convenient this way.
> 
> That's also another issue with the commit message, since I don't
> think it is true that in your version strings are stored in the
> array. No offense intended and I sure might be mistaken.
> 
But it is true. The strings are stored directly in the array, so that
each array takes up 5 * 7 bytes. Before the change, the array itself
took up 5 * sizeof(char *). And on top of that comes the space for the
strings itself.

Storing the strings itself in the array instead of pointers to the
strings saves the space of the pointers, but it forces the shortest
string to the size of the longest string. Therefore it is worthwhile if
the average size differs from the longest size by less than sizeof(char
*); there is furthermore one exception to this rule: If one stores
pointers, different pointers may point to the same string (or to a part
of a larger string). In the case here, the strings itself are smaller
than sizeof(char *) on 64bit systems, so this alone shows that one saves
space.

Also notice that there are two more differences:
a) The earlier version consisted of an array of nonconst pointers to
const strings. Making the array entries const has been forgotten (it
would go like this: "static const char *const keys[]"). Given that
arrays are automatically nonmodifiable, this problem doesn't exist.
(Given that these arrays are static and given that the compiler can see
that they are not modified means that the compiler could infer that they
are const and put them in the appropriate section for const data.)
b) The actual access to the string is different: If the array contains
pointer to strings, then one has to read the array entry (containing the
pointer to the string) and pass it to av_strcasecmp() etc. If the array
contains the strings, then one just has to get the address of the array
entry (which coincides with the address of the string itself) and pass
it to av_strcasecmp() etc..

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/lzw: adapt a function prototype using PutBitContext

2020-07-19 Thread Michael Niedermayer
On Sun, Jul 19, 2020 at 11:05:37AM -0300, James Almer wrote:
> Fixes warnings introduced by c63c303a1f
> 
> Signed-off-by: James Almer 
> ---
> Maybe gif should be benchmarked as well?
> 
>  libavcodec/lzw.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Steinar also send a related patch
feel free to apply whichever you prefer or revert. 
until my migraine goes away i dont
plan to look too much at patches

thx

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

Those who are best at talking, realize last or never when they are wrong.


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 v5] avdevice/xcbgrab: check return values of xcb query functions

2020-07-19 Thread Andriy Gelman
On Sun, 19. Jul 23:19, Alexander Strasser wrote:
> On 2020-07-16 23:54 -0400, Andriy Gelman wrote:
> > On Tue, 14. Jul 14:14, Moritz Barsnick wrote:
> [...]
> > > Subject: [PATCH] avdevice/xcbgrab: check return values of xcb query 
> > > functions
> > >
> > > Fixes #7312, segmentation fault on close of X11 server
> > >
> > > xcb_query_pointer_reply() and xcb_get_geometry_reply() can return NULL
> > > if e.g. the X server closes or the connection is lost. This needs to
> > > be checked in order to cleanly exit, because the returned pointers are
> > > dereferenced later.
> > >
> > > Furthermore, their return values need to be free()d, also in error
> > > code paths.
> > >
> > > Signed-off-by: Moritz Barsnick 
> > > ---
> > >  libavdevice/xcbgrab.c | 13 -
> > >  1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
> > > index 6f6b2dbf15..8bc320d055 100644
> > > --- a/libavdevice/xcbgrab.c
> > > +++ b/libavdevice/xcbgrab.c
> > > @@ -346,8 +346,10 @@ static void xcbgrab_draw_mouse(AVFormatContext *s, 
> > > AVPacket *pkt,
> > >  return;
> > >
> >
> > >  cursor = xcb_xfixes_get_cursor_image_cursor_image(ci);
> > > -if (!cursor)
> > > +if (!cursor) {
> > > +free(ci);
> > >  return;
> > > +}
> >
> > This check seems dead code. Looking at xcb sources, cursor is just an 
> > offset in
> > memory from ci so I don't think it can be null here.
> 
> It's great to look at the sources, but I don't think we should turn
> an implementation snapshot into a guarantee.
> 
> I guess it's safer to keep the check, if there is no documentation
> about this being always non-NULL.
> 
> I'm not entirely sure how well this is documented. Surely some of
> functions definitely return NULL sometimes, which was the reason to
> submit this patch, I would probably only assume non-NULL returns for
> functions where that is explicitly documented.

xcb_xfixes_get_cursor_image_cursor_image(ci) is just an accessor function to 
the 
reply:

uint32_t *
xcb_xfixes_get_cursor_image_cursor_image (const 
xcb_xfixes_get_cursor_image_reply_t *R)
{
return (uint32_t *) (R + 1);
}

All the error handling should be done after the call to:
ci = xcb_xfixes_get_cursor_image_reply(gr->conn, cc, NULL); 

We check whether ci == NULL, but you can also pass xcb_generic_error_t** and
check the result.  

But anyway, this part of the patch doesn't really have anything to do with
ticket #7312, and should be in a separate patch.

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

Re: [FFmpeg-devel] [PATCH 1/3] doc/http: Update HTTP protocol options

2020-07-19 Thread myp...@gmail.com
On Sat, Jul 18, 2020 at 11:34 PM Gyan Doshi  wrote:
>
>
>
> On 18-07-2020 05:26 pm, Jun Zhao wrote:
> > From: Jun Zhao 
> >
> > remove the timeout option docs part for HTTP protocol and add
> > auth_type option part.
> >
> > Signed-off-by: Jun Zhao 
> > ---
> >   doc/protocols.texi | 27 ++-
> >   1 file changed, 22 insertions(+), 5 deletions(-)
> >
> > diff --git a/doc/protocols.texi b/doc/protocols.texi
> > index 64ad3f0..7b3df96 100644
> > --- a/doc/protocols.texi
> > +++ b/doc/protocols.texi
> > @@ -392,11 +392,6 @@ string describing the libavformat build. 
> > ("Lavf/")
> >   @item user-agent
> >   This is a deprecated option, you can use user_agent instead it.
> >
> > -@item timeout
> > -Set timeout in microseconds of socket I/O operations used by the 
> > underlying low level
> > -operation. By default it is set to -1, which means that the timeout is
> > -not specified.
> > -
> >   @item reconnect_at_eof
> >   If set then eof is treated like an error and causes reconnection, this is 
> > useful
> >   for live / endless streams.
> > @@ -481,6 +476,28 @@ Send an Expect: 100-continue header for POST. If set 
> > to 1 it will send, if set
> >   to 0 it won't, if set to -1 it will try to send if it is applicable. 
> > Default
> >   value is -1.
> >
> > +@item auth_type
> > +
> > +Set HTTP authentication type. No option for Digest, since this method 
> > requires
> > +getting nonce parameters from the server first and can't be used straight 
> > away like
> > +Basic.
> > +
> > +@table @option
> > +@item none
> > +Choose the HTTP authentication type automatically. This is the default.
> > +@item basic
> > +
> > +Choose the HTTP basic authentication.
> > +
> > +Basic authentication sends a Base64-encoded string that contains a user 
> > name and password
> > +for the client. Base64 is not a form of encryption and should be 
> > considered the same as
> > +sending the user name and password in clear text (Base64 is a reversible 
> > encoding).
> > +If a resource needs to be protected, strongly consider using an 
> > authentication scheme
> > +other than basic authentication. HTTPS/TLS should be used with basic 
> > authentication.
> > +Without these additional security enhancements, basic authentication 
> > should not be used
> > +to protect sensitive or valuable information.
> > +@end table
> > +
> >   @end table
> >
> >   @subsection HTTP Cookies
>
> LGTM.
>
Pused, thx
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH] swscale/yuv2rgb: consider x2rgb10le on big endian hardware

2020-07-19 Thread Fei Wang
This fixed FATE fail report by filter-pixfmts* for x2rgb10le on big
endian hardware.
---
 libswscale/input.c   | 11 ++-
 libswscale/yuv2rgb.c |  6 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index 0bd1aa7bc9..064ed5902f 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -244,11 +244,12 @@ rgb48funcs(bgr, BE, AV_PIX_FMT_BGR48BE)
 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA ||  \
  origin == AV_PIX_FMT_BGRA ||  \
  origin == AV_PIX_FMT_ARGB ||  \
- origin == AV_PIX_FMT_ABGR ||  \
- origin == AV_PIX_FMT_X2RGB10) \
-? AV_RN32A(&src[(i) * 4])   \
-: (isBE(origin) ? AV_RB16(&src[(i) * 2])\
-: AV_RL16(&src[(i) * 2])))
+ origin == AV_PIX_FMT_ABGR)\
+? AV_RN32A(&src[(i) * 4])  \
+: ((origin == AV_PIX_FMT_X2RGB10LE)\
+   ? AV_RL32(&src[(i) * 4])\
+   : (isBE(origin) ? AV_RB16(&src[(i) * 2])\
+  : AV_RL16(&src[(i) * 2]
 
 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
 const uint8_t *src,
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 71d4b90baa..755fafd29a 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -793,7 +793,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const 
int inv_table[4],
 c->dstFormat == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||
 c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
 c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
-c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE);
+c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||
+c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE);
 const int bpp = c->dstFormatBpp;
 uint8_t *y_table;
 uint16_t *y_table16;
@@ -982,6 +983,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const 
int inv_table[4],
 y_table32[i + 2 * table_plane_size] = yval << bbase;
 yb += cy;
 }
+if (isNotNe)
+   for (i = 0; i < table_plane_size * 3; i++)
+   y_table32[i] = av_bswap32(y_table32[i]);
 fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
 fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + table_plane_size);
 fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2 * 
table_plane_size);
-- 
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] [FFmpeg-cvslog] swscale: Add swscale input/output support for X2RGB10LE

2020-07-19 Thread Wang, Fei W


> -Original Message-
> From: Andriy Gelman 
> Sent: Tuesday, July 7, 2020 12:27 PM
> To: Wang, Fei W 
> Cc: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] swscale: Add swscale
> input/output support for X2RGB10LE
> 
> On Mon, 06. Jul 02:33, Wang, Fei W wrote:
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Michael Niedermayer
> > > Sent: Monday, July 6, 2020 7:47 AM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] swscale: Add swscale
> > > input/output support for X2RGB10LE
> > >
> > > On Fri, Jun 12, 2020 at 04:57:30PM +, Fei Wang wrote:
> > > > ffmpeg | branch: master | Fei Wang  | Wed
> > > > Apr 22
> > > > 13:23:02 2020 +0800| [c721b450141d6bbe1e977212a0bcb70118965c34]
> |
> > > > committer: Lynne
> > > >
> > > > swscale: Add swscale input/output support for X2RGB10LE
> > > >
> > > > Signed-off-by: Fei Wang 
> > > >
> > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c721b4
> > > > > 5014
> > > > > 1d6bbe1e977212a0bcb70118965c34
> > > > ---
> > > >
> > > >  libswscale/input.c   | 13 -
> > > >  libswscale/output.c  | 14 ++
> > > >  libswscale/utils.c   |  1 +
> > > >  libswscale/yuv2rgb.c | 22 ++
> > > >  tests/ref/fate/filter-pixfmts-copy   |  1 +
> > > >  tests/ref/fate/filter-pixfmts-crop   |  1 +
> > > >  tests/ref/fate/filter-pixfmts-field  |  1 +
> > > >  tests/ref/fate/filter-pixfmts-fieldorder |  1 +
> > > >  tests/ref/fate/filter-pixfmts-hflip  |  1 +
> > > >  tests/ref/fate/filter-pixfmts-il |  1 +
> > > >  tests/ref/fate/filter-pixfmts-null   |  1 +
> > > >  tests/ref/fate/filter-pixfmts-pad|  1 +
> > > >  tests/ref/fate/filter-pixfmts-scale  |  1 +
> > > >  tests/ref/fate/filter-pixfmts-transpose  |  1 +
> > > >  tests/ref/fate/filter-pixfmts-vflip  |  1 +
> > > >  15 files changed, 60 insertions(+), 1 deletion(-)
> > >
> > > This fails on big endian (mips qemu)
> > >
> > > stuff like:
> > Thanks, I will try to setup mips qumu to check this. Mostly like it 
> > shouldn't
> execute little endian case on big endian enviroment.
I have send another mail thread to fix the fail, could you help to review? 
Thanks.

> >
> > @Andriy Gelman, I am not sure do we already have big endian test
> environment in patchwork fate test now? if not, we may consider to add it, so
> that we can catch the fail before patch merge.
> 
> It would be nice to have a big endian test running on the patchwork.
> I'll try to set one up.
Thanks, Andriy.

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

Re: [FFmpeg-devel] [PATCH 2/3] lavf/hls: enable custom interrup callback in sub-demuxer

2020-07-19 Thread Steven Liu
Jun Zhao  于2020年7月18日周六 下午7:56写道:
>
> From: Jun Zhao 
>
> Enable the custom callback in sub-demuxer
>
> Signed-off-by: Jun Zhao 
> ---
>  libavformat/hls.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index ba17c4e..cf0b71d 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1984,6 +1984,7 @@ static int hls_read_header(AVFormatContext *s)
>read_data, NULL, NULL);
>  pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
>  pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
> s->max_analyze_duration : 4 * AV_TIME_BASE;
> +pls->ctx->interrupt_callback = s->interrupt_callback;
>  url = av_strdup(pls->segments[0]->url);
>  ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0);
>  av_free(url);
> --
> 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".


LGTM


Thanks
Steven
___
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] lavf/dashdec: enable custom interrup callback in sub-demuxer

2020-07-19 Thread Steven Liu
Jun Zhao  于2020年7月18日周六 下午8:19写道:
>
> From: Jun Zhao 
>
> Enable the custom callback in sub-demuxer
>
> Signed-off-by: Jun Zhao 
> ---
>  libavformat/dashdec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 694782c..c5a5ff6 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1943,6 +1943,7 @@ static int reopen_demux_for_component(AVFormatContext 
> *s, struct representation
>  pls->ctx->flags = AVFMT_FLAG_CUSTOM_IO;
>  pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
>  pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
> s->max_analyze_duration : 4 * AV_TIME_BASE;
> +pls->ctx->interrupt_callback = s->interrupt_callback;
>  ret = av_probe_input_buffer(&pls->pb, &in_fmt, "", NULL, 0, 0);
>  if (ret < 0) {
>  av_log(s, AV_LOG_ERROR, "Error when loading first fragment, playlist 
> %d\n", (int)pls->rep_idx);
> --
> 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".

LGTM


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

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

Re: [FFmpeg-devel] [PATCH] avformat/hls: add supporting EXT-X-DISCONTINUITY tag

2020-07-19 Thread Steven Liu
김동원님(Dongwon Kim)  于2020年7月17日周五 上午8:43写道:
>
> Signed-off-by: Dongwon Kim 
> ---
>  libavformat/hls.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c index 
> ba17c4ed96..5e331ab68f 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -810,6 +810,8 @@ static int parse_playlist(HLSContext *c, const char *url,
>  ff_parse_key_value(ptr, (ff_parse_key_val_cb) 
> handle_rendition_args,
> &info);
>  new_rendition(c, &info, url);
> +} else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) {
> +c->ctx->iformat->flags |= AVFMT_TS_DISCONT;
>  } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
>  ret = ensure_playlist(c, &pls, url);
>  if (ret < 0)
> @@ -2406,7 +2408,7 @@ AVInputFormat ff_hls_demuxer = {
>  .long_name  = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
>  .priv_class = &hls_class,
>  .priv_data_size = sizeof(HLSContext),
> -.flags  = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT,
What will happen if keep AVFMT_TS_DISCONT flag?
> +.flags  = AVFMT_NOGENSEARCH,
>  .read_probe = hls_probe,
>  .read_header= hls_read_header,
>  .read_packet= hls_read_packet,
> --
> 2.25.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel 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] dnn/native: add native support for avg_pool

2020-07-19 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Ting Fu
> Sent: 2020年7月17日 23:23
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 1/2] dnn/native: add native support for
> avg_pool
> 
> It can be tested with the model generated with below python script:
> 
> import tensorflow as tf
> import numpy as np
> import imageio
> 
> in_img = imageio.imread('input_odd.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')
> x_pool = tf.nn.avg_pool(x, ksize=[1,2,2,1], strides=[1,2,2,1], padding='SAME')
> #please alter the params as needed
> y = tf.identity(x_pool, 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: Ting Fu 
> ---
>  libavfilter/dnn/Makefile  |   1 +
>  libavfilter/dnn/dnn_backend_native.h  |   2 +
>  .../dnn/dnn_backend_native_layer_avgpool.c| 136 ++
>  .../dnn/dnn_backend_native_layer_avgpool.h|  35 +
>  .../dnn/dnn_backend_native_layer_conv2d.h |   3 +-
>  libavfilter/dnn/dnn_backend_native_layers.c   |   2 +
>  tools/python/convert_from_tensorflow.py   |  31 +++-
>  7 files changed, 207 insertions(+), 3 deletions(-)
>  create mode 100644 libavfilter/dnn/dnn_backend_native_layer_avgpool.c
>  create mode 100644 libavfilter/dnn/dnn_backend_native_layer_avgpool.h
> 
> diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
> index d90137ec42..e0957073ee 100644
> --- a/libavfilter/dnn/Makefile
> +++ b/libavfilter/dnn/Makefile
> @@ -1,6 +1,7 @@
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_interface.o
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native.o
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native_layers.o
> +OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native_layer_avgpool.o
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native_layer_pad.o
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native_layer_conv2d.o
>  OBJS-$(CONFIG_DNN)   +=
> dnn/dnn_backend_native_layer_depth2space.o
> diff --git a/libavfilter/dnn/dnn_backend_native.h
> b/libavfilter/dnn/dnn_backend_native.h
> index 62191ffe88..26e9a33387 100644
> --- a/libavfilter/dnn/dnn_backend_native.h
> +++ b/libavfilter/dnn/dnn_backend_native.h
> @@ -43,10 +43,12 @@ typedef enum {
>  DLT_MAXIMUM = 4,
>  DLT_MATH_BINARY = 5,
>  DLT_MATH_UNARY = 6,
> +DLT_AVG_POOL = 7,
>  DLT_COUNT
>  } DNNLayerType;
> 
>  typedef enum {DOT_INPUT = 1, DOT_OUTPUT = 2, DOT_INTERMEDIATE =
> DOT_INPUT | DOT_OUTPUT} DNNOperandType;
> +typedef enum {VALID, SAME, SAME_CLAMP_TO_EDGE} DNNPaddingParam;
> 
>  typedef struct Layer{
>  DNNLayerType type;
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
> b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
> new file mode 100644
> index 00..f5a3f4a0dc
> --- /dev/null
> +++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
> @@ -0,0 +1,136 @@
> +/*
> + * Copyright (c) 2020
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * DNN native backend implementation.
> + */
> +
> +#include "libavutil/avassert.h"
> +#include "dnn_backend_native_layer_avgpool.h"
> +
> +int dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context,
> int file_size, int operands_num)
> +{
> +AvgPoolParams *avgpool_params;
> +int dnn_size = 0;
> +avgpool_params = av_malloc(sizeof(*avgpool_params));
> +if(!avgpool_params)
> +return 0;
> +
> +avgpool_params->strides = (int32_t)avio_rl32(model_file_context);
> +avgpool_params->padding_method =
> (int32_t)avio_rl32(model_file_context);
> 

[FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: Fix memleak upon repeating tags

2020-07-19 Thread Andreas Rheinhardt
When parsing MXF encountering some tags leads to allocations. And when
these tags were encountered repeatedly, this could lead to memleaks,
because the pointer to the old data got simply overwritten with a
pointer to the new data (or to NULL on allocation failure). This has
been fixed.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/mxfdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3016885e75..f0975f409e 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -850,6 +850,7 @@ static int mxf_read_cryptographic_context(void *arg, 
AVIOContext *pb, int tag, i
 static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
 {
 *count = avio_rb32(pb);
+av_free(*refs);
 *refs = av_calloc(*count, sizeof(UID));
 if (!*refs) {
 *count = 0;
@@ -903,10 +904,8 @@ static int mxf_read_content_storage(void *arg, AVIOContext 
*pb, int tag, int siz
 case 0x1901:
 if (mxf->packages_refs)
 av_log(mxf->fc, AV_LOG_VERBOSE, "Multiple packages_refs\n");
-av_free(mxf->packages_refs);
 return mxf_read_strong_ref_array(pb, &mxf->packages_refs, 
&mxf->packages_count);
 case 0x1902:
-av_free(mxf->essence_container_data_refs);
 return mxf_read_strong_ref_array(pb, 
&mxf->essence_container_data_refs, &mxf->essence_container_data_count);
 }
 return 0;
-- 
2.20.1

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

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

[FFmpeg-devel] [PATCH 1/3] avformat/mxfdec: Fix memleak when adding element to array fails

2020-07-19 Thread Andreas Rheinhardt
Said array contains pointers to other structs and both the designated
new element as well as other stuff contained in it (e.g. strings) leak
if the new element can't be added to the array.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/mxfdec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 90546d42b3..08ad92cc0c 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -822,15 +822,17 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 return 0;
 }
 
-static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
+static int mxf_add_metadata_set(MXFContext *mxf, MXFMetadataSet **metadata_set)
 {
 MXFMetadataSet **tmp;
 
 tmp = av_realloc_array(mxf->metadata_sets, mxf->metadata_sets_count + 1, 
sizeof(*mxf->metadata_sets));
-if (!tmp)
+if (!tmp) {
+mxf_free_metadataset(metadata_set, 1);
 return AVERROR(ENOMEM);
+}
 mxf->metadata_sets = tmp;
-mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;
+mxf->metadata_sets[mxf->metadata_sets_count] = *metadata_set;
 mxf->metadata_sets_count++;
 return 0;
 }
@@ -2780,7 +2782,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket 
*klv, MXFMetadataReadF
 avio_seek(pb, next, SEEK_SET);
 }
 if (ctx_size) ctx->type = type;
-return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
+return ctx_size ? mxf_add_metadata_set(mxf, &ctx) : 0;
 }
 
 /**
@@ -3083,10 +3085,8 @@ static int mxf_handle_missing_index_segment(MXFContext 
*mxf, AVStream *st)
 if (!(segment = av_mallocz(sizeof(*segment
 return AVERROR(ENOMEM);
 
-if ((ret = mxf_add_metadata_set(mxf, segment))) {
-mxf_free_metadataset((MXFMetadataSet**)&segment, 1);
+if ((ret = mxf_add_metadata_set(mxf, (MXFMetadataSet**)&segment)))
 return ret;
-}
 
 /* Make sure we have nonzero unique index_sid, body_sid will be ok, because
  * using the same SID for index is forbidden in MXF. */
-- 
2.20.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/3] avformat/mxfdec: Fix memleak when parsing tag fails

2020-07-19 Thread Andreas Rheinhardt
The MXF demuxer uses an array of pointers to different structures of
metadata (all containing a common initial sequence containing a type
field to distinguish them) and some of these structures contain pointers
to separately allocated subelements. If an error happens while reading
and creating the tags, the semi-finished new tag is freed using the
function to free these tags. But this function doesn't free the already
allocated subelements, because the type has not been set yet. This commit
changes this.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/mxfdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 08ad92cc0c..3016885e75 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2714,6 +2714,7 @@ static const MXFMetadataReadTableEntry 
mxf_metadata_read_table[] = {
 
 static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType 
type)
 {
+ctx->type = type;
 switch (type){
 case MultipleDescriptor:
 case Descriptor:
@@ -2734,7 +2735,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket 
*klv, MXFMetadataReadF
 
 if (!ctx)
 return AVERROR(ENOMEM);
-mxf_metadataset_init(ctx, type);
+if (ctx_size)
+mxf_metadataset_init(ctx, type);
 while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) {
 int ret;
 int tag = avio_rb16(pb);
@@ -2770,7 +2772,6 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket 
*klv, MXFMetadataReadF
  * it extending past the end of the KLV though (zzuf5.mxf). */
 if (avio_tell(pb) > klv_end) {
 if (ctx_size) {
-ctx->type = type;
 mxf_free_metadataset(&ctx, 1);
 }
 
@@ -2781,7 +2782,6 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket 
*klv, MXFMetadataReadF
 } else if (avio_tell(pb) <= next)   /* only seek forward, else this 
can loop for a long time */
 avio_seek(pb, next, SEEK_SET);
 }
-if (ctx_size) ctx->type = type;
 return ctx_size ? mxf_add_metadata_set(mxf, &ctx) : 0;
 }
 
-- 
2.20.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".