Re: [libav-devel] [PATCH 1/3 v2] avutil/spherical: add functions to retrieve and request projection names

2017-04-17 Thread Luca Barbato
On 10/04/2017 22:31, Vittorio Giovara wrote:
> On Mon, Apr 10, 2017 at 1:43 PM, James Almer  wrote:
>>> Even so, what's the user going to do with knowing the fact that
>>> the video contains spherical metadata it can't parse correctly/fully
>>> support? So, I'm hesitant to add a new type for this uncertain
>>> behaviour, wouldn't you agree?
>>
>> No, because that's the whole point of avprobe, the dump.c code, and
>> other tools using the libraries: Informing the user of the contents
>> and characteristics of their files.
>> avconv and similar tools are what attempt to do something with them,
>> and for unknown projections they would do nothing.
> 
> I don't know, I feel like we're discussing about what kind of noise a
> tree would do falling in an empty forest :)
> I guess we should wait for other people to chime in, and solve this knot
> 

I'm happy as long the function does return an AVERROR on failure or
something easy to match, if I recall correctly Anton seems to be more
for not reporting possibly misleading data when it got discussed on IRC.
(Anton please confirm :))

I'd go with your initial patch amended to return AVERROR(ENOSYS) at
least for now.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH/release/11] travis: Add travis support for release/11

2017-04-17 Thread Luca Barbato
---

As requested by Sean.

 .travis.yml | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00..6f9647a701
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,26 @@
+language: c
+sudo: false
+os:
+  - linux
+  - osx
+addons:
+  apt:
+packages:
+  - nasm
+  - diffutils
+compiler:
+  - clang
+  - gcc
+cache:
+  directories:
+- libav-samples
+before_install:
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi
+install:
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi
+script:
+  - mkdir -p libav-samples
+  - ./configure --samples=libav-samples --cc=$CC
+  - make -j 8
+  - make fate-rsync
+  - make check -j 8
--
2.11.1

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

[libav-devel] [PATCH] avplay: Do not try to allocate new frames when the player is closing

2017-04-17 Thread Luca Barbato
The allocation event can trigger while the decoding thread is already
closing.

Bug-Id: 1052
CC: libav-sta...@libav.org
---
 avtools/avplay.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/avtools/avplay.c b/avtools/avplay.c
index 26279e857d..b6dbc52cf7 100644
--- a/avtools/avplay.c
+++ b/avtools/avplay.c
@@ -213,6 +213,7 @@ typedef struct PlayerState {
 
 AVFilterContext *in_video_filter;   // the first filter in the video chain
 AVFilterContext *out_video_filter;  // the last filter in the video chain
+SDL_mutex *video_filter_mutex;
 
 float skip_frames;
 float skip_frames_index;
@@ -1201,6 +1202,7 @@ static void player_close(PlayerState *is)
 vp->bmp = NULL;
 }
 }
+SDL_DestroyMutex(is->video_filter_mutex);
 SDL_DestroyMutex(is->pictq_mutex);
 SDL_DestroyCond(is->pictq_cond);
 SDL_DestroyMutex(is->subpq_mutex);
@@ -1617,6 +1619,9 @@ static int video_thread(void *arg)
 stream_pause(player);
 }
  the_end:
+SDL_LockMutex(is->video_filter_mutex);
+is->out_video_filter = NULL;
+SDL_UnlockMutex(is->video_filter_mutex);
 av_freep(&vfilters);
 avfilter_graph_free(&graph);
 av_packet_unref(&pkt);
@@ -2552,6 +2557,8 @@ static int stream_open(PlayerState *is,
 return ret;
 }
 
+is->video_filter_mutex = SDL_CreateMutex();
+
 /* start video display */
 is->pictq_mutex = SDL_CreateMutex();
 is->pictq_cond  = SDL_CreateCond();
@@ -2827,8 +2834,12 @@ static void event_loop(void)
 do_exit();
 break;
 case FF_ALLOC_EVENT:
-video_open(event.user.data1);
-alloc_picture(event.user.data1);
+SDL_LockMutex(player->video_filter_mutex);
+if (player->out_video_filter) {
+video_open(event.user.data1);
+alloc_picture(event.user.data1);
+}
+SDL_UnlockMutex(player->video_filter_mutex);
 break;
 case FF_REFRESH_EVENT:
 video_refresh_timer(event.user.data1);
-- 
2.11.1

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

Re: [libav-devel] [PATCH 1/2] swscale: Do not shift negative values directly

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 4:42 PM, Luca Barbato  wrote:
> On 17/04/2017 21:31, Vittorio Giovara wrote:
>> On Mon, Apr 17, 2017 at 1:10 PM, Luca Barbato  wrote:
>>> On 17/04/2017 18:06, Vittorio Giovara wrote:
 On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
> It is undefined in C as reported:
> warning: shifting a negative signed value is undefined
> ---
>  libswscale/output.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)

 why are you using a macro to do a simple  << (1 * val) here?

