Re: [FFmpeg-devel] [PATCH] avcodec/vp9: mark frame as finished on decode_tiles() failure

2017-12-13 Thread James Zern
On Wed, Dec 13, 2017 at 5:02 PM, Michael Niedermayer
 wrote:
> Fixes deadlock with framethreads
> Fixes: 
> Netflix_Aerial_1080p_60fps_8bit_420.y4m.vp9.noaltref.webm.ivf.s69372_r01-05_b6-.ivf
> Fixes: 
> Netflix_Aerial_1080p_60fps_10bit_420.y4m.vp9.noaltref.webm.ivf.s149104_r01-05_b6-.ivf
> Fixes: ducks_take_off_444_720p50.y4m.vp9.webm.ivf.s107375_r01-05_b6-.ivf
>
> Reported-by: James Zern 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vp9.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

lgtm. tested locally, thanks for having a look.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH V3] lavc/vp8: Fix HWAccel VP8 decoder can't support resolution change.

2017-12-13 Thread Jun Zhao
V3: refine the code.
V2: fix the V1 lead to webp crash issue.
From f55a7e26214e066e9bf817ae04ca3d0c2d3e7a6d Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Thu, 30 Nov 2017 07:53:53 +0800
Subject: [PATCH V3] lavc/vp8: Fix HWAccel VP8 decoder can't support resolution
 change.

Use the following command to reproduce this issue:
make fate-vp8-size-change HWACCEL="vaapi -vaapi_device \
/dev/dri/renderD128 -hwaccel_output_format yuv420p"
SAMPLES=../fate-suite/.

At the same time, reconstruct the public logic as a function.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Tested by: Mark Thompson 
---
 libavcodec/vp8.c | 36 
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 471c0bb89e..7f71a75e4b 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -167,6 +167,22 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s)
 return frame;
 }
 
+static enum AVPixelFormat get_pixel_format(VP8Context *s)
+{
+enum AVPixelFormat pix_fmts[] = {
+#if CONFIG_VP8_VAAPI_HWACCEL
+AV_PIX_FMT_VAAPI,
+#endif
+#if CONFIG_VP8_NVDEC_HWACCEL
+AV_PIX_FMT_CUDA,
+#endif
+AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_NONE,
+};
+
+return ff_get_format(s->avctx, pix_fmts);
+}
+
 static av_always_inline
 int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
 {
@@ -182,6 +198,13 @@ int update_dimensions(VP8Context *s, int width, int 
height, int is_vp7)
 return ret;
 }
 
+if (!s->actually_webp && !is_vp7) {
+s->pix_fmt = get_pixel_format(s);
+if (s->pix_fmt < 0)
+return AVERROR(EINVAL);
+avctx->pix_fmt = s->pix_fmt;
+}
+
 s->mb_width  = (s->avctx->coded_width  + 15) / 16;
 s->mb_height = (s->avctx->coded_height + 15) / 16;
 
@@ -2598,18 +2621,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (s->actually_webp) {
 // avctx->pix_fmt already set in caller.
 } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) {
-enum AVPixelFormat pix_fmts[] = {
-#if CONFIG_VP8_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI,
-#endif
-#if CONFIG_VP8_NVDEC_HWACCEL
-AV_PIX_FMT_CUDA,
-#endif
-AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_NONE,
-};
-
-s->pix_fmt = ff_get_format(s->avctx, pix_fmts);
+s->pix_fmt = get_pixel_format(s);
 if (s->pix_fmt < 0) {
 ret = AVERROR(EINVAL);
 goto err;
-- 
2.14.1

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


[FFmpeg-devel] [PATCH] avformat/matroskaenc: flag discardable packets as such

2017-12-13 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/matroskaenc.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

This only has an effect when muxing h265 streams originating from the
libx265 wrapper atm, as no other encoder or demuxer currently sets
the flag.

I compared the output of our muxer with the latest mkvmerge, and in
the latter a few more SimpleBlocks were flagged as discardable than
by our muxer after this patch.
I can't say if our libx265 wrapper is not properly flagging what it
should, or if mkvmerge's parser is flagging more frames than it
should.

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f22c2ab70c..915ef3c107 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2100,7 +2100,8 @@ static void mkv_write_block(AVFormatContext *s, 
AVIOContext *pb,
 MatroskaMuxContext *mkv = s->priv_data;
 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
 uint8_t *data = NULL, *side_data = NULL;
-int offset = 0, size = pkt->size, side_data_size = 0;
+const int discardable = !!(pkt->flags & AV_PKT_FLAG_DISPOSABLE);
+int offset = 0, size = pkt->size, side_data_size = 0, flags = 0;
 int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : 
pkt->pts;
 uint64_t additional_id = 0;
 int64_t discard_padding = 0;
@@ -2160,12 +2161,15 @@ static void mkv_write_block(AVFormatContext *s, 
AVIOContext *pb,
 blockid = MATROSKA_ID_BLOCK;
 }
 
+if (blockid == MATROSKA_ID_SIMPLEBLOCK)
+flags = (keyframe << 7) | discardable;
+
 put_ebml_id(pb, blockid);
 put_ebml_num(pb, size + 4, 0);
 // this assumes stream_index is less than 126
 avio_w8(pb, 0x80 | track_number);
 avio_wb16(pb, ts - mkv->cluster_pts);
-avio_w8(pb, (blockid == MATROSKA_ID_SIMPLEBLOCK && keyframe) ? (1 << 7) : 
0);
+avio_w8(pb, flags);
 avio_write(pb, data + offset, size);
 if (data != pkt->data)
 av_free(data);
-- 
2.15.0

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


Re: [FFmpeg-devel] [PATCH V2] lavc/vp8: Fix HWAccel VP8 decoder can't support resolution change.

2017-12-13 Thread Jun Zhao


On 2017/12/14 8:51, Mark Thompson wrote:
> On 29/11/17 23:53, Jun Zhao wrote:
>> V2: fix the V1 lead to webp crash issue.
>>
>> From b943c2814789288d09b4032fa6cdfbc3fd672a2b Mon Sep 17 00:00:00 2001
>> From: Jun Zhao 
>> Date: Wed, 29 Nov 2017 10:22:03 +0800
>> Subject: [PATCH V2] lavc/vp8: Fix HWAccel VP8 decoder can't support 
>> resolution
>>  change.
>>
>> Use the following command to reproduce this issue:
>> make fate-vp8-size-change HWACCEL="vaapi -vaapi_device \
>> /dev/dri/renderD128 -hwaccel_output_format yuv420p"
>> SAMPLES=../fate-suite/.
>>
>> At the same time, reconstruct the public logic as a function.
>>
>> Signed-off-by: Yun Zhou 
>> Signed-off-by: Jun Zhao 
>> ---
>>  libavcodec/vp8.c | 46 ++
>>  1 file changed, 34 insertions(+), 12 deletions(-)
>>
>> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
>> index 471c0bb89e..d5cb7be7b3 100644
>> --- a/libavcodec/vp8.c
>> +++ b/libavcodec/vp8.c
>> @@ -167,6 +167,30 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s)
>>  return frame;
>>  }
>>  
>> +static enum AVPixelFormat get_pixel_format(VP8Context *s)
>> +{
>> +enum AVPixelFormat fmt;
>> +enum AVPixelFormat pix_fmts[] = {
>> +#if CONFIG_VP8_VAAPI_HWACCEL
>> +AV_PIX_FMT_VAAPI,
>> +#endif
>> +#if CONFIG_VP8_NVDEC_HWACCEL
>> +AV_PIX_FMT_CUDA,
>> +#endif
>> +AV_PIX_FMT_YUV420P,
>> +AV_PIX_FMT_NONE,
>> +};
>> +
>> +fmt = ff_get_format(s->avctx, pix_fmts);
>> +if (fmt < 0) {
>> +fmt = AV_PIX_FMT_NONE;
> ff_get_format() already returns either a format in the list or 
> AV_PIX_FMT_NONE.
>
>> +av_log(s->avctx, AV_LOG_ERROR,
>> +   "Can not support the format. \n");
> This error message is meaningless.
>
> I don't think an error message is appropriate here, anyway - either the user 
> explicitly chose to fail (and already knows it) or something went wrong in 
> ff_get_format() (which already prints a more useful error there).
>
>> +}
>> +
>> +return fmt;
> So I think just "return ff_get_format(...);"?
Will double-check this part, Tks.
>
>> +}
>> +
>>  static av_always_inline
>>  int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
>>  {
>> @@ -182,6 +206,15 @@ int update_dimensions(VP8Context *s, int width, int 
>> height, int is_vp7)
>>  return ret;
>>  }
>>  
>> +if (!s->actually_webp && !is_vp7) {
>> +s->pix_fmt = get_pixel_format(s);
>> +if (s->pix_fmt < 0) {
>> +ret = AVERROR(EINVAL);
>> +return ret;
> Just "return AVERROR(EINVAL);"?
Yes, this change more pithy
>
>> +}
>> +avctx->pix_fmt = s->pix_fmt;
>> +}
>> +
>>  s->mb_width  = (s->avctx->coded_width  + 15) / 16;
>>  s->mb_height = (s->avctx->coded_height + 15) / 16;
>>  
>> @@ -2598,18 +2631,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void 
>> *data, int *got_frame,
>>  if (s->actually_webp) {
>>  // avctx->pix_fmt already set in caller.
>>  } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) {
>> -enum AVPixelFormat pix_fmts[] = {
>> -#if CONFIG_VP8_VAAPI_HWACCEL
>> -AV_PIX_FMT_VAAPI,
>> -#endif
>> -#if CONFIG_VP8_NVDEC_HWACCEL
>> -AV_PIX_FMT_CUDA,
>> -#endif
>> -AV_PIX_FMT_YUV420P,
>> -AV_PIX_FMT_NONE,
>> -};
>> -
>> -s->pix_fmt = ff_get_format(s->avctx, pix_fmts);
>> +s->pix_fmt = get_pixel_format(s);
>>  if (s->pix_fmt < 0) {
>>  ret = AVERROR(EINVAL);
>>  goto err;
>> -- 
>> 2.14.1
>>
> Tested with VAAPI, logic LGTM.
>
> Thanks,
Thanks for the reviewed and tested, will re-submit after clean the code.
>
> - Mark
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/vp9: mark frame as finished on decode_tiles() failure

2017-12-13 Thread Michael Niedermayer
Fixes deadlock with framethreads
Fixes: 
Netflix_Aerial_1080p_60fps_8bit_420.y4m.vp9.noaltref.webm.ivf.s69372_r01-05_b6-.ivf
Fixes: 
Netflix_Aerial_1080p_60fps_10bit_420.y4m.vp9.noaltref.webm.ivf.s149104_r01-05_b6-.ivf
Fixes: ducks_take_off_444_720p50.y4m.vp9.webm.ivf.s107375_r01-05_b6-.ivf

Reported-by: James Zern 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vp9.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 6241f01de1..0fac638ec9 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1644,8 +1644,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 {
 ret = decode_tiles(avctx, data, size);
-if (ret < 0)
+if (ret < 0) {
+ff_thread_report_progress(>s.frames[CUR_FRAME].tf, INT_MAX, 
0);
 return ret;
+}
 }
 
 // Sum all counts fields into td[0].counts for tile threading
-- 
2.15.1

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


Re: [FFmpeg-devel] [PATCH V2] lavc/vp8: Fix HWAccel VP8 decoder can't support resolution change.

2017-12-13 Thread Mark Thompson
On 29/11/17 23:53, Jun Zhao wrote:
> V2: fix the V1 lead to webp crash issue.
> 
> From b943c2814789288d09b4032fa6cdfbc3fd672a2b Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Wed, 29 Nov 2017 10:22:03 +0800
> Subject: [PATCH V2] lavc/vp8: Fix HWAccel VP8 decoder can't support resolution
>  change.
> 
> Use the following command to reproduce this issue:
> make fate-vp8-size-change HWACCEL="vaapi -vaapi_device \
> /dev/dri/renderD128 -hwaccel_output_format yuv420p"
> SAMPLES=../fate-suite/.
> 
> At the same time, reconstruct the public logic as a function.
> 
> Signed-off-by: Yun Zhou 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/vp8.c | 46 ++
>  1 file changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 471c0bb89e..d5cb7be7b3 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -167,6 +167,30 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s)
>  return frame;
>  }
>  
> +static enum AVPixelFormat get_pixel_format(VP8Context *s)
> +{
> +enum AVPixelFormat fmt;
> +enum AVPixelFormat pix_fmts[] = {
> +#if CONFIG_VP8_VAAPI_HWACCEL
> +AV_PIX_FMT_VAAPI,
> +#endif
> +#if CONFIG_VP8_NVDEC_HWACCEL
> +AV_PIX_FMT_CUDA,
> +#endif
> +AV_PIX_FMT_YUV420P,
> +AV_PIX_FMT_NONE,
> +};
> +
> +fmt = ff_get_format(s->avctx, pix_fmts);
> +if (fmt < 0) {
> +fmt = AV_PIX_FMT_NONE;

ff_get_format() already returns either a format in the list or AV_PIX_FMT_NONE.

> +av_log(s->avctx, AV_LOG_ERROR,
> +   "Can not support the format. \n");

This error message is meaningless.

I don't think an error message is appropriate here, anyway - either the user 
explicitly chose to fail (and already knows it) or something went wrong in 
ff_get_format() (which already prints a more useful error there).

> +}
> +
> +return fmt;

So I think just "return ff_get_format(...);"?

> +}
> +
>  static av_always_inline
>  int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
>  {
> @@ -182,6 +206,15 @@ int update_dimensions(VP8Context *s, int width, int 
> height, int is_vp7)
>  return ret;
>  }
>  
> +if (!s->actually_webp && !is_vp7) {
> +s->pix_fmt = get_pixel_format(s);
> +if (s->pix_fmt < 0) {
> +ret = AVERROR(EINVAL);
> +return ret;

Just "return AVERROR(EINVAL);"?

> +}
> +avctx->pix_fmt = s->pix_fmt;
> +}
> +
>  s->mb_width  = (s->avctx->coded_width  + 15) / 16;
>  s->mb_height = (s->avctx->coded_height + 15) / 16;
>  
> @@ -2598,18 +2631,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void 
> *data, int *got_frame,
>  if (s->actually_webp) {
>  // avctx->pix_fmt already set in caller.
>  } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) {
> -enum AVPixelFormat pix_fmts[] = {
> -#if CONFIG_VP8_VAAPI_HWACCEL
> -AV_PIX_FMT_VAAPI,
> -#endif
> -#if CONFIG_VP8_NVDEC_HWACCEL
> -AV_PIX_FMT_CUDA,
> -#endif
> -AV_PIX_FMT_YUV420P,
> -AV_PIX_FMT_NONE,
> -};
> -
> -s->pix_fmt = ff_get_format(s->avctx, pix_fmts);
> +s->pix_fmt = get_pixel_format(s);
>  if (s->pix_fmt < 0) {
>  ret = AVERROR(EINVAL);
>  goto err;
> -- 
> 2.14.1
> 

Tested with VAAPI, logic LGTM.

Thanks,

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


Re: [FFmpeg-devel] [PATCH] Added Turing codec to ffmpeg

2017-12-13 Thread Jan Ekström
On Thu, Dec 14, 2017 at 12:39 AM, Josh de Kock  wrote:
> On Thu,  7 Dec 2017 11:08:47 +
> Matteo Naccari  wrote:
>
>> - This patch contains the changes required to interface the Turing codec
>> [...]
>
> I still have an issue with this patch, while it would be nice to have another 
> HEVC encoder available in FFmpeg for comparisons and whatnot, I feel that 
> turingcodec isn't a mature enough encoder compared to what is already in the 
> project.
>
> Not to mention that development seems to have stalled (with only very minor 
> fixes for several months). In FFmpeg it is very difficult to remove 
> 'features', so if this patch were to be merged and then turingcodec to 
> actually go stale we'd be left with dead code for longer than is ideal 
> (forever).
>
> My opinion is that you should just maintain this separately as an out-of-tree 
> patch as it doesn't benefit us.
>

Hi,

After taking a look at the commit history of the last year+ or so,
issue tracker and pull request list over at
https://github.com/bbc/turingcodec I must say I find it somewhat hard
to disagree on a general level.

Creating an encoder is great work and I applaud people for that, but
unfortunately it - at the current point of time - looks like neither
from the licensing, performance or project activity point of view
merging a wrapper for this library is a good idea.


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


Re: [FFmpeg-devel] [PATCH] Added Turing codec to ffmpeg

2017-12-13 Thread Josh de Kock
On Thu,  7 Dec 2017 11:08:47 +
Matteo Naccari  wrote:

> - This patch contains the changes required to interface the Turing codec
> [...]

I still have an issue with this patch, while it would be nice to have another 
HEVC encoder available in FFmpeg for comparisons and whatnot, I feel that 
turingcodec isn't a mature enough encoder compared to what is already in the 
project.

Not to mention that development seems to have stalled (with only very minor 
fixes for several months). In FFmpeg it is very difficult to remove 'features', 
so if this patch were to be merged and then turingcodec to actually go stale 
we'd be left with dead code for longer than is ideal (forever).

My opinion is that you should just maintain this separately as an out-of-tree 
patch as it doesn't benefit us.

-- 
Josh de Kock 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 10/24] avcodec/mjpegdec: replace YUVJ pixel formats

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 04:44:26PM -0300, James Almer wrote:
> On 12/13/2017 4:22 PM, Michael Niedermayer wrote:
> > On Wed, Dec 13, 2017 at 11:59:26AM +0100, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol 
> >> ---
> >>  libavcodec/mjpegdec.c| 18 +-
> >>  libavcodec/tdsc.c|  2 +-
> >>  tests/fate/vcodec.mak|  4 ++--
> >>  tests/ref/fate/api-mjpeg-codec-param |  4 ++--
> >>  tests/ref/fate/exif-image-embedded   |  2 +-
> >>  tests/ref/fate/exif-image-jpg|  2 +-
> >>  6 files changed, 16 insertions(+), 16 deletions(-)
> > 
> > this breaks ffplay playing a mjpeg in avi
> > 
> > ./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -t 0.5  -qscale 1 mjpeg.avi
> > ./ffplay mjpeg.avi
> > 
> > the output of ffplay looks darker than it should be
> 
> Without this patch swscale emits a warning about deprecated pixel
> format. With it, the warning is gone.
> 
> Guess swscale needs to be adapted in some way before the same is done to
> the decoders?

To clarify the report, the mjpeg.avi is the same before and after the
patch, the difference is in the ffplay command

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

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


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


Re: [FFmpeg-devel] [PATCH 1/4] lavf/mpegts: mark packets with TEI flag as corrupted

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 05:44:50AM -0600, Rodger Combs wrote:
> ---
>  libavformat/mpegts.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 53cbcfb543..0a3ad05726 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -2296,6 +2296,14 @@ static int handle_packet(MpegTSContext *ts, const 
> uint8_t *packet)
>  }
>  }
>  
> +if (packet[1] & 0x80) {
> +av_log(ts->stream, AV_LOG_DEBUG, "Packet had TEI flag set; marking 
> as corrupt\n");
> +if (tss->type == MPEGTS_PES) {
> +PESContext *pc = tss->u.pes_filter.opaque;
> +pc->flags |= AV_PKT_FLAG_CORRUPT;
> +}
> +}

probably ok

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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


Re: [FFmpeg-devel] [PATCH v2 1/5] avformat/http: ff_http_do_new_request() returns EINVAL if re-used with different hostname

2017-12-13 Thread Jeyapal, Karthick


>On 12/13/17, 6:05 AM, "Aman Gupta" ffm...@tmm1.net> wrote:
>
>From: Aman Gupta 
>
>This will prevent improper use of ff_http_do_new_request() if the user
>tries to send a request for a different host to a previously connected
>persistent http/1.1 connection.
>---
> libavformat/http.c | 16 
> 1 file changed, 16 insertions(+)
>
>diff --git a/libavformat/http.c b/libavformat/http.c
>index cf86adc617..a3c36423fc 100644
>--- a/libavformat/http.c
>+++ b/libavformat/http.c
>@@ -306,6 +306,22 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
> HTTPContext *s = h->priv_data;
> AVDictionary *options = NULL;
> int ret;
>+char hostname1[1024], hostname2[1024], proto1[10], proto2[10];
>+int port1, port2;
>+
>+av_url_split(proto1, sizeof(proto1), NULL, 0,
>+ hostname1, sizeof(hostname1), ,
>+ NULL, 0, s->location);
>+av_url_split(proto2, sizeof(proto2), NULL, 0,
>+ hostname2, sizeof(hostname2), ,
>+ NULL, 0, uri);
>+if (port1 != port2 || strncmp(hostname1, hostname2, sizeof(hostname2)) != 
>0) {
>+av_log(h, AV_LOG_ERROR, "Cannot reuse HTTP connection for different 
>host: %s:%d != %s:%d\n",
>+hostname1, port1,
>+hostname2, port2
>+);
>+return AVERROR(EINVAL);
>+}
Nice check!
It will prevent some bad server side errors/crashes, due to any misuse.
> 
> ret = http_shutdown(h, h->flags);
> if (ret < 0)
>-- 
>2.14.3 (Apple Git-98)



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


Re: [FFmpeg-devel] [PATCH 10/24] avcodec/mjpegdec: replace YUVJ pixel formats

2017-12-13 Thread Marton Balint


On Wed, 13 Dec 2017, Michael Niedermayer wrote:


On Wed, Dec 13, 2017 at 11:59:26AM +0100, Paul B Mahol wrote:

Signed-off-by: Paul B Mahol 
---
 libavcodec/mjpegdec.c| 18 +-
 libavcodec/tdsc.c|  2 +-
 tests/fate/vcodec.mak|  4 ++--
 tests/ref/fate/api-mjpeg-codec-param |  4 ++--
 tests/ref/fate/exif-image-embedded   |  2 +-
 tests/ref/fate/exif-image-jpg|  2 +-
 6 files changed, 16 insertions(+), 16 deletions(-)


this breaks ffplay playing a mjpeg in avi

./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -t 0.5  -qscale 1 mjpeg.avi
./ffplay mjpeg.avi

the output of ffplay looks darker than it should be


FFplay does not specify the needed range for its buffersink. If there is a 
way to specify allowed combinations (e.g. YUV+limited, YUV+unspecified, 
RGB+full, RGB+unspecified), then this probably can be fixed.


(As far as I know SDL also does not specify the range of the used 
pixel formats, but I think YUV is always limited range there, and 
RGB is always full range)


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 10/24] avcodec/mjpegdec: replace YUVJ pixel formats

