Re: [FFmpeg-devel] [PATCH 1/3] avcodec/takdec: Fix integer overflows in decode_subframe()

2017-09-24 Thread Michael Niedermayer
On Fri, Sep 22, 2017 at 08:45:26PM +0200, Michael Niedermayer wrote:
> Fixes: runtime error: signed integer overflow: -1562477869 + -691460395 
> cannot be represented in type 'int'
> Fixes: 3196/clusterfuzz-testcase-minimized-4528307146063872
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/takdec.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply patchset

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] [PATCH] fate/fits: add missing png & gif dependencies

2017-09-24 Thread Michael Niedermayer
On Sat, Sep 16, 2017 at 03:24:07AM +0530, Paras Chadha wrote:
> Signed-off-by: Paras Chadha 
> ---
>  tests/fate/demux.mak | 2 +-
>  tests/fate/fits.mak  | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)

will apply

thx

[...]
-- 
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] fate/hapdec : add test for hap alpha only

2017-09-24 Thread Michael Niedermayer
On Sat, Sep 23, 2017 at 09:53:45PM +0200, Martin Vignali wrote:
> Hello,
> 
> sample can be found here :
> https://we.tl/cP0pW9IfBJ
> 
> and need to be put inside ./fate-suite/hap

uploaded

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


Re: [FFmpeg-devel] [PATCH 5/5] lavd: Add KMS frame grabber

2017-09-24 Thread Andy Furniss

Mark Thompson wrote:

On 20/09/17 17:10, Andy Furniss wrote:

Mark Thompson wrote:

On 19/09/17 22:21, Andy Furniss wrote:



That point being around 7k frames it will run out of something.

[AVHWFramesContext @ 0x31ed880] Failed to create surface from DRM object: 2 
(resource allocation failed).
[Parsed_hwmap_0 @ 0x3114c40] Failed to map frame: -5.

I see that memory is reducing before this although I still have spare - is this 
the same issue you explained on users WRT leaking on decode?


Yeah, I also run out of ... something ... at around 7200 frames.  It's not fds 
or memory.  I don't think it's the buffer problem (which, incidentally, should 
finally be fixable sensibly in libva2 soon), because that ended up manifesting 
as leaking memory.  It's also not a problem for Intel (I've already been 
running that for a long time to test).  Maybe some other sort of handle on the 
Mesa side?  I'll investigate further tomorrow.


Leo has fixed the leak.


Yep, checked with the updated Mesa postproc patches + libva2 fixes and it all 
looks good now.  (And colours are even correct, yay!  I still need to look into 
why the default comes out wrong with the postproc bits for that on Intel...)


One thing that comes out in testing the patches WRT postproc is that for 
deinterlace 1080i25 -> 1080p50 there is an issue with the surface size 
being 1088.
This means the result gets scaled to 1088. It is possible to put scale 
after to get 1080, but this seems sub-optimal, costs about 8% perf and 
hypothetical quality issue (not that I could see it).


Apparently vaapi_scale does things differently and the driver is set for 
that way, so changing in the driver will break scale.


AFAICT this is orthogonal to the 1080/1088 encode issue discussed long 
ago where ffmpeg is doing the right thing, that should be fixable in the 
driver.


This case can be demonstrated with 1920x1080 nv12 hwupload -> deint -> 
hwdownload, so no chance for h26x cropping info being used.

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


Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs

2017-09-24 Thread pkv.stream

Hi atomnuker and others

I am interested in working on this patch by atomnuker who did a great job.

This could allow encoding to more channels with aac (e.g. ambisonics 
order three = 16 audio channels).


Here's a report about additions I made to the PCE table for all the 
basic ffmpeg channel layouts (except mixed stereo).


I have followed atomnuker assumptions for the guess work, notably 
regarding indexes (which seems right, I saw on spec an example with 
indexes running like 0 1 0 so ithe indexing seems to reset , quite 
probably for each group of either, front, side, back or LFE channels in 
the PCE).


I have done some testing:

encoding goes without fuss up to 16 channels. No warning, no error.

But, ffmpeg aac decoder is throwing errors in aacdec_template.c :

lines 3119-3124:

    if (elem_type < TYPE_DSE) {
    if (!(che=get_che(ac, elem_type, elem_id))) {
    av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d 
is not allocated\n",

   elem_type, elem_id);
    err = AVERROR_INVALIDDATA;
    goto fail;

error message is:

channel element 0.0 is not allocated

So the get_che function is failing.

Can't tell yet if this is an issue with the encoder or with the decoder.

*atomnuker: *do you remember if could you decode with ffmpeg the files 
you produced with the layouts in your original patch ? I haven't tried 
with other decoders. Libfdk_aac decoder provides for channel =0 
directing to a pce. Didn't find that in the ffmpeg aac decoder (haven't 
searched too much though)


Best

pkv




From dba1cef5d1aee3d26c35a6fa429a11a6039d4844 Mon Sep 17 00:00:00 2001
From: pkviet 
Date: Sun, 24 Sep 2017 16:11:17 +0200
Subject: [PATCH] avcodec/aacenc: more multichannels layouts added to pce

Add most ffmpeg channel layouts to the pce table by atomnuker. WIP. Encodes 
without errors up to 16 channels in aac but the files throw errors with ffmpeg 
aac decoder. Don't know yet if issue is with encoder or with decoder.
---
 libavcodec/aacenc.c |   2 +-
 libavcodec/aacenc.h | 184 
 2 files changed, 185 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 2996996..faa0684 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -565,7 +565,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 return 0;
 }
 