>>>
>>> Clarity and concision.
>>
>> except a macro is neither
>>
>> by reading the code i can immediately tell what << (1 * val) is doing,
>> whereas a macro, despite aptly named, carries additional semantic that
>> I have to be aware of and remember. IMO is not worth the trouble here
>>
>
> It is quite easy to typo the correct statement, I'd rather keep the
> macro if you aren't strongly against it.

I'm not strongly against, but I do dislike spreading macros when not needed.
Keep it like that, patch ok.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] swscale: Do not shift negative values directly

2017-04-17 Thread Luca Barbato
On 17/04/2017 21:31, Vittorio Giovara wrote:
> On Mon, Apr 17, 2017 at 1:10 PM, Luca Barbato  wrote:
>> On 17/04/2017 18:06, Vittorio Giovara wrote:
>>> On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
 It is undefined in C as reported:
 warning: shifting a negative signed value is undefined
 ---
  libswscale/output.c | 23 +--
  1 file changed, 13 insertions(+), 10 deletions(-)
>>>
>>> why are you using a macro to do a simple  << (1 * val) here?
>>>
>>
>> Clarity and concision.
> 
> except a macro is neither
> 
> by reading the code i can immediately tell what << (1 * val) is doing,
> whereas a macro, despite aptly named, carries additional semantic that
> I have to be aware of and remember. IMO is not worth the trouble here
> 

It is quite easy to typo the correct statement, I'd rather keep the
macro if you aren't strongly against it.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] mm: Skip unexpected audio packets

2017-04-17 Thread Luca Barbato
On 17/04/2017 21:47, Vittorio Giovara wrote:
> On Mon, Apr 17, 2017 at 3:27 PM, Luca Barbato  wrote:
>> Bug-Id: 1046
>> CC: libav-sta...@libav.org
>> ---
>>  libavformat/mm.c | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavformat/mm.c b/libavformat/mm.c
>> index 16505502fd..86e9ff0ba3 100644
>> --- a/libavformat/mm.c
>> +++ b/libavformat/mm.c
>> @@ -174,6 +174,12 @@ static int read_packet(AVFormatContext *s,
>>  return 0;
>>
>>  case MM_TYPE_AUDIO :
>> +if (s->nb_streams != 2) {
>> +av_log(s, AV_LOG_WARNING,
>> +   "Unexpected audio packet, skipping\n");
>> +avio_skip(pb, length);
>> +return AVERROR_INVALIDDATA;
> 
> is this an error or a warning?
> won't returning a negative number for a read_packet function be bad
> for the caller?
> 

Right, it should be an error.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] mjpeg: Report non-3 component rgb lossless as not supported

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 3:14 PM, Luca Barbato  wrote:
> Bug-Id: 1043
> CC: libav-sta...@libav.org
> ---
>  libavcodec/mjpegdec.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index 13d3e8cb02..833503d9dc 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -1129,6 +1129,12 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const 
> uint8_t *mb_bitmask,
>  for (i = s->mjpb_skiptosod; i > 0; i--)
>  skip_bits(&s->gb, 8);
>
> +if (s->lossless && s->rgb && nb_components != 3) {
> +avpriv_request_sample(s->avctx,
> +"Lossless RGB image without 3 components");
> +return AVERROR(ENOSYS);
> +}
> +
>  next_field:
>  for (i = 0; i < nb_components; i++)
>  s->last_dc[i] = 1024;
> --

ok
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] mm: Skip unexpected audio packets

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 3:27 PM, Luca Barbato  wrote:
> Bug-Id: 1046
> CC: libav-sta...@libav.org
> ---
>  libavformat/mm.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavformat/mm.c b/libavformat/mm.c
> index 16505502fd..86e9ff0ba3 100644
> --- a/libavformat/mm.c
> +++ b/libavformat/mm.c
> @@ -174,6 +174,12 @@ static int read_packet(AVFormatContext *s,
>  return 0;
>
>  case MM_TYPE_AUDIO :
> +if (s->nb_streams != 2) {
> +av_log(s, AV_LOG_WARNING,
> +   "Unexpected audio packet, skipping\n");
> +avio_skip(pb, length);
> +return AVERROR_INVALIDDATA;

is this an error or a warning?
won't returning a negative number for a read_packet function be bad
for the caller?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] swscale: Do not shift negative values directly

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 1:10 PM, Luca Barbato  wrote:
> On 17/04/2017 18:06, Vittorio Giovara wrote:
>> On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
>>> It is undefined in C as reported:
>>> warning: shifting a negative signed value is undefined
>>> ---
>>>  libswscale/output.c | 23 +--
>>>  1 file changed, 13 insertions(+), 10 deletions(-)
>>
>> why are you using a macro to do a simple  << (1 * val) here?
>>
>
> Clarity and concision.

except a macro is neither

by reading the code i can immediately tell what << (1 * val) is doing,
whereas a macro, despite aptly named, carries additional semantic that
I have to be aware of and remember. IMO is not worth the trouble here
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] mm: Skip unexpected audio packets