2017-12-13 Thread James Almer
On 12/13/2017 4:22 PM, Michael Niedermayer wrote:
> On Wed, Dec 13, 2017 at 11:59:26AM +0100, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavcodec/mjpegdec.c| 18 +-
>>  libavcodec/tdsc.c|  2 +-
>>  tests/fate/vcodec.mak|  4 ++--
>>  tests/ref/fate/api-mjpeg-codec-param |  4 ++--
>>  tests/ref/fate/exif-image-embedded   |  2 +-
>>  tests/ref/fate/exif-image-jpg|  2 +-
>>  6 files changed, 16 insertions(+), 16 deletions(-)
> 
> this breaks ffplay playing a mjpeg in avi
> 
> ./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -t 0.5  -qscale 1 mjpeg.avi
> ./ffplay mjpeg.avi
> 
> the output of ffplay looks darker than it should be

Without this patch swscale emits a warning about deprecated pixel
format. With it, the warning is gone.

Guess swscale needs to be adapted in some way before the same is done to
the decoders?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 12/24] avcodec/mjpegenc: add support for non-YUVJ formats

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 08:31:22PM +0100, Michael Niedermayer wrote:
> On Wed, Dec 13, 2017 at 11:59:28AM +0100, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol 
> > ---
> >  libavcodec/mjpegenc.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> this breaks:
> 
> ./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -strict -2 -t 0.5  mjpeg.avi

heres another case which breaks: (errors out)
./ffmpeg -y -i fate-suite/lena.pnm -pix_fmt +yuv420p -vf scale -strict -1 
test.jpg

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH 12/24] avcodec/mjpegenc: add support for non-YUVJ formats

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 11:59:28AM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/mjpegenc.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

this breaks:

./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -strict -2 -t 0.5  mjpeg.avi

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH 10/24] avcodec/mjpegdec: replace YUVJ pixel formats

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 11:59:26AM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/mjpegdec.c| 18 +-
>  libavcodec/tdsc.c|  2 +-
>  tests/fate/vcodec.mak|  4 ++--
>  tests/ref/fate/api-mjpeg-codec-param |  4 ++--
>  tests/ref/fate/exif-image-embedded   |  2 +-
>  tests/ref/fate/exif-image-jpg|  2 +-
>  6 files changed, 16 insertions(+), 16 deletions(-)

this breaks ffplay playing a mjpeg in avi

./ffmpeg -i matrixbench_mpeg2.mpg -vcodec mjpeg -t 0.5  -qscale 1 mjpeg.avi
./ffplay mjpeg.avi

the output of ffplay looks darker than it should be

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


[FFmpeg-devel] [PATCH] avformat/http: handle "content-range: -/*" responses

2017-12-13 Thread Aman Gupta
From: Aman Gupta 

The HTTP spec for the Content-Range response header specifies
that '*' may be used when the total size of the document is unknown.

Practically speaking, this can be used by a webserver to indicate
that the underlying video file is still growing, i.e. more video
data is being appended to the end.