-copy_input_samples(s, frame);
+   copy_input_samples(s, frame);
 if (s->psypp)
 ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
 
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 346d989..ce2202d 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -116,6 +116,22 @@ static const AACPCEInfo aac_pce_configs[] = {
 .config_map = { 1, TYPE_CPE, },
 .reorder_map = { 0, 1 },
 },
+   {
+   .layout = AV_CH_LAYOUT_2POINT1,
+   .num_ele = { 1, 0, 0, 1 },
+   .pairing = { { 1 }, },
+   .index = { { 0 }, { 0 }, { 0 }, { 0 } },
+   .config_map = { 2, TYPE_CPE, TYPE_LFE},
+   .reorder_map = { 0, 1, 2 },
+   },
+   {
+   .layout = AV_CH_LAYOUT_2_1,
+   .num_ele = { 1, 0, 1, 0 },
+   .pairing = { { 1 }, { 0 }, { 0 } },
+   .index = { { 0 }, { 0 }, { 0 }, },
+   .config_map = { 2, TYPE_CPE, TYPE_SCE },
+   .reorder_map = { 0, 1, 2 },
+   },
 {
 .layout = AV_CH_LAYOUT_SURROUND,
 .num_ele = { 2, 0, 0, 0 },
@@ -124,6 +140,14 @@ static const AACPCEInfo aac_pce_configs[] = {
 .config_map = { 2, TYPE_SCE, TYPE_CPE },
 .reorder_map = { 2, 0, 1 },
 },
+   {
+   .layout = AV_CH_LAYOUT_3POINT1,
+   .num_ele = { 2, 0, 0, 1 },
+   .pairing = { { 1, 0 }, },
+   .index = { { 0, 1 }, { 0 }, { 0 }, { 0 }, },
+   .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_LFE },
+   .reorder_map = { 2, 0, 1, 3 },
+   },
 {
 .layout = AV_CH_LAYOUT_4POINT0,
 .num_ele = { 2, 0, 1, 0 },
@@ -132,6 +156,166 @@ static const AACPCEInfo aac_pce_configs[] = {
 .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_SCE },
 .reorder_map = { 2, 0, 1, 3 },
 },
+   {
+   .layout = AV_CH_LAYOUT_4POINT1,
+   .num_ele = { 2, 0, 1, 1 },
+   .pairing = { { 1, 0 }, { 0 }, { 0 }, },
+   .index = { { 0, 1 }, { 0 }, { 0 }, { 0 } },
+   .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+   .reorder_map = { 2, 0, 1, 4, 3 },
+   },
+   {
+   .layout = AV_CH_LAYOUT_2_2,
+   .num_ele = { 1, 1, 0, 0 },
+   .pairing = { { 1 }, { 1 }, },
+   .index = { { 0 }, { 0 }, },
+   .config_map = { 2, TYPE_CPE, TYPE_CPE },
+   .reorder_map = { 0, 1, 2, 3 },
+ 

Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs

2017-09-24 Thread pkv.stream

link to original thread:

http://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/200566.html


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


Re: [FFmpeg-devel] [PATCH] avformat/libopenmpt: Query duration and metadata after selecting subsong

2017-09-24 Thread Jörn Heusipp


On 09/17/2017 03:35 PM, Jörn Heusipp wrote:

Duration depends on the selected subsong and thus must be queried after
selecting the subsong. There is no compelling reason to query other
metadata earlier either.

Signed-off-by: Jörn Heusipp 
---


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


Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs

2017-09-24 Thread Rostislav Pehlivanov
On 24 September 2017 at 15:27, pkv.stream  wrote:

> Hi atomnuker and others
>
> I am interested in working on this patch by atomnuker who did a great job.
>
> This could allow encoding to more channels with aac (e.g. ambisonics order
> three = 16 audio channels).
>
> Here's a report about additions I made to the PCE table for all the basic
> ffmpeg channel layouts (except mixed stereo).
>
> I have followed atomnuker assumptions for the guess work, notably
> regarding indexes (which seems right, I saw on spec an example with indexes
> running like 0 1 0 so ithe indexing seems to reset , quite probably for
> each group of either, front, side, back or LFE channels in the PCE).
>
> I have done some testing:
>
> encoding goes without fuss up to 16 channels. No warning, no error.
>
> But, ffmpeg aac decoder is throwing errors in aacdec_template.c :
>
> lines 3119-3124:
>
> if (elem_type < TYPE_DSE) {
> if (!(che=get_che(ac, elem_type, elem_id))) {
> av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is
> not allocated\n",
>elem_type, elem_id);
> err = AVERROR_INVALIDDATA;
> goto fail;
>
> error message is:
>
> channel element 0.0 is not allocated
>
> So the get_che function is failing.
>
>
Of course it isn't going to work, I explicitly told you 1.) its a wip patch
so no real error reporting and 2.) you need to add a new entry for whatever
messed up channel layout ambisonics use and make sure the signalling
indices are correct. And the latter isn't easy since nothing tells you
what's correct - the spec, a decoder or anything like that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] aacenc: WIP support for PCEs

2017-09-24 Thread pkv.stream


Le 24/09/2017 à 5:06 PM, Rostislav Pehlivanov a écrit :

On 24 September 2017 at 15:27, pkv.stream  wrote:


Hi atomnuker and others

I am interested in working on this patch by atomnuker who did a great job.

This could allow encoding to more channels with aac (e.g. ambisonics order
three = 16 audio channels).

Here's a report about additions I made to the PCE table for all the basic
ffmpeg channel layouts (except mixed stereo).

I have followed atomnuker assumptions for the guess work, notably
regarding indexes (which seems right, I saw on spec an example with indexes
running like 0 1 0 so ithe indexing seems to reset , quite probably for
each group of either, front, side, back or LFE channels in the PCE).

I have done some testing:

encoding goes without fuss up to 16 channels. No warning, no error.

But, ffmpeg aac decoder is throwing errors in aacdec_template.c :

lines 3119-3124:

 if (elem_type < TYPE_DSE) {
 if (!(che=get_che(ac, elem_type, elem_id))) {
 av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is
not allocated\n",
elem_type, elem_id);
 err = AVERROR_INVALIDDATA;
 goto fail;

error message is:

channel element 0.0 is not allocated

So the get_che function is failing.



Of course it isn't going to work, I explicitly told you 1.) its a wip patch
so no real error reporting and 2.) you need to add a new entry for whatever
messed up channel layout ambisonics use and make sure the signalling
indices are correct. And the latter isn't easy since nothing tells you
what's correct - the spec, a decoder or anything like that.

I understand.
I did get though a decode of pce 4.0  or quad with vlc (downmixed to 
stereo by my sound card). In contrast ffmpeg aac decoder throws the 
error I mentioned (in ffmpeg and ffplay).

So already your pce code is not doing a bad job.
My point is maybe faad2 is perhaps implementing pce decode better than 
ffmpeg own aac decoder.
Or your pce implementation might miss something that faad2 works around. 
I'll inquire and post if I find something useful for getting functional 
pce.



___
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] libavcodec/hapdec : add support for HapAphaOnly decoding