2017-04-17 Thread Luca Barbato
Bug-Id: 1046
CC: libav-sta...@libav.org
---
 libavformat/mm.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mm.c b/libavformat/mm.c
index 16505502fd..86e9ff0ba3 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -174,6 +174,12 @@ static int read_packet(AVFormatContext *s,
 return 0;
 
 case MM_TYPE_AUDIO :
+if (s->nb_streams != 2) {
+av_log(s, AV_LOG_WARNING,
+   "Unexpected audio packet, skipping\n");
+avio_skip(pb, length);
+return AVERROR_INVALIDDATA;
+}
 if (av_get_packet(s->pb, pkt, length)<0)
 return AVERROR(ENOMEM);
 pkt->size = length;
-- 
2.11.1

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

[libav-devel] [PATCH] mjpeg: Report non-3 component rgb lossless as not supported

2017-04-17 Thread Luca Barbato
Bug-Id: 1043
CC: libav-sta...@libav.org
---
 libavcodec/mjpegdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 13d3e8cb02..833503d9dc 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1129,6 +1129,12 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const 
uint8_t *mb_bitmask,
 for (i = s->mjpb_skiptosod; i > 0; i--)
 skip_bits(&s->gb, 8);
 
+if (s->lossless && s->rgb && nb_components != 3) {
+avpriv_request_sample(s->avctx,
+"Lossless RGB image without 3 components");
+return AVERROR(ENOSYS);
+}
+
 next_field:
 for (i = 0; i < nb_components; i++)
 s->last_dc[i] = 1024;
-- 
2.11.1

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

[libav-devel] [PATCH 2/2] hevc: Add support for bitdepth 10 for IDCT DC

2017-04-17 Thread Alexandra Hájková
---
 libavcodec/arm/hevc_idct.S| 50 ---
 libavcodec/arm/hevcdsp_init_arm.c | 21 +++-
 2 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index 7fdd7cc..082f832 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -30,26 +30,37 @@ const trans, align=4
 .short 57, 43, 25, 9
 endconst
 
-function ff_hevc_idct_4x4_dc_8_neon, export=1
+.macro idct_4x4_dc bitdepth
+function ff_hevc_idct_4x4_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q0, r1
 vdup.16 q1, r1
 vst1.16 {q0, q1}, [r0]
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_8x8_dc_8_neon, export=1
+.macro idct_8x8_dc bitdepth
+function ff_hevc_idct_8x8_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -61,14 +72,20 @@ function ff_hevc_idct_8x8_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_16x16_dc_8_neon, export=1
+.macro idct_16x16_dc bitdepth
+function ff_hevc_idct_16x16_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -83,14 +100,20 @@ function ff_hevc_idct_16x16_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_32x32_dc_8_neon, export=1
+.macro idct_32x32_dc bitdepth
+function ff_hevc_idct_32x32_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 mov r3, #16
 vdup.16 q8, r1
 vdup.16 q9, r1
@@ -103,8 +126,9 @@ function ff_hevc_idct_32x32_dc_8_neon, export=1
 1:  subsr3, #1
 vstmr0!, {q8-q15}
 bne 1b
-bx lr
+bx  lr
 endfunc
+.endm
 
 .macro sum_sub out, in, c, op
   .ifc \op, +
@@ -496,8 +520,16 @@ tr_16x4 secondpass_10, 20 - 10
 .ltorg
 
 idct_4x4 8
+idct_4x4_dc 8
 idct_4x4 10
+idct_4x4_dc 10
 idct_8x8 8
+idct_8x8_dc 8
 idct_8x8 10
+idct_8x8_dc 10
 idct_16x16 8
+idct_16x16_dc 8
 idct_16x16 10
+idct_16x16_dc 10
+idct_32x32_dc 8
+idct_32x32_dc 10
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index b65e2e9..febbcc1 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -25,13 +25,18 @@
 
 #include "libavcodec/hevcdsp.h"
 
-void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
+
+void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
@@ -51,9 +56,13 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)
 c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
 }
 if

Re: [libav-devel] [PATCH] extract_extradata_bsf: make sure all needed parameter set NALUs were found