With this commit, the http protocol parses the '*' and instead uses
the range end when reponding to AVSEEK_SIZE queries.
---
 libavformat/http.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index cf86adc617..d4b0d7c929 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -67,7 +67,7 @@ typedef struct HTTPContext {
 /* Used if "Transfer-Encoding: chunked" otherwise -1. */
 uint64_t chunksize;
 int chunkend;
-uint64_t off, end_off, filesize;
+uint64_t off, end_off, filesize, fileend;
 char *location;
 HTTPAuthState auth_state;
 HTTPAuthState proxy_auth_state;
@@ -501,6 +501,7 @@ static int http_open(URLContext *h, const char *uri, int 
flags,
 h->is_streamed = 1;
 
 s->filesize = UINT64_MAX;
+s->fileend = UINT64_MAX;
 s->location = av_strdup(uri);
 if (!s->location)
 return AVERROR(ENOMEM);
@@ -624,12 +625,21 @@ static void parse_content_range(URLContext *h, const char 
*p)
 {
 HTTPContext *s = h->priv_data;
 const char *slash;
+const char *dash;
 
 if (!strncmp(p, "bytes ", 6)) {
+uint64_t range_end = UINT64_MAX;
 p += 6;
 s->off = strtoull(p, NULL, 10);
-if ((slash = strchr(p, '/')) && strlen(slash) > 0)
-s->filesize = strtoull(slash + 1, NULL, 10);
+if ((dash = strchr(p, '-')))
+range_end = strtoull(dash + 1, NULL, 10);
+if ((slash = strchr(p, '/')) && strlen(slash) > 0) {
+if (slash[1] == '*') {
+s->fileend = range_end;
+} else {
+s->filesize = strtoull(slash + 1, NULL, 10);
+}
+}
 }
 if (s->seekable == -1 && (!s->is_akamai || s->filesize != 2147483647))
 h->is_streamed = 0; /* we _can_ in fact seek */
@@ -1253,6 +1263,7 @@ static int http_connect(URLContext *h, const char *path, 
const char *local_path,
 s->off  = 0;
 s->icy_data_read= 0;
 s->filesize = UINT64_MAX;
+s->fileend  = UINT64_MAX;
 s->willclose= 0;
 s->end_chunked_post = 0;
 s->end_header   = 0;
@@ -1601,19 +1612,22 @@ static int64_t http_seek_internal(URLContext *h, 
int64_t off, int whence, int fo
 int old_buf_size, ret;
 AVDictionary *options = NULL;
 
-if (whence == AVSEEK_SIZE)
+if (whence == AVSEEK_SIZE) {
+if (s->fileend != UINT64_MAX) {
+return s->off > s->fileend ? s->off : s->fileend;
+}
 return s->filesize;
-else if (!force_reconnect &&
+} else if (!force_reconnect &&
  ((whence == SEEK_CUR && off == 0) ||
   (whence == SEEK_SET && off == s->off)))
 return s->off;
-else if ((s->filesize == UINT64_MAX && whence == SEEK_END))
+else if ((s->filesize == UINT64_MAX && whence == SEEK_END && s->fileend == 
UINT64_MAX))
 return AVERROR(ENOSYS);
 
 if (whence == SEEK_CUR)
 off += s->off;
 else if (whence == SEEK_END)
-off += s->filesize;
+off += s->fileend != UINT64_MAX ? s->fileend : s->filesize;
 else if (whence != SEEK_SET)
 return AVERROR(EINVAL);
 if (off < 0)
-- 
2.14.3 (Apple Git-98)

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


Re: [FFmpeg-devel] avfilter/x86/vf_blend : add avx2 version for 8b func (WIP)

2017-12-13 Thread Henrik Gramner
On Sat, Dec 9, 2017 at 1:11 PM, Martin Vignali  wrote:
> the idea in AVX2 is to load 128bits of data (2x 64 bits)
> then shuffle accross lane, the two 64 bits in the low part of each lane, to
> keep the rest of the process similar
> to the sse version

What about using pmovzxbw instead of movu + vpermq + punpcklbw?

> for the store, the idea is similar in the opposite way (shuffle before
> store)

You could also do vextracti128 + 128-bit packuswb instead of 256-bit
packuswb + vpermq.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avfilter/x86/vf_hflip : make macro and add AVX2

2017-12-13 Thread Henrik Gramner
On Wed, Dec 13, 2017 at 6:07 AM, Martin Vignali
 wrote:
> +vpermq  m1, [srcq + xq - mmsize + %3], 0x4e; flip each lane at 
> load
> +vpermq  m2, [srcq + xq - 2 * mmsize + %3], 0x4e; flip each lane at 
> load

Would doing 2x 128-bit movu + 2x vinserti128 be faster?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ivfenc: add AV1 support

2017-12-13 Thread Ronald S. Bultje
Hi,

On Sun, Dec 10, 2017 at 6:28 PM, Tristan Matthews 
wrote:

> -avio_wl32(pb, par->codec_tag ? par->codec_tag : par->codec_id ==
> AV_CODEC_ID_VP9 ? AV_RL32("VP90") : AV_RL32("VP80"));
> +avio_wl32(pb, par->codec_tag ? par->codec_tag : par->codec_id ==
> AV_CODEC_ID_VP9 ? AV_RL32("VP90") :
> +par->codec_id ==  AV_CODEC_ID_VP8 ? AV_RL32("VP80") :
> AV_RL32("AV01"));


I'm frowning at you.

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


Re: [FFmpeg-devel] [PATCH] ivfenc: add AV1 support

2017-12-13 Thread Rostislav Pehlivanov
On 10 December 2017 at 23:28, Tristan Matthews  wrote:

> libaom tools work with ivf files.
> ---
>  libavformat/ivfenc.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index fdc0ee03e1..2d1f9aeef6 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -37,14 +37,16 @@ static int ivf_write_header(AVFormatContext *s)
>  }
>  par = s->streams[0]->codecpar;
>  if (par->codec_type != AVMEDIA_TYPE_VIDEO ||
> -!(par->codec_id == AV_CODEC_ID_VP8 || par->codec_id ==
> AV_CODEC_ID_VP9)) {
> -av_log(s, AV_LOG_ERROR, "Currently only VP8 and VP9 are
> supported!\n");
> +!(par->codec_id == AV_CODEC_ID_VP8 || par->codec_id ==
> AV_CODEC_ID_VP9 ||
> +  par->codec_id == AV_CODEC_ID_AV1)) {
> +av_log(s, AV_LOG_ERROR, "Currently only VP8, VP9 and AV1 are
> supported!\n");
>  return AVERROR(EINVAL);
>  }
>  avio_write(pb, "DKIF", 4);
>  avio_wl16(pb, 0); // version
>  avio_wl16(pb, 32); // header length
> -avio_wl32(pb, par->codec_tag ? par->codec_tag : par->codec_id ==
> AV_CODEC_ID_VP9 ? AV_RL32("VP90") : AV_RL32("VP80"));
> +avio_wl32(pb, par->codec_tag ? par->codec_tag : par->codec_id ==
> AV_CODEC_ID_VP9 ? AV_RL32("VP90") :
> +par->codec_id ==  AV_CODEC_ID_VP8 ? AV_RL32("VP80") :
> AV_RL32("AV01"));
>  avio_wl16(pb, par->width);
>  avio_wl16(pb, par->height);
>  avio_wl32(pb, s->streams[0]->time_base.den);
> @@ -100,6 +102,7 @@ static int ivf_check_bitstream(struct AVFormatContext
> *s, const AVPacket *pkt)
>  static const AVCodecTag codec_ivf_tags[] = {
>  { AV_CODEC_ID_VP8,  MKTAG('V', 'P', '8', '0') },
>  { AV_CODEC_ID_VP9,  MKTAG('V', 'P', '9', '0') },
> +{ AV_CODEC_ID_AV1,  MKTAG('A', 'V', '0', '1') },
>  { AV_CODEC_ID_NONE, 0 }
>  };
>
> --
> 2.15.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Thanks, pushed
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] lavf/utils: add flag to discard timestamps on corrupted frames

2017-12-13 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 03:04:06AM -0600, Rodger Combs wrote:
> 
> 
> > On Dec 10, 2017, at 09:27, Michael Niedermayer  
> > wrote:
> > 
> > On Sun, Dec 10, 2017 at 05:17:44AM -0600, Rodger Combs wrote:
> >> 
> >> 
> >>> On Dec 9, 2017, at 12:19, Michael Niedermayer  
> >>> wrote:
> >>> 
> >>> On Fri, Dec 08, 2017 at 10:34:39PM -0600, Rodger Combs wrote:
>  
>  
> > On Dec 8, 2017, at 11:06, Michael Niedermayer  
> > wrote:
> > 
> > On Thu, Dec 07, 2017 at 10:23:15PM -0600, Rodger Combs wrote:
> >> ---
> >> libavformat/avformat.h  | 1 +
> >> libavformat/options_table.h | 1 +
> >> libavformat/utils.c | 8 
> >> 3 files changed, 10 insertions(+)
> >> 
> >> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> >> index 4f2798a871..d10d583dff 100644
> >> --- a/libavformat/avformat.h
> >> +++ b/libavformat/avformat.h
> >> @@ -1450,6 +1450,7 @@ typedef struct AVFormatContext {
> >> #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but 
> >> inaccurate seeks for some formats
> >> #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the 
> >> shortest stream stops.
> >> #define AVFMT_FLAG_AUTO_BSF   0x20 ///< Add bitstream filters as 
> >> requested by the muxer
> >> +#define AVFMT_FLAG_DISCARD_CORRUPT_TS 0x40 ///< Discard 
> >> timestamps of frames marked corrupt
> >> 
> >>   /**
> >>* Maximum size of the data read from input for determining
> >> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> >> index b8fa47c6fd..515574d3e0 100644
> >> --- a/libavformat/options_table.h
> >> +++ b/libavformat/options_table.h
> >> @@ -58,6 +58,7 @@ static const AVOption avformat_options[] = {
> >> {"bitexact", "do not write random/volatile data", 0, 
> >> AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
> >> {"shortest", "stop muxing with the shortest stream", 0, 
> >> AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
> >> {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { 
> >> .i64 = AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
> >> +{"discardcorruptts", "discard timestamps on corrupted frames", 0, 
> >> AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_DISCARD_CORRUPT_TS }, 0, 0, E, 
> >> "fflags" },
> >> {"analyzeduration", "specify how many microseconds are analyzed to 
> >> probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, 
> >> {.i64 = 0 }, 0, INT64_MAX, D},
> >> {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl 
> >> = 0}, 0, 0, D},
> >> {"indexmem", "max memory used for timestamp index (per stream)", 
> >> OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, 
> >> D},
> >> diff --git a/libavformat/utils.c b/libavformat/utils.c
> >> index 84e49208b8..98af941e9f 100644
> >> --- a/libavformat/utils.c
> >> +++ b/libavformat/utils.c
> > 
> >> @@ -873,6 +873,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket 
> >> *pkt)
> >>   st->cur_dts = wrap_timestamp(st, st->cur_dts);
> >>   }
> >> 
> >> +if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT_TS) &&
> >> +(pkt->flags & AV_PKT_FLAG_CORRUPT)) {
> >> +pkt->pts = pkt->dts = AV_NOPTS_VALUE;
> >> +av_log(s, AV_LOG_WARNING,
> >> +   "Discarded timestamp on corrupted packet (stream = 
> >> %d)\n",
> >> +   pkt->stream_index);
> >> +}
> > 
> > how many of the cases that set AV_PKT_FLAG_CORRUPT can even be due to
> > the timestamp ?
>  
>  Pretty much just the new TEI check, or potentially other CRC checks. I 
>  don't _think_ the continuity-counter check failing could indicate an 
>  incorrect timestamp. I suppose we could add a second flag just for 
>  corruption that could affect timestamps?
> >>> 
> >>> I think thats a great idea, maybe if we already change it we should
> >>> also split the truncated case out as it is very common.
> >>> 
> >>> AV_PKT_FLAG_DATA_CORRUPT// the packet data may be 
> >>> corrupted
> >>> AV_PKT_FLAG_DATA_TRUNCATED  // the packet size may be 
> >>> corrupted, data available is undamaged unless another flag indicates 
> >>> otherwise. Any headers or sub-packets which are complete are non 
> >>> corrupted-
> >>> AV_PKT_FLAG_TS_CORRUPT  // the packets timestamps and or 
> >>> duration may be corrupted
> >>> 
> >>> #define AV_PKT_FLAG_CORRUPT (AV_PKT_FLAG_DATA_CORRUPT | 
> >>> AV_PKT_FLAG_DATA_TRUNCATED | AV_PKT_FLAG_TS_CORRUPT)
> >> 
> >> What kind of API bump would be needed to make this kind of change?
> > 
> > IIUC we are still within the major bump thing (didnt check 

[FFmpeg-devel] [PATCH 3/4] lavf/utils: add flag to discard timestamps on corrupted frames

2017-12-13 Thread Rodger Combs
---
 libavformat/avformat.h  | 1 +
 libavformat/options_table.h | 1 +
 libavformat/utils.c | 8 
 3 files changed, 10 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4f2798a871..d10d583dff 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1450,6 +1450,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the shortest 
stream stops.
 #define AVFMT_FLAG_AUTO_BSF   0x20 ///< Add bitstream filters as requested 
by the muxer
+#define AVFMT_FLAG_DISCARD_CORRUPT_TS 0x40 ///< Discard timestamps of 
frames marked corrupt
 
 /**
  * Maximum size of the data read from input for determining
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index b8fa47c6fd..515574d3e0 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -58,6 +58,7 @@ static const AVOption avformat_options[] = {
 {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 
= AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
 {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { 
.i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
 {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { .i64 = 
AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
+{"discardcorruptts", "discard timestamps on corrupted frames", 0, 
AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_DISCARD_CORRUPT_TS }, 0, 0, E, "fflags" 
},
 {"analyzeduration", "specify how many microseconds are analyzed to probe the 
input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 
0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", 
OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8d49348d9e..2e15f34469 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -873,6 +873,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 st->cur_dts = wrap_timestamp(st, st->cur_dts);
 }
 
+if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT_TS) &&
+(pkt->flags & AV_PKT_FLAG_HEADER_CORRUPT)) {
+pkt->pts = pkt->dts = AV_NOPTS_VALUE;
+av_log(s, AV_LOG_WARNING,
+   "Discarded timestamp on corrupted packet (stream = %d)\n",
+   pkt->stream_index);
+}
+
 pkt->dts = wrap_timestamp(st, pkt->dts);
 pkt->pts = wrap_timestamp(st, pkt->pts);
 
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 2/4] lavc+lavf: split AV_PKG_FLAG_CORRUPT into more specific flags

2017-12-13 Thread Rodger Combs
This maintains AV_PKG_FLAG_CORRUPT as a mask of the 3 new flags.
Requires a major bump in both libraries.
---
 libavcodec/avcodec.h   | 29 -
 libavcodec/trace_headers_bsf.c | 10 --
 libavcodec/version.h   |  3 +++
 libavformat/aiffdec.c  |  2 +-
 libavformat/apc.c  |  2 +-
 libavformat/iv8.c  |  2 +-
 libavformat/jvdec.c|  2 +-
 libavformat/mp3dec.c   |  2 +-
 libavformat/mpegts.c   |  6 +++---
 libavformat/oggparseopus.c |  2 +-
 libavformat/oggparsevorbis.c   |  4 ++--
 libavformat/omadec.c   |  4 ++--
 libavformat/pcm.c  |  2 +-
 libavformat/sdsdec.c   |  2 +-
 libavformat/sol.c  |  2 +-
 libavformat/utils.c|  2 +-
 16 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5db6a81320..b00e851ccb 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1430,7 +1430,11 @@ typedef struct AVPacket {
 #endif
 } AVPacket;
 #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
-#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
+/**
+ * The packet's data is corrupted (as opposed to the headers being corrupted,
+ * or the data being truncated).
+ */
+#define AV_PKT_FLAG_DATA_CORRUPT 0x0002
 /**
  * Flag is used to discard packets which are required to maintain valid
  * decoder state but are not required for output and should be dropped
@@ -1449,6 +1453,29 @@ typedef struct AVPacket {
  * be discarded by the decoder.  I.e. Non-reference frames.
  */
 #define AV_PKT_FLAG_DISPOSABLE 0x0010
+#if !FF_API_SINGLE_CORRUPT_FLAG
+/**
+ * The packet's contents are truncated.
+ */
+#define AV_PKT_FLAG_DATA_TRUNCATED 0x0020
+/**
+ * The packet's headers (most notably including the timestamps) are corrupted.
+ */
+#define AV_PKT_FLAG_HEADER_CORRUPT 0x0040
+
+/**
+ * The packet's data or headers are corrupted or truncated.
+ * Bit-combination of AV_PKT_FLAG_DATA_CORRUPT, AV_PKT_FLAG_DATA_TRUNCATED, and
+ * AV_PKT_FLAG_HEADER_CORRUPT.
+ * Can be set to indicate corruption that may affect data or headers, or cause 
truncation.
+ * Can be masked against to check for any kind of corruption.
+ */
+#define AV_PKT_FLAG_CORRUPT 
(AV_PKT_FLAG_DATA_CORRUPT|AV_PKT_FLAG_DATA_TRUNCATED|AV_PKT_FLAG_HEADER_CORRUPT)
+#else
+#define AV_PKT_FLAG_CORRUPT AV_PKT_FLAG_DATA_CORRUPT
+#define AV_PKT_FLAG_DATA_TRUNCATED AV_PKT_FLAG_DATA_CORRUPT
+#define AV_PKT_FLAG_HEADER_CORRUPT AV_PKT_FLAG_DATA_CORRUPT
+#endif
 
 
 enum AVSideDataParamChangeFlags {
diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
index 93d04cb509..cbea9cdf1c 100644
--- a/libavcodec/trace_headers_bsf.c
+++ b/libavcodec/trace_headers_bsf.c
@@ -81,8 +81,14 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *out)
 
 if (in->flags & AV_PKT_FLAG_KEY)
 av_strlcat(tmp, ", key frame", sizeof(tmp));
-if (in->flags & AV_PKT_FLAG_CORRUPT)
-av_strlcat(tmp, ", corrupt", sizeof(tmp));
+if (in->flags & AV_PKT_FLAG_DATA_CORRUPT)
+av_strlcat(tmp, ", data corrupt", sizeof(tmp));
+#if !FF_API_SINGLE_CORRUPT_FLAG
+if (in->flags & AV_PKT_FLAG_DATA_TRUNCATED)
+av_strlcat(tmp, ", truncated", sizeof(tmp));
+if (in->flags & AV_PKT_FLAG_HEADER_CORRUPT)
+av_strlcat(tmp, ", header corrupt", sizeof(tmp));
+#endif
 
 if (in->pts != AV_NOPTS_VALUE)
 av_strlcatf(tmp, sizeof(tmp), ", pts %"PRId64, in->pts);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 3b5c3000be..2673d8528c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -126,6 +126,9 @@
 #ifndef FF_API_USER_VISIBLE_AVHWACCEL
 #define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_SINGLE_CORRUPT_FLAG
+#define FF_API_SINGLE_CORRUPT_FLAG (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
 
 
 #endif /* AVCODEC_VERSION_H */
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 99e05c78ec..efe6ce3c42 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -396,7 +396,7 @@ static int aiff_read_packet(AVFormatContext *s,
 return res;
 
 if (size >= st->codecpar->block_align)
-pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+pkt->flags &= ~AV_PKT_FLAG_DATA_TRUNCATED;
 /* Only one stream in an AIFF file */
 pkt->stream_index = 0;
 pkt->duration = (res / st->codecpar->block_align) * 
aiff->block_duration;
diff --git a/libavformat/apc.c b/libavformat/apc.c
index b180a50c9b..63a9c9 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -78,7 +78,7 @@ static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
 return AVERROR(EIO);
-pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+pkt->flags &= ~AV_PKT_FLAG_DATA_TRUNCATED;
 pkt->stream_index = 0;
 return 0;
 }
diff --git a/libavformat/iv8.c b/libavformat/iv8.c

[FFmpeg-devel] [PATCH 4/4] lavf/utils: add flag to fill unset timestamps from wallclock offset

2017-12-13 Thread Rodger Combs
---
 libavformat/avformat.h  |  1 +
 libavformat/internal.h  |  5 +
 libavformat/options_table.h |  1 +
 libavformat/utils.c | 12 
 4 files changed, 19 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d10d583dff..a039a2764d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1451,6 +1451,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the shortest 
stream stops.
 #define AVFMT_FLAG_AUTO_BSF   0x20 ///< Add bitstream filters as requested 
by the muxer
 #define AVFMT_FLAG_DISCARD_CORRUPT_TS 0x40 ///< Discard timestamps of 
frames marked corrupt
+#define AVFMT_FLAG_FILL_WALLCLOCK_DTS 0x80 ///< Fill missing or discarded 
DTS values from wallclock (for live streams)
 
 /**
  * Maximum size of the data read from input for determining
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 36a57214ce..3abf1dc720 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -192,6 +192,11 @@ struct AVStreamInternal {
 int need_context_update;
 
 FFFrac *priv_pts;
+
+/**
+ * The wallclock timestamp of the most recent read packet (if 
AVFMT_FLAG_FILL_WALLCLOCK_DTS is set)
+ */
+int64_t cur_wallclock_time;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 515574d3e0..64febc7a21 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -59,6 +59,7 @@ static const AVOption avformat_options[] = {
 {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { 
.i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
 {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { .i64 = 
AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
 {"discardcorruptts", "discard timestamps on corrupted frames", 0, 
AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_DISCARD_CORRUPT_TS }, 0, 0, E, "fflags" 
},
+{"fillwallclockdts", "fill missing or discarded DTS values from wallclock (for 
live streams)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_FILL_WALLCLOCK_DTS }, 
0, 0, E, "fflags" },
 {"analyzeduration", "specify how many microseconds are analyzed to probe the 
input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 
0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", 
OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2e15f34469..9704f2ae29 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -881,6 +881,18 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index);
 }
 
+if (s->flags & AVFMT_FLAG_FILL_WALLCLOCK_DTS) {
+int64_t cur_wallclock_time = av_gettime_relative();
+if (pkt->dts == AV_NOPTS_VALUE && st->cur_dts != AV_NOPTS_VALUE && 
st->internal->cur_wallclock_time) {
+int64_t wallclock_offset = 
av_rescale_q(st->internal->cur_wallclock_time - cur_wallclock_time, 
AV_TIME_BASE_Q, st->time_base);
+pkt->dts = st->cur_dts + FFMAX(wallclock_offset, 1);
+av_log(s, AV_LOG_VERBOSE,
+   "Filled timestamp from wallclock (stream = %d; last = 
%"PRId64"; val = %"PRId64")\n",
+   pkt->stream_index, st->cur_dts, pkt->dts);
+}
+st->internal->cur_wallclock_time = cur_wallclock_time;
+}
+
 pkt->dts = wrap_timestamp(st, pkt->dts);
 pkt->pts = wrap_timestamp(st, pkt->pts);
 
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 1/4] lavf/mpegts: mark packets with TEI flag as corrupted

2017-12-13 Thread Rodger Combs
---
 libavformat/mpegts.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 53cbcfb543..0a3ad05726 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2296,6 +2296,14 @@ static int handle_packet(MpegTSContext *ts, const 
uint8_t *packet)
 }
 }
 
+if (packet[1] & 0x80) {
+av_log(ts->stream, AV_LOG_DEBUG, "Packet had TEI flag set; marking as 
corrupt\n");
+if (tss->type == MPEGTS_PES) {
+PESContext *pc = tss->u.pes_filter.opaque;
+pc->flags |= AV_PKT_FLAG_CORRUPT;
+}
+}
+
 p = packet + 4;
 if (has_adaptation) {
 int64_t pcr_h;
-- 
2.15.1

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


[FFmpeg-devel] avfilter/x86/vf_hflip : make macro and add AVX2

2017-12-13 Thread Martin Vignali
Hello,

In attach patch to merge byte and short hflip asm func into a macro
and add AVX2 version

Checkasm result (Kaby Lake, x86_64, mac os 10.12)
hflip_byte_c: 30.9
hflip_byte_ssse3: 30.4
hflip_byte_avx2: 21.9
hflip_short_c: 31.6
hflip_short_ssse3: 30.4
hflip_short_avx2: 22.4


Martin


0001-avfilter-x86-vf_hflip-merge-hflip-byte-and-hflip-sho.patch
Description: Binary data


0002-avfilter-x86-vf_hflip-add-avx2-version-for-hflip_byt.patch
Description: Binary data


0003-avfilter-x86-vf_hflip-indent-after-previous-commit.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 23/24] avformat/rtpenc_jpeg: remove usage of YUVJ formats

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavformat/rtpenc_jpeg.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 38eb2e68eb..e0e7afebfc 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -46,13 +46,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 h = AV_CEIL_RSHIFT(s1->streams[0]->codecpar->height, 3);
 
 /* get the pixel format type or fail */
-if (s1->streams[0]->codecpar->format == AV_PIX_FMT_YUVJ422P ||
-(s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG &&
- s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV422P)) {
+if (s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG &&
+ s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV422P) {
 type = 0;
-} else if (s1->streams[0]->codecpar->format == AV_PIX_FMT_YUVJ420P ||
-   (s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG &&
-s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV420P)) {
+} else if (s1->streams[0]->codecpar->color_range == AVCOL_RANGE_JPEG &&
+s1->streams[0]->codecpar->format == AV_PIX_FMT_YUV420P) {
 type = 1;
 } else {
 av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n");
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 20/24] libavcodec/hevcdec: remove usage of YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/hevcdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 433a7056ea..d1b54b1db5 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -363,7 +363,6 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 
 switch (sps->pix_fmt) {
 case AV_PIX_FMT_YUV420P:
-case AV_PIX_FMT_YUVJ420P:
 #if CONFIG_HEVC_DXVA2_HWACCEL
 *fmt++ = AV_PIX_FMT_DXVA2_VLD;
 #endif
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 21/24] avfilter/vf_blackdetect: use color_range from inlink

2017-12-13 Thread Paul B Mahol
Remove YUVJ pixel format usage.

Signed-off-by: Paul B Mahol 
---
 libavfilter/vf_blackdetect.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index 06ef9988d1..ff4b9eebb9 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -61,13 +61,6 @@ static const AVOption blackdetect_options[] = {
 
 AVFILTER_DEFINE_CLASS(blackdetect);
 
-#define YUVJ_FORMATS \
-AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, 
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
-
-static const enum AVPixelFormat yuvj_formats[] = {
-YUVJ_FORMATS, AV_PIX_FMT_NONE
-};
-
 static int query_formats(AVFilterContext *ctx)
 {
 static const enum AVPixelFormat pix_fmts[] = {
@@ -76,7 +69,6 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
 AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
-YUVJ_FORMATS,
 AV_PIX_FMT_NONE
 };
 
@@ -94,7 +86,7 @@ static int config_input(AVFilterLink *inlink)
 blackdetect->black_min_duration =
 blackdetect->black_min_duration_time / av_q2d(inlink->time_base);
 
-blackdetect->pixel_black_th_i = ff_fmt_is_in(inlink->format, yuvj_formats) 
?
+blackdetect->pixel_black_th_i = inlink->color_range == AVCOL_RANGE_JPEG ?
 // luminance_minimum_value + pixel_black_th * luminance_range_size
  blackdetect->pixel_black_th *  255 :
 16 + blackdetect->pixel_black_th * (235 - 16);
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 24/24] avfilter: remove YUVJ pixel format usage

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avf_showspectrum.c |  2 +-
 libavfilter/vaf_spectrumsynth.c|  4 +---
 libavfilter/vf_atadenoise.c|  3 ---
 libavfilter/vf_avgblur.c   |  4 +---
 libavfilter/vf_bitplanenoise.c |  2 --
 libavfilter/vf_blend.c |  1 -
 libavfilter/vf_bwdif.c |  2 --
 libavfilter/vf_colorspace.c|  1 -
 libavfilter/vf_convolution.c   |  4 +---
 libavfilter/vf_convolve.c  |  4 +---
 libavfilter/vf_cover_rect.c|  3 +--
 libavfilter/vf_cropdetect.c|  6 +++---
 libavfilter/vf_deband.c|  4 +---
 libavfilter/vf_deflicker.c |  3 ---
 libavfilter/vf_deshake.c   |  3 +--
 libavfilter/vf_displace.c  |  4 +---
 libavfilter/vf_drawbox.c   |  3 +--
 libavfilter/vf_extractplanes.c |  6 --
 libavfilter/vf_fade.c  |  3 +--
 libavfilter/vf_fftfilt.c   |  6 +++---
 libavfilter/vf_fillborders.c   |  4 +---
 libavfilter/vf_find_rect.c |  1 -
 libavfilter/vf_framepack.c |  3 +--
 libavfilter/vf_framerate.c | 10 +-
 libavfilter/vf_fspp.c  |  2 --
 libavfilter/vf_gblur.c |  4 +---
 libavfilter/vf_histogram.c |  8 
 libavfilter/vf_hqdn3d.c|  4 
 libavfilter/vf_hysteresis.c|  4 +---
 libavfilter/vf_idet.c  |  4 
 libavfilter/vf_interlace.c |  4 ++--
 libavfilter/vf_lenscorrection.c|  4 ++--
 libavfilter/vf_limiter.c   |  4 +---
 libavfilter/vf_lut.c   |  2 --
 libavfilter/vf_lut2.c  |  4 +---
 libavfilter/vf_maskedclamp.c   |  4 +---
 libavfilter/vf_maskedmerge.c   |  4 +---
 libavfilter/vf_mestimate.c |  3 ---
 libavfilter/vf_midequalizer.c  |  4 +---
 libavfilter/vf_minterpolate.c  |  3 ---
 libavfilter/vf_mpdecimate.c|  2 --
 libavfilter/vf_neighbor.c  |  1 -
 libavfilter/vf_nlmeans.c   |  3 ---
 libavfilter/vf_nnedi.c |  3 ---
 libavfilter/vf_ocr.c   |  3 ---
 libavfilter/vf_overlay.c   |  6 +++---
 libavfilter/vf_perspective.c   |  1 -
 libavfilter/vf_phase.c |  1 -
 libavfilter/vf_pp.c| 12 
 libavfilter/vf_pp7.c   |  2 --
 libavfilter/vf_premultiply.c   | 10 +-
 libavfilter/vf_psnr.c  |  2 --
 libavfilter/vf_pullup.c|  4 +---
 libavfilter/vf_readeia608.c|  3 ---
 libavfilter/vf_readvitc.c  |  5 -
 libavfilter/vf_remap.c |  1 -
 libavfilter/vf_removegrain.c   |  2 --
 libavfilter/vf_rotate.c|  4 ++--
 libavfilter/vf_signalstats.c   |  2 --
 libavfilter/vf_signature.c |  3 ---
 libavfilter/vf_spp.c   |  2 --
 libavfilter/vf_ssim.c  |  2 --
 libavfilter/vf_stereo3d.c  |  5 -
 libavfilter/vf_threshold.c |  4 +---
 libavfilter/vf_tinterlace.c| 11 ++-
 libavfilter/vf_unsharp.c   |  4 ++--
 libavfilter/vf_uspp.c  |  2 --
 libavfilter/vf_vaguedenoiser.c |  3 ---
 libavfilter/vf_vectorscope.c   | 10 +-
 libavfilter/vf_w3fdif.c|  3 ---
 libavfilter/vf_waveform.c  | 10 ++
 libavfilter/vf_yadif.c |  4 
 libavfilter/vf_zoompan.c   |  3 ---
 libavfilter/vf_zscale.c|  3 ---
 libavfilter/vsrc_testsrc.c |  2 +-
 tests/ref/fate/filter-pixfmts-lut  |  4 
 tests/ref/fate/filter-pixfmts-pullup   |  5 -
 tests/ref/fate/filter-pixfmts-rotate   |  2 --
 tests/ref/fate/filter-pixfmts-tinterlace_cvlpf |  4 
 tests/ref/fate/filter-pixfmts-tinterlace_merge |  4 
 tests/ref/fate/filter-pixfmts-tinterlace_pad   |  4 
 tests/ref/fate/filter-pixfmts-tinterlace_vlpf  |  4 
 82 files changed, 63 insertions(+), 250 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 956f62f3ad..33449df315 100644
--- a/libavfilter/avf_showspectrum.c

[FFmpeg-devel] [PATCH 22/24] avfilter/vf_setrange: change outlink color_range too

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/vf_setparams.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index 8427f98ba8..98a4aa2ad3 100644
--- a/libavfilter/vf_setparams.c
+++ b/libavfilter/vf_setparams.c
@@ -56,6 +56,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 return ff_filter_frame(ctx->outputs[0], frame);
 }
 
+static int config_output(AVFilterLink *outlink)
+{
+SetParamsContext *s = outlink->src->priv;
+
+if (s->color_range >= 0)
+outlink->color_range = s->color_range;
+
+return 0;
+}
+
 static const AVFilterPad inputs[] = {
 {
 .name = "default",
@@ -69,6 +79,7 @@ static const AVFilterPad outputs[] = {
 {
 .name = "default",
 .type = AVMEDIA_TYPE_VIDEO,
+.config_props = config_output,
 },
 { NULL }
 };
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 19/24] avcodec/roqvideoenc: do not use YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/roqvideoenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index ac05123dc6..18ceef1b2c 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -1132,7 +1132,8 @@ AVCodec ff_roq_encoder = {
 .init = roq_encode_init,
 .encode2  = roq_encode_frame,
 .close= roq_encode_end,
-.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUVJ444P,
+.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_NONE },
+.color_ranges = (const enum AVColorRange[]){ AVCOL_RANGE_JPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 18/24] avcodec/hevc_ps: do not use YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Color range is already set.

Signed-off-by: Paul B Mahol 
---
 libavcodec/hevc_ps.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index a4f7ed60f7..19ec2d7ebf 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -578,8 +578,6 @@ static void decode_vui(GetBitContext *gb, AVCodecContext 
*avctx,
 vui->video_format= get_bits(gb, 3);
 vui->video_full_range_flag   = get_bits1(gb);
 vui->colour_description_present_flag = get_bits1(gb);
-if (vui->video_full_range_flag && sps->pix_fmt == AV_PIX_FMT_YUV420P)
-sps->pix_fmt = AV_PIX_FMT_YUVJ420P;
 if (vui->colour_description_present_flag) {
 vui->colour_primaries= get_bits(gb, 8);
 vui->transfer_characteristic = get_bits(gb, 8);
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 17/24] avcodec/h264_slice: do not use YUVJ pixel formats

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/h264_slice.c | 22 ++
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index aad5484588..a75ab08c29 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -820,15 +820,10 @@ static enum AVPixelFormat get_pixel_format(H264Context 
*h, int force_callback)
 if (CHROMA444(h)) {
 if (h->avctx->colorspace == AVCOL_SPC_RGB)
 *fmt++ = AV_PIX_FMT_GBRP;
-else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-*fmt++ = AV_PIX_FMT_YUVJ444P;
 else
 *fmt++ = AV_PIX_FMT_YUV444P;
 } else if (CHROMA422(h)) {
-if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-*fmt++ = AV_PIX_FMT_YUVJ422P;
-else
-*fmt++ = AV_PIX_FMT_YUV422P;
+*fmt++ = AV_PIX_FMT_YUV422P;
 } else {
 #if CONFIG_H264_DXVA2_HWACCEL
 *fmt++ = AV_PIX_FMT_DXVA2_VLD;
@@ -845,8 +840,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 #endif
 if (h->avctx->codec->pix_fmts)
 choices = h->avctx->codec->pix_fmts;
-else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-*fmt++ = AV_PIX_FMT_YUVJ420P;
 else
 *fmt++ = AV_PIX_FMT_YUV420P;
 }
@@ -992,17 +985,6 @@ fail:
 return ret;
 }
 
-static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
-{
-switch (a) {
-case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
-case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
-case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
-default:
-return a;
-}
-}
-
 static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int 
first_slice)
 {
 const SPS *sps;
@@ -1047,7 +1029,7 @@ static int h264_init_ps(H264Context *h, const 
H264SliceContext *sl, int first_sl
  || h->mb_height != sps->mb_height
 ));
 if (h->avctx->pix_fmt == AV_PIX_FMT_NONE
-|| (non_j_pixfmt(h->avctx->pix_fmt) != 
non_j_pixfmt(get_pixel_format(h, 0
+|| (h->avctx->pix_fmt != get_pixel_format(h, 0)))
 must_reinit = 1;
 
 if (first_slice && av_cmp_q(sps->sar, h->avctx->sample_aspect_ratio))
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 16/24] avcodec/mdec: replace YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 330b761279..637158d231 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -227,7 +227,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 ff_init_scantable(a->idsp.idct_permutation, >scantable,
   ff_zigzag_direct);
 
-avctx->pix_fmt  = AV_PIX_FMT_YUVJ420P;
+avctx->pix_fmt  = AV_PIX_FMT_YUV420P;
 avctx->color_range = AVCOL_RANGE_JPEG;
 
 /* init q matrix */
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 12/24] avcodec/mjpegenc: add support for non-YUVJ formats

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mjpegenc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index d2fcb8e191..3ae0a0a70d 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -415,8 +415,10 @@ AVCodec ff_mjpeg_encoder = {
 .close  = ff_mpv_encode_end,
 .capabilities   = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS 
| AV_CODEC_CAP_INTRA_ONLY,
 .pix_fmts   = (const enum AVPixelFormat[]) {
+AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, 
AV_PIX_FMT_NONE
 },
+.color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_JPEG, 
AVCOL_RANGE_UNSPECIFIED},
 .priv_class = _class,
 };
 #endif
@@ -439,8 +441,9 @@ AVCodec ff_amv_encoder = {
 .encode2= amv_encode_picture,
 .close  = ff_mpv_encode_end,
 .pix_fmts   = (const enum AVPixelFormat[]) {
-AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
+AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
 },
+.color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_JPEG, 
AVCOL_RANGE_UNSPECIFIED},
 .priv_class = _class,
 };
 #endif
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 14/24] avcodec/fraps: replace YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/fraps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 7a7673f73f..b2025b5d3f 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -218,7 +218,7 @@ static int decode_frame(AVCodecContext *avctx,
 f->pict_type = AV_PICTURE_TYPE_I;
 f->key_frame = 1;
 
-avctx->pix_fmt = version & 1 ? is_pal ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_BGR24 
: AV_PIX_FMT_YUVJ420P;
+avctx->pix_fmt = version & 1 ? is_pal ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_BGR24 
: AV_PIX_FMT_YUV420P;
 avctx->color_range = version & 1 ? AVCOL_RANGE_UNSPECIFIED
  : AVCOL_RANGE_JPEG;
 avctx->colorspace = version & 1 ? AVCOL_SPC_UNSPECIFIED : AVCOL_SPC_BT709;
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 15/24] avcodec/roqvideodec: replace YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/roqvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
index 0ab7d399d6..c5b7bbe236 100644
--- a/libavcodec/roqvideodec.c
+++ b/libavcodec/roqvideodec.c
@@ -190,7 +190,7 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 
-avctx->pix_fmt = AV_PIX_FMT_YUVJ444P;
+avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 avctx->color_range = AVCOL_RANGE_JPEG;
 
 return 0;
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 13/24] avcodec/svq3: replace YUVJ pixel format

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/svq3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index a937b2f951..4c6d838a15 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1158,7 +1158,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
 ff_hpeldsp_init(>hdsp, avctx->flags);
 ff_tpeldsp_init(>tdsp);
 
-avctx->pix_fmt = AV_PIX_FMT_YUVJ420P;
+avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 avctx->color_range = AVCOL_RANGE_JPEG;
 
 s->avctx = avctx;
@@ -1652,6 +1652,6 @@ AVCodec ff_svq3_decoder = {
 .capabilities   = AV_CODEC_CAP_DRAW_HORIZ_BAND |
   AV_CODEC_CAP_DR1 |
   AV_CODEC_CAP_DELAY,
-.pix_fmts   = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P,
+.pix_fmts   = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
  AV_PIX_FMT_NONE},
 };
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 07/24] avfilter: negotiate color_range between filters

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 fftools/ffmpeg.c|  2 ++
 fftools/ffmpeg_filter.c | 56 ++---
 libavcodec/utils.c  | 11 +++
 libavfilter/avfilter.c  |  9 --
 libavfilter/avfilter.h  |  4 ++-
 libavfilter/avfiltergraph.c | 53 
 libavfilter/buffersink.c| 16 ++
 libavfilter/buffersink.h|  1 +
 libavfilter/buffersrc.c |  4 +++
 libavfilter/formats.c   | 75 ++---
 libavfilter/formats.h   | 31 +++
 libavfilter/internal.h  | 11 +++
 libavfilter/vf_format.c | 46 ++-
 libavfilter/vf_noise.c  |  6 +++-
 libavfilter/vf_scale.c  | 17 --
 libavfilter/vsrc_testsrc.c  | 15 +++--
 tests/fate/filter-video.mak |  2 +-
 tests/fate/pixlet.mak   |  2 +-
 18 files changed, 339 insertions(+), 22 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6aff3366c5..64de55d9a5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3390,6 +3390,8 @@ static int init_output_stream_encode(OutputStream *ost)
 enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
  
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
 
+enc_ctx->color_range = 
av_buffersink_get_color_range(ost->filter->filter);
+
 enc_ctx->framerate = ost->frame_rate;
 
 ost->st->avg_frame_rate = ost->frame_rate;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 877fd670e6..49b9ae232e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -89,6 +89,28 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, 
AVCodecContext *enc_ctx, AVCod
 return target;
 }
 