2017-09-24 Thread Michael Niedermayer
On Sat, Sep 23, 2017 at 09:52:50PM +0200, Martin Vignali wrote:
> Sorry, i made a mistake in the previous patchs
> 
> Correct patchs in attach

will apply

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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/2] movenc: Add an option for enabling negative CTS offsets

2017-09-24 Thread Michael Niedermayer
On Sat, Sep 23, 2017 at 06:44:44PM +0300, Jan Ekström wrote:
> From: Martin Storsjö 
> 
> This reduces the need for an edit list; streams that start with
> e.g. dts=-1, pts=0 can be encoded as dts=0, pts=0 (which is valid
> in mov/mp4) by shifting the dts values of all packets forward.
> This avoids the need for edit lists for such streams (while they
> still are needed for audio streams with encoder delay).
> 
> This eases conformance with the DASH-IF interoperability guidelines.
> 
> Signed-off-by: Martin Storsjö 
> ---
>  libavformat/movenc.c | 28 
>  libavformat/movenc.h |  2 ++
>  2 files changed, 26 insertions(+), 4 deletions(-)

This is missing a update to the docs

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


[FFmpeg-devel] [PATCH v2] avcodec/hevc_sei: Support HEVC paired fields.

2017-09-24 Thread Brian Matherly
From: Brian Matherly 