2017-04-17 Thread Luca Barbato
On 14/04/2017 15:53, James Almer wrote:
> This mimics the behavior of the now unused h264/hevc parser's split()
> function and fixes decoding some files when extract_extradata bsf is
> enabled.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/extract_extradata_bsf.c | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/extract_extradata_bsf.c 
> b/libavcodec/extract_extradata_bsf.c
> index 20b30803b..20840bd6a 100644
> --- a/libavcodec/extract_extradata_bsf.c
> +++ b/libavcodec/extract_extradata_bsf.c
> @@ -65,7 +65,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, 
> AVPacket *pkt,
>  int extradata_size = 0;
>  const int *extradata_nal_types;
>  int nb_extradata_nal_types;
> -int i, ret = 0;
> +int i, has_sps = 0, has_vps = 0, ret = 0;
>  
>  if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) {
>  extradata_nal_types= extradata_nal_types_hevc;
> @@ -82,11 +82,20 @@ static int extract_extradata_h2645(AVBSFContext *ctx, 
> AVPacket *pkt,
>  
>  for (i = 0; i < h2645_pkt.nb_nals; i++) {
>  H2645NAL *nal = &h2645_pkt.nals[i];
> -if (val_in_array(extradata_nal_types, nb_extradata_nal_types, 
> nal->type))
> +if (val_in_array(extradata_nal_types, nb_extradata_nal_types, 
> nal->type)) {
>  extradata_size += nal->raw_size + 3;
> +if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) {
> +if (nal->type == HEVC_NAL_SPS) has_sps = 1;
> +if (nal->type == HEVC_NAL_VPS) has_vps = 1;
> +} else {
> +if (nal->type == H264_NAL_SPS) has_sps = 1;
> +}
> +}
>  }
>  
> -if (extradata_size) {
> +if (extradata_size &&
> +((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) ||
> + (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
>  AVBufferRef *filtered_buf;
>  uint8_t *extradata, *filtered_data;
>  
> 

The patch itself seems fine btw.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] swscale: Do not shift negative values directly

2017-04-17 Thread Luca Barbato
On 17/04/2017 18:06, Vittorio Giovara wrote:
> On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
>> It is undefined in C as reported:
>> warning: shifting a negative signed value is undefined
>> ---
>>  libswscale/output.c | 23 +--
>>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> why are you using a macro to do a simple  << (1 * val) here?
> 

Clarity and concision.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] extract_extradata_bsf: make sure all needed parameter set NALUs were found

2017-04-17 Thread Luca Barbato
On 17/04/2017 17:56, James Almer wrote:
> On 4/17/2017 8:48 AM, Luca Barbato wrote:
>> On 14/04/2017 15:53, James Almer wrote:
>>> This mimics the behavior of the now unused h264/hevc parser's split()
>>> function and fixes decoding some files when extract_extradata bsf is
>>> enabled.
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavcodec/extract_extradata_bsf.c | 15 ---
>>>  1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> Do you have a small sample to use?
>>
>> lu
> 
> https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4544/globo%20hd%2020120424%20champions%20league%20paulonline_cut.ts
> 
> 20mb so not exactly small, but it can be cut even further if you want to
> make a fate test for it since the problem is that extract_extradata takes
> a bunch of useless NALUs out of the first complete frame instead of waiting
> until it finds an SPS.
> 

That's the idea but yes, I'd be happier with a tiny file =)

lu

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

Re: [libav-devel] [PATCH 2/2] hevc: Add support for bitdepth 10 for IDCT DC

2017-04-17 Thread Alexandra Hájková
>> -function ff_hevc_idct_32x32_dc_8_neon, export=1
>> +.macro idct_32x32_dc bitdepth
>> +function ff_hevc_idct_32x32_dc_\bitdepth\()_neon, export=1
>>  ldrsh   r1, [r0]
>>  ldr r2, =0x20
>> +.if \bitdepth == 8
>> +ldr r2, =0x20
>> +.else
>> +ldr r2, =0x8
>> +.endif
>
> This doesn't look quite right, shouldn't the new block replace/wrap
> the old ldr instruction, like it does in the 16x16 version (and all
> other sizes)?
>

It's wrong, yes. I'll resend it.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/2] hevc: Add support for bitdepth 10 for IDCT DC

2017-04-17 Thread Hendrik Leppkes
On Mon, Apr 17, 2017 at 6:25 PM, Alexandra Hájková
 wrote:
> ---
>
> Indent operands.
>
>  libavcodec/arm/hevc_idct.S| 51 
> ---
>  libavcodec/arm/hevcdsp_init_arm.c | 21 +++-
>  2 files changed, 57 insertions(+), 15 deletions(-)
>
> diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
> index 7fdd7cc..f949d80 100644
> --- a/libavcodec/arm/hevc_idct.S
> +++ b/libavcodec/arm/hevc_idct.S
> @@ -30,26 +30,37 @@ const trans, align=4
>  .short 57, 43, 25, 9
>  endconst
>
> -function ff_hevc_idct_4x4_dc_8_neon, export=1
> +.macro idct_4x4_dc bitdepth
> +function ff_hevc_idct_4x4_dc_\bitdepth\()_neon, export=1
>  ldrsh   r1, [r0]
> +.if \bitdepth == 8
>  ldr r2, =0x20
> +.else
> +ldr r2, =0x8
> +.endif
>  add r1, #1
>  asr r1, #1
>  add r1, r2
> -asr r1, #6
> +asr r1, #(14 - \bitdepth)
>  vdup.16 q0, r1
>  vdup.16 q1, r1
>  vst1.16 {q0, q1}, [r0]
>  bx  lr
>  endfunc
> +.endm
>
> -function ff_hevc_idct_8x8_dc_8_neon, export=1
> +.macro idct_8x8_dc bitdepth
> +function ff_hevc_idct_8x8_dc_\bitdepth\()_neon, export=1
>  ldrsh   r1, [r0]
> +.if \bitdepth == 8
>  ldr r2, =0x20
> +.else
> +ldr r2, =0x8
> +.endif
>  add r1, #1
>  asr r1, #1
>  add r1, r2
> -asr r1, #6
> +asr r1, #(14 - \bitdepth)
>  vdup.16 q8, r1
>  vdup.16 q9, r1
>  vmov.16 q10, q8
> @@ -61,14 +72,20 @@ function ff_hevc_idct_8x8_dc_8_neon, export=1
>  vstmr0, {q8-q15}
>  bx  lr
>  endfunc
> +.endm
>
> -function ff_hevc_idct_16x16_dc_8_neon, export=1
> +.macro idct_16x16_dc bitdepth
> +function ff_hevc_idct_16x16_dc_\bitdepth\()_neon, export=1
>  ldrsh   r1, [r0]
> +.if \bitdepth == 8
>  ldr r2, =0x20
> +.else
> +ldr r2, =0x8
> +.endif
>  add r1, #1
>  asr r1, #1
>  add r1, r2
> -asr r1, #6
> +asr r1, #(14 - \bitdepth)
>  vdup.16 q8, r1
>  vdup.16 q9, r1
>  vmov.16 q10, q8
> @@ -83,14 +100,21 @@ function ff_hevc_idct_16x16_dc_8_neon, export=1
>  vstmr0, {q8-q15}
>  bx  lr
>  endfunc
> +.endm
>
> -function ff_hevc_idct_32x32_dc_8_neon, export=1
> +.macro idct_32x32_dc bitdepth
> +function ff_hevc_idct_32x32_dc_\bitdepth\()_neon, export=1
>  ldrsh   r1, [r0]
>  ldr r2, =0x20
> +.if \bitdepth == 8
> +ldr r2, =0x20
> +.else
> +ldr r2, =0x8
> +.endif

This doesn't look quite right, shouldn't the new block replace/wrap
the old ldr instruction, like it does in the 16x16 version (and all
other sizes)?

>  add r1, #1
>  asr r1, #1
>  add r1, r2
> -asr r1, #6
> +asr r1, #(14 - \bitdepth)
>  mov r3, #16
>  vdup.16 q8, r1
>  vdup.16 q9, r1
> @@ -103,8 +127,9 @@ function ff_hevc_idct_32x32_dc_8_neon, export=1
>  1:  subsr3, #1
>  vstmr0!, {q8-q15}
>  bne 1b
> -bx lr
> +bx  lr
>  endfunc
> +.endm
>
>  .macro sum_sub out, in, c, op
>.ifc \op, +
> @@ -496,8 +521,16 @@ tr_16x4 secondpass_10, 20 - 10
>  .ltorg
>
>  idct_4x4 8
> +idct_4x4_dc 8
>  idct_4x4 10
> +idct_4x4_dc 10
>  idct_8x8 8
> +idct_8x8_dc 8
>  idct_8x8 10
> +idct_8x8_dc 10
>  idct_16x16 8
> +idct_16x16_dc 8
>  idct_16x16 10
> +idct_16x16_dc 10
> +idct_32x32_dc 8
> +idct_32x32_dc 10
> diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
> b/libavcodec/arm/hevcdsp_init_arm.c
> index b65e2e9..febbcc1 100644
> --- a/libavcodec/arm/hevcdsp_init_arm.c
> +++ b/libavcodec/arm/hevcdsp_init_arm.c
> @@ -25,13 +25,18 @@
>
>  #include "libavcodec/hevcdsp.h"
>
> -void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
>  void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
> -void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
>  void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
> -void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
>  void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
>  void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
> +void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
> +void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
> +void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
> +void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
> +
> +vo

[libav-devel] [PATCH 2/2] hevc: Add support for bitdepth 10 for IDCT DC

2017-04-17 Thread Alexandra Hájková
---

Indent operands.

 libavcodec/arm/hevc_idct.S| 51 ---
 libavcodec/arm/hevcdsp_init_arm.c | 21 +++-
 2 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index 7fdd7cc..f949d80 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -30,26 +30,37 @@ const trans, align=4
 .short 57, 43, 25, 9
 endconst
 
-function ff_hevc_idct_4x4_dc_8_neon, export=1
+.macro idct_4x4_dc bitdepth
+function ff_hevc_idct_4x4_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q0, r1
 vdup.16 q1, r1
 vst1.16 {q0, q1}, [r0]
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_8x8_dc_8_neon, export=1
+.macro idct_8x8_dc bitdepth
+function ff_hevc_idct_8x8_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -61,14 +72,20 @@ function ff_hevc_idct_8x8_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_16x16_dc_8_neon, export=1
+.macro idct_16x16_dc bitdepth
+function ff_hevc_idct_16x16_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
+.if \bitdepth == 8
 ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -83,14 +100,21 @@ function ff_hevc_idct_16x16_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_32x32_dc_8_neon, export=1
+.macro idct_32x32_dc bitdepth
+function ff_hevc_idct_32x32_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
 ldr r2, =0x20
+.if \bitdepth == 8
+ldr r2, =0x20
+.else
+ldr r2, =0x8
+.endif
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 mov r3, #16
 vdup.16 q8, r1
 vdup.16 q9, r1
@@ -103,8 +127,9 @@ function ff_hevc_idct_32x32_dc_8_neon, export=1
 1:  subsr3, #1
 vstmr0!, {q8-q15}
 bne 1b
-bx lr
+bx  lr
 endfunc
+.endm
 
 .macro sum_sub out, in, c, op
   .ifc \op, +
@@ -496,8 +521,16 @@ tr_16x4 secondpass_10, 20 - 10
 .ltorg
 
 idct_4x4 8
+idct_4x4_dc 8
 idct_4x4 10
+idct_4x4_dc 10
 idct_8x8 8
+idct_8x8_dc 8
 idct_8x8 10
+idct_8x8_dc 10
 idct_16x16 8
+idct_16x16_dc 8
 idct_16x16 10
+idct_16x16_dc 10
+idct_32x32_dc 8
+idct_32x32_dc 10
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index b65e2e9..febbcc1 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -25,13 +25,18 @@
 
 #include "libavcodec/hevcdsp.h"
 
-void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
+
+void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
@@ -51,9 +56,13 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)
 c->idct_dc[3] 