+static enum AVColorRange choose_color_range(AVStream *st, AVCodecContext 
*enc_ctx, AVCodec *codec, enum AVColorRange target)
+{
+if (codec && codec->color_ranges) {
+const enum AVColorRange *p = codec->color_ranges;
+
+for (; *p != AVCOL_RANGE_UNSPECIFIED; p++) {
+if (*p == target)
+break;
+}
+if (*p == AVCOL_RANGE_UNSPECIFIED) {
+if (target != AVCOL_RANGE_UNSPECIFIED)
+av_log(NULL, AV_LOG_WARNING,
+   "Incompatible color range '%s' for codec '%s', 
auto-selecting color range '%s'\n",
+   av_color_range_name(target),
+   codec->name,
+   av_color_range_name(codec->color_ranges[0]));
+return codec->color_ranges[0];
+}
+}
+return target;
+}
+
 void choose_sample_fmt(AVStream *st, AVCodec *codec)
 {
 if (codec && codec->sample_fmts) {
@@ -127,7 +149,19 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 return av_strdup(av_get_pix_fmt_name(ost->enc_ctx->pix_fmt));
 }
 if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
-return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, 
ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)));
+AVIOContext *s = NULL;
+uint8_t *ret;
+int len;
+
+if (avio_open_dyn_buf() < 0)
+exit_program(1);
+
+avio_printf(s, "%s:%s", av_get_pix_fmt_name(choose_pixel_fmt(ost->st, 
ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)),
+
av_color_range_name(choose_color_range(ost->st, ost->enc_ctx, ost->enc, 
ost->enc_ctx->color_range)));
+
+len = avio_close_dyn_buf(s, );
+ret[len] = 0;
+return ret;
 } else if (ost->enc && ost->enc->pix_fmts) {
 const enum AVPixelFormat *p;
 AVIOContext *s = NULL;
@@ -144,7 +178,20 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 
 for (; *p != AV_PIX_FMT_NONE; p++) {
 const char *name = av_get_pix_fmt_name(*p);
-avio_printf(s, "%s|", name);
+avio_printf(s, "%s", name);
+if (*(p + 1) != AV_PIX_FMT_NONE)
+avio_printf(s, "|");
+else
+avio_printf(s, ":");
+}
+
+if (ost->enc->color_ranges) {
+const enum AVColorRange *c = ost->enc->color_ranges;
+
+for (; *c != AVCOL_RANGE_UNSPECIFIED; c++) {
+const char *name = av_color_range_name(*c);
+avio_printf(s, "%s|", name);
+}
 }
 len = avio_close_dyn_buf(s, );
 ret[len - 1] = 0;
@@ -777,10 +824,11 @@ static int configure_input_video_filter(FilterGraph *fg, 
InputFilter *ifilter,
 av_bprint_init(, 0, 1);
 av_bprintf(,
  "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
- "pixel_aspect=%d/%d:sws_param=flags=%d",
+ "pixel_aspect=%d/%d:sws_param=flags=%d:color_range=%s",
  ifilter->width, ifilter->height, ifilter->format,
  tb.num, tb.den, sar.num, sar.den,
- SWS_BILINEAR + 

[FFmpeg-devel] [PATCH 11/24] avcodec/mjpegdec: remove YUVJ pixel format usage

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mjpegdec.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 55676d8576..160bbfd34b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2415,12 +2415,9 @@ the_end:
 
 if (AV_RB32(s->upscale_h)) {
 int p;
-av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
-   avctx->pix_fmt == AV_PIX_FMT_YUV444P  ||
-   avctx->pix_fmt == AV_PIX_FMT_YUVJ440P ||
+av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUV444P  ||
avctx->pix_fmt == AV_PIX_FMT_YUV440P  ||
avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
-   avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P  ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P16||
avctx->pix_fmt == AV_PIX_FMT_YUVA420P  ||
@@ -2476,14 +2473,10 @@ the_end:
 }
 if (AV_RB32(s->upscale_v)) {
 int p;
-av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
-   avctx->pix_fmt == AV_PIX_FMT_YUV444P  ||
-   avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
+av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV422P  ||
-   avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P  ||
avctx->pix_fmt == AV_PIX_FMT_YUV440P  ||
-   avctx->pix_fmt == AV_PIX_FMT_YUVJ440P ||
avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVA420P  ||
avctx->pix_fmt == AV_PIX_FMT_YUVA420P16||
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 09/24] avcodec/mpeg4videoenc: mark as limited color range only

2017-12-13 Thread Paul B Mahol
lavf-mkv changes only because of metadata.

Signed-off-by: Paul B Mahol 
---
 libavcodec/mpeg4videoenc.c |  1 +
 libavcodec/mpegvideo_enc.c |  4 
 tests/ref/lavf/mkv |  8 
 tests/ref/seek/lavf-mkv| 44 ++--
 4 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 494452c938..80279bb3a2 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1396,6 +1396,7 @@ AVCodec ff_mpeg4_encoder = {
 .encode2= ff_mpv_encode_picture,
 .close  = ff_mpv_encode_end,
 .pix_fmts   = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.color_ranges   = (const enum AVColorRange[]) { AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
 .priv_class = _class,
 };
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index f1f4989231..46a52d3930 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -4864,6 +4864,7 @@ AVCodec ff_h263p_encoder = {
 .close  = ff_mpv_encode_end,
 .capabilities   = AV_CODEC_CAP_SLICE_THREADS,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.color_ranges   = (const enum AVColorRange[]){ AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
 
@@ -4884,6 +4885,7 @@ AVCodec ff_msmpeg4v2_encoder = {
 .encode2= ff_mpv_encode_picture,
 .close  = ff_mpv_encode_end,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.color_ranges   = (const enum AVColorRange[]){ AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
 
@@ -4904,6 +4906,7 @@ AVCodec ff_msmpeg4v3_encoder = {
 .encode2= ff_mpv_encode_picture,
 .close  = ff_mpv_encode_end,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.color_ranges   = (const enum AVColorRange[]){ AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
 
@@ -4924,5 +4927,6 @@ AVCodec ff_wmv1_encoder = {
 .encode2= ff_mpv_encode_picture,
 .close  = ff_mpv_encode_end,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.color_ranges   = (const enum AVColorRange[]){ AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index 0083033958..bd0302b14f 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,6 +1,6 @@
-7c8697c324e8ad79c5ea14364a6c39b8 *./tests/data/lavf/lavf.mkv
-472759 ./tests/data/lavf/lavf.mkv
+80092ba5b6833704dd04bd9f7f75366d *./tests/data/lavf/lavf.mkv
+472766 ./tests/data/lavf/lavf.mkv
 ./tests/data/lavf/lavf.mkv CRC=0xec6c3c68
-9767a3b526d7e56d7400164cb888990c *./tests/data/lavf/lavf.mkv
-320603 ./tests/data/lavf/lavf.mkv
+b919b159a2dd7c9c7cd45cc36f204754 *./tests/data/lavf/lavf.mkv
+320610 ./tests/data/lavf/lavf.mkv
 ./tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index cea34e99ac..368e86cd14 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:834 size:   
208
+ret: 0 st: 1 flags:1 dts: 0.00 pts: 0.00 pos:841 size:   
208
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:   1050 size: 
27837
+ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:   1057 size: 
27837
 ret: 0 st:-1 flags:1  ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292476 size: 
27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292483 size: 
27834
 ret: 0 st: 0 flags:0  ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292476 size: 
27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292483 size: 
27834
 ret: 0 st: 0 flags:1  ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:   1050 size: 
27837
+ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:   1057 size: 
27837
 ret:-1 st: 1 flags:0  ts: 2.577000
 ret: 0 st: 1 flags:1  ts: 1.471000
-ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320317 size:   
209
+ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320324 size:   
209
 ret: 0 st:-1 flags:0  ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147023 size: 
27925
+ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147030 size: 
27925
 ret: 0 st:-1 flags:1  ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:   1050 size: 

[FFmpeg-devel] [PATCH 08/24] avcodec/proresenc: prores supports limited color range only

2017-12-13 Thread Paul B Mahol
Add .color_range field to encoder's AVCodec struct.

Signed-off-by: Paul B Mahol 
---
 libavcodec/proresenc_anatoliy.c | 2 ++
 libavcodec/proresenc_kostya.c   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 0516066163..cb86d2df44 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -611,6 +611,7 @@ AVCodec ff_prores_aw_encoder = {
 .close  = prores_encode_close,
 .encode2= prores_encode_frame,
 .pix_fmts   = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, 
AV_PIX_FMT_NONE},
+.color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED},
 .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
 .profiles   = profiles
 };
@@ -625,6 +626,7 @@ AVCodec ff_prores_encoder = {
 .close  = prores_encode_close,
 .encode2= prores_encode_frame,
 .pix_fmts   = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, 
AV_PIX_FMT_NONE},
+.color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED},
 .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
 .profiles   = profiles
 };
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 149dc81b3c..807f9c9c84 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1367,5 +1367,6 @@ AVCodec ff_prores_ks_encoder = {
   AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
   AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
   },
+.color_ranges   = (const enum AVColorRange[]){ AVCOL_RANGE_MPEG, 
AVCOL_RANGE_UNSPECIFIED },
 .priv_class = _class,
 };
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 06/24] avcodec/pngdec: set full color range only for gray formats

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/pngdec.c| 8 ++--
 tests/ref/fate/api-png-codec-param | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f93f200bb1..dbf986de50 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -641,9 +641,11 @@ static int decode_idat_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 } else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 
8) &&
 s->color_type == PNG_COLOR_TYPE_GRAY) {
 avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+avctx->color_range = AVCOL_RANGE_JPEG;
 } else if (s->bit_depth == 16 &&
 s->color_type == PNG_COLOR_TYPE_GRAY) {
 avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
+avctx->color_range = AVCOL_RANGE_JPEG;
 } else if (s->bit_depth == 16 &&
 s->color_type == PNG_COLOR_TYPE_RGB) {
 avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
@@ -658,9 +660,11 @@ static int decode_idat_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 } else if (s->bit_depth == 8 &&
 s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
 avctx->pix_fmt = AV_PIX_FMT_YA8;
+avctx->color_range = AVCOL_RANGE_JPEG;
 } else if (s->bit_depth == 16 &&
 s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
 avctx->pix_fmt = AV_PIX_FMT_YA16BE;
+avctx->color_range = AVCOL_RANGE_JPEG;
 } else {
 avpriv_report_missing_feature(avctx,
   "Bit depth %d color type %d",
@@ -680,10 +684,12 @@ static int decode_idat_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 
 case AV_PIX_FMT_GRAY8:
 avctx->pix_fmt = AV_PIX_FMT_YA8;
+avctx->color_range = AVCOL_RANGE_JPEG;
 break;
 
 case AV_PIX_FMT_GRAY16BE:
 avctx->pix_fmt = AV_PIX_FMT_YA16BE;
+avctx->color_range = AVCOL_RANGE_JPEG;
 break;
 
 default:
@@ -1575,8 +1581,6 @@ static av_cold int png_dec_init(AVCodecContext *avctx)
 {
 PNGDecContext *s = avctx->priv_data;
 
-avctx->color_range = AVCOL_RANGE_JPEG;
-
 s->avctx = avctx;
 s->previous_picture.f = av_frame_alloc();
 s->last_picture.f = av_frame_alloc();
diff --git a/tests/ref/fate/api-png-codec-param 
b/tests/ref/fate/api-png-codec-param
index c6ea7c6296..a04b77fa43 100644
--- a/tests/ref/fate/api-png-codec-param
+++ b/tests/ref/fate/api-png-codec-param
@@ -115,7 +115,7 @@ stream=0, decode=0
 color_primaries=2
 color_trc=2
 colorspace=2
-color_range=2
+color_range=0
 chroma_sample_location=0
 log_level_offset=0
 slices=0
@@ -254,7 +254,7 @@ stream=0, decode=1
 color_primaries=2
 color_trc=2
 colorspace=2
-color_range=2
+color_range=0
 chroma_sample_location=0
 log_level_offset=0
 slices=0
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 10/24] avcodec/mjpegdec: replace YUVJ pixel formats

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mjpegdec.c| 18 +-
 libavcodec/tdsc.c|  2 +-
 tests/fate/vcodec.mak|  4 ++--
 tests/ref/fate/api-mjpeg-codec-param |  4 ++--
 tests/ref/fate/exif-image-embedded   |  2 +-
 tests/ref/fate/exif-image-jpg|  2 +-
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index e005dd0cd3..55676d8576 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -467,7 +467,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && 
s->component_id[2] == 'A') {
 s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : 
AV_PIX_FMT_GBRP16;
 } else {
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 else  s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
 }
@@ -509,7 +509,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x22122100:
 case 0x21211100:
 case 0x22211200:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
@@ -517,7 +517,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x1100:
 case 0x22112200:
 case 0x1100:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
@@ -549,7 +549,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 } else {
 if (pix_fmt_id == 0x1400)
 s->upscale_v[1] = s->upscale_v[2] = 1;
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV440P;
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
@@ -562,7 +562,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 goto unk_pixfmt;
 s->upscale_h[0] = s->upscale_h[1] = 1;
 } else {
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 else  s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
 }
@@ -570,13 +570,13 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x3100:
 if (s->bits > 8)
 goto unk_pixfmt;
-s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : 
AV_PIX_FMT_YUVJ444P;
+s->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
 s->upscale_h[1] = s->upscale_h[2] = 2;
 break;
 case 0x22121100:
 case 0x22111200:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
@@ -584,7 +584,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x2200:
 case 0x4200:
 case 0x2400:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 else  s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
 if (pix_fmt_id == 0x4200) {
@@ -598,7 +598,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 }
 break;
 case 0x4100:
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P;
+if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUV411P;
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c
index 4182404cf0..af92ef6ccc 100644
--- a/libavcodec/tdsc.c
+++ b/libavcodec/tdsc.c
@@ -357,7 +357,7 @@ static int 

[FFmpeg-devel] [PATCH 05/24] avfilter/vf_scale: make use of color_range from filter links

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/vf_scale.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 9f45032e85..802f841cc3 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -303,9 +303,15 @@ static int config_props(AVFilterLink *outlink)
 if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
 av_opt_set_int(*s, "src_range",
scale->in_range == AVCOL_RANGE_JPEG, 0);
+else
+av_opt_set_int(*s, "src_range",
+   inlink->color_range == AVCOL_RANGE_JPEG, 0);
 if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
 av_opt_set_int(*s, "dst_range",
scale->out_range == AVCOL_RANGE_JPEG, 0);
+   else
+av_opt_set_int(*s, "dst_range",
+   outlink->color_range == AVCOL_RANGE_JPEG, 0);
 
 if (scale->opts) {
 AVDictionaryEntry *e = NULL;
@@ -416,6 +422,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 if(   in->width  != link->w
|| in->height != link->h
|| in->format != link->format
+   || in->color_range != link->color_range
|| in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || 
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num) {
 int ret;
 
@@ -429,6 +436,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 link->dst->inputs[0]->format = in->format;
 link->dst->inputs[0]->w  = in->width;
 link->dst->inputs[0]->h  = in->height;
+link->dst->inputs[0]->color_range = in->color_range;
 
 link->dst->inputs[0]->sample_aspect_ratio.den = 
in->sample_aspect_ratio.den;
 link->dst->inputs[0]->sample_aspect_ratio.num = 
in->sample_aspect_ratio.num;
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 03/24] avfilter/buffersrc: recognize color_range as additonal parameter and set it to input link

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/buffersrc.c | 18 ++
 libavfilter/buffersrc.h |  5 +
 2 files changed, 23 insertions(+)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index cd56f8ca45..51a1a9fb49 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -52,6 +52,7 @@ typedef struct BufferSourceContext {
 int   w, h;
 enum AVPixelFormat  pix_fmt;
 AVRationalpixel_aspect;
+int   color_range;
 char  *sws_param;
 
 AVBufferRef *hw_frames_ctx;
@@ -109,6 +110,8 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, 
AVBufferSrcParameters *par
 s->h = param->height;
 if (param->sample_aspect_ratio.num > 0 && 
param->sample_aspect_ratio.den > 0)
 s->pixel_aspect = param->sample_aspect_ratio;
+if (param->color_range > AVCOL_RANGE_UNSPECIFIED)
+s->color_range = param->color_range;
 if (param->frame_rate.num > 0 && param->frame_rate.den > 0)
 s->frame_rate = param->frame_rate;
 if (param->hw_frames_ctx) {
@@ -279,6 +282,11 @@ static av_cold int init_video(AVFilterContext *ctx)
 return AVERROR(EINVAL);
 }
 
+if (!av_color_range_name(c->color_range)) {
+av_log(ctx, AV_LOG_ERROR, "Invalid color_range parameter provided.\n");
+return AVERROR(EINVAL);
+}
+
 if (!(c->fifo = av_fifo_alloc(sizeof(AVFrame*
 return AVERROR(ENOMEM);
 
@@ -309,6 +317,15 @@ static const AVOption buffer_options[] = {
 { "time_base", NULL, OFFSET(time_base),
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 { "frame_rate",NULL, OFFSET(frame_rate),   
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 { "sws_param", NULL, OFFSET(sws_param),
AV_OPT_TYPE_STRING,.flags = V },
+{ "color_range",   NULL, OFFSET(color_range),  
AV_OPT_TYPE_INT,  { .i64 = AVCOL_RANGE_UNSPECIFIED }, 0, INT_MAX, V, 
"range" },
+{ "unspecified",   NULL,   0, AV_OPT_TYPE_CONST, 
{.i64=AVCOL_RANGE_UNSPECIFIED},  0, 0, V, "range"},
+{ "unknown",   NULL,   0, AV_OPT_TYPE_CONST, 
{.i64=AVCOL_RANGE_UNSPECIFIED},  0, 0, V, "range"},
+{ "limited",   NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG},  
   0, 0, V, "range"},
+{ "tv",NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG},  
   0, 0, V, "range"},
+{ "mpeg",  NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG},  
   0, 0, V, "range"},
+{ "full",  NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG},  
   0, 0, V, "range"},
+{ "pc",NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG},  
   0, 0, V, "range"},
+{ "jpeg",  NULL,   0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG},  
   0, 0, V, "range"},
 { NULL },
 };
 
@@ -434,6 +451,7 @@ static int config_props(AVFilterLink *link)
 link->w = c->w;
 link->h = c->h;
 link->sample_aspect_ratio = c->pixel_aspect;
+link->color_range = c->color_range;
 
 if (c->hw_frames_ctx) {
 link->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx);
diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h
index 0652113f2b..7129db6bd9 100644
--- a/libavfilter/buffersrc.h
+++ b/libavfilter/buffersrc.h
@@ -114,6 +114,11 @@ typedef struct AVBufferSrcParameters {
  * Audio only, the audio channel layout
  */
 uint64_t channel_layout;
+
+   /**
+ * Video only
+ */
+enum AVColorRange color_range;
 } AVBufferSrcParameters;
 
 /**
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 04/24] avfilter/buffersink: export color_range from filtergraph output

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/buffersink.c | 1 +
 libavfilter/buffersink.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 0f87b5439a..897396cac4 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -194,6 +194,7 @@ MAKE_AVFILTERLINK_ACCESSOR(AVRational   , frame_rate
 )
 MAKE_AVFILTERLINK_ACCESSOR(int  , w  )
 MAKE_AVFILTERLINK_ACCESSOR(int  , h  )
 MAKE_AVFILTERLINK_ACCESSOR(AVRational   , sample_aspect_ratio)
+MAKE_AVFILTERLINK_ACCESSOR(enum AVColorRange, color_range)
 
 MAKE_AVFILTERLINK_ACCESSOR(int  , channels   )
 MAKE_AVFILTERLINK_ACCESSOR(uint64_t , channel_layout )
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 21d6bb505b..e6d6504832 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -114,6 +114,7 @@ AVRational   av_buffersink_get_frame_rate  
(const AVFilterContext *c
 int  av_buffersink_get_w   (const AVFilterContext 
*ctx);
 int  av_buffersink_get_h   (const AVFilterContext 
*ctx);
 AVRational   av_buffersink_get_sample_aspect_ratio (const AVFilterContext 
*ctx);
+enum AVColorRange av_buffersink_get_color_range(const AVFilterContext 
*ctx);
 
 int  av_buffersink_get_channels(const AVFilterContext 
*ctx);
 uint64_t av_buffersink_get_channel_layout  (const AVFilterContext 
*ctx);
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 02/24] avfilter/avfilter: add color_range to AVFilterLink struct

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avfilter.c | 2 ++
 libavfilter/avfilter.h | 2 ++
 libavfilter/video.c| 8 +++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b98b32bacb..4a579bb49d 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -336,6 +336,8 @@ int avfilter_config_links(AVFilterContext *filter)
 link->w = inlink->w;
 if (!link->h)
 link->h = inlink->h;
+if (!link->color_range)
+link->color_range = inlink->color_range;
 } else if (!link->w || !link->h) {
 av_log(link->src, AV_LOG_ERROR,
"Video source filters must set their output link's "
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 47546c15e5..40ad28ffd8 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -584,6 +584,8 @@ struct AVFilterLink {
  */
 AVBufferRef *hw_frames_ctx;
 
+enum AVColorRange color_range;///< color range type, video only
+
 #ifndef FF_INTERNAL_FIELDS
 
 /**
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 6f9020b9fe..8f12cb7080 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -43,6 +43,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, 
int h)
 
 AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
 {
+AVFrame *frame = NULL;
 int pool_width = 0;
 int pool_height = 0;
 int pool_align = 0;
@@ -86,7 +87,12 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int 
w, int h)
 }
 }
 
-return ff_frame_pool_get(link->frame_pool);
+frame = ff_frame_pool_get(link->frame_pool);
+if (!frame)
+return NULL;
+frame->color_range = link->color_range;
+
+return frame;
 }
 
 AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 01/24] avcodec: add color_range to AVCodec struct

2017-12-13 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/avcodec.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5db6a81320..be00bad528 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3376,6 +3376,7 @@ typedef struct AVCodec {
 uint8_t max_lowres; ///< maximum value for lowres 
supported by the decoder
 const AVClass *priv_class;  ///< AVClass for the private 
context
 const AVProfile *profiles;  ///< array of recognized profiles, 
or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
+const enum AVColorRange *color_ranges;  ///< array of supported color 
ranges by encoder, or NULL if unknown, array is terminated by 
AVCOL_RANGE_UNSPECIFIED
 
 /*
  * No fields below this line are part of the public API. They
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/af_dcshift.c: Fixed repeated spelling error

2017-12-13 Thread Michael Niedermayer
On Tue, Dec 12, 2017 at 11:31:23AM -0800, Kelly Ledford wrote:
> 'threshhold' should be 'threshold'
> 
> Signed-off-by: Kelly Ledford 
> ---
>  libavfilter/af_dcshift.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)

will apply the patchset

thanks

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] checkasm/vf_hflip : add test for vf_hflip SIMD

2017-12-13 Thread Martin Vignali
>
> Tested on linux/mingw 32/64 x86 and linux mips/arm
>
>
>
> Thanks for comments and testing

Pushed

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


Re: [FFmpeg-devel] [PATCH] avcodec: add properties for lossless to AVCodecParameters

2017-12-13 Thread Rodger Combs


> On May 9, 2016, at 08:28, Hendrik Leppkes  wrote:
> 
> On Mon, May 9, 2016 at 3:26 PM, Derek Buitenhuis
>  wrote:
>> On 5/9/2016 2:22 PM, Paul B Mahol wrote:
>>> Once st->codec is gone, how would this lossless info be gathered back?
>> 
>> As myself and others have said above: decode a frame.
> 
> And before people argue that avformat does this anyway today - one of
> the hopes is to make it stop doing that for many "simple" codecs where
> this is just not necessary, and say a parser could extract all the
> important information with much less overhead.

(necroing old thread because this came up elsewhere)

I can understand the argument that lavf shouldn't return all of this by 
_default_, but not providing a mechanism at all forces a lot of additional 
boilerplate onto the consumer. It'd be convenient to have an API that does the 
equivalent of what avformat_find_stream_info currently does (determine all 
relevant stream information for all streams, either using parsers or decoders 
as necessary, running through as many frames as necessary to gather the info, 
up to timestamp- and size-based limits).
If you don't think this fits well in lavf, there could be a higher-level lib on 
top of lavf+lavc that handles this sort of thing (potentially the 
"ffmpeg.c-as-a-library" concept I've thought about for a while, with 
ffprobe-like functionality as well), but the simplest way to do it is just to 
have avformat_find_stream_info continue to perform that function, perhaps 
behind a "gather more info than what lavf itself needs" flag.

> 
> - Hendrik
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/3] lavf/utils: add flag to discard timestamps on corrupted frames

2017-12-13 Thread Rodger Combs


> On Dec 10, 2017, at 09:27, Michael Niedermayer  wrote:
> 
> On Sun, Dec 10, 2017 at 05:17:44AM -0600, Rodger Combs wrote:
>> 
>> 
>>> On Dec 9, 2017, at 12:19, Michael Niedermayer  
>>> wrote:
>>> 
>>> On Fri, Dec 08, 2017 at 10:34:39PM -0600, Rodger Combs wrote:
 
 
> On Dec 8, 2017, at 11:06, Michael Niedermayer  
> wrote:
> 
> On Thu, Dec 07, 2017 at 10:23:15PM -0600, Rodger Combs wrote:
>> ---
>> libavformat/avformat.h  | 1 +
>> libavformat/options_table.h | 1 +
>> libavformat/utils.c | 8 
>> 3 files changed, 10 insertions(+)
>> 
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index 4f2798a871..d10d583dff 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -1450,6 +1450,7 @@ typedef struct AVFormatContext {
>> #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate 
>> seeks for some formats
>> #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the 
>> shortest stream stops.
>> #define AVFMT_FLAG_AUTO_BSF   0x20 ///< Add bitstream filters as 
>> requested by the muxer
>> +#define AVFMT_FLAG_DISCARD_CORRUPT_TS 0x40 ///< Discard timestamps 
>> of frames marked corrupt
>> 
>>   /**
>>* Maximum size of the data read from input for determining
>> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
>> index b8fa47c6fd..515574d3e0 100644
>> --- a/libavformat/options_table.h
>> +++ b/libavformat/options_table.h
>> @@ -58,6 +58,7 @@ static const AVOption avformat_options[] = {
>> {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, 
>> { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
>> {"shortest", "stop muxing with the shortest stream", 0, 
>> AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
>> {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { 
>> .i64 = AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
>> +{"discardcorruptts", "discard timestamps on corrupted frames", 0, 
>> AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_DISCARD_CORRUPT_TS }, 0, 0, E, 
>> "fflags" },
>> {"analyzeduration", "specify how many microseconds are analyzed to probe 
>> the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 
>> }, 0, INT64_MAX, D},
>> {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 
>> 0}, 0, 0, D},
>> {"indexmem", "max memory used for timestamp index (per stream)", 
>> OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 84e49208b8..98af941e9f 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
> 
>> @@ -873,6 +873,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket 
>> *pkt)
>>   st->cur_dts = wrap_timestamp(st, st->cur_dts);
>>   }
>> 
>> +if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT_TS) &&
>> +(pkt->flags & AV_PKT_FLAG_CORRUPT)) {
>> +pkt->pts = pkt->dts = AV_NOPTS_VALUE;
>> +av_log(s, AV_LOG_WARNING,
>> +   "Discarded timestamp on corrupted packet (stream = 
>> %d)\n",
>> +   pkt->stream_index);
>> +}
> 
> how many of the cases that set AV_PKT_FLAG_CORRUPT can even be due to
> the timestamp ?
 
 Pretty much just the new TEI check, or potentially other CRC checks. I 
 don't _think_ the continuity-counter check failing could indicate an 
 incorrect timestamp. I suppose we could add a second flag just for 
 corruption that could affect timestamps?
>>> 
>>> I think thats a great idea, maybe if we already change it we should
>>> also split the truncated case out as it is very common.
>>> 
>>> AV_PKT_FLAG_DATA_CORRUPT// the packet data may be corrupted
>>> AV_PKT_FLAG_DATA_TRUNCATED  // the packet size may be 
>>> corrupted, data available is undamaged unless another flag indicates 
>>> otherwise. Any headers or sub-packets which are complete are non corrupted-
>>> AV_PKT_FLAG_TS_CORRUPT  // the packets timestamps and or 
>>> duration may be corrupted
>>> 
>>> #define AV_PKT_FLAG_CORRUPT (AV_PKT_FLAG_DATA_CORRUPT | 
>>> AV_PKT_FLAG_DATA_TRUNCATED | AV_PKT_FLAG_TS_CORRUPT)
>> 
>> What kind of API bump would be needed to make this kind of change?
> 
> IIUC we are still within the major bump thing (didnt check but others
> have said it in relation to other changes)
> 
> a minor bump should probably be done anyway to signal that these
> additional flag may be set in the output

Come to think of it, I think a major bump would be required, as this would 
break ABI (applications checking for 

[FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open SRT protocol

2017-12-13 Thread Nablet Developer
protocol requires libsrt (https://github.com/Haivision/srt) to be
installed

Signed-off-by: Nablet Developer 
---
 configure   |  10 +
 doc/protocols.texi  | 116 +
 libavformat/Makefile|   1 +
 libavformat/opensrt.c   | 622 
 libavformat/protocols.c |   1 +
 5 files changed, 750 insertions(+)
 create mode 100644 libavformat/opensrt.c

diff --git a/configure b/configure
index d5bbb5b..b26c60f 100755
--- a/configure
+++ b/configure
@@ -293,6 +293,7 @@ External library support:
   --enable-opengl  enable OpenGL rendering [no]
   --enable-openssl enable openssl, needed for https support
if gnutls is not used [no]
+  --enable-opensrt enable Haivision Open SRT protocol [no]
   --disable-sndio  disable sndio support [autodetect]
   --disable-schannel   disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used 
[autodetect]
@@ -1638,6 +1639,7 @@ EXTERNAL_LIBRARY_LIST="
 mediacodec
 openal
 opengl
+opensrt
 "
 
 HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -3145,6 +3147,8 @@ libsmbclient_protocol_deps="libsmbclient gplv3"
 libssh_protocol_deps="libssh"
 mmsh_protocol_select="http_protocol"
 mmst_protocol_select="network"
+opensrt_protocol_select="network"
+opensrt_protocol_deps="opensrt"
 rtmp_protocol_conflict="librtmp_protocol"
 rtmp_protocol_select="tcp_protocol"
 rtmp_protocol_suggest="zlib"
@@ -5972,6 +5976,8 @@ enabled omx   && require_header OMX_Core.h
 enabled omx_rpi   && { check_header OMX_Core.h ||
{ ! enabled cross_compile && add_cflags 
-isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
die "ERROR: OpenMAX IL headers not found"; } && 
enable omx
+#enabled opensrt   && check_lib srt srt/srt.h srt_socket -lsrt
+enabled opensrt   && require_pkg_config libsrt "srt >= 1.2.0" 
srt/srt.h srt_socket
 enabled openssl   && { check_pkg_config openssl openssl openssl/ssl.h 
OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h 
SSL_library_init ||
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto ||
@@ -6026,6 +6032,10 @@ if enabled decklink; then
 esac
 fi
 
+if enabled opensrt; then
+opensrt_protocol_extralibs="$opensrt_protocol_extralibs -lsrt"
+fi
+
 enabled securetransport &&
 check_func SecIdentityCreate "-Wl,-framework,CoreFoundation 
-Wl,-framework,Security" &&
 check_lib securetransport "Security/SecureTransport.h Security/Security.h" 
"SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 8661aea..358366e 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -752,6 +752,122 @@ Set the workgroup used for making connections. By default 
workgroup is not speci
 
 For more information see: @url{http://www.samba.org/}.
 
+@section srt
+
+Haivision Secure Reliable Transport Protocol via libsrt.
+
+The required syntax for a SRT url is:
+@example
+srt://@var{hostname}:@var{port}[?@var{options}]
+@end example
+
+@var{options} contains a list of &-separated options of the form
+@var{key}=@var{val}.
+
+This protocol accepts the following options.
+
+@table @option
+@item conntimeo=@var{milliseconds}
+Connection timeout, in milliseconds. SRT cannot connect for RTT > 1500 msec
+(2 handshake exchanges) with the default connect timeout of 3 seconds. This 
option
+applies to the caller and rendezvous connection modes. The connect timeout is 
10 times
+the value set for the rendezvous mode (which can be used as a workaround for 
this
+connection problem with earlier versions).
+
+@item fc=@var{bytes}
+Flight Flag Size (Window Size), in bytes. FC is actually an internal parameter 
and
+you should set it to not less than @option{recv_buffer_size} and @option{mss}.
+The default value is relatively large, therefore unless you set a very large
+receiver buffer, you do not need to change this option. Default value is 25600.
+
+@item inputbw=@var{bytes/seconds}
+Sender nominal input rate, in bytes per seconds. Used along with 
@option{oheadbw},
+when @option{maxbw} is set to relative (0), to calculate maximum sending rate 
when
+recovery packets are sent along with main media stream:
+@option{inputbw} * (100 + @option{oheadbw}) / 100
+if @option{inputbw} is not set while @option{maxbw} is set to relative (0), 
the actual
+ctual input rate is evaluated inside the library. Default value is 0.
+
+@item iptos=@var{tos}
+IP Type of Service. Applies to sender only. Default value is 0xB8.
+
+@item ipttl=@var{ttl}
+IP Time To Live. Applies to sender only. Default value is 64.
+
+@item listen_timeout=@var{milliseconds}
+Set listen timeout, expressed in milliseconds.
+
+@item maxbw=@var{bytes/seconds}

[FFmpeg-devel] [PATCH] libavformat/opensrt: add Haivision Open SRT protocol

2017-12-13 Thread Nablet Developer
The protocol is used by thousands of Haivision customers since 2013,
in extremely sensitive medical, military and enterprise applications
with FIPS compliant encryption requirements. Since April 2017, the protocol
is Open Source and meanwhile >50 partners joined the SRT Alliance 
(srtalliance.org).
GStreamer already integrated the protocol and VLC has already accepted the pull
request for adding the SRT protocol to VLC. We see a dramatic adoption of the
protocol in the market and a lot of our partners are asking us frequently on a
ffmpeg integration.

Nablet Developer (1):
  avformat/opensrt: add Haivision Open SRT protocol

 configure   |  10 +
 doc/protocols.texi  | 116 +
 libavformat/Makefile|   1 +
 libavformat/opensrt.c   | 622 
 libavformat/protocols.c |   1 +
 5 files changed, 750 insertions(+)
 create mode 100644 libavformat/opensrt.c

-- 
2.7.4

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