Correctly set the interlaced_frame and top_field_first fields when pic_struct
indicates paired fields.
---
 libavcodec/hevc_sei.c |   4 +-
 tests/fate/hevc.mak   |   3 +
 tests/ref/fate/hevc-paired-fields | 120 ++
 3 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/hevc-paired-fields

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index cd55d50..d0f9966 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -137,10 +137,10 @@ static int decode_nal_sei_pic_timing(HEVCSEIContext *s, 
GetBitContext *gb, const
 if (sps->vui.frame_field_info_present_flag) {
 int pic_struct = get_bits(gb, 4);
 h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
-if (pic_struct == 2) {
+if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
 av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
-} else if (pic_struct == 1) {
+} else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
 av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
 }
diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index d23d1ba..a763170 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -225,6 +225,9 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
FATE_HEVC_TEST_444_12BIT,$(N
 fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i 
$(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags 
area+accurate_rnd+bitexact
 FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10
 
+fate-hevc-paired-fields: CMD = probeframes 
$(TARGET_SAMPLES)/hevc/paired_fields.hevc
+FATE_HEVC += fate-hevc-paired-fields
+
 tests/data/hevc-mp4.mov: TAG = GEN
 tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/hevc-paired-fields 
b/tests/ref/fate/hevc-paired-fields
new file mode 100644
index 000..53b9cf6
--- /dev/null
+++ b/tests/ref/fate/hevc-paired-fields
@@ -0,0 +1,120 @@
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=0
+pkt_size=229528
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=I
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=296042
+pkt_size=95954
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=391996
+pkt_size=114837
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=506833
+pkt_size=85098
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
-- 
2.7.4


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


[FFmpeg-devel] [PATCH v2] avcodec/hevc_sei: Support HEVC paired fields.

2017-09-24 Thread Brian Matherly
From: Brian Matherly 

Correctly set the interlaced_frame and top_field_first fields when pic_struct
indicates paired fields.
---
 libavcodec/hevc_sei.c |   4 +-
 tests/fate/hevc.mak   |   3 +
 tests/ref/fate/hevc-paired-fields | 120 ++
 3 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/hevc-paired-fields

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index cd55d50..d0f9966 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -137,10 +137,10 @@ static int decode_nal_sei_pic_timing(HEVCSEIContext *s, 
GetBitContext *gb, const
 if (sps->vui.frame_field_info_present_flag) {
 int pic_struct = get_bits(gb, 4);
 h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
-if (pic_struct == 2) {
+if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
 av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
-} else if (pic_struct == 1) {
+} else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
 av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
 }
diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index d23d1ba..a763170 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -225,6 +225,9 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
FATE_HEVC_TEST_444_12BIT,$(N
 fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i 
$(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags 
area+accurate_rnd+bitexact
 FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10
 
+fate-hevc-paired-fields: CMD = probeframes 
$(TARGET_SAMPLES)/hevc/paired_fields.hevc
+FATE_HEVC += fate-hevc-paired-fields
+
 tests/data/hevc-mp4.mov: TAG = GEN
 tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/hevc-paired-fields 
b/tests/ref/fate/hevc-paired-fields
new file mode 100644
index 000..53b9cf6
--- /dev/null
+++ b/tests/ref/fate/hevc-paired-fields
@@ -0,0 +1,120 @@
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=0
+pkt_size=229528
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=I
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=296042
+pkt_size=95954
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=391996
+pkt_size=114837
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=506833
+pkt_size=85098
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
-- 
2.7.4


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


Re: [FFmpeg-devel] [PATCH] avcodec/hevc_sei: Support HEVC paired fields.

2017-09-24 Thread Brian Matherly

On 9/23/2017 5:22 PM, Michael Niedermayer wrote:

On Thu, Sep 14, 2017 at 08:39:19PM -0500, Brian Matherly wrote:

Correctly set frame.interlaced and frame.top_field_first when pic_struct
indicates paired fields.

Do you have a (small) sample that gets fixed by this ?

Can you make a fate test for this case ?

[...]



Thanks Michael,

I submitted a V2 patch (sorry about the double e-mail). V2 includes a 
fate test which uses probeframes. The reason I test probeframes is 
because the pixel data in the frame is exactly the same with/wo the 
patch - and the important part of the test is the value of the 
interlaced_frame and repeat_first_field fields.


The sample file is uploaded to the videolan uploader: paired_fields.hevc
It should be placed in: fate-suite/hevc/paired_fields.hevc

Thanks,

~Brian

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


[FFmpeg-devel] libavcodec/hapdec : add support for hapqa decoding

2017-09-24 Thread Martin Vignali
Hello,

In attach two patchs to add support for hapqa alpha decoding
More info can be found here
https://github.com/Vidvox/hap/blob/master/documentation/HapVideoDRAFT.md

Part 1 :
0006-libavodec-texturedsp-add-rgtc1u_alpha-uncompress-fun

add a new func into texture dsp, in order to decompress rgtc1u only in the
alpha channel

Useful for Hapqa, who use 2 textures : DXT5-YCoCg-scaled for RGB and RGTC1
for alpha
and avoid to use two intermediate frame

Part 2 :
0007-libavcodec-hapdec-add-support-for-hapqa-decoding

This is the modification of the hap decoder
Change are more invasive, that what i expected
but the two texture mode of this codec, need lot of changes in several place

Samples can be found here (create with Quicktime Plugin, an remux using the
official lib,
in order to have the 3 main case of this codec)

https://we.tl/g7YFdpri1P


Need to be apply after patch in discussion
libavcodec/hapdec : add support for HapAphaOnly decoding


Comments Welcome

Martin
Jokyo Images


0006-libavodec-texturedsp-add-rgtc1u_alpha-uncompress-fun.patch
Description: Binary data


0007-libavcodec-hapdec-add-support-for-hapqa-decoding.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] fate/hapdec : add test for hapqa decoding

2017-09-24 Thread Martin Vignali
Hello,

sample can be found here:
https://we.tl/g7YFdpri1P

and need to be put inside ./fate-suite/hap

These files test the 3 main mode of HAPQA
- No snappy compression for both texture
- Snappy 1 chunk for both texture
- Snappy 16 chunks for both texture

The CRC is the same, because the source picture is the same
but the header of the frame of each sample is different


Martin


0008-fate-hapdec-add-test-for-hapqa-decoding.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] fate/cineform : add test for yuv 10b

2017-09-24 Thread Martin Vignali
2017-08-28 17:52 GMT+02:00 Martin Vignali :

>
>
> 2017-03-26 1:17 GMT+01:00 Michael Niedermayer :
>
>> On Sat, Mar 25, 2017 at 02:04:03PM +0100, Martin Vignali wrote:
>> > Hello,
>> >
>> > In attach patch to add fate test for cineform decoder
>> >
>> > Sample can be found here :
>> > https://we.tl/y06cKrKh3a
>> >
>> > there is two sample in the download link
>> > The test is about : cineform_yuv10b_hd.mov
>>
>> uploaded
>>
>>
>> Ping for the patch
>
>
> Ping for the patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavcodec/hapdec : add support for HapAphaOnly decoding

2017-09-24 Thread Carl Eugen Hoyos
2017-09-23 21:49 GMT+02:00 Martin Vignali :

> Following this doc :
> https://github.com/Vidvox/hap/blob/master/documentation/HapVideoDRAFT.md
>
> Hap Alpha Only, is only an rgtc1 texture with or without
> snappy compression

Sorry if I misunderstand:
If the format only contains one layer, why is the pix_fmt
rgb0 and not gray8?

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


Re: [FFmpeg-devel] fate/cineform : add test for yuv 10b

2017-09-24 Thread Carl Eugen Hoyos
2017-03-25 14:04 GMT+01:00 Martin Vignali :

> In attach patch to add fate test for cineform decoder
>
> Sample can be found here :
> https://we.tl/y06cKrKh3a

Looking at #6675, the sample may not be ideal.

But we can of course have more than one sample
for cineform...

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


Re: [FFmpeg-devel] fate/cineform : add test for yuv 10b

2017-09-24 Thread Michael Niedermayer
On Mon, Sep 25, 2017 at 12:10:25AM +0200, Carl Eugen Hoyos wrote:
> 2017-03-25 14:04 GMT+01:00 Martin Vignali :
> 
> > In attach patch to add fate test for cineform decoder
> >
> > Sample can be found here :
> > https://we.tl/y06cKrKh3a
> 
> Looking at #6675, the sample may not be ideal.

if the sample was not used by anything yet then it could be
overwritten by a different sample too


> 
> But we can of course have more than one sample
> for cineform...
> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
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 2/2] avcodec/snowenc: Replace "return -1" by named constants

2017-09-24 Thread Carl Eugen Hoyos
2017-09-23 3:14 GMT+02:00 James Almer :
> On 9/22/2017 10:01 PM, Michael Niedermayer wrote:

>> +if((ret = ff_rate_control_init(&s->m)) < 0)
>> +return ret;
>
> ret = foo();
> if (ret < 0)
> return ret;
>
> No more combined assignment and comparisons for
> new code if possible. It's too prone to mistakes.

This comment looks strange given today's patches from you.

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/snowenc: Replace "return -1" by named constants

2017-09-24 Thread James Almer
On 9/24/2017 8:06 PM, Carl Eugen Hoyos wrote:
> 2017-09-23 3:14 GMT+02:00 James Almer :
>> On 9/22/2017 10:01 PM, Michael Niedermayer wrote:
> 
>>> +if((ret = ff_rate_control_init(&s->m)) < 0)
>>> +return ret;
>>
>> ret = foo();
>> if (ret < 0)
>> return ret;
>>
>> No more combined assignment and comparisons for
>> new code if possible. It's too prone to mistakes.
> 
> This comment looks strange given today's patches from you.
> 
> Carl Eugen

You mean the patch where i did a sed replace of a function name in code
that existed beforehand? I don't think it's the same as manually adding
a brand new case of assignment and comparison in one statement.

Do you want me to split those lines before i push the patch? Guess it
would kill two birds with one stone, so probably worth it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavcodec/hapenc : add support for hap alpha only encoding

2017-09-24 Thread Carl Eugen Hoyos
2017-09-23 23:41 GMT+02:00 Martin Vignali :

> In attach patch for Hap Alpha encoding

Same question as before:
How can 24bit input be encoded into alpha?

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/snowenc: Replace "return -1" by named constants

2017-09-24 Thread Carl Eugen Hoyos
2017-09-25 1:16 GMT+02:00 James Almer :
> On 9/24/2017 8:06 PM, Carl Eugen Hoyos wrote:
>> 2017-09-23 3:14 GMT+02:00 James Almer :
>>> On 9/22/2017 10:01 PM, Michael Niedermayer wrote:
>>
 +if((ret = ff_rate_control_init(&s->m)) < 0)
 +return ret;
>>>
>>> ret = foo();
>>> if (ret < 0)
>>> return ret;
>>>
>>> No more combined assignment and comparisons for
>>> new code if possible. It's too prone to mistakes.
>>
>> This comment looks strange given today's patches from you.

> You mean the patch where i did a sed replace of a function
> name in code that existed beforehand?

Sorry, but I believe using sed here is worse than above
code which is why I hadn't realized you used it.

Please feel free to ignore, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] swscale_unscaled: fix DITHER_COPY macro, use it only for dst_depth == 8

2017-09-24 Thread Carl Eugen Hoyos
2017-09-23 19:18 GMT+02:00 Mateusz :

> In reality -- current version of DITHER_COPY mess
> up the average color tone.

You could explain how we can reproduce this.

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc_sei: Support HEVC paired fields.

2017-09-24 Thread Michael Niedermayer
On Sun, Sep 24, 2017 at 02:36:55PM -0500, Brian Matherly wrote:
> From: Brian Matherly 
> 
> Correctly set the interlaced_frame and top_field_first fields when pic_struct
> indicates paired fields.
> ---
>  libavcodec/hevc_sei.c |   4 +-
>  tests/fate/hevc.mak   |   3 +
>  tests/ref/fate/hevc-paired-fields | 120 
> ++
>  3 files changed, 125 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ref/fate/hevc-paired-fields
> 
> diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> index cd55d50..d0f9966 100644
> --- a/libavcodec/hevc_sei.c
> +++ b/libavcodec/hevc_sei.c
> @@ -137,10 +137,10 @@ static int decode_nal_sei_pic_timing(HEVCSEIContext *s, 
> GetBitContext *gb, const
>  if (sps->vui.frame_field_info_present_flag) {
>  int pic_struct = get_bits(gb, 4);
>  h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
> -if (pic_struct == 2) {
> +if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
>  av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
>  h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
> -} else if (pic_struct == 1) {
> +} else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
>  av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
>  h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
>  }
> diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
> index d23d1ba..a763170 100644
> --- a/tests/fate/hevc.mak
> +++ b/tests/fate/hevc.mak
> @@ -225,6 +225,9 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
> FATE_HEVC_TEST_444_12BIT,$(N
>  fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i 
> $(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags 
> area+accurate_rnd+bitexact
>  FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10
>  
> +fate-hevc-paired-fields: CMD = probeframes 
> $(TARGET_SAMPLES)/hevc/paired_fields.hevc
> +FATE_HEVC += fate-hevc-paired-fields
> +
>  tests/data/hevc-mp4.mov: TAG = GEN
>  tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
>   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \

this is missing a dependancy on ffporbe

running this without ffprobe being build prior:
make -j12 fate-hevc-paired-fields V=2
...
./tests/fate-run.sh: 79: eval: ffprobe: not found



[...]
-- 
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


[FFmpeg-devel] [PATCH 1/4] avcodec/avpacket: add av_packet_copy_side_data()

2017-09-24 Thread James Almer
It's added as a replacemet of av_copy_packet_side_data() using the proper
av_packet_* namespace, and differs from it in the following ways:

- Side data already allocated and copied is properly freed in case of failure.
- The dst packet is unchanged in case of failure instead of being unreffed.

Signed-off-by: James Almer 
---
 doc/APIchanges|  3 +++
 libavcodec/avcodec.h  | 16 
 libavcodec/avpacket.c | 41 +
 libavcodec/version.h  |  4 ++--
 4 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index d06144f1e9..2d3f470186 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-09-xx - xxx - lavc 57.107.100 - avcodec.h
+  Add av_packet_copy_side_data().
+
 2017-xx-xx - xxx - lavu 55.76.100 / 56.6.0 - pixdesc.h
   Add av_color_range_from_name(), av_color_primaries_from_name(),
   av_color_transfer_from_name(), av_color_space_from_name(), and
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 07d9f3e255..655e6abbde 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4624,7 +4624,10 @@ int av_copy_packet(AVPacket *dst, const AVPacket *src);
  * Copy packet side data
  *
  * @return 0 on success, negative AVERROR on fail
+ *
+ * @deprecated Use av_packet_copy_side_data
  */
+attribute_deprecated
 int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
 
 /**
@@ -4664,6 +4667,19 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum 
AVPacketSideDataType type,
 int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
 uint8_t *data, size_t size);
 
+/**
+ * Copy packet side data from src to dst.
+ *
+ * @see av_packet_copy_props
+ * @see av_packet_free_side_data
+ *
+ * @param dst Destination packet
+ * @param src Source packet
+ *
+ * @return 0 on success, a negative AVERROR on error. On failure, dst is 
unchanged.
+ */
+int av_packet_copy_side_data(AVPacket *dst, const AVPacket *src);
+
 /**
  * Shrink the already allocated side data buffer
  *
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index b07180eac8..33e325c9ed 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -582,6 +582,47 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum 
AVPacketSideDataType type,
 return AVERROR(ENOENT);
 }
 
+int av_packet_copy_side_data(AVPacket *dst, const AVPacket *src)
+{
+AVPacketSideData *side_data;
+int i, side_data_elems = 0;
+
+if (!src->side_data_elems)
+return 0;
+
+side_data = av_malloc_array(src->side_data_elems, sizeof(*src->side_data));
+if (!side_data)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < src->side_data_elems; i++) {
+AVPacketSideData *sd_src = &src->side_data[i];
+AVPacketSideData *sd_dst = &side_data[i];
+
+if ((unsigned)sd_src->size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
+goto fail;
+
+sd_dst->data = av_mallocz(sd_src->size + AV_INPUT_BUFFER_PADDING_SIZE);
+if (!sd_dst->data)
+goto fail;
+
+memcpy(sd_dst->data, sd_src->data, sd_src->size);
+sd_dst->size = sd_src->size;
+sd_dst->type = sd_src->type;
+side_data_elems++;
+}
+dst->side_data = side_data;
+dst->side_data_elems = side_data_elems;
+
+return 0;
+
+fail:
+for (i = 0; i < side_data_elems; i++)
+av_free(side_data[i].data);
+av_free(side_data);
+
+return AVERROR(ENOMEM);;
+}
+
 int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
 {
 int i;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e1224752bd..10d9ac4eb3 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR 106
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 107
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 3/4] avformat/movenc: replace use of av_copy_packet_side_data()

2017-09-24 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/movenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index aa0b60c345..0e98b93b2c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -449,7 +449,8 @@ concatenate:
 memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, 
pkt->size);
 info->num_blocks += num_blocks;
 info->pkt.duration += pkt->duration;
-if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)
+ret = av_packet_copy_side_data(&info->pkt, pkt);
+if (ret < 0)
 return ret;
 if (info->num_blocks != 6)
 return 0;
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 2/4] avcodec/avpacket: use av_packet_copy_side_data() in av_packet_copy_props()

2017-09-24 Thread James Almer
The side data array in av_packet_copy_side_data() is not reallocated every
time a new element is added, unlike when calling av_packet_new_side_data()
in a loop.

Signed-off-by: James Almer 
---
 libavcodec/avpacket.c | 19 +--
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 33e325c9ed..01b899c79d 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -625,7 +625,7 @@ fail:
 
 int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
 {
-int i;
+int ret;
 
 dst->pts  = src->pts;
 dst->dts  = src->dts;
@@ -639,20 +639,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 dst->flags= src->flags;
 dst->stream_index = src->stream_index;
 
-for (i = 0; i < src->side_data_elems; i++) {
- enum AVPacketSideDataType type = src->side_data[i].type;
- int size  = src->side_data[i].size;
- uint8_t *src_data = src->side_data[i].data;
- uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
-
-if (!dst_data) {
-av_packet_free_side_data(dst);
-return AVERROR(ENOMEM);
-}
-memcpy(dst_data, src_data, size);
-}
+ret = av_packet_copy_side_data(dst, src);
+if (ret < 0)
+av_packet_free_side_data(dst);
 
-return 0;
+return ret;
 }
 
 void av_packet_unref(AVPacket *pkt)
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 4/4] ffmpeg: replace use of av_copy_packet_side_data()

2017-09-24 Thread James Almer
Signed-off-by: James Almer 
---
 ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 1d248bc269..a3ea4c84a6 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2077,7 +2077,7 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
 opkt.data = pkt->data;
 opkt.size = pkt->size;
 }
-av_copy_packet_side_data(&opkt, pkt);
+av_packet_copy_side_data(&opkt, pkt);
 
 #if FF_API_LAVF_FMT_RAWPICTURE
 if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/scale: More descriptive in/ref/out logging

2017-09-24 Thread Kevin Mark
Hi Ronald,

On Sat, Sep 23, 2017 at 11:54 AM, Ronald S. Bultje  wrote:
>
> Yes, -E works on Mac.

Thanks! Are there any remaining blockers for a potential merge?

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolbox: fix decoding of some h264 bitstreams

2017-09-24 Thread Aman Gupta
On Thu, Oct 1, 2015 at 9:54 AM, wm4  wrote:

> On Thu, 1 Oct 2015 18:45:40 +0200
> Hendrik Leppkes  wrote:
>
> > On Thu, Oct 1, 2015 at 6:39 PM, wm4  wrote:
> > > On Thu, 1 Oct 2015 18:29:00 +0200
> > > Hendrik Leppkes  wrote:
> > >
> > >> On Thu, Oct 1, 2015 at 6:13 PM, wm4  wrote:
> > >> > This affects Annex B streams (such as demuxed from .ts and others).
> It
> > >> > also handles the format change in reinit-large_420_8-to-small_
> 420_8.h264
> > >> > correctly.
> > >> >
> > >> > Instead of passing through the extradata, create it on the fly it
> from
> > >> > the currently active SPS and PPS. Since reconstructing the PPS and
> SPS
> > >> > NALs would be very complicated and verbose, we use the NALs as they
> > >> > originally appeared in the bitstream.
> > >> >
> > >> > The code for writing the extradata is somewhat derived from
> > >> > libavformat/avc.c, but it's small and different enough that sharing
> it
> > >> > is not really worth it.
> > >> > ---
> > >> > Even though it requires changes in the general h264 decoder
> (previous
> > >> > patch), this solution is much cleaner and more robust than my patch
> > >> > from yesterday.
> > >> > ---
> > >> >  libavcodec/videotoolbox.c | 48 +-
> -
> > >> >  1 file changed, 30 insertions(+), 18 deletions(-)
> > >> >
> > >> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > >> > index 9dec5fc..cc1e592 100644
> > >> > --- a/libavcodec/videotoolbox.c
> > >> > +++ b/libavcodec/videotoolbox.c
> > >> > @@ -77,28 +77,40 @@ int ff_videotoolbox_alloc_frame(AVCodecContext
> *avctx, AVFrame *frame)
> > >> >  return 0;
> > >> >  }
> > >> >
> > >> > +#define AV_W8(p, v) *(p) = (v)
> > >> > +
> > >> >  CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext
> *avctx)
> > >> >  {
> > >> > +H264Context *h = avctx->priv_data;
> > >> >  CFDataRef data = NULL;
> > >> > +uint8_t *p;
> > >> > +int vt_extradata_size = 6 + 3 + h->sps.data_size + 4 +
> h->pps.data_size;
> > >> > +uint8_t *vt_extradata = av_malloc(vt_extradata_size);
> > >> > +if (!vt_extradata)
> > >> > +return NULL;
> > >> >
> > >> > -/* Each VCL NAL in the bitstream sent to the decoder
> > >> > - * is preceded by a 4 bytes length header.
> > >> > - * Change the avcC atom header if needed, to signal headers of
> 4 bytes. */
> > >> > -if (avctx->extradata_size >= 4 && (avctx->extradata[4] & 0x03)
> != 0x03) {
> > >> > -uint8_t *rw_extradata = av_memdup(avctx->extradata,
> avctx->extradata_size);
> > >> > -
> > >> > -if (!rw_extradata)
> > >> > -return NULL;
> > >> > -
> > >> > -rw_extradata[4] |= 0x03;
> > >> > -
> > >> > -data = CFDataCreate(kCFAllocatorDefault, rw_extradata,
> avctx->extradata_size);
> > >> > -
> > >> > -av_freep(&rw_extradata);
> > >> > -} else {
> > >> > -data = CFDataCreate(kCFAllocatorDefault,
> avctx->extradata, avctx->extradata_size);
> > >> > -}
> > >> > -
> > >> > +p = vt_extradata;
> > >> > +
> > >> > +AV_W8(p + 0, 1); /* version */
> > >> > +AV_W8(p + 1, h->sps.data[0]); /* profile */
> > >> > +AV_W8(p + 2, h->sps.data[1]); /* profile compat */
> > >> > +AV_W8(p + 3, h->sps.data[2]); /* level */
> > >> > +AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal
> size length - 3 (11) */
> > >> > +AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number
> of sps (1) */
> > >> > +AV_WB16(p + 6, h->sps.data_size + 1);
> > >> > +AV_W8(p + 8, NAL_SPS | (3 << 5)); // NAL unit header
> > >> > +memcpy(p + 9, h->sps.data, h->sps.data_size);
> > >> > +p += 9 + h->sps.data_size;
> > >> > +AV_W8(p + 0, 1); /* number of pps */
> > >> > +AV_WB16(p + 1, h->pps.data_size + 1);
> > >> > +AV_W8(p + 3, NAL_PPS | (3 << 5)); // NAL unit header
> > >> > +memcpy(p + 4, h->pps.data, h->pps.data_size);
> > >> > +
> > >> > +p += 4 + h->pps.data_size;
> > >> > +av_assert0(p - vt_extradata == vt_extradata_size);
> > >> > +
> > >> > +data = CFDataCreate(kCFAllocatorDefault, vt_extradata,
> vt_extradata_size);
> > >> > +av_free(vt_extradata);
> > >> >  return data;
> > >> >  }
> > >> >
> > >>
> > >> This will still fail spectacularly with a SPS/PPS change mid-stream. I
> > >> don't suppose it somehow accepts the SPS/PPS data in-band as well?
> > >
> > > Well, it worked for the resolution change sample. It _should_ be using
> > > SPS/PPS NALs that occur mid-stream and in-band. The h264 decoder will
> > > reinitialize itself when they change (at least in most cases), and then
> > > it will also reinitialize this hwaccel, which means the code above is
> > > actually run in this situation. The h->sps and h->pps fields will be
> > > set to whatever is actually used by the decoder at this point. So I'm
> > > hoping that this change is actually pretty correct.
> >
> > Is init re-called on resolution change alone, everything else the same

[FFmpeg-devel] [PATCH v3] avcodec/hevc_sei: Support HEVC paired fields.

2017-09-24 Thread Brian Matherly
From: Brian Matherly 

Correctly set the interlaced_frame and top_field_first fields when pic_struct
indicates paired fields.
---
 libavcodec/hevc_sei.c |   4 +-
 tests/fate/hevc.mak   |   6 +-
 tests/ref/fate/hevc-paired-fields | 120 ++
 3 files changed, 127 insertions(+), 3 deletions(-)
 create mode 100644 tests/ref/fate/hevc-paired-fields

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index cd55d50..d0f9966 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -137,10 +137,10 @@ static int decode_nal_sei_pic_timing(HEVCSEIContext *s, 
GetBitContext *gb, const
 if (sps->vui.frame_field_info_present_flag) {
 int pic_struct = get_bits(gb, 4);
 h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
-if (pic_struct == 2) {
+if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
 av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
-} else if (pic_struct == 1) {
+} else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
 av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
 h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
 }
diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index d23d1ba..8300f50 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -225,6 +225,9 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
FATE_HEVC_TEST_444_12BIT,$(N
 fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i 
$(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags 
area+accurate_rnd+bitexact
 FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10
 
+fate-hevc-paired-fields: CMD = probeframes 
$(TARGET_SAMPLES)/hevc/paired_fields.hevc
+FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-paired-fields
+
 tests/data/hevc-mp4.mov: TAG = GEN
 tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
@@ -244,5 +247,6 @@ FATE_HEVC-$(call DEMDEC, MOV, HEVC) += 
fate-hevc-extradata-reload
 fate-hevc-extradata-reload: CMD = framemd5 -i 
$(TARGET_SAMPLES)/hevc/extradata-reload-multi-stsd.mov -sws_flags bitexact
 
 FATE_SAMPLES_AVCONV += $(FATE_HEVC-yes)
+FATE_SAMPLES_FFPROBE += $(FATE_HEVC_FFPROBE-yes)
 
-fate-hevc: $(FATE_HEVC-yes)
+fate-hevc: $(FATE_HEVC-yes) $(FATE_HEVC_FFPROBE-yes)
diff --git a/tests/ref/fate/hevc-paired-fields 
b/tests/ref/fate/hevc-paired-fields
new file mode 100644
index 000..53b9cf6
--- /dev/null
+++ b/tests/ref/fate/hevc-paired-fields
@@ -0,0 +1,120 @@
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=0
+pkt_size=229528
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=I
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=296042
+pkt_size=95954
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=391996
+pkt_size=114837
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=1
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=0
+pkt_pts=N/A
+pkt_pts_time=N/A
+pkt_dts=N/A
+pkt_dts_time=N/A
+best_effort_timestamp=N/A
+best_effort_timestamp_time=N/A
+pkt_duration=20020
+pkt_duration_time=0.016683
+pkt_pos=506833
+pkt_size=85098
+width=1920
+height=540
+pix_fmt=yuv422p10le
+sample_aspect_ratio=1:1
+pict_type=B
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=1
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[/FRAME]
-- 
2.7.4


.
___
ffmpeg-devel