[libav-devel] [PATCH 1/2] hevc: Add NEON IDCT DC functions for bitdepth 8

2017-04-17 Thread Alexandra Hájková
From: Seppo Tomperi 

Signed-off-by: Alexandra Hájková 
---

Indent operands.

 libavcodec/arm/hevc_idct.S| 78 +++
 libavcodec/arm/hevcdsp_init_arm.c | 14 +--
 2 files changed, 89 insertions(+), 3 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index 156d476..7fdd7cc 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -1,5 +1,7 @@
 /*
  * ARM NEON optimised IDCT functions for HEVC decoding
+ *
+ * Copyright (c) 2014 Seppo Tomperi 
  * Copyright (c) 2017 Alexandra Hájková
  *
  * This file is part of Libav.
@@ -28,6 +30,82 @@ const trans, align=4
 .short 57, 43, 25, 9
 endconst
 
+function ff_hevc_idct_4x4_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q0, r1
+vdup.16 q1, r1
+vst1.16 {q0, q1}, [r0]
+bx  lr
+endfunc
+
+function ff_hevc_idct_8x8_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_16x16_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_32x32_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+mov r3, #16
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+1:  subsr3, #1
+vstmr0!, {q8-q15}
+bne 1b
+bx lr
+endfunc
+
 .macro sum_sub out, in, c, op
   .ifc \op, +
 vmlal.s16   \out, \in, \c
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index e61587f..b65e2e9 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -26,8 +26,12 @@
 #include "libavcodec/hevcdsp.h"
 
 void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
@@ -38,9 +42,13 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)
 
 if (have_neon(cpu_flags)) {
 if (bit_depth == 8) {
-c->idct[0] = ff_hevc_idct_4x4_8_neon;
-c->idct[1] = ff_hevc_idct_8x8_8_neon;
-c->idct[2] = ff_hevc_idct_16x16_8_neon;
+c->idct[0]= ff_hevc_idct_4x4_8_neon;
+c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon;
+c->idct[1]= ff_hevc_idct_8x8_8_neon;
+c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
+c->idct[2]= ff_hevc_idct_16x16_8_neon;
+c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
+c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
 }
 if (bit_depth == 10) {
 c->idct[0] = ff_hevc_idct_4x4_10_neon;
-- 
2.10.2

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

Re: [libav-devel] [PATCH 2/2] swscale: Convert the check check_image_pointers helper to a macro

2017-04-17 Thread Vittorio Giovara
On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
> Avoid warnings about types mismatch and make the code a little simpler.
> ---
>  libswscale/swscale_unscaled.c | 37 +++--
>  1 file changed, 15 insertions(+), 22 deletions(-)

ok if you like it
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] swscale: Do not shift negative values directly

2017-04-17 Thread Vittorio Giovara
On Sat, Apr 15, 2017 at 9:07 AM, Luca Barbato  wrote:
> It is undefined in C as reported:
> warning: shifting a negative signed value is undefined
> ---
>  libswscale/output.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)

why are you using a macro to do a simple  << (1 * val) here?

-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] avprobe: Handle invalid values for the color description

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 9:48 AM, Luca Barbato  wrote:
> print_str() cannot print NULL.
>
> Bug-Id: 1040
> CC: libav-sta...@libav.org
> ---
>  avtools/avprobe.c | 36 +++-
>  1 file changed, 31 insertions(+), 5 deletions(-)

I'm not sure about this. First of all these values are not invalid but
simply unknown.
Secondly I'm starting to think whether these name API should return a
simple "" instead of NULL.
Any opinions?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] flv: Validate the packet size

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 10:23 AM, Luca Barbato  wrote:
> Size can be negative at that point.
>
> Bug-Id: 1041
> CC: libav-sta...@libav.org
> ---
>  libavformat/flvdec.c | 6 ++
>  1 file changed, 6 insertions(+)

ok
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] dca: Account for lfe when checking for the channel count

2017-04-17 Thread Vittorio Giovara
On Mon, Apr 17, 2017 at 8:53 AM, Luca Barbato  wrote:
> Bug-Id: 1037
> CC: libav-sta...@libav.org
> ---
>  libavcodec/dcadec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ok
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] Add ClearVideo decoder

2017-04-17 Thread Vittorio Giovara
On Sat, Apr 15, 2017 at 6:31 AM, Diego Biurrun  wrote:
> From: Kostya Shishkov 
>
> Only I-frames are decoded for now.
>
> Signed-off-by: Diego Biurrun 
> ---
>  Changelog   |   1 +
>  doc/general.texi|   1 +
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/clearvideo.c | 385 
> 
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/version.h|   2 +-
>  libavformat/riff.c  |   2 +
>  libavformat/rm.c|   1 +
>  10 files changed, 401 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/clearvideo.c
>
> diff --git a/Changelog b/Changelog
> index dccf173..ebf094a 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -14,6 +14,7 @@ version :
>  - Cineform HD decoder
>  - VP9 superframe split/merge bitstream filters
>  - FM Screen Capture Codec decoder
> +- incomplete ClearVideo decoder

IMO `incomplete` is not descriptive, I'd suggest

- ClearVideo decoder (I-frames only)

> diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
> new file mode 100644
> index 000..88af1a7
> --- /dev/null
> +++ b/libavcodec/clearvideo.c
> @@ -0,0 +1,385 @@
> +/*
> + * ClearVideo decoder
> + * Copyright (c) 2012 Konstantin Shishkov
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * ClearVideo decoder
> + */
> +
> +#include "avcodec.h"
> +#include "bytestream.h"
> +#include "get_bits.h"

shouldn't new code be converted to the new bitstream reader?
> +
> +if (frame_type & 0x2) {
> +bytestream2_get_be32(&gb); // frame size;
> +c->ac_quant= bytestream2_get_byte(&gb);
> +c->luma_dc_quant   = 32;
> +c->chroma_dc_quant = 32;
> +
> +if ((ret = init_get_bits8(&c->gb, buf + bytestream2_tell(&gb),
> +  buf_size - bytestream2_tell(&gb))) < 0)
> +return ret;
> +
> +for (i = 0; i < 3; i++)
> +c->top_dc[i] = 32;
> +for (i = 0; i < 4; i++)
> +c->left_dc[i] = 32;
> +
> +for (j = 0; j < c->mb_height; j++) {
> +for (i = 0; i < c->mb_width; i++) {
> +ret |= decode_mb(c, i, j);
> +}
> +}
> +} else {
> +}

empty else? probably missing a patchwelcome message

> +if ((ret = av_frame_ref(data, c->pic)) < 0)
> +return ret;
> +
> +*got_frame = 1;
> +
> +return ret < 0 ? ret : buf_size;
> +}
> +
> +AVCodec ff_clearvideo_decoder = {
> +.name   = "clearvideo",
> +.long_name  = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
> +.type   = AVMEDIA_TYPE_VIDEO,
> +.id = AV_CODEC_ID_CLEARVIDEO,
> +.priv_data_size = sizeof(CLVContext),
> +.init   = clv_decode_init,
> +.close  = clv_decode_end,
> +.decode = clv_decode_frame,
> +.capabilities   = AV_CODEC_CAP_DR1,
> +};

this should have the safe open and init cleanup internal capabilities
set I think
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] extract_extradata_bsf: make sure all needed parameter set NALUs were found

2017-04-17 Thread James Almer
On 4/17/2017 8:48 AM, Luca Barbato wrote:
> On 14/04/2017 15:53, James Almer wrote:
>> This mimics the behavior of the now unused h264/hevc parser's split()
>> function and fixes decoding some files when extract_extradata bsf is
>> enabled.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavcodec/extract_extradata_bsf.c | 15 ---
>>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> Do you have a small sample to use?
> 
> lu

https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4544/globo%20hd%2020120424%20champions%20league%20paulonline_cut.ts

20mb so not exactly small, but it can be cut even further if you want to
make a fate test for it since the problem is that extract_extradata takes
a bunch of useless NALUs out of the first complete frame instead of waiting
until it finds an SPS.

Couldn't find any hevc sample that fails without this patch, but it should
be a matter of finding a badly cut mpegts file out there.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] flv: Validate the packet size

2017-04-17 Thread Luca Barbato
Size can be negative at that point.

Bug-Id: 1041
CC: libav-sta...@libav.org
---
 libavformat/flvdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 693c859ebf..1b29740f41 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -912,6 +912,12 @@ skip:
 st->codecpar->codec_id == AV_CODEC_ID_H264) {
 int type = avio_r8(s->pb);
 size--;
+
+if (size < 0) {
+ret = AVERROR_INVALIDDATA;
+goto leave;
+}
+
 if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 // sign extension
 int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;
-- 
2.11.1

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

[libav-devel] [PATCH] avprobe: Handle invalid values for the color description

2017-04-17 Thread Luca Barbato
print_str() cannot print NULL.

Bug-Id: 1040
CC: libav-sta...@libav.org
---
 avtools/avprobe.c | 36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/avtools/avprobe.c b/avtools/avprobe.c
index 68f19220c8..92986b5693 100644
--- a/avtools/avprobe.c
+++ b/avtools/avprobe.c
@@ -609,6 +609,12 @@ static char *tag_string(char *buf, int buf_size, int tag)
 return buf;
 }
 
+static char *invalid_string(char *buf, int buf_size, int val)
+{
+snprintf(buf, buf_size, "Invalid (%d)", val);
+return buf;
+}
+
 static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt)
 {
 char val_str[128];
@@ -660,6 +666,7 @@ static void show_stream(InputFile *ifile, InputStream *ist)
 char val_str[128];
 AVRational display_aspect_ratio, *sar = NULL;
 const AVPixFmtDescriptor *desc;
+const char *val;
 
 probe_object_header("stream");
 
@@ -718,11 +725,30 @@ static void show_stream(InputFile *ifile, InputStream 
*ist)
 probe_str("pix_fmt", desc ? desc->name : "unknown");
 probe_int("level", par->level);
 
-probe_str("color_range", av_color_range_name(par->color_range));
-probe_str("color_space", av_color_space_name(par->color_space));
-probe_str("color_trc",   av_color_transfer_name (par->color_trc));
-probe_str("color_pri",   
av_color_primaries_name(par->color_primaries));
-probe_str("chroma_loc", av_chroma_location_name 
(par->chroma_location));
+val = av_color_range_name(par->color_range);
+if (!val)
+val = invalid_string(val_str, sizeof(val_str), par->color_range);
+probe_str("color_range", val);
+
+val = av_color_space_name(par->color_space);
+if (!val)
+val = invalid_string(val_str, sizeof(val_str), par->color_space);
+probe_str("color_space", val);
+
+val = av_color_transfer_name(par->color_trc);
+if (!val)
+val = invalid_string(val_str, sizeof(val_str), par->color_trc);
+probe_str("color_trc", val);
+
+val = av_color_primaries_name(par->color_primaries);
+if (!val)
+val = invalid_string(val_str, sizeof(val_str), 
par->color_primaries);
+probe_str("color_pri", val);
+
+val = av_chroma_location_name(par->chroma_location);
+if (!val)
+val = invalid_string(val_str, sizeof(val_str), 
par->chroma_location);
+probe_str("chroma_loc", val);
 break;
 
 case AVMEDIA_TYPE_AUDIO:
-- 
2.11.1

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

[libav-devel] [PATCH] dca: Account for lfe when checking for the channel count

2017-04-17 Thread Luca Barbato
Bug-Id: 1037
CC: libav-sta...@libav.org
---
 libavcodec/dcadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index ed1ed2d5f3..3fe46cdc5c 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1300,7 +1300,7 @@ static int set_channel_layout(AVCodecContext *avctx, int 
channels)
 s->channel_order_tab = ff_dca_channel_reorder_nolfe[s->amode];
 }
 
-if (channels < ff_dca_channels[s->amode])
+if (channels < ff_dca_channels[s->amode] + !!s->lfe)
 return AVERROR_INVALIDDATA;
 
 if (channels > !!s->lfe &&
-- 
2.11.1

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

Re: [libav-devel] [PATCH] extract_extradata_bsf: make sure all needed parameter set NALUs were found

2017-04-17 Thread Luca Barbato
On 14/04/2017 15:53, James Almer wrote:
> This mimics the behavior of the now unused h264/hevc parser's split()
> function and fixes decoding some files when extract_extradata bsf is
> enabled.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/extract_extradata_bsf.c | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)

Do you have a small sample to use?

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel