Re: [FFmpeg-devel] [libav-devel] [PATCH] alsdec: validate time diff index

2015-04-22 Thread Thilo Borgmann
Am 21.04.15 um 19:35 schrieb Andreas Cadhalpun:
> On 21.04.2015 08:14, Thilo Borgmann wrote:
>> Am 20.04.15 um 23:20 schrieb Andreas Cadhalpun:
>>> On 19.04.2015 22:20, Luca Barbato wrote:
 I'd check that `master` is always between `raw_buffer` and the end of it.
>>>
>>> You mean something like the attached patch?
>>>
 (I'm not sure if `div_blocks` is validated before, same for `offset`)
>>>
>>> That should catch problems in those as well.
>>
>> Have you tested with fate after applying this patch locally?
> 
> Yes, but only on amd64, where fate passes.
> 
> Attached is a new patch, which should work everywhere.

LGTM

-Thilo

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


[FFmpeg-devel] [PATCH] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for HEVC copy and hv mc functions

2015-04-22 Thread shivraj.patil
From: Shivraj Patil 

Incorporated review comment.
Removed "__" from volatile.

Signed-off-by: Shivraj Patil 
---
 libavcodec/mips/hevcdsp_init_mips.c |   19 +
 libavcodec/mips/hevcdsp_mips.h  |   20 +
 libavcodec/mips/hevcdsp_msa.c   | 1098 +++
 libavutil/mips/generic_macros_msa.h |  133 +
 4 files changed, 1270 insertions(+)

diff --git a/libavcodec/mips/hevcdsp_init_mips.c 
b/libavcodec/mips/hevcdsp_init_mips.c
index 05ed81f..4fec336 100644
--- a/libavcodec/mips/hevcdsp_init_mips.c
+++ b/libavcodec/mips/hevcdsp_init_mips.c
@@ -25,6 +25,16 @@ static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
   const int bit_depth)
 {
 if (8 == bit_depth) {
+c->put_hevc_qpel[1][0][0] = ff_hevc_put_hevc_pel_pixels4_8_msa;
+c->put_hevc_qpel[2][0][0] = ff_hevc_put_hevc_pel_pixels6_8_msa;
+c->put_hevc_qpel[3][0][0] = ff_hevc_put_hevc_pel_pixels8_8_msa;
+c->put_hevc_qpel[4][0][0] = ff_hevc_put_hevc_pel_pixels12_8_msa;
+c->put_hevc_qpel[5][0][0] = ff_hevc_put_hevc_pel_pixels16_8_msa;
+c->put_hevc_qpel[6][0][0] = ff_hevc_put_hevc_pel_pixels24_8_msa;
+c->put_hevc_qpel[7][0][0] = ff_hevc_put_hevc_pel_pixels32_8_msa;
+c->put_hevc_qpel[8][0][0] = ff_hevc_put_hevc_pel_pixels48_8_msa;
+c->put_hevc_qpel[9][0][0] = ff_hevc_put_hevc_pel_pixels64_8_msa;
+
 c->put_hevc_qpel[1][0][1] = ff_hevc_put_hevc_qpel_h4_8_msa;
 c->put_hevc_qpel[3][0][1] = ff_hevc_put_hevc_qpel_h8_8_msa;
 c->put_hevc_qpel[4][0][1] = ff_hevc_put_hevc_qpel_h12_8_msa;
@@ -42,6 +52,15 @@ static av_cold void hevc_dsp_init_msa(HEVCDSPContext *c,
 c->put_hevc_qpel[7][1][0] = ff_hevc_put_hevc_qpel_v32_8_msa;
 c->put_hevc_qpel[8][1][0] = ff_hevc_put_hevc_qpel_v48_8_msa;
 c->put_hevc_qpel[9][1][0] = ff_hevc_put_hevc_qpel_v64_8_msa;
+
+c->put_hevc_qpel[1][1][1] = ff_hevc_put_hevc_qpel_hv4_8_msa;
+c->put_hevc_qpel[3][1][1] = ff_hevc_put_hevc_qpel_hv8_8_msa;
+c->put_hevc_qpel[4][1][1] = ff_hevc_put_hevc_qpel_hv12_8_msa;
+c->put_hevc_qpel[5][1][1] = ff_hevc_put_hevc_qpel_hv16_8_msa;
+c->put_hevc_qpel[6][1][1] = ff_hevc_put_hevc_qpel_hv24_8_msa;
+c->put_hevc_qpel[7][1][1] = ff_hevc_put_hevc_qpel_hv32_8_msa;
+c->put_hevc_qpel[8][1][1] = ff_hevc_put_hevc_qpel_hv48_8_msa;
+c->put_hevc_qpel[9][1][1] = ff_hevc_put_hevc_qpel_hv64_8_msa;
 }
 }
 #endif  // #if HAVE_MSA
diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h
index 13cdb5b..4f7f273 100644
--- a/libavcodec/mips/hevcdsp_mips.h
+++ b/libavcodec/mips/hevcdsp_mips.h
@@ -29,6 +29,16 @@ void ff_hevc_put_hevc_##PEL##_##DIRWIDTH##_8_msa(int16_t 
*dst,  \
  intptr_t my,   \
  int width)
 
+MC(pel, pixels, 4);
+MC(pel, pixels, 6);
+MC(pel, pixels, 8);
+MC(pel, pixels, 12);
+MC(pel, pixels, 16);
+MC(pel, pixels, 24);
+MC(pel, pixels, 32);
+MC(pel, pixels, 48);
+MC(pel, pixels, 64);
+
 MC(qpel, h, 4);
 MC(qpel, h, 8);
 MC(qpel, h, 12);
@@ -46,4 +56,14 @@ MC(qpel, v, 24);
 MC(qpel, v, 32);
 MC(qpel, v, 48);
 MC(qpel, v, 64);
+
+MC(qpel, hv, 4);
+MC(qpel, hv, 8);
+MC(qpel, hv, 12);
+MC(qpel, hv, 16);
+MC(qpel, hv, 24);
+MC(qpel, hv, 32);
+MC(qpel, hv, 48);
+MC(qpel, hv, 64);
+
 #undef MC
diff --git a/libavcodec/mips/hevcdsp_msa.c b/libavcodec/mips/hevcdsp_msa.c
index 88e97d6..fcc344b 100644
--- a/libavcodec/mips/hevcdsp_msa.c
+++ b/libavcodec/mips/hevcdsp_msa.c
@@ -21,6 +21,18 @@
 #include "libavutil/mips/generic_macros_msa.h"
 #include "libavcodec/mips/hevcdsp_mips.h"
 
+#define HEVC_FILT_8TAP_DPADD_W(vec0, vec1, vec2, vec3,\
+   filt0, filt1, filt2, filt3)\
+( {   \
+v4i32 out;\
+  \
+out = __msa_dotp_s_w((v8i16) (vec0), (v8i16) (filt0));\
+out = __msa_dpadd_s_w(out, (v8i16) (vec1), (v8i16) (filt1));  \
+out = __msa_dpadd_s_w(out, (v8i16) (vec2), (v8i16) (filt2));  \
+out = __msa_dpadd_s_w(out, (v8i16) (vec3), (v8i16) (filt3));  \
+out;  \
+} )
+
 #define HEVC_FILT_8TAP_DPADD_H(vec0, vec1, vec2, vec3, 
\
filt0, filt1, filt2, filt3, 
\
var_in) 
\
@@ -34,6 +46,603 @@
 out;   
\
 } )
 
+static void hevc_copy_4w_msa(uint8_t * __restrict src, int32_t src_stride,
+ int16_t * __restrict dst, int32_t dst_stride,
+ int32_t height)
+{
+v16i8 zero = { 

Re: [FFmpeg-devel] [libav-devel] [PATCH] alsdec: validate time diff index

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 10:59:29AM +0200, Thilo Borgmann wrote:
> Am 21.04.15 um 19:35 schrieb Andreas Cadhalpun:
> > On 21.04.2015 08:14, Thilo Borgmann wrote:
> >> Am 20.04.15 um 23:20 schrieb Andreas Cadhalpun:
> >>> On 19.04.2015 22:20, Luca Barbato wrote:
>  I'd check that `master` is always between `raw_buffer` and the end of it.
> >>>
> >>> You mean something like the attached patch?
> >>>
>  (I'm not sure if `div_blocks` is validated before, same for `offset`)
> >>>
> >>> That should catch problems in those as well.
> >>
> >> Have you tested with fate after applying this patch locally?
> > 
> > Yes, but only on amd64, where fate passes.
> > 
> > Attached is a new patch, which should work everywhere.
> 
> LGTM

applied

thanks

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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


[FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

2015-04-22 Thread Niklesh Lalwani
From: Niklesh 

This patch supports decoding of Bold, Italic, Underlined styles for 3gpp timed 
text. While the code can be improved upon to make it more clean and well 
structured, this works for now, even for multiple style records. Suggestions 
awaited.
Signed-off-by: Niklesh 
---
 libavcodec/movtextdec.c | 86 ++---
 1 file changed, 82 insertions(+), 4 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 1c7ffea..a4aa7cb 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -25,10 +25,28 @@
 #include "libavutil/common.h"
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
 
-static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
+#define STYLE_FLAG_BOLD 1
+#define STYLE_FLAG_ITALIC   2
+#define STYLE_FLAG_UNDERLINE4
+
+static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, 
+const char **style_start, const char **style_end, 
+const int **style_flags, const int style_entries)
 {
 while (text < text_end) {
+for (int i=0; idata;
 const char *end;
+int text_length, tsmb_type, style_entries, tsmb_size;
+char **style_start={0,}; 
+char **style_end={0,};
+int **style_flags={0,};
+const uint8_t *tsmb;
+int index,i, flag=0;;
+char *ptr_temp;
 
 if (!ptr || avpkt->size < 2)
 return AVERROR_INVALIDDATA;
@@ -82,7 +118,8 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
  * In complex cases, there are style descriptors appended to the string
  * so we can't just assume the packet size is the string size.
  */
-end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt->size);
+text_length = AV_RB16(ptr);
+end = ptr + FFMIN(2 + text_length, avpkt->size); 
 ptr += 2;
 
 ts_start = av_rescale_q(avpkt->pts,
@@ -92,10 +129,51 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
 avctx->time_base,
 (AVRational){1,100});
 
+tsmb_size=0;
 // Note that the spec recommends lines be no longer than 2048 characters.
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
-text_to_ass(&buf, ptr, end);
-ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end-ts_start);
+if (text_length + 2 != avpkt->size) {
+while (text_length + 2 + tsmb_size < avpkt->size)  {
+tsmb = ptr + text_length+tsmb_size; 
+tsmb_size = AV_RB32(tsmb);  
+tsmb += 4;
+tsmb_type = AV_RB32(tsmb);
+tsmb += 4;
+
+if (tsmb_type == MKBETAG('s','t','y','l')) {
+style_entries = AV_RB16(tsmb);
+tsmb += 2;
+
+for(i = 0; i < style_entries;i++) {
+ptr_temp= ptr + AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_start, &index, ptr_temp);
+tsmb += 2;
+ptr_temp= ptr+ AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_end, &index, ptr_temp);
+tsmb += 2;
+// fontID = AV_RB16(tsmb);
+tsmb += 2;
+flag=AV_RB8(tsmb);
+index=i;
+av_dynarray_add(&style_flags, &index, &flag);
+//fontsize=AV_RB8(tsmb);
+tsmb += 2;
+// text-color-rgba
+tsmb += 4;
+}
+text_to_ass(&buf, ptr, end, style_start, style_end, 
style_flags,style_entries);
+av_freep(&style_start);
+av_freep(&style_end);
+av_freep(&style_flags);
+}
+}
+}
+else
+text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);
+
+ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end - ts_start);
 av_bprint_finalize(&buf, NULL);
 if (ret < 0)
 return ret;
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for H264 lpf and weight/biweight functions

2015-04-22 Thread Shivraj Patil


-Original Message-
From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
On Behalf Of Timothy Gu
Sent: 21 April 2015 00:28
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mips: MSA (MIPS-SIMD-Arch) 
optimizations for H264 lpf and weight/biweight functions

On Mon, Apr 20, 2015 at 2:54 AM  wrote:

> From: Shivraj Patil 
>
> Signed-off-by: Shivraj Patil 
> ---
>  libavcodec/h264dsp.c|1 +
>  libavcodec/h264dsp.h|2 +
>  libavcodec/mips/Makefile|2 +
>  libavcodec/mips/h264dsp_init_mips.c |   74 +
>  libavcodec/mips/h264dsp_mips.h  |   71 +
>  libavcodec/mips/h264dsp_msa.c   | 3037
> +++
>  libavutil/mips/generic_macros_msa.h |  518 ++
>  7 files changed, 3705 insertions(+)
>  create mode 100644 libavcodec/mips/h264dsp_init_mips.c
>  create mode 100644 libavcodec/mips/h264dsp_mips.h  create mode 100644 
> libavcodec/mips/h264dsp_msa.c
>
[...]

> diff --git a/libavcodec/mips/h264dsp_init_mips.c
> b/libavcodec/mips/h264dsp_init_mips.c
> new file mode 100644
> index 000..8d3d760
> --- /dev/null
> +++ b/libavcodec/mips/h264dsp_init_mips.c
> @@ -0,0 +1,74 @@
> +/*
> + * Copyright (c) 2015 Parag Salasakar (parag.salasa...@imgtec.com)
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> + */
> +
> +#include "h264dsp_mips.h"
> +
> +#if HAVE_MSA
> +static av_cold void h264dsp_init_msa(H264DSPContext *c,
> + const int bit_depth,
> + const int chroma_format_idc) {
> +if (8 == bit_depth) {
> +c->h264_v_loop_filter_luma = ff_h264_v_lpf_luma_inter_msa;
> +c->h264_h_loop_filter_luma = ff_h264_h_lpf_luma_inter_msa;
> +c->h264_h_loop_filter_luma_mbaff =
> +ff_h264_h_loop_filter_luma_mbaff_msa;
> +c->h264_v_loop_filter_luma_intra = ff_h264_v_lpf_luma_intra_msa;
> +c->h264_h_loop_filter_luma_intra = ff_h264_h_lpf_luma_intra_msa;
> +c->h264_h_loop_filter_luma_mbaff_intra =
> +ff_h264_h_loop_filter_luma_mbaff_intra_msa;
> +c->h264_v_loop_filter_chroma = 
> +ff_h264_v_lpf_chroma_inter_msa;
> +
> +if (chroma_format_idc <= 1)
> +c->h264_h_loop_filter_chroma = ff_h264_h_lpf_chroma_inter_msa;
> +else
> +c->h264_h_loop_filter_chroma =
> +ff_h264_h_loop_filter_chroma422_msa;
> +
> +if (chroma_format_idc > 1)
> +c->h264_h_loop_filter_chroma_mbaff =
> +ff_h264_h_loop_filter_chroma422_mbaff_msa;
> +
> +c->h264_v_loop_filter_chroma_intra =
> +ff_h264_v_lpf_chroma_intra_msa;
> +
> +if (chroma_format_idc <= 1)
> +c->h264_h_loop_filter_chroma_intra =
> +ff_h264_h_lpf_chroma_intra_msa;
> +
> +/* Weighted MC */
> +c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16_8_msa;
> +c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels8_8_msa;
> +c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels4_8_msa;
> +
> +c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16_8_msa;
> +c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_msa;
> +c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_msa;
> +}  // if (8 == bit_depth)
> +}
> +#endif  // #if HAVE_MSA
> +
> +av_cold void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth,
> +  const int chroma_format_idc) { #if 
> +HAVE_MSA
> +h264dsp_init_msa(c, bit_depth, chroma_format_idc); #endif  // #if 
> +HAVE_MSA }
>

You should fold the _init_msa() function into this function. 

"ff_h264dsp_init_mips" is a generic initialization function for all MIPS 
variants. 
h264dsp_init_msa() is specific to MIPS variants having MSA. In future, there 
could be another init function(s) for other variants.
Hence not clubbing these two functions.

You also need to add the flags into libavutil/mips/cpu.h as the user might not 
want to use MSA at runtime.

See libavutil/cpu.h and libavutil/*/cpu.h.

Timothy
___
ffmpeg-devel mailing list
ffmpeg

[FFmpeg-devel] [PATCH 2/6] avformat/mp3dec: use the common mechanism for skipping samples

2015-04-22 Thread wm4
The mp2 seek test results change. Whether to skip samples if the file
had no LAME gapless tags was inconsistent. When seeking to the start
of the file, 529 samples were skipped, but when playing from start,
nothing was skipped. This commit changes the behavior on seek to skip
nothing.
---
 libavformat/mp3dec.c  | 7 ++-
 tests/ref/seek/acodec-mp2 | 8 
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 0604e31..008cb23 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -228,13 +228,13 @@ static void mp3_parse_info_tag(AVFormatContext *s, 
AVStream *st,
 
 mp3->start_pad = v>>12;
 mp3->  end_pad = v&4095;
-st->skip_samples = mp3->start_pad + 528 + 1;
+st->start_skip_samples = mp3->start_pad + 528 + 1;
 if (mp3->frames) {
 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * 
(int64_t)spf;
 st->last_discard_sample = mp3->frames * (int64_t)spf;
 }
 if (!st->start_time)
-st->start_time = av_rescale_q(st->skip_samples,
+st->start_time = av_rescale_q(st->start_skip_samples,
 (AVRational){1, c->sample_rate},
 st->time_base);
 av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3->  end_pad);
@@ -447,8 +447,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 
 ie = &st->index_entries[ret];
 } else {
-st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
-
 return -1;
 }
 
@@ -496,7 +494,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 }
 
 ff_update_cur_dts(s, st, ie->timestamp);
-st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
 return 0;
 }
 
diff --git a/tests/ref/seek/acodec-mp2 b/tests/ref/seek/acodec-mp2
index 62abab4..8de3676 100644
--- a/tests/ref/seek/acodec-mp2
+++ b/tests/ref/seek/acodec-mp2
@@ -1,6 +1,6 @@
 ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st:-1 flags:1  ts: 1.894167
 ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  30093 size:   
418
 ret: 0 st: 0 flags:0  ts: 0.788334
@@ -18,7 +18,7 @@ ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 
 34690 size:   418
 ret: 0 st:-1 flags:1  ts: 1.047503
 ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  16718 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 2.835837
 ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  45139 size:   
418
 ret: 0 st:-1 flags:0  ts: 1.730004
@@ -26,7 +26,7 @@ ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 
 28003 size:   418
 ret: 0 st:-1 flags:1  ts: 0.624171
 ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:   9613 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 2.412505
 ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  38452 size:   
418
 ret: 0 st:-1 flags:0  ts: 1.306672
@@ -34,7 +34,7 @@ ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 
 21315 size:   418
 ret: 0 st:-1 flags:1  ts: 0.200839
 ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   2925 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 1.989173
 ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  31764 size:   
418
 ret: 0 st:-1 flags:0  ts: 0.883340
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/6] avformat: add common mechanism for skipping samples at the start of file

2015-04-22 Thread wm4
This makes using the generic indexing code with mp3 easier at a later
point.
---
 libavformat/avformat.h | 9 +
 libavformat/utils.c| 4 
 2 files changed, 13 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 514e646..c2f798d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1083,6 +1083,15 @@ typedef struct AVStream {
 int skip_samples;
 
 /**
+ * If not 0, the number of samples that should be skipped from the start of
+ * the stream (the samples are removed from packets with pts==0, which also
+ * assumes negative timestamps do not happen).
+ * Intended for use with formats such as mp3 with ad-hoc gapless audio
+ * support.
+ */
+int64_t start_skip_samples;
+
+/**
  * If not 0, the first audio sample that should be discarded from the 
stream.
  * This is broken by design (needs global sample count), but can't be
  * avoided for broken by design formats such as mp3 with ad-hoc gapless
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 950b3c6..2f6122d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1416,6 +1416,8 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 sample < st->last_discard_sample)
 discard_padding = FFMIN(end_sample - st->first_discard_sample, 
duration);
 }
+if (st->start_skip_samples && (pkt->pts == 0 || pkt->pts == 
RELATIVE_TS_BASE))
+st->skip_samples = st->start_skip_samples;
 if (st->skip_samples || discard_padding) {
 uint8_t *p = av_packet_new_side_data(pkt, 
AV_PKT_DATA_SKIP_SAMPLES, 10);
 if (p) {
@@ -1645,6 +1647,8 @@ void ff_read_frame_flush(AVFormatContext *s)
 
 if (s->internal->inject_global_side_data)
 st->inject_global_side_data = 1;
+
+st->skip_samples = 0;
 }
 }
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 0/6] Fixing gapless mp3 (Nth try)

2015-04-22 Thread wm4
Updated patches.

wm4 (6):
  avformat: add common mechanism for skipping samples at the start of
file
  avformat/mp3dec: use the common mechanism for skipping samples
  avformat/mp3dec: allow enabling generic seek mode
  avformat/mp3dec: make generic index mode the default
  fate: gapless: remove useless tests
  avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

 doc/APIchanges   |  4 
 doc/formats.texi |  2 ++
 libavformat/avformat.h   | 10 ++
 libavformat/mp3dec.c | 19 +++
 libavformat/options_table.h  |  1 +
 libavformat/utils.c  |  4 
 tests/fate/gapless.mak   |  5 ++---
 tests/ref/fate/gapless-mp3   |  2 +-
 tests/ref/fate/gapless-mp3-notoc |  5 -
 tests/ref/seek/acodec-mp2|  8 
 10 files changed, 39 insertions(+), 21 deletions(-)
 delete mode 100644 tests/ref/fate/gapless-mp3-notoc

-- 
2.1.4

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


[FFmpeg-devel] [PATCH 3/6] avformat/mp3dec: allow enabling generic seek mode

2015-04-22 Thread wm4
"-usetoc 2" now invokes the generic seek and indexing mode. This mode
skips data until the seek target is reached, and this is exact. It also
makes gapless audio actually work if a seek past the start of the file
is involved.

Change the fate-gapless-mp3 test to use the new mode, and move the old
one to fate-gapless-mp3-toc (since the test forces use of the Xing TOC).
The new mode has a different result for the seek - this result is
actually correct.
---
 libavformat/mp3dec.c   | 12 +---
 tests/fate/gapless.mak |  5 +++--
 tests/ref/fate/gapless-mp3 |  2 +-
 tests/ref/fate/gapless-mp3-toc |  5 +
 4 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 tests/ref/fate/gapless-mp3-toc

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 008cb23..8a4dfbd 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -110,7 +110,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t 
filesize, int64_t duration
 {
 int i;
 MP3DecContext *mp3 = s->priv_data;
-int fill_index = mp3->usetoc && duration > 0;
+int fill_index = mp3->usetoc == 1 && duration > 0;
 
 if (!filesize &&
 !(filesize = avio_size(s->pb))) {
@@ -336,6 +336,9 @@ static int mp3_read_header(AVFormatContext *s)
 int ret;
 int i;
 
+if (mp3->usetoc < 0)
+mp3->usetoc = 0;
+
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
@@ -432,8 +435,11 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 int64_t best_pos;
 int best_score;
 
+if (mp3->usetoc == 2)
+return -1; // generic index code
+
 if (   mp3->is_cbr
-&& (mp3->usetoc <= 0 || !mp3->xing_toc)
+&& (mp3->usetoc == 0 || !mp3->xing_toc)
 && st->duration > 0
 && mp3->header_filesize > s->internal->data_offset
 && mp3->frames) {
@@ -498,7 +504,7 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 }
 
 static const AVOption options[] = {
-{ "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM},
+{ "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, AV_OPT_FLAG_DECODING_PARAM},
 { NULL },
 };
 
diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index a09dac6..93a878f 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,5 +1,6 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-notoc
-fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
1"
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
+fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
2"
+fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
 fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
 FATE_GAPLESS = $(FATE_GAPLESS-yes)
diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3
index 984ae84..e6a7a33 100644
--- a/tests/ref/fate/gapless-mp3
+++ b/tests/ref/fate/gapless-mp3
@@ -2,4 +2,4 @@ d5c88cf38416329a052a9b0cb140fb4c 
*tests/data/fate/gapless-mp3.out-1
 c96c3ae7bd3300fd2f4debac222de5b7
 3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3.out-2
 c96c3ae7bd3300fd2f4debac222de5b7
-70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3.out-3
+92e37f050ad4fc817730c8af17ee6d1b *tests/data/fate/gapless-mp3.out-3
diff --git a/tests/ref/fate/gapless-mp3-toc b/tests/ref/fate/gapless-mp3-toc
new file mode 100644
index 000..5d1cc00
--- /dev/null
+++ b/tests/ref/fate/gapless-mp3-toc
@@ -0,0 +1,5 @@
+d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-toc.out-1
+c96c3ae7bd3300fd2f4debac222de5b7
+3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-toc.out-2
+c96c3ae7bd3300fd2f4debac222de5b7
+70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3-toc.out-3
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 4/6] avformat/mp3dec: make generic index mode the default

2015-04-22 Thread wm4
It's the most useful mode, because it seeks accurately, and does not
break features like gapless audio.
---
 libavformat/mp3dec.c   | 2 +-
 tests/fate/gapless.mak | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 8a4dfbd..a2d3dfe 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -337,7 +337,7 @@ static int mp3_read_header(AVFormatContext *s)
 int i;
 
 if (mp3->usetoc < 0)
-mp3->usetoc = 0;
+mp3->usetoc = 2;
 
 st = avformat_new_stream(s, NULL);
 if (!st)
diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index 93a878f..f0f5fd0 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,5 +1,5 @@
 FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
-fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
2"
+fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3
 fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
 fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 6/6] avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

2015-04-22 Thread wm4
---
 doc/APIchanges  | 4 
 doc/formats.texi| 2 ++
 libavformat/avformat.h  | 1 +
 libavformat/mp3dec.c| 2 +-
 libavformat/options_table.h | 1 +
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b422e29..b65fd62 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - xxx - lavf 56.xx.xxx - avformat.h
+  Add AVFMT_FLAG_FAST_SEEK flag. Some formats (initially mp3) use it to enable
+  fast, but inaccurate seeking.
+
 2015-xx-xx - xxx - lavu 54.12.0
   Add AV_LOG_TRACE for extremely verbose debugging.
 
diff --git a/doc/formats.texi b/doc/formats.texi
index cbbdc10..aa39d4b 100644
--- a/doc/formats.texi
+++ b/doc/formats.texi
@@ -37,6 +37,8 @@ Possible values:
 @table @samp
 @item ignidx
 Ignore index.
+@item fastseek
+Enable fast, but inaccurate seeks for some formats.
 @item genpts
 Generate PTS.
 @item nofillin
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index c2f798d..339ff52 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1391,6 +1391,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_SORT_DTS0x1 ///< try to interleave outputted 
packets by dts (using this flag can slow demuxing down)
 #define AVFMT_FLAG_PRIV_OPT0x2 ///< Enable use of private options by 
delaying codec open (this could be made default once all code is converted)
 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep 
it separate.
+#define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 
 /**
  * @deprecated deprecated in favor of probesize2
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index a2d3dfe..8c17776 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -337,7 +337,7 @@ static int mp3_read_header(AVFormatContext *s)
 int i;
 
 if (mp3->usetoc < 0)
-mp3->usetoc = 2;
+mp3->usetoc = (s->flags & AVFMT_FLAG_FAST_SEEK) ? 0 : 2;
 
 st = avformat_new_stream(s, NULL);
 if (!st)
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 40f1e0a..58670b0 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -49,6 +49,7 @@ static const AVOption avformat_options[] = {
 {"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},
 {"sortdts", "try to interleave outputted packets by dts", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, 
"fflags"},
 {"keepside", "don't merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
+{"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"},
 {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
 {"nobuffer", "reduce the latency introduced by optional buffering", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
 {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D},
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 5/6] fate: gapless: remove useless tests

2015-04-22 Thread wm4
These could be kept, but they are not overly useful. The only thing they
had over the remaining mp3 gapless test was seeking, which was incorrect
in the toc test, and only by chance correct in the notoc test.
---
 tests/fate/gapless.mak   | 4 +---
 tests/ref/fate/gapless-mp3-notoc | 5 -
 tests/ref/fate/gapless-mp3-toc   | 5 -
 3 files changed, 1 insertion(+), 13 deletions(-)
 delete mode 100644 tests/ref/fate/gapless-mp3-notoc
 delete mode 100644 tests/ref/fate/gapless-mp3-toc

diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index f0f5fd0..2fb005f 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,7 +1,5 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
 fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3
-fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
-fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
 FATE_GAPLESS = $(FATE_GAPLESS-yes)
 
diff --git a/tests/ref/fate/gapless-mp3-notoc b/tests/ref/fate/gapless-mp3-notoc
deleted file mode 100644
index 936d0ba..000
--- a/tests/ref/fate/gapless-mp3-notoc
+++ /dev/null
@@ -1,5 +0,0 @@
-d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-notoc.out-1
-c96c3ae7bd3300fd2f4debac222de5b7
-3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-notoc.out-2
-c96c3ae7bd3300fd2f4debac222de5b7
-92e37f050ad4fc817730c8af17ee6d1b *tests/data/fate/gapless-mp3-notoc.out-3
diff --git a/tests/ref/fate/gapless-mp3-toc b/tests/ref/fate/gapless-mp3-toc
deleted file mode 100644
index 5d1cc00..000
--- a/tests/ref/fate/gapless-mp3-toc
+++ /dev/null
@@ -1,5 +0,0 @@
-d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-toc.out-1
-c96c3ae7bd3300fd2f4debac222de5b7
-3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-toc.out-2
-c96c3ae7bd3300fd2f4debac222de5b7
-70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3-toc.out-3
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 2/5] avformat/mp3dec: use the common mechanism for skipping samples

2015-04-22 Thread wm4
On Wed, 22 Apr 2015 01:42:39 +0200
Michael Niedermayer  wrote:

> On Wed, Apr 22, 2015 at 01:09:26AM +0200, wm4 wrote:
> > On Wed, 22 Apr 2015 00:48:30 +0200
> > Michael Niedermayer  wrote:
> > 
> > > On Tue, Apr 21, 2015 at 09:33:51PM +0200, wm4 wrote:
> > > > ---
> > > > Feel free to squash with the previous patch if it's too fine-grained.
> > > > ---
> > > >  libavformat/mp3dec.c | 7 ++-
> > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > 
> > > this breaks fate-seek-acodec-mp2
> > > 
> > > [...]
> > 
> > The old behavior is quite inconsistent:
> > 
> > - if the file has a LAME header
> >  - the start of the file skps at least 529 samples
> >  - seeking to the start also does
> > - if the file has no LAME hesder
> >  - the start of the file skips no samples
> >  - seeking to the start skips 529 samples
> > 
> > So should it skip data on the start or not? (If no LAME header.)
> 
> hmm, i was not conciously aware of it being inconsistent
> 
> iam not against the change the patch does if you think its ok and
> the patch that introduces it also updates the fate checksum
> 
> [...]

I chose not to skip samples at all if the LAME header is missing.
Patches resent.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] vp9: add support for resolution changes in inter frames.

2015-04-22 Thread Ronald S. Bultje
Hi,

On Tue, Apr 21, 2015 at 11:25 PM, James Almer  wrote:

> On 22/04/15 12:20 AM, James Almer wrote:
> > On 21/04/15 9:54 PM, Ronald S. Bultje wrote:
> >> ---
> >>  libavcodec/vp9.c | 316
> ++-
> >>  libavcodec/vp9_mc_template.c | 171 +++
> >>  libavcodec/vp9_parser.c  |   5 +-
> >>  libavcodec/vp9dsp.c  | 205 ++--
> >>  libavcodec/vp9dsp.h  |   9 ++
> >>  5 files changed, 535 insertions(+), 171 deletions(-)
> >>  create mode 100644 libavcodec/vp9_mc_template.c
> >>
> >> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> >> index 89257fa..ee73325 100644
> >> --- a/libavcodec/vp9.c
> >> +++ b/libavcodec/vp9.c
> >> @@ -242,7 +242,7 @@ typedef struct VP9Context {
> >>  // whole-frame cache
> >>  uint8_t *intra_pred_data[3];
> >>  struct VP9Filter *lflvl;
> >> -DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[71*80];
> >> +DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135*144];
> >>
> >>  // block reconstruction intermediates
> >>  int block_alloc_using_2pass;
> >> @@ -251,6 +251,8 @@ typedef struct VP9Context {
> >>  struct { int x, y; } min_mv, max_mv;
> >>  DECLARE_ALIGNED(32, uint8_t, tmp_y)[64*64];
> >>  DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][32*32];
> >> +uint16_t mvscale[3][2];
> >> +uint8_t mvstep[3][2];
> >>  } VP9Context;
> >>
> >>  static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
> >> @@ -577,6 +579,26 @@ static int decode_frame_header(AVCodecContext *ctx,
> >>  s->varcompref[1] = 2;
> >>  }
> >>  }
> >> +
> >> +for (i = 0; i < 3; i++) {
> >> +AVFrame *ref = s->refs[s->refidx[i]].f;
> >> +int refw = ref->width, refh = ref->height;
> >> +
> >> +if (refw == w && refh == h) {
> >> +s->mvscale[i][0] = s->mvscale[i][1] = 0;
> >> +} else {
> >> +if (w * 2 < refw || h * 2 < refh || w > 16 * refw
> || h > 16 * refh) {
> >> +av_log(ctx, AV_LOG_ERROR,
> >> +   "Invalid ref frame dimensions %dx%d for
> frame size %dx%d\n",
> >> +   refw, refh, w, h);
> >> +return AVERROR_INVALIDDATA;
> >> +}
> >> +s->mvscale[i][0] = (refw << 14) / w;
> >> +s->mvscale[i][1] = (refh << 14) / h;
> >> +s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
> >> +s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
> >> +}
> >> +}
> >>  }
> >>  }
> >>  s->refreshctx   = s->errorres ? 0 : get_bits1(&s->gb);
> >> @@ -2524,12 +2546,118 @@ static void intra_recon(AVCodecContext *ctx,
> ptrdiff_t y_off, ptrdiff_t uv_off)
> >>  }
> >>  }
> >>
> >> -static av_always_inline void mc_luma_dir(VP9Context *s, vp9_mc_func
> (*mc)[2],
> >> - uint8_t *dst, ptrdiff_t
> dst_stride,
> >> - const uint8_t *ref, ptrdiff_t
> ref_stride,
> >> - ThreadFrame *ref_frame,
> >> - ptrdiff_t y, ptrdiff_t x,
> const VP56mv *mv,
> >> - int bw, int bh, int w, int h)
> >> +static av_always_inline void mc_luma_scaled(VP9Context *s,
> vp9_scaled_mc_func smc,
> >> +uint8_t *dst, ptrdiff_t
> dst_stride,
> >> +const uint8_t *ref,
> ptrdiff_t ref_stride,
> >> +ThreadFrame *ref_frame,
> >> +ptrdiff_t y, ptrdiff_t x,
> const VP56mv *mv,
> >> +int bw, int bh, int w, int
> h,
> >> +const uint16_t *scale,
> const uint8_t *step)
> >> +{
> >> +#define scale_mv(n, dim) (((int64_t)n * scale[dim]) >> 14)
> >> +// BUG libvpx seems to scale the two components separately. This
> introduces
> >> +// rounding errors but we have to reproduce them to be exactly
> compatible
> >> +// with the output from libvpx...
> >
> > Did you report it to libvpx? It's probably a better idea to fix the bug
> in the reference
> > library than purposely reproduce the buggy behavior in our
> implementation to remain
> > compatible.
>
> Just checked the link further down the patch (As i should have done before
> replying).
> Assuming it's the same bug as this one then forget what i said, they
> decided to leave
> the bitstream unchanged.


Yes, sadly, not much can be done here on our end...

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


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Máté Sebők
Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now fixed.

Error handler fixed.

Parameter names changed to audio(/video)_device_load(/save) as I think the
to_file and from_file is evident and is specified in the help.

About the "fake" input:  by loading a device filter from file, in the
dshow_open_device() it loads the device object from file instead of
searching it by name. So as long as the dshow_open_device() get called it
will load the device -- however to get called it is required to have a not
NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
If you have better suggestion for the description, please tell me.

Here is the fixed patch.

Regards,
Máté

On Tue, Apr 21, 2015 at 9:38 PM, Roger Pack  wrote:

> OK some verbiage nits:
>
>
> +@item capture_audio_device_load
> I'd suggest naming it it audio_device_load_from_filename instead.
> Similar for video.
>
> +Load an audio capture filter device from file instead of searching
> +it by name. It c, if the filter
> +supports the serialization of its properties to.
> +To use this an audio capture source has to be specified, but it can
> +be anything even fake one.
>
> "It may load"
>
> I'd probably say "even a fake one, but we recommend just specifying
> the name of the desired device."
>
> +If a file with the same name existed before it will be overwritten.
>
> suggest:
>
> If a file with the same name exists it will be overwritten.
>
> +@item capture_audio_device_save
> suggest rename to audio_device_to_filename, similar for video.
>
> Somehow this diff changed all the line endings so it appears as if the
> entire file has changed.  You can use "dos2unix" command to convert
> them back then do the diff again, so we can see what really changed.
>
> +if (file_stream)
> +IStream_Release(file_stream);
>
> I'd prefer to only have this only "once" which means either putting it
> in the error:
> section
> or creating your own error section "error1:" and on failure say "goto
> error1" or the like.
>
> GL!
>
> On 4/21/15, Máté Sebők  wrote:
> > This patch allows for saving and loading of audio and video capture
> filter
> > devices (and in some cases its parameters) .
> > (similar to IPersistStream, but with the cleaner OleSaveToStream and
> > OleLoadFromStream methods)
> >
> > Regards,
> > Máté
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-dshow-add-capture-device-save-and-load.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now fixed.
> 
> Error handler fixed.
> 
> Parameter names changed to audio(/video)_device_load(/save) as I think the
> to_file and from_file is evident and is specified in the help.
> 
> About the "fake" input:  by loading a device filter from file, in the
> dshow_open_device() it loads the device object from file instead of
> searching it by name. So as long as the dshow_open_device() get called it
> will load the device -- however to get called it is required to have a not
> NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
> If you have better suggestion for the description, please tell me.
> 
> Here is the fixed patch.

[...]

> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index d03670e..9ac28c5 100644
> --- a/libavdevice/dshow.c
> +++ b/libavdevice/dshow.c
> @@ -27,6 +27,8 @@
>  #include "libavformat/riff.h"
>  #include "avdevice.h"
>  #include "libavcodec/raw.h"
> +#include "objidl.h"

> +#include "Shlwapi.h"

this header does not exist, it must be lowwer case or it will break
build on linux-mingw

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH] libavcodec/parser.c: re-fetch PTS/DTS if fetch failed

2015-04-22 Thread luckliuyuxin
From 00b457adb855b0b25ac7cde4a9cb8c7b53fd0511 Mon Sep 17 00:00:00 2001
From: liuyuxin 
Date: Wed, 22 Apr 2015 16:56:42 +0800
Subject: [PATCH] re-fetch PTS/DTS if fetch failed


Signed-off-by: liuyuxin 
---
 libavcodec/parser.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index b06a959..e62407b 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -163,6 +163,11 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 s->last_dts= s->dts;
 s->last_pos= s->pos;
 ff_fetch_timestamp(s, 0, 0, 0);
+if (s->dts == AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE
+&& s->pos == -1 && !s->offset) {
+//fetch failed, re-fetch next time
+s->fetch_timestamp = 1;
+}
 }
 /* WARNING: the returned index can be negative */
 index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,

0001-re-fetch-PTS-DTS-if-fetch-failed.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

2015-04-22 Thread Michael Niedermayer
Hi

On Wed, Apr 22, 2015 at 03:40:03PM +0530, Niklesh Lalwani wrote:
> From: Niklesh 
> 
> This patch supports decoding of Bold, Italic, Underlined styles for 3gpp 
> timed text. While the code can be improved upon to make it more clean and 
> well structured, this works for now, even for multiple style records. 
> Suggestions awaited.
> Signed-off-by: Niklesh 
> ---
>  libavcodec/movtextdec.c | 86 
> ++---
>  1 file changed, 82 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index 1c7ffea..a4aa7cb 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -25,10 +25,28 @@
>  #include "libavutil/common.h"
>  #include "libavutil/bprint.h"
>  #include "libavutil/intreadwrite.h"
> +#include "libavutil/mem.h"
>  
> -static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
> +#define STYLE_FLAG_BOLD 1
> +#define STYLE_FLAG_ITALIC   2
> +#define STYLE_FLAG_UNDERLINE4
> +
> +static int text_to_ass(AVBPrint *buf, const char *text, const char 
> *text_end, 
> +const char **style_start, const char **style_end, 
> +const int **style_flags, const int style_entries)
>  {
>  while (text < text_end) {

> +for (int i=0; i

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


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Hendrik Leppkes
On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer  wrote:
> On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
>> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now fixed.
>>
>> Error handler fixed.
>>
>> Parameter names changed to audio(/video)_device_load(/save) as I think the
>> to_file and from_file is evident and is specified in the help.
>>
>> About the "fake" input:  by loading a device filter from file, in the
>> dshow_open_device() it loads the device object from file instead of
>> searching it by name. So as long as the dshow_open_device() get called it
>> will load the device -- however to get called it is required to have a not
>> NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
>> If you have better suggestion for the description, please tell me.
>>
>> Here is the fixed patch.
>
> [...]
>
>> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
>> index d03670e..9ac28c5 100644
>> --- a/libavdevice/dshow.c
>> +++ b/libavdevice/dshow.c
>> @@ -27,6 +27,8 @@
>>  #include "libavformat/riff.h"
>>  #include "avdevice.h"
>>  #include "libavcodec/raw.h"
>> +#include "objidl.h"
>
>> +#include "Shlwapi.h"
>
> this header does not exist, it must be lowwer case or it will break
> build on linux-mingw
>

That is the proper capitalization of the header in the MS Windows SDK.
If mingw has it all lower-cased, its technically a bug in mingw.

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


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer  wrote:
> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now 
> >> fixed.
> >>
> >> Error handler fixed.
> >>
> >> Parameter names changed to audio(/video)_device_load(/save) as I think the
> >> to_file and from_file is evident and is specified in the help.
> >>
> >> About the "fake" input:  by loading a device filter from file, in the
> >> dshow_open_device() it loads the device object from file instead of
> >> searching it by name. So as long as the dshow_open_device() get called it
> >> will load the device -- however to get called it is required to have a not
> >> NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
> >> If you have better suggestion for the description, please tell me.
> >>
> >> Here is the fixed patch.
> >
> > [...]
> >
> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> >> index d03670e..9ac28c5 100644
> >> --- a/libavdevice/dshow.c
> >> +++ b/libavdevice/dshow.c
> >> @@ -27,6 +27,8 @@
> >>  #include "libavformat/riff.h"
> >>  #include "avdevice.h"
> >>  #include "libavcodec/raw.h"
> >> +#include "objidl.h"
> >
> >> +#include "Shlwapi.h"
> >
> > this header does not exist, it must be lowwer case or it will break
> > build on linux-mingw
> >
> 
> That is the proper capitalization of the header in the MS Windows SDK.
> If mingw has it all lower-cased, its technically a bug in mingw.

hmm i wasnt aware of that but yes
 locate Shlwapi.h confirms that theres no such header in ubuntu mingw*

so this definitly needs some configure check so it doesnt break build

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


Re: [FFmpeg-devel] [GSoC] Patch which adds support for gamma correct scaling

2015-04-22 Thread nand
> I intended to fetch the correct gamma value from the video/image metada
> or pass it by flag (like gamma=x) but yet I don't know how to get the
> correct gamma based on the input, thus for now it is hardcode.

This is how we do it in mpv:

1. If the source has enum AVColorTransferCharacteristic set, use that.
2. Otherwise, apply this heuristic:
 If YCbCr, assume BT.1886
 If RGB, assume sRGB

Also, you should note that scaling in linear light is only desirable for
downscaling. For upscaling it tends to produce rather ugly ringing
artifacts.

So I would advise adding a check to see if (newRes < oldRes) before
applying the gamma transformation.


pgpwzU9aiZNkt.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/6] avformat: add common mechanism for skipping samples at the start of file

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:24:36PM +0200, wm4 wrote:
> This makes using the generic indexing code with mp3 easier at a later
> point.
> ---
>  libavformat/avformat.h | 9 +
>  libavformat/utils.c| 4 
>  2 files changed, 13 insertions(+)

applied

thanks

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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/6] avformat/mp3dec: use the common mechanism for skipping samples

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:24:37PM +0200, wm4 wrote:
> The mp2 seek test results change. Whether to skip samples if the file
> had no LAME gapless tags was inconsistent. When seeking to the start
> of the file, 529 samples were skipped, but when playing from start,
> nothing was skipped. This commit changes the behavior on seek to skip
> nothing.
> ---
>  libavformat/mp3dec.c  | 7 ++-
>  tests/ref/seek/acodec-mp2 | 8 
>  2 files changed, 6 insertions(+), 9 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH 3/6] avformat/mp3dec: allow enabling generic seek mode

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:24:38PM +0200, wm4 wrote:
> "-usetoc 2" now invokes the generic seek and indexing mode. This mode
> skips data until the seek target is reached, and this is exact. It also
> makes gapless audio actually work if a seek past the start of the file
> is involved.
> 
> Change the fate-gapless-mp3 test to use the new mode, and move the old
> one to fate-gapless-mp3-toc (since the test forces use of the Xing TOC).
> The new mode has a different result for the seek - this result is
> actually correct.
> ---
>  libavformat/mp3dec.c   | 12 +---
>  tests/fate/gapless.mak |  5 +++--
>  tests/ref/fate/gapless-mp3 |  2 +-
>  tests/ref/fate/gapless-mp3-toc |  5 +
>  4 files changed, 18 insertions(+), 6 deletions(-)
>  create mode 100644 tests/ref/fate/gapless-mp3-toc

applied

thanks

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


[FFmpeg-devel] [PATCH] dss_sp: use lowercase codec name without whitespace

2015-04-22 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/dss_sp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index 42ba1c4..909ad1f 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -776,7 +776,7 @@ static int dss_sp_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 
 AVCodec ff_dss_sp_decoder = {
-.name   = "DSS SP",
+.name   = "dss_sp",
 .long_name  = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard 
Play mode (DSS SP)"),
 .type   = AVMEDIA_TYPE_AUDIO,
 .id = AV_CODEC_ID_DSS_SP,
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] libavutil: Make changes in softfloat needed for fixed point aac decoder.

2015-04-22 Thread Nedeljko Babic
> >
>> >> +static av_always_inline SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
>> >
>> >missing documentation
>> 
>> I'll add it.
>> 
>> >is this exact ?
>> >if not what are the gurantees to the user
>> >
>> 
>> On our tests
>> For 80.3% of input values the output is exact
>> For 19.2% of input values the error is one LSB bit of mantissa
>> For 0.5% of input values the error is two LSB bits of mantissa
>
>I think av_div_sf() should be exact, approximate
>functions should have a clear and distinct name, be that
>av_div_sf_approx() or whatever
>

Ok, I'll rename the function.
Should I leave the original div function in the code?

>
>[...]
>> >
>> >> +SoftFloat res;
>> >> +SoftFloat iB, tmp;
>> >> +
>> >> +if (b.mant != 0)
>> >> +{
>> >> +iB = av_recip_sf(b);
>> >> +/* Newton iteration to double precision */
>> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
>> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
>> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
>> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
>> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
>> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
>> >> +res = av_mul_sf(a, iB);
>> >> +}
>> >> +else
>> >> +{
>> >> +/* handle division-by-zero */
>> >> +res.mant = 1;
>> >> +res.exp = 0x7FFF;
>> >> +}
>> >> +
>> >> +return res;
>> >> +#endif
>> >> +}
>> >> +
>> >> +//FIXME log, exp, pow
>> >>  
>> >
>> >>  static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
>> >> -return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits});
>> >> +return av_normalize_sf((SoftFloat){v, frac_bits});
>> >>  }
>> >
>> >missing documentation
>> 
>> I'll add it.
>> 
>> >also please make sure that the parameters make some logic sense
>> >and do not depend on the precission choosen by the implementation
>> >
>> >so a "1.0" shwould be generated from the same arguments no matter
>> >what the precision used in the implementation is
>> 
>> I am not sure I understand you on this.
>> 
>> Basic implementation of this function is the same as in original except
>> "ONE_BITS-frac_bits" is changed with "frac_bits".
>> This was done since algorithm is adjusted to be usable in implementation
>> of fixed point aac decoder.
>
>the numbers are of the form x * 2^y
>thus the interface to create 4.0 should be av_int2sf(1,2) not
>int2sf(1,123)
>The interface should be simple, logic and intuitive

As I said in the comment of this patch and before in comments to review,
I modified the code in the softfloat to be more usable in the implementation
of fixed point aac decoder.
Fixed point aac decoder was developed by using our float emulation and it was
more convenient to change ffmpeg softfloat than to make changes in aac since
softfloat is not used anywhere in ffmpeg currently.

It is clear to me that maybe for the number that is power of two it is more
convenient to use original way, but for other numbers it is basically the same.

On the other hand there is one subtraction less in the implementation of this
function if precision is used as argument.

And at the end, basically, I do not have a problem with changing this function
back to original if you want me to and comments above were just for the sake of
discussion :)

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


Re: [FFmpeg-devel] [GSoC] Patch which adds support for gamma correct scaling

2015-04-22 Thread Pedro Arthur
Thank you for the tips, I'll work on it.

2015-04-22 3:06 GMT-03:00 nand :

> > I intended to fetch the correct gamma value from the video/image metada
> > or pass it by flag (like gamma=x) but yet I don't know how to get the
> > correct gamma based on the input, thus for now it is hardcode.
>
> This is how we do it in mpv:
>
> 1. If the source has enum AVColorTransferCharacteristic set, use that.
> 2. Otherwise, apply this heuristic:
>  If YCbCr, assume BT.1886
>  If RGB, assume sRGB
>
> Also, you should note that scaling in linear light is only desirable for
> downscaling. For upscaling it tends to produce rather ugly ringing
> artifacts.
>
> So I would advise adding a check to see if (newRes < oldRes) before
> applying the gamma transformation.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/aacsbr.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index b582d3f..7e98834 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -514,7 +514,7 @@ static int sbr_make_f_master(AACContext *ac, 
SpectralBandReplication *sbr,
 /// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 
4.46)
 static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
 {
-int i, k, sb = 0;
+int i, k, last_k = -1, last_msb = -1, sb = 0;
 int msb = sbr->k[0];
 int usb = sbr->kx[1];
 int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
@@ -528,6 +528,12 @@ static int sbr_hf_calc_npatches(AACContext *ac, 
SpectralBandReplication *sbr)
 
 do {
 int odd = 0;
+if (k == last_k && msb == last_msb) {
+av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
+return AVERROR_INVALIDDATA;
+}
+last_k = k;
+last_msb = msb;
 for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
 sb = sbr->f_master[i];
 odd = (sb + sbr->k[0]) & 1;
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

2015-04-22 Thread Niklesh Lalwani
From: Niklesh 

Updated patch for decoding of Bold-Italic-Underlined style records for 3gpp 
timed text. Fixed several build warnings.
Signed-off-by: Niklesh 
---
 libavcodec/movtextdec.c | 91 +
 1 file changed, 85 insertions(+), 6 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 1c7ffea..1a03b14 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -25,10 +25,29 @@
 #include "libavutil/common.h"
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
 
-static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
+#define STYLE_FLAG_BOLD 1
+#define STYLE_FLAG_ITALIC   2
+#define STYLE_FLAG_UNDERLINE4
+
+static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, 
+char **style_start, char **style_end, 
+int **style_flags, int style_entries)
 {
+int i=0;
 while (text < text_end) {
+for (i=0; idata;
-const char *end;
+char *ptr = avpkt->data;
+char *end;
+char *ptr_temp;
+int text_length, tsmb_type, style_entries, tsmb_size;
+char **style_start={0,}; 
+char **style_end={0,};
+int **style_flags={0,};
+const uint8_t *tsmb;
+int index,i, flag=0;;
 
 if (!ptr || avpkt->size < 2)
 return AVERROR_INVALIDDATA;
@@ -82,7 +119,8 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
  * In complex cases, there are style descriptors appended to the string
  * so we can't just assume the packet size is the string size.
  */
-end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt->size);
+text_length = AV_RB16(ptr);
+end = ptr + FFMIN(2 + text_length, avpkt->size); 
 ptr += 2;
 
 ts_start = av_rescale_q(avpkt->pts,
@@ -92,10 +130,51 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
 avctx->time_base,
 (AVRational){1,100});
 
+tsmb_size=0;
 // Note that the spec recommends lines be no longer than 2048 characters.
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
-text_to_ass(&buf, ptr, end);
-ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end-ts_start);
+if (text_length + 2 != avpkt->size) {
+while (text_length + 2 + tsmb_size < avpkt->size)  {
+tsmb = ptr + text_length+tsmb_size; 
+tsmb_size = AV_RB32(tsmb);  
+tsmb += 4;
+tsmb_type = AV_RB32(tsmb);
+tsmb += 4;
+
+if (tsmb_type == MKBETAG('s','t','y','l')) {
+style_entries = AV_RB16(tsmb);
+tsmb += 2;
+
+for(i = 0; i < style_entries;i++) {
+ptr_temp= ptr + AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_start, &index, ptr_temp);
+tsmb += 2;
+ptr_temp= ptr+ AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_end, &index, ptr_temp);
+tsmb += 2;
+// fontID = AV_RB16(tsmb);
+tsmb += 2;
+flag=AV_RB8(tsmb);
+index=i;
+av_dynarray_add(&style_flags, &index, &flag);
+//fontsize=AV_RB8(tsmb);
+tsmb += 2;
+// text-color-rgba
+tsmb += 4;
+}
+text_to_ass(&buf, ptr, end, style_start, style_end, 
style_flags,style_entries);
+av_freep(&style_start);
+av_freep(&style_end);
+av_freep(&style_flags);
+}
+}
+}
+else
+text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);
+
+ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end - ts_start);
 av_bprint_finalize(&buf, NULL);
 if (ret < 0)
 return ret;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] alsdec: only adapt order for positive max_order

2015-04-22 Thread Andreas Cadhalpun
For max_order = 0 the clipping range is invalid. (amin = 2, amax = 1)

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e34cf6e..75be55c 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -682,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, 
ALSBlockData *bd)
 
 
 if (!sconf->rlslms) {
-if (sconf->adapt_order) {
+if (sconf->adapt_order && sconf->max_order) {
 int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 
3) - 1,
 2, sconf->max_order + 1));
 *bd->opt_order   = get_bits(gb, opt_order_length);
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] libavutil: Make changes in softfloat needed for fixed point aac decoder.

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 01:15:56PM +, Nedeljko Babic wrote:
> > >
> >> >> +static av_always_inline SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
> >> >
> >> >missing documentation
> >> 
> >> I'll add it.
> >> 
> >> >is this exact ?
> >> >if not what are the gurantees to the user
> >> >
> >> 
> >> On our tests
> >> For 80.3% of input values the output is exact
> >> For 19.2% of input values the error is one LSB bit of mantissa
> >> For 0.5% of input values the error is two LSB bits of mantissa
> >
> >I think av_div_sf() should be exact, approximate
> >functions should have a clear and distinct name, be that
> >av_div_sf_approx() or whatever
> >
> 
> Ok, I'll rename the function.
> Should I leave the original div function in the code?

there should be an exact divide function left in there, yes


> 
> >
> >[...]
> >> >
> >> >> +SoftFloat res;
> >> >> +SoftFloat iB, tmp;
> >> >> +
> >> >> +if (b.mant != 0)
> >> >> +{
> >> >> +iB = av_recip_sf(b);
> >> >> +/* Newton iteration to double precision */
> >> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
> >> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
> >> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
> >> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
> >> >> +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB));
> >> >> +iB = av_add_sf(iB, av_mul_sf(iB, tmp));
> >> >> +res = av_mul_sf(a, iB);
> >> >> +}
> >> >> +else
> >> >> +{
> >> >> +/* handle division-by-zero */
> >> >> +res.mant = 1;
> >> >> +res.exp = 0x7FFF;
> >> >> +}
> >> >> +
> >> >> +return res;
> >> >> +#endif
> >> >> +}
> >> >> +
> >> >> +//FIXME log, exp, pow
> >> >>  
> >> >
> >> >>  static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
> >> >> -return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits});
> >> >> +return av_normalize_sf((SoftFloat){v, frac_bits});
> >> >>  }
> >> >
> >> >missing documentation
> >> 
> >> I'll add it.
> >> 
> >> >also please make sure that the parameters make some logic sense
> >> >and do not depend on the precission choosen by the implementation
> >> >
> >> >so a "1.0" shwould be generated from the same arguments no matter
> >> >what the precision used in the implementation is
> >> 
> >> I am not sure I understand you on this.
> >> 
> >> Basic implementation of this function is the same as in original except
> >> "ONE_BITS-frac_bits" is changed with "frac_bits".
> >> This was done since algorithm is adjusted to be usable in implementation
> >> of fixed point aac decoder.
> >
> >the numbers are of the form x * 2^y
> >thus the interface to create 4.0 should be av_int2sf(1,2) not
> >int2sf(1,123)
> >The interface should be simple, logic and intuitive
> 
> As I said in the comment of this patch and before in comments to review,
> I modified the code in the softfloat to be more usable in the implementation
> of fixed point aac decoder.
> Fixed point aac decoder was developed by using our float emulation and it was
> more convenient to change ffmpeg softfloat than to make changes in aac since
> softfloat is not used anywhere in ffmpeg currently.
> 
> It is clear to me that maybe for the number that is power of two it is more
> convenient to use original way, but for other numbers it is basically the 
> same.
> 
> On the other hand there is one subtraction less in the implementation of this
> function if precision is used as argument.
> 
> And at the end, basically, I do not have a problem with changing this function
> back to original if you want me to and comments above were just for the sake 
> of
> discussion :)

you can add a 2nd function if you feel the subtraction matters
but there should be one with simple and a human understandable
interface

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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


Re: [FFmpeg-devel] [PATCH 4/6] avformat/mp3dec: make generic index mode the default

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:24:39PM +0200, wm4 wrote:
> It's the most useful mode, because it seeks accurately, and does not
> break features like gapless audio.
> ---
>  libavformat/mp3dec.c   | 2 +-
>  tests/fate/gapless.mak | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


[FFmpeg-devel] [PATCH] mpeg4videodec: only allow a positive length

2015-04-22 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/mpeg4videodec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 8449392..9bf33dd 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext 
*ctx, GetBitContext *g
 int x = 0, y = 0;
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 x = get_xbits(gb, length);
 
 if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
 check_marker(gb, "before sprite_trajectory");
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 y = get_xbits(gb, length);
 
 check_marker(gb, "after sprite_trajectory");
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSoC] Patch which adds support for gamma correct scaling

2015-04-22 Thread Kevin Wheatley
I'll add that for some encodings filters with negative lobes will
cause ringing no matter the direction up/down, especially true for
higher dynamic range encodings like log and HDR options like SMPTE ST
2084

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


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Roger Pack
On 4/22/15, Máté Sebők  wrote:
> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now
> fixed.
>
> Error handler fixed.

Thank you it's very close.
A few more nits and we'll be there.

You have
+if (ofile_stream)
+IStream_Release(ofile_stream);

in there twice.  In reality even a "normal flow" goes through the
error block, so you'll only want/need to release it in the error block
(it's being released twice currently).  As is it seg faults...

Also in this block:

hr = OleSaveToStream(pers_stream, ofile_stream);
if (hr != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not save capture filter \n");
goto error;
}
   IPersistStream_Release(pers_stream);

if it calls that "goto error" it will end up never releasing the
IpersistStream object.  So basically for the pers_stream you're going
to want to have two of them (like you did with the other) and release
them both in the error block.  I'll admit the concept of a cleanup
block kind of confused me at first...but it's how the code was
initially written so I've kept using it, and it works out OK.

Besides that LGTM.
-roger-

> Parameter names changed to audio(/video)_device_load(/save) as I think the
> to_file and from_file is evident and is specified in the help.
>
> About the "fake" input:  by loading a device filter from file, in the
> dshow_open_device() it loads the device object from file instead of
> searching it by name. So as long as the dshow_open_device() get called it
> will load the device -- however to get called it is required to have a not
> NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
> If you have better suggestion for the description, please tell me.
> Here is the fixed patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Roger Pack
On 4/22/15, Michael Niedermayer  wrote:
> On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
>> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer 
>> wrote:
>> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
>> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now
>> >> fixed.
>> >>
>> >> Error handler fixed.
>> >>
>> >> Parameter names changed to audio(/video)_device_load(/save) as I think
>> >> the
>> >> to_file and from_file is evident and is specified in the help.
>> >>
>> >> About the "fake" input:  by loading a device filter from file, in the
>> >> dshow_open_device() it loads the device object from file instead of
>> >> searching it by name. So as long as the dshow_open_device() get called
>> >> it
>> >> will load the device -- however to get called it is required to have a
>> >> not
>> >> NULL input name .. aka any fake text would do the trick (eg: -i video="
>> >> " )
>> >> If you have better suggestion for the description, please tell me.
>> >>
>> >> Here is the fixed patch.
>> >
>> > [...]
>> >
>> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
>> >> index d03670e..9ac28c5 100644
>> >> --- a/libavdevice/dshow.c
>> >> +++ b/libavdevice/dshow.c
>> >> @@ -27,6 +27,8 @@
>> >>  #include "libavformat/riff.h"
>> >>  #include "avdevice.h"
>> >>  #include "libavcodec/raw.h"
>> >> +#include "objidl.h"
>> >
>> >> +#include "Shlwapi.h"
>> >
>> > this header does not exist, it must be lowwer case or it will break
>> > build on linux-mingw
>> >
>>
>> That is the proper capitalization of the header in the MS Windows SDK.
>> If mingw has it all lower-cased, its technically a bug in mingw.
>
> hmm i wasnt aware of that but yes
>  locate Shlwapi.h confirms that theres no such header in ubuntu mingw*
>
> so this definitly needs some configure check so it doesnt break build

Interesting.  After doing some research (in my own cross compiler, I
only have "shlwapi.h" and not "Shlwapi.h"), it appears that the
mingw-gcc cross compilers are themselves "filename case insensitive"
even on linux with case sensitive underlying file systems.  So I guess
as long as "shlwapi.h" is common we should be ok.  Unexpected for
sure.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] dss_sp: use lowercase codec name without whitespace

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 02:42:08PM +0200, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/dss_sp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

In a rich man's house there is no place to spit but his face.
-- 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] mpeg4videodec: only allow a positive length

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:32:42PM +0200, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/mpeg4videodec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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


[FFmpeg-devel] [PATCH] bink: check vst->index_entries before using it

2015-04-22 Thread Andreas Cadhalpun
This fixes a NULL pointer dereference if vst->duration is 0.

The problem was introduced in commit 0588acaf.

Signed-off-by: Andreas Cadhalpun 
---
 libavformat/bink.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 92ce261..332edbb 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -194,7 +194,10 @@ static int read_header(AVFormatContext *s)
 return ret;
 }
 
-avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
+if (vst->index_entries)
+avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
+else
+avio_skip(pb, 4);
 
 bink->current_track = -1;
 return 0;
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 6/6] avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

2015-04-22 Thread Nicolas George
Le tridi 3 floréal, an CCXXIII, wm4 a écrit :
>  #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but 
> keep it separate.
> +#define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate 
> seeks for some formats

Better with the 0, but I suspect it needs a safety gap to avoid future
conflicts with the fork.

Regards,

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


[FFmpeg-devel] [PATCH 2/2] api-flac-test: Coding style

2015-04-22 Thread Ludmila Glinskih
---
 libavcodec/api-flac-test.c | 72 --
 1 file changed, 24 insertions(+), 48 deletions(-)

diff --git a/libavcodec/api-flac-test.c b/libavcodec/api-flac-test.c
index 1540da9..5ff8f12 100644
--- a/libavcodec/api-flac-test.c
+++ b/libavcodec/api-flac-test.c
@@ -40,8 +40,7 @@ static int generate_raw_frame(uint16_t *frame_data, int i, 
int sample_rate,
 {
 int j, k;
 
-for (j = 0; j < frame_size; j++)
-{
+for (j = 0; j < frame_size; j++) {
 frame_data[channels * j] = 1 * ((j / 10 * i) % 2);
 for (k = 1; k < channels; k++)
 frame_data[channels * j + k] = frame_data[channels * j] * (k + 1);
@@ -60,8 +59,7 @@ static int init_encoder(AVCodec *enc, AVCodecContext 
**enc_ctx,
 av_log(NULL, AV_LOG_INFO, "channel layout: %s, sample rate: %i\n", 
name_buff, sample_rate);
 
 ctx = avcodec_alloc_context3(enc);
-if (!ctx)
-{
+if (!ctx) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate encoder context\n");
 return AVERROR(ENOMEM);
 }
@@ -71,8 +69,7 @@ static int init_encoder(AVCodec *enc, AVCodecContext 
**enc_ctx,
 ctx->channel_layout = ch_layout;
 
 result = avcodec_open2(ctx, enc, NULL);
-if (result < 0)
-{
+if (result < 0) {
 av_log(ctx, AV_LOG_ERROR, "Can't open encoder\n");
 return result;
 }
@@ -88,8 +85,7 @@ static int init_decoder(AVCodec *dec, AVCodecContext 
**dec_ctx,
 int result;
 
 ctx = avcodec_alloc_context3(dec);
-if (!ctx)
-{
+if (!ctx) {
 av_log(NULL, AV_LOG_ERROR , "Can't allocate decoder context\n");
 return AVERROR(ENOMEM);
 }
@@ -100,8 +96,7 @@ static int init_decoder(AVCodec *dec, AVCodecContext 
**dec_ctx,
 ctx->channel_layout = ch_layout;
 
 result = avcodec_open2(ctx, dec, NULL);
-if (result < 0)
-{
+if (result < 0) {
 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
 return result;
 }
@@ -122,8 +117,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 int i = 0;
 
 in_frame = av_frame_alloc();
-if (!in_frame)
-{
+if (!in_frame) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate input frame\n");
 return AVERROR(ENOMEM);
 }
@@ -131,35 +125,30 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 in_frame->nb_samples = enc_ctx->frame_size;
 in_frame->format = enc_ctx->sample_fmt;
 in_frame->channel_layout = enc_ctx->channel_layout;
-if (av_frame_get_buffer(in_frame, 32) != 0)
-{
+if (av_frame_get_buffer(in_frame, 32) != 0) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate a buffer for input 
frame\n");
 return AVERROR(ENOMEM);
 }
 
 out_frame = av_frame_alloc();
-if (!out_frame)
-{
+if (!out_frame) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate output frame\n");
 return AVERROR(ENOMEM);
 }
 
 raw_in = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
-if (!raw_in)
-{
+if (!raw_in) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_in\n");
 return AVERROR(ENOMEM);
 }
 
 raw_out = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
-if (!raw_out)
-{
+if (!raw_out) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_out\n");
 return AVERROR(ENOMEM);
 }
 
-for (i = 0; i < NUMBER_OF_FRAMES; i++)
-{
+for (i = 0; i < NUMBER_OF_FRAMES; i++) {
 av_init_packet(&enc_pkt);
 enc_pkt.data = NULL;
 enc_pkt.size = 0;
@@ -169,44 +158,36 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 memcpy(raw_in + in_offset, in_frame->data[0], in_frame->linesize[0]);
 in_offset += in_frame->linesize[0];
 result = avcodec_encode_audio2(enc_ctx, &enc_pkt, in_frame, 
&got_output);
-if (result < 0)
-{
+if (result < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error encoding audio frame\n");
 return result;
 }
 
 /* if we get an encoded packet, feed it straight to the decoder */
-if (got_output)
-{
+if (got_output) {
 result = avcodec_decode_audio4(dec_ctx, out_frame, &got_output, 
&enc_pkt);
-if (result < 0)
-{
+if (result < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error decoding audio packet\n");
 return result;
 }
 
-if (got_output)
-{
-if (result != enc_pkt.size)
-{
+if (got_output) {
+if (result != enc_pkt.size) {
 av_log(NULL, AV_LOG_INFO, "Decoder consumed only part of a 
packet, it is allowed to do so -- need to update this test\n");
 return AVERROR_UNKNOWN;
 }
 
-if (in_frame->nb_samples != out_frame->nb_samples)
-  

[FFmpeg-devel] [PATCH 1/2] api-flac-test: Fix stupid mistake

2015-04-22 Thread Ludmila Glinskih
Was comparing 0 bytes in memcmp
---
 libavcodec/api-flac-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/api-flac-test.c b/libavcodec/api-flac-test.c
index 5ca8e8f..1540da9 100644
--- a/libavcodec/api-flac-test.c
+++ b/libavcodec/api-flac-test.c
@@ -117,7 +117,6 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 AVFrame *in_frame, *out_frame;
 uint8_t *raw_in = NULL, *raw_out = NULL;
 int in_offset = 0, out_offset = 0;
-int frame_data_size = 0;
 int result = 0;
 int got_output = 0;
 int i = 0;
@@ -218,7 +217,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 av_free_packet(&enc_pkt);
 }
 
-if (memcmp(raw_in, raw_out, frame_data_size * NUMBER_OF_FRAMES) != 0)
+if (memcmp(raw_in, raw_out, out_frame->linesize[0] * NUMBER_OF_FRAMES) != 
0)
 {
 av_log(NULL, AV_LOG_ERROR, "Output differs\n");
 return 1;
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 6/6] avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

2015-04-22 Thread wm4
On Wed, 22 Apr 2015 17:10:30 +0200
Nicolas George  wrote:

> Le tridi 3 floréal, an CCXXIII, wm4 a écrit :
> >  #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but 
> > keep it separate.
> > +#define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate 
> > seeks for some formats
> 
> Better with the 0, but I suspect it needs a safety gap to avoid future
> conflicts with the fork.
> 
> Regards,
> 

AVFMT_FLAG_KEEP_SIDE_DATA already does not exist in Libav. (Mainly
because the associated side-data "inline" mechanism is 100% insane
and FFmpeg-only.)

There's actually a gap after AVFMT_FLAG_BITEXACT, which is probably
meant to avoid ABI issues if Libav adds something.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

2015-04-22 Thread Carl Eugen Hoyos
Niklesh Lalwani  iitb.ac.in> writes:

> +int i=0;

Usual style is:
int i = 0;

> +for (i=0; i +}
> +else
> +text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);

Please make this:
} else {
text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);
}

There is a script tools/patcheck that should 
tell you about such nits.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Claudio Freire
On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
 wrote:
> +if (k == last_k && msb == last_msb) {
> +av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
> +return AVERROR_INVALIDDATA;
> +}
> +last_k = k;
> +last_msb = msb;


I don't think the INVALIDDATA return will have the desired effect.

I think you want return -1;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] api-flac-test: Fix stupid mistake

2015-04-22 Thread wm4
On Wed, 22 Apr 2015 18:09:14 +0300
Ludmila Glinskih  wrote:

> Was comparing 0 bytes in memcmp
> ---
>  libavcodec/api-flac-test.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavcodec/api-flac-test.c b/libavcodec/api-flac-test.c
> index 5ca8e8f..1540da9 100644
> --- a/libavcodec/api-flac-test.c
> +++ b/libavcodec/api-flac-test.c
> @@ -117,7 +117,6 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
> AVCodecContext *enc_ctx,
>  AVFrame *in_frame, *out_frame;
>  uint8_t *raw_in = NULL, *raw_out = NULL;
>  int in_offset = 0, out_offset = 0;
> -int frame_data_size = 0;
>  int result = 0;
>  int got_output = 0;
>  int i = 0;
> @@ -218,7 +217,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
> AVCodecContext *enc_ctx,
>  av_free_packet(&enc_pkt);
>  }
>  
> -if (memcmp(raw_in, raw_out, frame_data_size * NUMBER_OF_FRAMES) != 0)
> +if (memcmp(raw_in, raw_out, out_frame->linesize[0] * NUMBER_OF_FRAMES) 
> != 0)
>  {
>  av_log(NULL, AV_LOG_ERROR, "Output differs\n");
>  return 1;

Something that I just noticed, though it's not necessarily related to
this particular patch: you should use nb_samples to copy the data
in/out. linesize can be larger than the actual data due to padding.

The padding is needed because SIMD instructions may write more data
than actually needed, which would write past the memory allocation. So
the memory allocation is simply made large enough to avoid problems.

The API user doesn't need to care about these issues, because
av_frame_get_buffer() already takes care of it. (The test still could
check that nb_samples and the AVFrame format is consistent with
linesize. Maybe.)

Also, in this case, there's probably no observable issue with your
code, because the frame sizes are already aligned, so that linesize
equals the used size by coincidence.

The doxygen for linesize says:

 * @note The linesize may be larger than the size of usable data -- there
 * may be extra padding present for performance reasons.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Máté Sebők
Added NULL-ing after release on load and save, lower-cased the #include
"shlwapi.h" and added release of pers_stream in the error handler.

There is no other pers_stream, only in the save because the
OleLoadFromStream loads directly to the described object.

On Wed, Apr 22, 2015 at 4:46 PM, Roger Pack  wrote:

> On 4/22/15, Michael Niedermayer  wrote:
> > On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
> >> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer 
> >> wrote:
> >> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
> >> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now
> >> >> fixed.
> >> >>
> >> >> Error handler fixed.
> >> >>
> >> >> Parameter names changed to audio(/video)_device_load(/save) as I
> think
> >> >> the
> >> >> to_file and from_file is evident and is specified in the help.
> >> >>
> >> >> About the "fake" input:  by loading a device filter from file, in the
> >> >> dshow_open_device() it loads the device object from file instead of
> >> >> searching it by name. So as long as the dshow_open_device() get
> called
> >> >> it
> >> >> will load the device -- however to get called it is required to have
> a
> >> >> not
> >> >> NULL input name .. aka any fake text would do the trick (eg: -i
> video="
> >> >> " )
> >> >> If you have better suggestion for the description, please tell me.
> >> >>
> >> >> Here is the fixed patch.
> >> >
> >> > [...]
> >> >
> >> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> >> >> index d03670e..9ac28c5 100644
> >> >> --- a/libavdevice/dshow.c
> >> >> +++ b/libavdevice/dshow.c
> >> >> @@ -27,6 +27,8 @@
> >> >>  #include "libavformat/riff.h"
> >> >>  #include "avdevice.h"
> >> >>  #include "libavcodec/raw.h"
> >> >> +#include "objidl.h"
> >> >
> >> >> +#include "Shlwapi.h"
> >> >
> >> > this header does not exist, it must be lowwer case or it will break
> >> > build on linux-mingw
> >> >
> >>
> >> That is the proper capitalization of the header in the MS Windows SDK.
> >> If mingw has it all lower-cased, its technically a bug in mingw.
> >
> > hmm i wasnt aware of that but yes
> >  locate Shlwapi.h confirms that theres no such header in ubuntu mingw*
> >
> > so this definitly needs some configure check so it doesnt break build
>
> Interesting.  After doing some research (in my own cross compiler, I
> only have "shlwapi.h" and not "Shlwapi.h"), it appears that the
> mingw-gcc cross compilers are themselves "filename case insensitive"
> even on linux with case sensitive underlying file systems.  So I guess
> as long as "shlwapi.h" is common we should be ok.  Unexpected for
> sure.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-dshow-add-capture-device-save-and-load.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] vp9: add fate test for bilinear MC filter.

2015-04-22 Thread Ronald S. Bultje
Sample at:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-06-bilinear.webm
---
 tests/fate/vpx.mak |  1 +
 tests/ref/fate/vp9-06-bilinear | 15 +++
 2 files changed, 16 insertions(+)
 create mode 100644 tests/ref/fate/vp9-06-bilinear

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index a5449c8..ad26a8d 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -99,6 +99,7 @@ $(foreach SHARP,$(VP9_SHARP),$(eval $(call 
FATE_VP9_SUITE,01-sharpness-$(SHARP),
 $(foreach W,$(VP9_SIZE_A),$(eval $(foreach H,$(VP9_SIZE_A),$(eval $(call 
FATE_VP9_SUITE,02-size-$(W)x$(H),$(1),$(2))
 $(foreach W,$(VP9_SIZE_B),$(eval $(foreach H,$(VP9_SIZE_B),$(eval $(call 
FATE_VP9_SUITE,03-size-$(W)x$(H),$(1),$(2))
 $(eval $(call FATE_VP9_SUITE,03-deltaq,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,06-bilinear,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,2pass-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,parallelmode-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,segmentation-aq-akiyo,$(1),$(2)))
diff --git a/tests/ref/fate/vp9-06-bilinear b/tests/ref/fate/vp9-06-bilinear
new file mode 100644
index 000..b175195
--- /dev/null
+++ b/tests/ref/fate/vp9-06-bilinear
@@ -0,0 +1,15 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1001/3
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   152064, 818a5af531c921ae58dfedc75234f3c5
+0,  1,  1,1,   152064, f863f8c68b5c87c721d345c5a894336d
+0,  2,  2,1,   152064, 3f1213e44db416530bc0717f0a795b5d
+0,  3,  3,1,   152064, 4b99c16a62c3d6687c78236fa13e1f41
+0,  4,  4,1,   152064, 80f23a3f04215dd7542128e7c53d68d0
+0,  5,  5,1,   152064, b40b7aa34a77fe773d82d75b5bdd9c13
+0,  6,  6,1,   152064, dd4af6263d20bbaf9afedb6695c1ba67
+0,  7,  7,1,   152064, 1f2ccf88f15c10e3c27b2368dacc3727
+0,  8,  8,1,   152064, 232b027c4e9b598f50d078bb7b7a165e
+0,  9,  9,1,   152064, 2b44367332aa0fe42362d61f18e7f8dd
-- 
2.1.2

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


[FFmpeg-devel] [PATCH 3/3] vp9: add lf_deltas fate test.

2015-04-22 Thread Ronald S. Bultje
Sample available at:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-09-lf_deltas.webm
---
 tests/fate/vpx.mak  |  1 +
 tests/ref/fate/vp9-09-lf_deltas | 35 +++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/ref/fate/vp9-09-lf_deltas

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index ad26a8d..c03b285 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -100,6 +100,7 @@ $(foreach W,$(VP9_SIZE_A),$(eval $(foreach 
H,$(VP9_SIZE_A),$(eval $(call FATE_VP
 $(foreach W,$(VP9_SIZE_B),$(eval $(foreach H,$(VP9_SIZE_B),$(eval $(call 
FATE_VP9_SUITE,03-size-$(W)x$(H),$(1),$(2))
 $(eval $(call FATE_VP9_SUITE,03-deltaq,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,06-bilinear,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,09-lf_deltas,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,2pass-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,parallelmode-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,segmentation-aq-akiyo,$(1),$(2)))
diff --git a/tests/ref/fate/vp9-09-lf_deltas b/tests/ref/fate/vp9-09-lf_deltas
new file mode 100644
index 000..733a70c
--- /dev/null
+++ b/tests/ref/fate/vp9-09-lf_deltas
@@ -0,0 +1,35 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1/30
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   126720, a83c7f4602f595fd09e97f8c8a7277ec
+0,  1,  1,1,   126720, 53e1a3fd44932883a8dd112bbb0e359f
+0,  2,  2,1,   126720, 4bb16d168f9f0a7702c31a68bb8ff36c
+0,  3,  3,1,   126720, 1b2df157913aba96553aaf8d51491bf3
+0,  4,  4,1,   126720, 9d041532e42fca7a4062cd3e9b75413b
+0,  5,  5,1,   126720, 0dbac5ca06e13714d10e99042aefe375
+0,  6,  6,1,   126720, bb83a507a65d2a640b08f42a77bb37f6
+0,  7,  7,1,   126720, 176f992d37c7daa36135cddb49398de3
+0,  8,  8,1,   126720, c41834f72b3281cf6aaa66fd7416e6c3
+0,  9,  9,1,   126720, 790d4e6b1609dec782ff978e2003d318
+0, 10, 10,1,   126720, 449622f741f7577c1d721f2e9eb25091
+0, 11, 11,1,   126720, 8ef8543f7895c87ab04491b0150628e5
+0, 12, 12,1,   126720, 88ef626aca4b2bcb8c58a69db20a7b02
+0, 13, 13,1,   126720, 4b2f7adc2e1872ecdd9ffa7d1f1df4a6
+0, 14, 14,1,   126720, 7b162660225022ef31e39c34fee3418e
+0, 15, 15,1,   126720, 2b439a4b846edcc69cdf6075de5ac8fb
+0, 16, 16,1,   126720, ba2eb1ba0ed9abf701a53a94c9c626fc
+0, 17, 17,1,   126720, 9fbec5d5334fd5e917feee756b652d93
+0, 18, 18,1,   126720, 93b5eb99ea54abc5fa90c5674499e27e
+0, 19, 19,1,   126720, 04a98408e9b0aed28932ef1dfdcfdb6c
+0, 20, 20,1,   126720, 9856ba976bed30bc790a3f28e926b092
+0, 21, 21,1,   126720, 2b0f450e9724cfc57b846148ff876e51
+0, 22, 22,1,   126720, 163757f3529369b9789ea606387b831d
+0, 23, 23,1,   126720, de5ed2aff936c54f3378d0dcc2575d13
+0, 24, 24,1,   126720, 1f642826b8a6fb111c7c6130481dab89
+0, 25, 25,1,   126720, b8e3a77c7d3c5c56f67aa7409fb5404c
+0, 26, 26,1,   126720, eb06cb4f471e42d7fc06929a442cca8b
+0, 27, 27,1,   126720, 53471649a5080b306d2c04a4f7673bdf
+0, 28, 28,1,   126720, 70996be0cc5d2bd97025015dd50caa99
+0, 29, 29,1,   126720, ff3280a8562fdf6697c4a7cb9c1bf0a0
-- 
2.1.2

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


[FFmpeg-devel] [PATCH 2/3] vp9: maintain lf_delta values if feature is turned off.

2015-04-22 Thread Ronald S. Bultje
This is required if it's subsequently re-enabled with no value updates
(which means, use values that were previously set).
---
 libavcodec/vp9.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index ee73325..b3d6d86 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -622,8 +622,6 @@ static int decode_frame_header(AVCodecContext *ctx,
 if (get_bits1(&s->gb))
 s->lf_delta.mode[i] = get_sbits_inv(&s->gb, 6);
 }
-} else {
-memset(&s->lf_delta, 0, sizeof(s->lf_delta));
 }
 
 /* quantization header data */
@@ -705,16 +703,21 @@ static int decode_frame_header(AVCodecContext *ctx,
 } else {
 lflvl  = s->filter.level;
 }
-s->segmentation.feat[i].lflvl[0][0] =
-s->segmentation.feat[i].lflvl[0][1] =
-av_clip_uintp2(lflvl + (s->lf_delta.ref[0] << sh), 6);
-for (j = 1; j < 4; j++) {
-s->segmentation.feat[i].lflvl[j][0] =
-av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
- s->lf_delta.mode[0]) * (1 << sh)), 6);
-s->segmentation.feat[i].lflvl[j][1] =
-av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
- s->lf_delta.mode[1]) * (1 << sh)), 6);
+if (s->lf_delta.enabled) {
+s->segmentation.feat[i].lflvl[0][0] =
+s->segmentation.feat[i].lflvl[0][1] =
+av_clip_uintp2(lflvl + (s->lf_delta.ref[0] << sh), 6);
+for (j = 1; j < 4; j++) {
+s->segmentation.feat[i].lflvl[j][0] =
+av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
+ s->lf_delta.mode[0]) * (1 << 
sh)), 6);
+s->segmentation.feat[i].lflvl[j][1] =
+av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
+ s->lf_delta.mode[1]) * (1 << 
sh)), 6);
+}
+} else {
+memset(s->segmentation.feat[i].lflvl, lflvl,
+   sizeof(s->segmentation.feat[i].lflvl));
 }
 }
 
-- 
2.1.2

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


Re: [FFmpeg-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Andreas Cadhalpun
On 22.04.2015 17:35, Claudio Freire wrote:
> On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
>  wrote:
>> +if (k == last_k && msb == last_msb) {
>> +av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
>> +return AVERROR_INVALIDDATA;
>> +}
>> +last_k = k;
>> +last_msb = msb;
> 
> 
> I don't think the INVALIDDATA return will have the desired effect.
> 
> I think you want return -1;

This function is only called once and there the check is:
if (sbr_hf_calc_npatches(ac, sbr) < 0)
return -1;

Thus returning AVERROR_INVALIDDATA works as well as -1.

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


Re: [FFmpeg-devel] [PATCH 2/2] api-flac-test: Coding style

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 06:09:15PM +0300, Ludmila Glinskih wrote:
> ---
>  libavcodec/api-flac-test.c | 72 
> --
>  1 file changed, 24 insertions(+), 48 deletions(-)

applied

thanks

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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/6] fate: gapless: remove useless tests

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 12:24:40PM +0200, wm4 wrote:
> These could be kept, but they are not overly useful. The only thing they
> had over the remaining mp3 gapless test was seeking, which was incorrect
> in the toc test, and only by chance correct in the notoc test.
> ---
>  tests/fate/gapless.mak   | 4 +---
>  tests/ref/fate/gapless-mp3-notoc | 5 -
>  tests/ref/fate/gapless-mp3-toc   | 5 -
>  3 files changed, 1 insertion(+), 13 deletions(-)
>  delete mode 100644 tests/ref/fate/gapless-mp3-notoc
>  delete mode 100644 tests/ref/fate/gapless-mp3-toc

i suggest to keep the test which is correct even when its just by
chance unless it breaks for a not easy correctable reason

the test with wrong output should be removed, i agree

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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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/3] vp9: add fate test for bilinear MC filter.

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 11:51:01AM -0400, Ronald S. Bultje wrote:
> Sample at:
> http://downloads.webmproject.org/test_data/libvpx/vp90-2-06-bilinear.webm

uploaded

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


[FFmpeg-devel] [PATCH 2/2] vp9: add fate tests for show-existing-frame feature.

2015-04-22 Thread Ronald S. Bultje
Samples available at:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-10-show-existing-frame.webm
http://downloads.webmproject.org/test_data/libvpx/vp90-2-10-show-existing-frame2.webm
---
 tests/fate/vpx.mak |  2 ++
 tests/ref/fate/vp9-10-show-existing-frame  | 14 ++
 tests/ref/fate/vp9-10-show-existing-frame2 | 20 
 3 files changed, 36 insertions(+)
 create mode 100644 tests/ref/fate/vp9-10-show-existing-frame
 create mode 100644 tests/ref/fate/vp9-10-show-existing-frame2

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index c03b285..9847be6 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -101,6 +101,8 @@ $(foreach W,$(VP9_SIZE_B),$(eval $(foreach 
H,$(VP9_SIZE_B),$(eval $(call FATE_VP
 $(eval $(call FATE_VP9_SUITE,03-deltaq,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,06-bilinear,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,09-lf_deltas,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,10-show-existing-frame,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,10-show-existing-frame2,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,2pass-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,parallelmode-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,segmentation-aq-akiyo,$(1),$(2)))
diff --git a/tests/ref/fate/vp9-10-show-existing-frame 
b/tests/ref/fate/vp9-10-show-existing-frame
new file mode 100644
index 000..266f44e
--- /dev/null
+++ b/tests/ref/fate/vp9-10-show-existing-frame
@@ -0,0 +1,14 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1/30
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   152064, 18981342ec178e082519451062c3a67f
+0,  1,  1,1,   152064, 04ab9dbeac49ec31be58f6e671698e05
+0,  6,  6,1,   152064, a41f00034923e56ba51a0b598acc2e3a
+0,  7,  7,1,   152064, 63fa55ae9535ccdf06d44cce8065dda6
+0,  9,  9,1,   152064, 0e4b08e14d919edee2bbff2ecd47de57
+0, 10, 10,1,   152064, 0e4b08e14d919edee2bbff2ecd47de57
+0, 13, 13,1,   152064, 9e932915c67a789f6877e6d3f76d3649
+0, 14, 14,1,   152064, 12f2e975c217e7ffcf334524e8acec35
+0, 15, 15,1,   152064, 9e932915c67a789f6877e6d3f76d3649
diff --git a/tests/ref/fate/vp9-10-show-existing-frame2 
b/tests/ref/fate/vp9-10-show-existing-frame2
new file mode 100644
index 000..cdd4369
--- /dev/null
+++ b/tests/ref/fate/vp9-10-show-existing-frame2
@@ -0,0 +1,20 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1/30
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   152064, 382b12c33cd86b38758706b8ebca8a85
+0,  1,  1,1,   152064, 799544370b35c91711a5b49a28cf86a8
+0,  2,  2,1,   152064, 7218eb4b6d1c7aea4f96ee47ad675e8e
+0,  3,  3,1,   152064, 627466200370e6ad60ea570d31be66e3
+0,  4,  4,1,   152064, 7dc65a2af108379f2b9265a9a1ea7cf8
+0,  5,  5,1,   152064, c979e2f084760775a567f60f79f28198
+0,  6,  6,1,   152064, fe668a6417aa0543e4ed4d1c67c5cbcb
+0,  7,  7,1,   152064, bf9901e39815fa93cce0ed5b02b2ef2d
+0,  8,  8,1,   152064, 627466200370e6ad60ea570d31be66e3
+0,  9,  9,1,   152064, 7dc65a2af108379f2b9265a9a1ea7cf8
+0, 10, 10,1,   152064, c979e2f084760775a567f60f79f28198
+0, 11, 11,1,   152064, fe668a6417aa0543e4ed4d1c67c5cbcb
+0, 13, 13,1,   152064, 627466200370e6ad60ea570d31be66e3
+0, 14, 14,1,   152064, 7dc65a2af108379f2b9265a9a1ea7cf8
+0, 15, 15,1,   152064, c979e2f084760775a567f60f79f28198
-- 
2.1.2

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


[FFmpeg-devel] [PATCH 1/2] vp9: set timestamps for show_existing_frame return images.

2015-04-22 Thread Ronald S. Bultje
---
 libavcodec/vp9.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index b3d6d86..8d9ba0d 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -3765,6 +3765,8 @@ static int vp9_decode_frame(AVCodecContext *ctx, void 
*frame,
 }
 if ((res = av_frame_ref(frame, s->refs[ref].f)) < 0)
 return res;
+((AVFrame *)frame)->pkt_pts = pkt->pts;
+((AVFrame *)frame)->pkt_dts = pkt->dts;
 *got_frame = 1;
 return pkt->size;
 }
-- 
2.1.2

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


[FFmpeg-devel] [PATCH] alac: validate k before using show_bits in decode_scalar

2015-04-22 Thread Andreas Cadhalpun
The k != 1 case calls show_bits(gb, k), which doesn't make sense if k
is 0.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/alac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index ffd2d77..9db690b 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -90,6 +90,8 @@ static inline unsigned int decode_scalar(GetBitContext *gb, 
int k, int bps)
 if (x > 8) { /* RICE THRESHOLD */
 /* use alternative encoding */
 x = get_bits_long(gb, bps);
+} else if (k <= 0) {
+x = 0;
 } else if (k != 1) {
 int extrabits = show_bits(gb, k);
 
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Roger Pack
On 4/22/15, Máté Sebők  wrote:
> Added NULL-ing after release on load and save, lower-cased the #include
> "shlwapi.h" and added release of pers_stream in the error handler.

OK the crash is gone now.
I'd like to have the IStream_Release only in one section, however.
Would it be possible to remove the Release's and *only* release in the
error block please?

> There is no other pers_stream, only in the save because the
> OleLoadFromStream loads directly to the described object.

OK point taken.  I'd like to see the IPersistStream Release only
called in the error block as well.  Just to match the existing code
style.  It's practically there, thank you!
-roger-

> On Wed, Apr 22, 2015 at 4:46 PM, Roger Pack  wrote:
>
>> On 4/22/15, Michael Niedermayer  wrote:
>> > On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
>> >> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer
>> >> 
>> >> wrote:
>> >> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
>> >> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix--
>> >> >> now
>> >> >> fixed.
>> >> >>
>> >> >> Error handler fixed.
>> >> >>
>> >> >> Parameter names changed to audio(/video)_device_load(/save) as I
>> think
>> >> >> the
>> >> >> to_file and from_file is evident and is specified in the help.
>> >> >>
>> >> >> About the "fake" input:  by loading a device filter from file, in
>> >> >> the
>> >> >> dshow_open_device() it loads the device object from file instead of
>> >> >> searching it by name. So as long as the dshow_open_device() get
>> called
>> >> >> it
>> >> >> will load the device -- however to get called it is required to
>> >> >> have
>> a
>> >> >> not
>> >> >> NULL input name .. aka any fake text would do the trick (eg: -i
>> video="
>> >> >> " )
>> >> >> If you have better suggestion for the description, please tell me.
>> >> >>
>> >> >> Here is the fixed patch.
>> >> >
>> >> > [...]
>> >> >
>> >> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
>> >> >> index d03670e..9ac28c5 100644
>> >> >> --- a/libavdevice/dshow.c
>> >> >> +++ b/libavdevice/dshow.c
>> >> >> @@ -27,6 +27,8 @@
>> >> >>  #include "libavformat/riff.h"
>> >> >>  #include "avdevice.h"
>> >> >>  #include "libavcodec/raw.h"
>> >> >> +#include "objidl.h"
>> >> >
>> >> >> +#include "Shlwapi.h"
>> >> >
>> >> > this header does not exist, it must be lowwer case or it will break
>> >> > build on linux-mingw
>> >> >
>> >>
>> >> That is the proper capitalization of the header in the MS Windows SDK.
>> >> If mingw has it all lower-cased, its technically a bug in mingw.
>> >
>> > hmm i wasnt aware of that but yes
>> >  locate Shlwapi.h confirms that theres no such header in ubuntu mingw*
>> >
>> > so this definitly needs some configure check so it doesnt break build
>>
>> Interesting.  After doing some research (in my own cross compiler, I
>> only have "shlwapi.h" and not "Shlwapi.h"), it appears that the
>> mingw-gcc cross compilers are themselves "filename case insensitive"
>> even on linux with case sensitive underlying file systems.  So I guess
>> as long as "shlwapi.h" is common we should be ok.  Unexpected for
>> sure.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/6] fate: gapless: remove useless tests

2015-04-22 Thread wm4
On Wed, 22 Apr 2015 18:19:02 +0200
Michael Niedermayer  wrote:

> On Wed, Apr 22, 2015 at 12:24:40PM +0200, wm4 wrote:
> > These could be kept, but they are not overly useful. The only thing they
> > had over the remaining mp3 gapless test was seeking, which was incorrect
> > in the toc test, and only by chance correct in the notoc test.
> > ---
> >  tests/fate/gapless.mak   | 4 +---
> >  tests/ref/fate/gapless-mp3-notoc | 5 -
> >  tests/ref/fate/gapless-mp3-toc   | 5 -
> >  3 files changed, 1 insertion(+), 13 deletions(-)
> >  delete mode 100644 tests/ref/fate/gapless-mp3-notoc
> >  delete mode 100644 tests/ref/fate/gapless-mp3-toc
> 
> i suggest to keep the test which is correct even when its just by
> chance unless it breaks for a not easy correctable reason
> 
> the test with wrong output should be removed, i agree

No, they're just useless. If you insist, I can send a patch to re-add a
seek test with the gapless.mp3 we have. (The existing seek test for mp3
uses a generated file with plain CBR.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Claudio Freire
On Wed, Apr 22, 2015 at 12:54 PM, Andreas Cadhalpun
 wrote:
> On 22.04.2015 17:35, Claudio Freire wrote:
>> On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
>>  wrote:
>>> +if (k == last_k && msb == last_msb) {
>>> +av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
>>> +return AVERROR_INVALIDDATA;
>>> +}
>>> +last_k = k;
>>> +last_msb = msb;
>>
>>
>> I don't think the INVALIDDATA return will have the desired effect.
>>
>> I think you want return -1;
>
> This function is only called once and there the check is:
> if (sbr_hf_calc_npatches(ac, sbr) < 0)
> return -1;
>
> Thus returning AVERROR_INVALIDDATA works as well as -1.

The fact that AVERROR_INVALIDDATA < 0 is a close call on 32 bit platforms.

Still, it's not a new assumption in the code, so I'll grant you that.

With the disclaimer that I'm not familiar with this code said, it
looks like it would be better to attack the reason why it loops
without increasing npatches rather than a bandaid like this, but aside
from that preference (which is personal) the patch seems to make
sense.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Máté Sebők
Of course can it be only in the error block - just deleted the other
releases.
Also no need for NULL-ing either in this case.

On Wed, Apr 22, 2015 at 6:26 PM, Roger Pack  wrote:

> On 4/22/15, Máté Sebők  wrote:
> > Added NULL-ing after release on load and save, lower-cased the #include
> > "shlwapi.h" and added release of pers_stream in the error handler.
>
> OK the crash is gone now.
> I'd like to have the IStream_Release only in one section, however.
> Would it be possible to remove the Release's and *only* release in the
> error block please?
>
> > There is no other pers_stream, only in the save because the
> > OleLoadFromStream loads directly to the described object.
>
> OK point taken.  I'd like to see the IPersistStream Release only
> called in the error block as well.  Just to match the existing code
> style.  It's practically there, thank you!
> -roger-
>
> > On Wed, Apr 22, 2015 at 4:46 PM, Roger Pack 
> wrote:
> >
> >> On 4/22/15, Michael Niedermayer  wrote:
> >> > On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
> >> >> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer
> >> >> 
> >> >> wrote:
> >> >> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
> >> >> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix--
> >> >> >> now
> >> >> >> fixed.
> >> >> >>
> >> >> >> Error handler fixed.
> >> >> >>
> >> >> >> Parameter names changed to audio(/video)_device_load(/save) as I
> >> think
> >> >> >> the
> >> >> >> to_file and from_file is evident and is specified in the help.
> >> >> >>
> >> >> >> About the "fake" input:  by loading a device filter from file, in
> >> >> >> the
> >> >> >> dshow_open_device() it loads the device object from file instead
> of
> >> >> >> searching it by name. So as long as the dshow_open_device() get
> >> called
> >> >> >> it
> >> >> >> will load the device -- however to get called it is required to
> >> >> >> have
> >> a
> >> >> >> not
> >> >> >> NULL input name .. aka any fake text would do the trick (eg: -i
> >> video="
> >> >> >> " )
> >> >> >> If you have better suggestion for the description, please tell me.
> >> >> >>
> >> >> >> Here is the fixed patch.
> >> >> >
> >> >> > [...]
> >> >> >
> >> >> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> >> >> >> index d03670e..9ac28c5 100644
> >> >> >> --- a/libavdevice/dshow.c
> >> >> >> +++ b/libavdevice/dshow.c
> >> >> >> @@ -27,6 +27,8 @@
> >> >> >>  #include "libavformat/riff.h"
> >> >> >>  #include "avdevice.h"
> >> >> >>  #include "libavcodec/raw.h"
> >> >> >> +#include "objidl.h"
> >> >> >
> >> >> >> +#include "Shlwapi.h"
> >> >> >
> >> >> > this header does not exist, it must be lowwer case or it will break
> >> >> > build on linux-mingw
> >> >> >
> >> >>
> >> >> That is the proper capitalization of the header in the MS Windows
> SDK.
> >> >> If mingw has it all lower-cased, its technically a bug in mingw.
> >> >
> >> > hmm i wasnt aware of that but yes
> >> >  locate Shlwapi.h confirms that theres no such header in ubuntu mingw*
> >> >
> >> > so this definitly needs some configure check so it doesnt break build
> >>
> >> Interesting.  After doing some research (in my own cross compiler, I
> >> only have "shlwapi.h" and not "Shlwapi.h"), it appears that the
> >> mingw-gcc cross compilers are themselves "filename case insensitive"
> >> even on linux with case sensitive underlying file systems.  So I guess
> >> as long as "shlwapi.h" is common we should be ok.  Unexpected for
> >> sure.
> >> ___
> >> 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
>


0001-dshow-add-capture-device-save-and-load.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Andreas Cadhalpun
On 22.04.2015 18:31, Claudio Freire wrote:
> On Wed, Apr 22, 2015 at 12:54 PM, Andreas Cadhalpun
>  wrote:
>> On 22.04.2015 17:35, Claudio Freire wrote:
>>> On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
>>>  wrote:
 +if (k == last_k && msb == last_msb) {
 +av_log(ac->avctx, AV_LOG_ERROR, "patch construction 
 failed\n");
 +return AVERROR_INVALIDDATA;
 +}
 +last_k = k;
 +last_msb = msb;
>>>
>>>
>>> I don't think the INVALIDDATA return will have the desired effect.
>>>
>>> I think you want return -1;
>>
>> This function is only called once and there the check is:
>> if (sbr_hf_calc_npatches(ac, sbr) < 0)
>> return -1;
>>
>> Thus returning AVERROR_INVALIDDATA works as well as -1.
> 
> The fact that AVERROR_INVALIDDATA < 0 is a close call on 32 bit platforms.
> 
> Still, it's not a new assumption in the code, so I'll grant you that.

I think there is more generally the assumption that all error codes are 
negative.

> With the disclaimer that I'm not familiar with this code said, it
> looks like it would be better to attack the reason why it loops
> without increasing npatches

The condition for increasing num_patches never becomes true:
sbr->patch_num_subbands[sbr->num_patches]  = FFMAX(sb - usb, 0);
Here sb = usb ...
sbr->patch_start_subband[sbr->num_patches] = sbr->k[0] - odd - 
sbr->patch_num_subbands[sbr->num_patches];

if (sbr->patch_num_subbands[sbr->num_patches] > 0) {
... thus this condition is false.
usb = sb;
msb = sb;
sbr->num_patches++;
} else
msb = sbr->kx[1];

If you have any other idea how to fix this, please let me know.

> rather than a bandaid like this, but aside
> from that preference (which is personal) the patch seems to make
> sense.

OK.

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


Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Roger Pack
On 4/22/15, Máté Sebők  wrote:
> Of course can it be only in the error block - just deleted the other
> releases.
> Also no need for NULL-ing either in this case.

Perfect.  OK LGTM now.   Recommend applying.
-roger-

> On Wed, Apr 22, 2015 at 6:26 PM, Roger Pack  wrote:
>
>> On 4/22/15, Máté Sebők  wrote:
>> > Added NULL-ing after release on load and save, lower-cased the #include
>> > "shlwapi.h" and added release of pers_stream in the error handler.
>>
>> OK the crash is gone now.
>> I'd like to have the IStream_Release only in one section, however.
>> Would it be possible to remove the Release's and *only* release in the
>> error block please?
>>
>> > There is no other pers_stream, only in the save because the
>> > OleLoadFromStream loads directly to the described object.
>>
>> OK point taken.  I'd like to see the IPersistStream Release only
>> called in the error block as well.  Just to match the existing code
>> style.  It's practically there, thank you!
>> -roger-
>>
>> > On Wed, Apr 22, 2015 at 4:46 PM, Roger Pack 
>> wrote:
>> >
>> >> On 4/22/15, Michael Niedermayer  wrote:
>> >> > On Wed, Apr 22, 2015 at 01:40:03PM +0200, Hendrik Leppkes wrote:
>> >> >> On Wed, Apr 22, 2015 at 1:12 PM, Michael Niedermayer
>> >> >> 
>> >> >> wrote:
>> >> >> > On Wed, Apr 22, 2015 at 12:47:59PM +0200, Máté Sebők wrote:
>> >> >> >> Indeed, sorry i've forgotten to change the Eclipse' EOL to
>> >> >> >> unix--
>> >> >> >> now
>> >> >> >> fixed.
>> >> >> >>
>> >> >> >> Error handler fixed.
>> >> >> >>
>> >> >> >> Parameter names changed to audio(/video)_device_load(/save) as I
>> >> think
>> >> >> >> the
>> >> >> >> to_file and from_file is evident and is specified in the help.
>> >> >> >>
>> >> >> >> About the "fake" input:  by loading a device filter from file,
>> >> >> >> in
>> >> >> >> the
>> >> >> >> dshow_open_device() it loads the device object from file instead
>> of
>> >> >> >> searching it by name. So as long as the dshow_open_device() get
>> >> called
>> >> >> >> it
>> >> >> >> will load the device -- however to get called it is required to
>> >> >> >> have
>> >> a
>> >> >> >> not
>> >> >> >> NULL input name .. aka any fake text would do the trick (eg: -i
>> >> video="
>> >> >> >> " )
>> >> >> >> If you have better suggestion for the description, please tell
>> >> >> >> me.
>> >> >> >>
>> >> >> >> Here is the fixed patch.
>> >> >> >
>> >> >> > [...]
>> >> >> >
>> >> >> >> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
>> >> >> >> index d03670e..9ac28c5 100644
>> >> >> >> --- a/libavdevice/dshow.c
>> >> >> >> +++ b/libavdevice/dshow.c
>> >> >> >> @@ -27,6 +27,8 @@
>> >> >> >>  #include "libavformat/riff.h"
>> >> >> >>  #include "avdevice.h"
>> >> >> >>  #include "libavcodec/raw.h"
>> >> >> >> +#include "objidl.h"
>> >> >> >
>> >> >> >> +#include "Shlwapi.h"
>> >> >> >
>> >> >> > this header does not exist, it must be lowwer case or it will
>> >> >> > break
>> >> >> > build on linux-mingw
>> >> >> >
>> >> >>
>> >> >> That is the proper capitalization of the header in the MS Windows
>> SDK.
>> >> >> If mingw has it all lower-cased, its technically a bug in mingw.
>> >> >
>> >> > hmm i wasnt aware of that but yes
>> >> >  locate Shlwapi.h confirms that theres no such header in ubuntu
>> >> > mingw*
>> >> >
>> >> > so this definitly needs some configure check so it doesnt break
>> >> > build
>> >>
>> >> Interesting.  After doing some research (in my own cross compiler, I
>> >> only have "shlwapi.h" and not "Shlwapi.h"), it appears that the
>> >> mingw-gcc cross compilers are themselves "filename case insensitive"
>> >> even on linux with case sensitive underlying file systems.  So I guess
>> >> as long as "shlwapi.h" is common we should be ok.  Unexpected for
>> >> sure.
>> >> ___
>> >> ffmpeg-devel mailing list
>> >> ffmpeg-devel@ffmpeg.org
>> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> >>
>> >
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-devel] [PATCH] mpeg4videodec: only allow a positive length

2015-04-22 Thread Andreas Cadhalpun
On 22.04.2015 18:51, Vittorio Giovara wrote:
> On Wed, Apr 22, 2015 at 3:32 PM, Andreas Cadhalpun
>  wrote:
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/mpeg4videodec.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
>> index 8449392..9bf33dd 100644
>> --- a/libavcodec/mpeg4videodec.c
>> +++ b/libavcodec/mpeg4videodec.c
>> @@ -189,14 +189,14 @@ static int 
>> mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
>>  int x = 0, y = 0;
>>
>>  length = get_vlc2(gb, sprite_trajectory.table, 
>> SPRITE_TRAJ_VLC_BITS, 3);
>> -if (length)
>> +if (length > 0)
>>  x = get_xbits(gb, length);
>>
>>  if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
>>  check_marker(gb, "before sprite_trajectory");
>>
>>  length = get_vlc2(gb, sprite_trajectory.table, 
>> SPRITE_TRAJ_VLC_BITS, 3);
>> -if (length)
>> +if (length > 0)
>>  y = get_xbits(gb, length);
>>
>>  check_marker(gb, "after sprite_trajectory");
>> --
> 
> Not very familiar with the code, but shouldn't you error out in this case?

One could error out as well, but there was already the check for length != 0,
so changing that was simpler.

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Andreas Cadhalpun
On 22.04.2015 18:52, Vittorio Giovara wrote:
> On Wed, Apr 22, 2015 at 5:31 PM, Claudio Freire  
> wrote:
>> On Wed, Apr 22, 2015 at 12:54 PM, Andreas Cadhalpun
>>  wrote:
>>> On 22.04.2015 17:35, Claudio Freire wrote:
 On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
  wrote:
> +if (k == last_k && msb == last_msb) {
> +av_log(ac->avctx, AV_LOG_ERROR, "patch construction 
> failed\n");
> +return AVERROR_INVALIDDATA;
> +}
> +last_k = k;
> +last_msb = msb;
> 
> Andreas, do you have a sample that triggers the infinite loop?

Yes. I can send it to you privately, if you want to play around with it.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] libavcodec/parser.c: re-fetch PTS/DTS if fetch failed

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 07:17:59PM +0800, luckliuyuxin wrote:
[...]
>  parser.c |5 +
>  1 file changed, 5 insertions(+)
> f3ed39fd2c44d36a96dbab27a8c810d7479e8d22  
> 0001-re-fetch-PTS-DTS-if-fetch-failed.patch
> From 00b457adb855b0b25ac7cde4a9cb8c7b53fd0511 Mon Sep 17 00:00:00 2001
> From: liuyuxin 
> Date: Wed, 22 Apr 2015 16:56:42 +0800
> Subject: [PATCH] re-fetch PTS/DTS if fetch failed
> 
> IQiYi has special PES packets:
> |<---PES#1--->|<-PES#2--->|
> | AUD | P frame | PPS | AUD | P frame |

isnt this a violation of the spec ?

anyway, please provide a sample file of such stream

also the patch breaks "make fate"

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

2015-04-22 Thread Philip Langdale

On 2015-04-22 03:10, Niklesh Lalwani wrote:

From: Niklesh 

This patch supports decoding of Bold, Italic, Underlined styles for
3gpp timed text. While the code can be improved upon to make it more
clean and well structured, this works for now, even for multiple style
records. Suggestions awaited.
Signed-off-by: Niklesh 
---
 libavcodec/movtextdec.c | 86 
++---

 1 file changed, 82 insertions(+), 4 deletions(-)


Thank you Niklesh.

I will repeat my three primary items from the previous review as they 
all still

apply:

* You need to handle large (> 32bit) boxes.
* You should store indices in style_start and style_end
* You should define a struct TextSampleModifierBox and use that for 
de-serialization.


I'm personally ok with you doing these as follow-up items, and not 
having them in to

initial committed patch, but the others need to agree with that.

Please address the syntax and warning issues that have already been 
pointed out.




diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 1c7ffea..a4aa7cb 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -25,10 +25,28 @@
 #include "libavutil/common.h"
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"

-static int text_to_ass(AVBPrint *buf, const char *text, const char 
*text_end)

+#define STYLE_FLAG_BOLD 1
+#define STYLE_FLAG_ITALIC   2
+#define STYLE_FLAG_UNDERLINE4
+
+static int text_to_ass(AVBPrint *buf, const char *text, const char 
*text_end,
+const char **style_start, const char 
**style_end,
+const int **style_flags, const int 
style_entries)

 {
 while (text < text_end) {
+for (int i=0; i@@ -63,6 +92,13 @@ static int mov_text_decode_frame(AVCodecContext 
*avctx,

 AVBPrint buf;
 const char *ptr = avpkt->data;
 const char *end;
+int text_length, tsmb_type, style_entries, tsmb_size;
+char **style_start={0,};
+char **style_end={0,};
+int **style_flags={0,};
+const uint8_t *tsmb;
+int index,i, flag=0;;
+char *ptr_temp;

 if (!ptr || avpkt->size < 2)
 return AVERROR_INVALIDDATA;
@@ -82,7 +118,8 @@ static int mov_text_decode_frame(AVCodecContext 
*avctx,
  * In complex cases, there are style descriptors appended to the 
string

  * so we can't just assume the packet size is the string size.
  */
-end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt->size);
+text_length = AV_RB16(ptr);
+end = ptr + FFMIN(2 + text_length, avpkt->size);
 ptr += 2;

 ts_start = av_rescale_q(avpkt->pts,
@@ -92,10 +129,51 @@ static int mov_text_decode_frame(AVCodecContext 
*avctx,

 avctx->time_base,
 (AVRational){1,100});

+tsmb_size=0;
 // Note that the spec recommends lines be no longer than 2048 
characters.

 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
-text_to_ass(&buf, ptr, end);
-ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, 
ts_end-ts_start);

+if (text_length + 2 != avpkt->size) {
+while (text_length + 2 + tsmb_size < avpkt->size)  {
+tsmb = ptr + text_length+tsmb_size;
+tsmb_size = AV_RB32(tsmb);
+tsmb += 4;
+tsmb_type = AV_RB32(tsmb);
+tsmb += 4;
+
+if (tsmb_type == MKBETAG('s','t','y','l')) {
+style_entries = AV_RB16(tsmb);
+tsmb += 2;
+
+for(i = 0; i < style_entries;i++) {
+ptr_temp= ptr + AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_start, &index, ptr_temp);
+tsmb += 2;
+ptr_temp= ptr+ AV_RB16(tsmb);
+index=i;
+av_dynarray_add(&style_end, &index, ptr_temp);
+tsmb += 2;
+// fontID = AV_RB16(tsmb);
+tsmb += 2;
+flag=AV_RB8(tsmb);
+index=i;
+av_dynarray_add(&style_flags, &index, &flag);
+//fontsize=AV_RB8(tsmb);
+tsmb += 2;
+// text-color-rgba
+tsmb += 4;
+}
+text_to_ass(&buf, ptr, end, style_start, style_end,
style_flags,style_entries);
+av_freep(&style_start);
+av_freep(&style_end);
+av_freep(&style_flags);
+}
+}
+}
+else
+text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);
+
+ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end - 
ts_start);

 av_bprint_finalize(&buf, NULL);
 if (ret < 0)
 return ret;


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


Re: [FFmpeg-devel] [PATCH 5/6] fate: gapless: remove useless tests

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 06:30:29PM +0200, wm4 wrote:
> On Wed, 22 Apr 2015 18:19:02 +0200
> Michael Niedermayer  wrote:
> 
> > On Wed, Apr 22, 2015 at 12:24:40PM +0200, wm4 wrote:
> > > These could be kept, but they are not overly useful. The only thing they
> > > had over the remaining mp3 gapless test was seeking, which was incorrect
> > > in the toc test, and only by chance correct in the notoc test.
> > > ---
> > >  tests/fate/gapless.mak   | 4 +---
> > >  tests/ref/fate/gapless-mp3-notoc | 5 -
> > >  tests/ref/fate/gapless-mp3-toc   | 5 -
> > >  3 files changed, 1 insertion(+), 13 deletions(-)
> > >  delete mode 100644 tests/ref/fate/gapless-mp3-notoc
> > >  delete mode 100644 tests/ref/fate/gapless-mp3-toc
> > 
> > i suggest to keep the test which is correct even when its just by
> > chance unless it breaks for a not easy correctable reason
> > 
> > the test with wrong output should be removed, i agree
> 
> No, they're just useless.

hmm, ok, applied


> If you insist, I can send a patch to re-add a
> seek test with the gapless.mp3 we have. (The existing seek test for mp3
> uses a generated file with plain CBR.)

i dont "insist" but i think its a good idea

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH] fate: add mp3 CBR seek test

2015-04-22 Thread wm4
This tests the "old", now non-default seek mode, and this requires a
special extra argument.
---
Requested... not like I think this test is overly useful.
---
 libavformat/seek-test.c  |  2 ++
 tests/fate/seek.mak  | 13 +---
 tests/ref/seek/extra-mp3 | 53 
 3 files changed, 65 insertions(+), 3 deletions(-)
 create mode 100644 tests/ref/seek/extra-mp3

diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 8b0611d..1dd041d 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -76,6 +76,8 @@ int main(int argc, char **argv)
 frame_count = atoi(argv[i+1]);
 } else if(!strcmp(argv[i], "-duration")){
 duration = atoi(argv[i+1]);
+} else if(!strcmp(argv[i], "-usetoc")) {
+av_dict_set(&format_opts, "usetoc", argv[i+1], 0);
 } else {
 argc = 1;
 }
diff --git a/tests/fate/seek.mak b/tests/fate/seek.mak
index 3be04ca..dfb2e84 100644
--- a/tests/fate/seek.mak
+++ b/tests/fate/seek.mak
@@ -241,11 +241,18 @@ fate-seek-lavf-yuv4mpeg: SRC = lavf/lavf.y4m
 
 FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)
 
-$(FATE_SEEK) $(FATE_SAMPLES_SEEK): libavformat/seek-test$(EXESUF)
+# extra files
+
+FATE_SEEK_EXTRA-$(CONFIG_MP3_DEMUXER)   += fate-seek-extra-mp3
+fate-seek-extra-mp3:  CMD = run libavformat/seek-test$(EXESUF) 
$(TARGET_SAMPLES)/gapless/gapless.mp3 -usetoc 0
+FATE_SEEK_EXTRA += $(FATE_SEEK_EXTRA-yes)
+
+
+$(FATE_SEEK) $(FATE_SAMPLES_SEEK) $(FATE_SEEK_EXTRA): 
libavformat/seek-test$(EXESUF)
 $(FATE_SEEK) $(FATE_SAMPLES_SEEK): CMD = run libavformat/seek-test$(EXESUF) 
$(TARGET_PATH)/tests/data/$(SRC)
 $(FATE_SEEK) $(FATE_SAMPLES_SEEK): fate-seek-%: fate-%
 fate-seek-%: REF = $(SRC_PATH)/tests/ref/seek/$(@:fate-seek-%=%)
 
 FATE_AVCONV += $(FATE_SEEK)
-FATE_SAMPLES_AVCONV += $(FATE_SAMPLES_SEEK)
-fate-seek: $(FATE_SEEK) $(FATE_SAMPLES_SEEK)
+FATE_SAMPLES_AVCONV += $(FATE_SAMPLES_SEEK) $(FATE_SEEK_EXTRA)
+fate-seek: $(FATE_SEEK) $(FATE_SAMPLES_SEEK) $(FATE_SEEK_EXTRA)
diff --git a/tests/ref/seek/extra-mp3 b/tests/ref/seek/extra-mp3
new file mode 100644
index 000..981ac02
--- /dev/null
+++ b/tests/ref/seek/extra-mp3
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:0  ts:-1.00
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:1  ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  31544 size:   
418
+ret: 0 st: 0 flags:0  ts: 0.788334
+ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos:  14407 size:   
418
+ret: 0 st: 0 flags:1  ts:-0.317499
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:0  ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos:  42828 size:   
418
+ret: 0 st:-1 flags:1  ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos:  24856 size:   
418
+ret: 0 st: 0 flags:0  ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos:   7302 size:   
418
+ret: 0 st: 0 flags:1  ts:-0.740831
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st:-1 flags:0  ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos:  36141 size:   
418
+ret: 0 st:-1 flags:1  ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  18169 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.058330
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 2.835837
+ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  46590 size:   
418
+ret: 0 st:-1 flags:0  ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos:  29454 size:   
418
+ret: 0 st:-1 flags:1  ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:  11064 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.481662
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 2.412505
+ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  39903 size:   
418
+ret: 0 st:-1 flags:0  ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos:  22766 size:   
418
+ret: 0 st:-1 flags:1  ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   4376 size:   
418
+ret: 0 st: 0 flags:0  ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:   1451 size:   
440
+ret: 0 st: 0 flags:1  ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  33215 size:   
418
+ret: 0 st:-1 flags:0  ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos:  15661 size:   
418
+ret: 0  

Re: [FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 11:02:56AM -0600, Roger Pack wrote:
> On 4/22/15, Máté Sebők  wrote:
> > Of course can it be only in the error block - just deleted the other
> > releases.
> > Also no need for NULL-ing either in this case.
> 
> Perfect.  OK LGTM now.   Recommend applying.

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH] bink: check vst->index_entries before using it

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 05:08:51PM +0200, Andreas Cadhalpun wrote:
> This fixes a NULL pointer dereference if vst->duration is 0.
> 
> The problem was introduced in commit 0588acaf.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/bink.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

applied

thanks

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


[FFmpeg-devel] [PATCH] vp9: remove one optimization branch in iadst16 which causes overflows.

2015-04-22 Thread Ronald S. Bultje
See sample vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm from the vp9 test
vector set which reproduces the issue. This probably costs a few cycles,
but I don't think there's an easy way to workaround that.
---
 libavcodec/x86/vp9itxfm.asm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/vp9itxfm.asm b/libavcodec/x86/vp9itxfm.asm
index bfe427f..a9d45a4 100644
--- a/libavcodec/x86/vp9itxfm.asm
+++ b/libavcodec/x86/vp9itxfm.asm
@@ -1699,7 +1699,9 @@ VP9_IDCT_IDCT_16x16_ADD_XMM avx
 SUMSUB_BAw,  5,  7,  4
 PSIGNW  m5, [pw_m1] ; m12=out15[w], 
m8=t3[w]
 
-%if cpuflag(ssse3)
+; unfortunately, the code below overflows in some cases, e.g.
+; 
http://downloads.webmproject.org/test_data/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm
+%if 0 ; cpuflag(ssse3)
 SUMSUB_BA   w,   7,  6,  4
 pmulhrswm7, [pw_m11585x2]   ; m8=out7[w]
 pmulhrswm6, [pw_11585x2]; m1=out8[w]
-- 
2.1.2

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


Re: [FFmpeg-devel] [libav-devel] [PATCH] dss_sp: use lowercase codec name without whitespace

2015-04-22 Thread Vittorio Giovara
On Wed, Apr 22, 2015 at 1:42 PM, Andreas Cadhalpun
 wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/dss_sp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
> index 42ba1c4..909ad1f 100644
> --- a/libavcodec/dss_sp.c
> +++ b/libavcodec/dss_sp.c
> @@ -776,7 +776,7 @@ static int dss_sp_decode_frame(AVCodecContext *avctx, 
> void *data,
>  }
>
>  AVCodec ff_dss_sp_decoder = {
> -.name   = "DSS SP",
> +.name   = "dss_sp",
>  .long_name  = NULL_IF_CONFIG_SMALL("Digital Speech Standard - 
> Standard Play mode (DSS SP)"),
>  .type   = AVMEDIA_TYPE_AUDIO,
>  .id = AV_CODEC_ID_DSS_SP,

Makes sense, thanks
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-devel] [PATCH] mpeg4videodec: only allow a positive length

2015-04-22 Thread Vittorio Giovara
On Wed, Apr 22, 2015 at 3:32 PM, Andreas Cadhalpun
 wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/mpeg4videodec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> index 8449392..9bf33dd 100644
> --- a/libavcodec/mpeg4videodec.c
> +++ b/libavcodec/mpeg4videodec.c
> @@ -189,14 +189,14 @@ static int 
> mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
>  int x = 0, y = 0;
>
>  length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> -if (length)
> +if (length > 0)
>  x = get_xbits(gb, length);
>
>  if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
>  check_marker(gb, "before sprite_trajectory");
>
>  length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> -if (length)
> +if (length > 0)
>  y = get_xbits(gb, length);
>
>  check_marker(gb, "after sprite_trajectory");
> --

Not very familiar with the code, but shouldn't you error out in this case?
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-devel] [PATCH] aacsbr: break infinite loop in sbr_hf_calc_npatches

2015-04-22 Thread Vittorio Giovara
On Wed, Apr 22, 2015 at 5:31 PM, Claudio Freire  wrote:
> On Wed, Apr 22, 2015 at 12:54 PM, Andreas Cadhalpun
>  wrote:
>> On 22.04.2015 17:35, Claudio Freire wrote:
>>> On Wed, Apr 22, 2015 at 10:23 AM, Andreas Cadhalpun
>>>  wrote:
 +if (k == last_k && msb == last_msb) {
 +av_log(ac->avctx, AV_LOG_ERROR, "patch construction 
 failed\n");
 +return AVERROR_INVALIDDATA;
 +}
 +last_k = k;
 +last_msb = msb;

Andreas, do you have a sample that triggers the infinite loop?

>>>
>>>
>>> I don't think the INVALIDDATA return will have the desired effect.
>>>
>>> I think you want return -1;
>>
>> This function is only called once and there the check is:
>> if (sbr_hf_calc_npatches(ac, sbr) < 0)
>> return -1;
>>
>> Thus returning AVERROR_INVALIDDATA works as well as -1.
>
> The fact that AVERROR_INVALIDDATA < 0 is a close call on 32 bit platforms.
>
> Still, it's not a new assumption in the code, so I'll grant you that.

What do you mean by "A close call"? All AVERROR_* are negative by
design, and they carry more information than a -1, so their increased
usage is certainly welcome.
The fact that it does not get propagated is a separate issue.
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat: drop libquvi demuxer

2015-04-22 Thread Lou Logan
libquvi is dead.

Signed-off-by: Lou Logan 
---
TODO:
Changelog
Bump minor

Relevant post:


If a user still wants this they can locally maintain it.
---
 configure|   4 --
 doc/demuxers.texi|  12 
 libavformat/Makefile |   1 -
 libavformat/allformats.c |   1 -
 libavformat/libquvi.c| 153 ---
 5 files changed, 171 deletions(-)
 delete mode 100644 libavformat/libquvi.c

diff --git a/configure b/configure
index e2bd3de..b97ea7c 100755
--- a/configure
+++ b/configure
@@ -232,7 +232,6 @@ External library support:
   --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
   --enable-libopus enable Opus de/encoding via libopus [no]
   --enable-libpulseenable Pulseaudio input via libpulse [no]
-  --enable-libquvi enable quvi input via libquvi [no]
   --enable-librtmp enable RTMP[E] support via librtmp [no]
   --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
   --enable-libshineenable fixed-point MP3 encoding via libshine [no]
@@ -1383,7 +1382,6 @@ EXTERNAL_LIBRARY_LIST="
 libopenjpeg
 libopus
 libpulse
-libquvi
 librtmp
 libschroedinger
 libshine
@@ -2424,7 +2422,6 @@ libopenjpeg_encoder_deps="libopenjpeg"
 libopus_decoder_deps="libopus"
 libopus_encoder_deps="libopus"
 libopus_encoder_select="audio_frame_queue"
-libquvi_demuxer_deps="libquvi"
 libschroedinger_decoder_deps="libschroedinger"
 libschroedinger_encoder_deps="libschroedinger"
 libshine_encoder_deps="libshine"
@@ -5051,7 +5048,6 @@ enabled libopenjpeg   && { check_lib openjpeg.h 
opj_version -lopenmj2 -DOPJ_
die "ERROR: libopenjpeg not found"; }
 enabled libopus   && require_pkg_config opus opus_multistream.h 
opus_multistream_decoder_create
 enabled libpulse  && require_pkg_config libpulse pulse/pulseaudio.h 
pa_context_new
-enabled libquvi   && require_pkg_config libquvi quvi/quvi.h quvi_init
 enabled librtmp   && require_pkg_config librtmp librtmp/rtmp.h 
RTMP_Socket
 enabled libschroedinger   && require_pkg_config schroedinger-1.0 
schroedinger/schro.h schro_init
 enabled libshine  && require_pkg_config shine shine/layer3.h 
shine_encode_buffer
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 3f7c45e..3bf217c 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -182,18 +182,6 @@ track. Track indexes start at 0. The demuxer exports the 
number of tracks as
 
 For very large files, the @option{max_size} option may have to be adjusted.
 
-@section libquvi
-
-Play media from Internet services using the quvi project.
-
-The demuxer accepts a @option{format} option to request a specific quality. It
-is by default set to @var{best}.
-
-See @url{http://quvi.sourceforge.net/} for more information.
-
-FFmpeg needs to be built with @code{--enable-libquvi} for this demuxer to be
-enabled.
-
 @section gif
 
 Animated GIF demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8d9a770..dfc9b7b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -483,7 +483,6 @@ OBJS-$(CONFIG_LIBGME_DEMUXER)+= libgme.o
 OBJS-$(CONFIG_LIBMODPLUG_DEMUXER)+= libmodplug.o
 OBJS-$(CONFIG_LIBNUT_DEMUXER)+= libnut.o
 OBJS-$(CONFIG_LIBNUT_MUXER)  += libnut.o
-OBJS-$(CONFIG_LIBQUVI_DEMUXER)   += libquvi.o
 OBJS-$(CONFIG_LIBRTMP)   += librtmp.o
 OBJS-$(CONFIG_LIBSSH_PROTOCOL)   += libssh.o
 OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e6a9d01..ae422f6 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -385,7 +385,6 @@ void av_register_all(void)
 REGISTER_DEMUXER (LIBGME,   libgme);
 REGISTER_DEMUXER (LIBMODPLUG,   libmodplug);
 REGISTER_MUXDEMUX(LIBNUT,   libnut);
-REGISTER_DEMUXER (LIBQUVI,  libquvi);
 REGISTER_PROTOCOL(LIBRTMP,  librtmp);
 REGISTER_PROTOCOL(LIBRTMPE, librtmpe);
 REGISTER_PROTOCOL(LIBRTMPS, librtmps);
diff --git a/libavformat/libquvi.c b/libavformat/libquvi.c
deleted file mode 100644
index 7c5f7a2..000
--- a/libavformat/libquvi.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2013 Clément Bœsch
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more d

Re: [FFmpeg-devel] [PATCH] vp9: remove one optimization branch in iadst16 which causes overflows.

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 02:53:01PM -0400, Ronald S. Bultje wrote:
> See sample vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm from the vp9 test
> vector set which reproduces the issue. This probably costs a few cycles,
> but I don't think there's an easy way to workaround that.
> ---
>  libavcodec/x86/vp9itxfm.asm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

applied

thanks

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

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


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


[FFmpeg-devel] [PATCH] vp9: remove another optimization branch in iadst16 which causes overflows.

2015-04-22 Thread Ronald S. Bultje
See sample vp90-2-14-resize-fp-tiles-16-8.webm from the vp9 test vector
set to reproduce the issue.
---
 libavcodec/x86/vp9itxfm.asm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/vp9itxfm.asm b/libavcodec/x86/vp9itxfm.asm
index a9d45a4..9cf0d78 100644
--- a/libavcodec/x86/vp9itxfm.asm
+++ b/libavcodec/x86/vp9itxfm.asm
@@ -1622,7 +1622,9 @@ VP9_IDCT_IDCT_16x16_ADD_XMM avx
 PSIGNW  m3, [pw_m1] ; m3=out1[w], 
m7=t10[w]
 SUMSUB_BAw,  2,  6,  1  ; m2=out14[w], 
m6=t11[w]
 
-%if cpuflag(ssse3)
+; unfortunately, the code below overflows in some cases, e.g.
+; 
http://downloads.webmproject.org/test_data/libvpx/vp90-2-14-resize-fp-tiles-16-8.webm
+%if 0; cpuflag(ssse3)
 SUMSUB_BAw,  7,  6,  1
 pmulhrswm7, [pw_11585x2]; m7=out6[w]
 pmulhrswm6, [pw_11585x2]; m6=out9[w]
-- 
2.1.2

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


[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 1/6] postproc: Replaced inline asm for prefetching with prefetch functions

2015-04-22 Thread Tucker DiNapoli
This set of patches is what I am submitting as qualification for the google 
summer of code. 
I wrote sse2/avx2 versions of several of the postprocessing filters 
(namely the accurate deblock filter and all the deinterlace filters), and made 
several
changes to the structure of the postprocess_template.c file to support the new 
versions
of the fliters. However this is ultimately incomplete, I was unable to 
reproduce exactly
the same results using the sse2/avx2 fliters as obtained from the c/existing 
mmx2 filters.

The patches I'm submitting make all the changes necessary to use the new 
sse2/avx2 filters, 
but by default they aren't used. This means all the patches should apply 
cleanly and pass
all the tests. 

This qualification task has been more work that I'd anticapated and being a 
student I 
haven't been able to put all the time into figuring out the problems as I 
would've liked.
I am confident that during the summer, without any other commitments, I will be 
able 
to figure out the existing issues and fix them. I hope that dispite the obvious
issues you will still consider my accepting my project for the summer of code.

And now back to the original commit message:

Prefetching functions are defined in postprocess_template using the
RENAME macro so that prefetching is used when available. For x86
targets inline asm is used and the functions are non-empty only for
cpus where prefetching is available. For non x86 targets the gcc bultin
prefetch is used if it is available, otherwise no prefetching is done.
---
 libpostproc/postprocess.c  |  31 -
 libpostproc/postprocess_template.c | 126 +
 2 files changed, 71 insertions(+), 86 deletions(-)

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 9d89782..af70bb3 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -168,37 +168,6 @@ static const char * const replaceTable[]=
 NULL //End Marker
 };
 
-
-#if ARCH_X86 && HAVE_INLINE_ASM
-static inline void prefetchnta(const void *p)
-{
-__asm__ volatile(   "prefetchnta (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht0(const void *p)
-{
-__asm__ volatile(   "prefetcht0 (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht1(const void *p)
-{
-__asm__ volatile(   "prefetcht1 (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht2(const void *p)
-{
-__asm__ volatile(   "prefetcht2 (%0)\n\t"
-: : "r" (p)
-);
-}
-#endif
-
 /* The horizontal functions exist only in C because the MMX
  * code is faster with vertical filters and transposing. */
 
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 16e441a..e153b13 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3242,6 +3242,69 @@ static inline void RENAME(duplicate)(uint8_t src[], int 
stride)
 #endif
 }
 
+#if ARCH_X86 && TEMPLATE_PP_MMXEXT
+static inline void RENAME(prefetchnta)(const void *p)
+{
+__asm__ volatile(   "prefetchnta (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht0)(const void *p)
+{
+__asm__ volatile(   "prefetcht0 (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht1)(const void *p)
+{
+__asm__ volatile(   "prefetcht1 (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht2)(const void *p)
+{
+__asm__ volatile(   "prefetcht2 (%0)\n\t"
+: : "r" (p)
+);
+}
+#elif !ARCH_X86 && AV_GCC_VERSION_AT_LEAST(3,2)
+static inline void RENAME(prefetchnta)(const void *p)
+{
+__builtin_prefetch(p,0,0);
+}
+static inline void RENAME(prefetcht0)(const void *p)
+{
+__builtin_prefetch(p,0,1);
+}
+static inline void RENAME(prefetcht1)(const void *p)
+{
+__builtin_prefetch(p,0,2);
+}
+static inline void RENAME(prefetcht2)(const void *p)
+{
+__builtin_prefetch(p,0,3);
+}
+#else
+static inline void RENAME(prefetchnta)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht0)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht1)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht2)(const void *p)
+{
+return;
+}
+#endif
 /**
  * Filter array of bytes (Y or U or V values)
  */
@@ -3368,34 +3431,10 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 // finish 1 block before the next otherwise we might have a problem
 // with the L1 Cache of the P4 ... or only a few blocks at a time or 
something
 for(x=0; x>2)&6) + 5)*srcStride + 32);
-prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-__asm__(
-"mov %4, %%"REG_a"  \n\t"
-"shr $2, %%"REG_a"   

[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 2/6] postproc: Made QP, nonBQP, and pQPb arrays

2015-04-22 Thread Tucker DiNapoli
From: Tucker DiNapoli 

Also pulled QP initialization out of inner loop, which removed some redundent 
code.

Added some dummy fields to PPContext to allow current code to work while
changing the rest of the postprocessing code to support the arrays.

I also increased alignment requirements for some fields in the PPContext struct 
to
support future avx2 code.
---
 libpostproc/postprocess_internal.h | 10 -
 libpostproc/postprocess_template.c | 81 ++
 2 files changed, 46 insertions(+), 45 deletions(-)

diff --git a/libpostproc/postprocess_internal.h 
b/libpostproc/postprocess_internal.h
index 1ebd974..c1a306d 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -143,8 +143,11 @@ typedef struct PPContext{
 DECLARE_ALIGNED(8, uint64_t, pQPb);
 DECLARE_ALIGNED(8, uint64_t, pQPb2);
 
-DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
-DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
+DECLARE_ALIGNED(32, uint64_t, pQPb_block)[4];
+DECLARE_ALIGNED(32, uint64_t, pQPb2_block)[4];
+
+DECLARE_ALIGNED(32, uint64_t, mmxDcOffset)[64];
+DECLARE_ALIGNED(32, uint64_t, mmxDcThreshold)[64];
 
 QP_STORE_T *stdQPTable;   ///< used to fix MPEG2 style qscale
 QP_STORE_T *nonBQPTable;
@@ -153,6 +156,9 @@ typedef struct PPContext{
 int QP;
 int nonBQP;
 
+DECLARE_ALIGNED(32, int, QP_block)[4];
+DECLARE_ALIGNED(32, int, nonBQP_block)[4];
+
 int frameNum;
 
 int cpuCaps;
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index e153b13..b7296c4 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3479,7 +3479,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 #endif
 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
-int QP=0;
+int QP=0, nonBQP=0;
 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 
1 line upwards
if not than use a temporary buffer */
 if(y+15 >= height){
@@ -3512,6 +3512,29 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 int endx = FFMIN(width, x+32);
 uint8_t *dstBlockStart = dstBlock;
 const uint8_t *srcBlockStart = srcBlock;
+int qp_index = 0;
+for(qp_index=0; qp_index < (endx-startx)/BLOCK_SIZE; qp_index++){
+QP = QPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
+nonBQP = nonBQPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
+if(!isColor){
+QP= (QP* QPCorrecture + 256*128)>>16;
+nonBQP= (nonBQP* QPCorrecture + 256*128)>>16;
+yHistogram[(srcBlock+qp_index*8)[srcStride*12 + 4]]++;
+}
+c.QP_block[qp_index] = QP;
+c.nonBQP_block[qp_index] = nonBQP;
+#if TEMPLATE_PP_MMX
+__asm__ volatile(
+"movd %1, %%mm7 \n\t"
+"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
+"movq %%mm7, %0 \n\t"
+: "=m" (c.pQPb_block[qp_index])
+: "r" (QP)
+);
+#endif
+}
   for(; x < endx; x+=BLOCK_SIZE){
 RENAME(prefetchnta)(srcBlock + (((x>>2)&6) + copyAhead)*srcStride 
+ 32);
 RENAME(prefetchnta)(srcBlock + (((x>>2)&6) + 
copyAhead+1)*srcStride + 32);
@@ -3543,27 +3566,15 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
   dstBlock = dstBlockStart;
   srcBlock = srcBlockStart;
 
-  for(x = startx; x < endx; x+=BLOCK_SIZE){
+  for(x = startx, qp_index = 0; x < endx; x+=BLOCK_SIZE, qp_index++){
 const int stride= dstStride;
-QP = QPptr[x>>qpHShift];
-c.nonBQP = nonBQPptr[x>>qpHShift];
-if(!isColor){
-QP= (QP* QPCorrecture + 256*128)>>16;
-c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
-yHistogram[srcBlock[srcStride*12 + 4]]++;
-}
-c.QP= QP;
-#if TEMPLATE_PP_MMX
-__asm__ volatile(
-"movd %1, %%mm7 \n\t"
-"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
-"movq %%mm7, %0 \n\t"
-: "=m" (c.pQPb)
-: "r" (QP)
-);
-#endif
+//temporary while changing QP stuff to make things continue to work
+//eventually QP,nonBQP,etc will be arrays and this will be 
unnecessary
+c.Q

[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 4/6] postproc: Updated postprocess_template to use new sse/avx deinterlace functions

2015-04-22 Thread Tucker DiNapoli
This commit adds several new files containing yasm assembly code, they are:
PPContext.asm; Defines the PPContext struct using the yasm struc command
PPUtil.asm; Various utility macros used in the other asm code
block_copy.asm; Implements the block copy function, the sse2 and avx2
versions copy multiple blocks at once.
deinterlace.asm; Contains implemenations of the postprocessing filters
with support for sse2 and avx2.

Adding these new functions to postprocess_template entailed adding a new
templates for AVX2 and modifying the current SSE2 template to use the
sse2 functions.
A new deinterlace function was added to move the logic of which
deinterlace function to use out of the postprocess function and make
adding the new functions eaiser.

Being as the filters don't reproduce the exact results as the mmx/c versions 
they are
not actually used, the code to enable them is present, but commented out.
---
 libpostproc/postprocess.c  |  22 ++-
 libpostproc/postprocess_internal.h |   9 +-
 libpostproc/postprocess_template.c | 227 ++-
 libpostproc/x86/Makefile   |   2 +
 libpostproc/x86/PPContext.asm  |  77 
 libpostproc/x86/PPUtil.asm | 224 +++
 libpostproc/x86/block_copy.asm | 116 
 libpostproc/x86/deinterlace.asm| 356 +
 8 files changed, 981 insertions(+), 52 deletions(-)
 create mode 100644 libpostproc/x86/Makefile
 create mode 100644 libpostproc/x86/PPContext.asm
 create mode 100644 libpostproc/x86/PPUtil.asm
 create mode 100644 libpostproc/x86/block_copy.asm
 create mode 100644 libpostproc/x86/deinterlace.asm

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index af70bb3..63b01a5 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -542,11 +542,16 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, 
int step,
 #include "postprocess_template.c"
 #define TEMPLATE_PP_SSE2 1
 #include "postprocess_template.c"
+#define TEMPLATE_PP_AVX2 1
+#include "postprocess_template.c"
 #else
-#if HAVE_SSE2_INLINE
-#define TEMPLATE_PP_SSE2 1
+/*#if HAVE_AVX2_INLINE
+#define TEMPLATE_PP_AVX2 1
 #include "postprocess_template.c"
-#elif HAVE_MMXEXT_INLINE
+#elif HAVE_SSE2_INLINE
+#define TEMPLATE_PP_SSE2 1
+#include "postprocess_template.c"*/
+#if HAVE_MMXEXT_INLINE
 #define TEMPLATE_PP_MMXEXT 1
 #include "postprocess_template.c"
 #elif HAVE_AMD3DNOW_INLINE
@@ -574,16 +579,19 @@ static inline void postProcess(const uint8_t src[], int 
srcStride, uint8_t dst[]
 #if CONFIG_RUNTIME_CPUDETECT
 #if ARCH_X86 && HAVE_INLINE_ASM
 // ordered per speed fastest first
-if  (c->cpuCaps & AV_CPU_FLAG_SSE2) pp = postProcess_SSE2;
-else if (c->cpuCaps & AV_CPU_FLAG_MMXEXT)   pp = postProcess_MMX2;
+/*if  (c->cpuCaps & AV_CPU_FLAG_AVX2) pp = postProcess_avx2;
+else if (c->cpuCaps & AV_CPU_FLAG_SSE2) pp = postProcess_sse2;*/
+if (c->cpuCaps & AV_CPU_FLAG_MMXEXT)   pp = postProcess_MMX2;
 else if (c->cpuCaps & AV_CPU_FLAG_3DNOW)pp = postProcess_3DNow;
 else if (c->cpuCaps & AV_CPU_FLAG_MMX)  pp = postProcess_MMX;
 #elif HAVE_ALTIVEC
 if  (c->cpuCaps & AV_CPU_FLAG_ALTIVEC)  pp = postProcess_altivec;
 #endif
 #else /* CONFIG_RUNTIME_CPUDETECT */
-#if HAVE_SSE2_INLINE
-pp = postProcess_SSE2;
+#if HAVE_AVX2_INLINE
+pp = postProcess_avx2;
+#elif HAVE_SSE2_INLINE
+pp = postProcess_sse2;
 #elif   HAVE_MMXEXT_INLINE
 pp = postProcess_MMX2;
 #elif HAVE_AMD3DNOW_INLINE
diff --git a/libpostproc/postprocess_internal.h 
b/libpostproc/postprocess_internal.h
index c1a306d..494d965 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -180,5 +180,12 @@ static inline void linecpy(void *dest, const void *src, 
int lines, int stride) {
 memcpy((uint8_t*)dest+(lines-1)*stride, (const 
uint8_t*)src+(lines-1)*stride, -lines*stride);
 }
 }
-
+extern void ff_deInterlaceInterpolateLinear_mmx2(uint8_t *, int);
+extern void ff_deInterlaceInterpolateCubic_mmx2(uint8_t *, int);
+extern void ff_deInterlaceFF_mmx2(uint8_t *, int, uint8_t *);
+extern void ff_deInterlaceL5_mmx2(uint8_t *, int,
+  uint8_t *,uint8_t*);
+extern void ff_deInterlaceBlendLinear_mmx2(uint8_t *, int, uint8_t *);
+extern void ff_deInterlaceMedian_mmx2(uint8_t *, int);
+extern void ff_blockCopy_mmx2(uint8_t*,int,const uint8_t*,int,int,int64_t*);
 #endif /* POSTPROC_POSTPROCESS_INTERNAL_H */
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 083be9d..1003b7c 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -69,10 +69,21 @@
 #   define TEMPLATE_PP_MM

[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 5/6] postproc: Added support for sse2/avx2 versions of the do_a_deblock function

2015-04-22 Thread Tucker DiNapoli
I added a new file with the sse2/avx2 code for do_a_deblock.
I also moved the code for running vertical deblock filters into it's own
function, both to clean up the postprocess funciton and to make it
easier to integrate the new sse2/avx2 versions of these filters.
---
 libpostproc/postprocess_template.c | 123 +++---
 libpostproc/x86/Makefile   |   1 +
 libpostproc/x86/deblock.asm| 454 +
 3 files changed, 545 insertions(+), 33 deletions(-)
 create mode 100644 libpostproc/x86/deblock.asm

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 1003b7c..2d957e8 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -122,6 +122,7 @@ extern void RENAME(ff_deInterlaceFF)(uint8_t *, int, 
uint8_t *);
 extern void RENAME(ff_deInterlaceL5)(uint8_t *, int, uint8_t *, uint8_t*);
 extern void RENAME(ff_deInterlaceBlendLinear)(uint8_t *, int, uint8_t *);
 extern void RENAME(ff_deInterlaceMedian)(uint8_t *, int);
+extern void RENAME(ff_do_a_deblock)(uint8_t *, int, int, PPContext*, int);
 extern void RENAME(ff_blockCopy)(uint8_t*,int,const uint8_t*,
  int,int,int64_t*);
 extern void RENAME(ff_duplicate)(uint8_t*, int);
@@ -165,6 +166,38 @@ static inline void RENAME(duplicate)(uint8_t *src, int 
stride)
 {
 RENAME(ff_duplicate)(src, stride);
 }
+static inline void RENAME(do_a_deblock)(uint8_t *src, int stride, int step,
+PPContext *c, int mode)
+{
+RENAME(ff_do_a_deblock)(src, stride, step, c, mode);
+}
+//these are to avoid a bunch of duplicate code
+static inline int RENAME(vertClassify)(const uint8_t src[], int stride, 
PPContext *c)
+{
+return vertClassify_MMX2(src,stride,c);
+}
+static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext 
*c)
+{
+doVertLowPass_MMX2(src,stride,c);
+}
+static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, 
PPContext *c)
+{
+doVertDefFilter_MMX2(src, stride, c);
+}
+static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext 
*co)
+{
+vertX1Filter_MMX2(src,stride,co);
+}
+static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
+{
+dering_MMX2(src, stride, c);
+}
+static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
+uint8_t *tempBlurred, uint32_t 
*tempBlurredPast, const int *maxNoise)
+{
+tempNoiseReducer_MMX2(src, stride, tempBlurred, tempBlurredPast, maxNoise);
+}
+
 #else
 //FIXME? |255-0| = 1 (should not be a problem ...)
 #if TEMPLATE_PP_MMX
@@ -3368,6 +3401,57 @@ static inline void RENAME(prefetcht2)(const void *p)
 return;
 }
 #endif
+
+//pass PPContext by value since this should get inlined into postprocess
+//which has a copy of PPContext on the stack for fast access
+static inline void RENAME(deblock)(uint8_t *dstBlock, int stride,
+   int step, PPContext c, int mode,
+   int num_blocks)
+{
+//usually processes 4 blocks, unless there are less than 4 left
+int qp_index = 0;
+#if TEMPLATE_PP_AVX2
+if(num_blocks == 4 && (mode & V_A_DEBLOCK)){
+RENAME(do_a_deblock)(dstBlock, stride, step, &c, mode);
+qp_index = 4;
+}
+#elif TEMPLATE_PP_SSE2
+if(num_blocks >= 2 && (mode & V_A_DEBLOCK)){
+if(num_blocks == 4){
+RENAME(do_a_deblock)(dstBlock, stride, 0, &c, mode);
+RENAME(do_a_deblock)(dstBlock + 16, stride, 8, &c, mode);
+qp_index = 4;//skip for loop
+} else {
+RENAME(do_a_deblock)(dstBlock, stride, 0, &c, mode);
+dstBlock +=8;
+qp_index = 2;
+}
+}
+#endif
+for(;qp_index= 2QP -> 0
+pcmpeqb m7, m6 ;diff < 2QP -> 0
+pcmpeqb m7, m6 ;diff < 2QP -> 0, is this supposed to be here
+mova [rsp + 21*mmsize], m7; dc_mask
+
+mova m7, [r3 + PPContext.ppMode + PPMode.flatness_threshold]
+dup_low_byte m7, m6
+%if cpuflag(ssse3)
+pxor m6,m6
+%endif
+psubb m6, m0
+pcmpgtb m6, m7
+mova [rsp + 20*mmsize], m6; eq_mask
+
+ptest_neq m6, [rsp + 21*mmsize], r5, r6
+
+;; if eq_mask & dc_mask == 0 jump to .skip
+jz .skip
+lea r5, [r1 * 8]
+neg r5 ;;r5 == offset
+mov r6, r0
+
+mova m0, [r3 + PPContext.pQPb]
+pxor m4, m4
+mova m6, [r0]
+mova m5, [r0+r1]
+mova m1, m5
+mova m2, m6
+
+psubusb m5, m6
+psubusb m2, m1
+por m2, m5 ;;abs diff of lines
+psubusb m0, m2 ;;diff >= QP -> 0s
+pcmpeqb m0, m4 ;;dif >= QP -> 1s
+
+pxor m1, m6
+pand m1, m0
+pxor m6, m1
+
+mova m5, [r0 + r1 * 8]
+add r0, r1
+mova m7, [r0 + r1 * 8]
+mova m1, m5
+mova m2, m7
+
+psubusb m5, m7
+psubusb m1, m2
+por m2, m5
+mova m0, [r3 + PPContext.pQPb]
+psubusb m0, m2
+pcmpeqb m0, m4
+
+pxor m1, m7
+pand m1, m0
+pxor m7, m1
+

[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 6/6] postproc: Various formatting updates from the recent changes

2015-04-22 Thread Tucker DiNapoli
I did my best to make as few changes as possible to the formatting when
adding new code, so this commit is just a means of making the format
changes that go along with the new code.

Mostly these are just changes in indentation, but I also re-formatted a
few assignment statments (from x= y -> x = y), and added some braces to
make some loops/if-else statements clearer.
---
 libpostproc/postprocess_template.c | 306 ++---
 1 file changed, 150 insertions(+), 156 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 2d957e8..7ec6dee 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3342,29 +3342,21 @@ static inline void RENAME(duplicate)(uint8_t src[], int 
stride)
 #if ARCH_X86 && TEMPLATE_PP_MMXEXT
 static inline void RENAME(prefetchnta)(const void *p)
 {
-__asm__ volatile(   "prefetchnta (%0)\n\t"
-: : "r" (p)
-);
+__asm__ volatile("prefetchnta (%0)\n\t" : : "r" (p));
 }
 static inline void RENAME(prefetcht0)(const void *p)
 {
-__asm__ volatile(   "prefetcht0 (%0)\n\t"
-: : "r" (p)
-);
+__asm__ volatile("prefetcht0 (%0)\n\t" : : "r" (p));
 }
 
 static inline void RENAME(prefetcht1)(const void *p)
 {
-__asm__ volatile(   "prefetcht1 (%0)\n\t"
-: : "r" (p)
-);
+__asm__ volatile("prefetcht1 (%0)\n\t" : : "r" (p));
 }
 
 static inline void RENAME(prefetcht2)(const void *p)
 {
-__asm__ volatile(   "prefetcht2 (%0)\n\t"
-: : "r" (p)
-);
+__asm__ volatile("prefetcht2 (%0)\n\t" : : "r" (p));
 }
 #elif !ARCH_X86 && AV_GCC_VERSION_AT_LEAST(3,2)
 static inline void RENAME(prefetchnta)(const void *p)
@@ -3401,7 +3393,6 @@ static inline void RENAME(prefetcht2)(const void *p)
 return;
 }
 #endif
-
 //pass PPContext by value since this should get inlined into postprocess
 //which has a copy of PPContext on the stack for fast access
 static inline void RENAME(deblock)(uint8_t *dstBlock, int stride,
@@ -3526,8 +3517,11 @@ static inline void RENAME(deInterlace)(uint8_t 
*dstBlock, int dstStride,
 /**
  * Filter array of bytes (Y or U or V values)
  */
-static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t 
dst[], int dstStride, int width, int height,
-const QP_STORE_T QPs[], int QPStride, int 
isColor, PPContext *c2)
+static void RENAME(postProcess)(const uint8_t src[], int srcStride, 
+uint8_t dst[], int dstStride, 
+int width, int height,
+const QP_STORE_T QPs[], int QPStride,
+int isColor, PPContext *c2)
 {
 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
 int x,y;
@@ -3615,25 +3609,25 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 clipped-= yHistogram[white];
 }
 
-scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / 
(double)(white-black);
+scale = (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / 
(double)(white-black);
 
 #if TEMPLATE_PP_MMXEXT
-c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
-c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) 
& 0x;
+c.packedYScale = (uint16_t)(scale*256.0 + 0.5);
+c.packedYOffset = (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) 
& 0x;
 #else
-c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
-c.packedYOffset= (black - c.ppMode.minAllowedY) & 0x;
+c.packedYScale = (uint16_t)(scale*1024.0 + 0.5);
+c.packedYOffset = (black - c.ppMode.minAllowedY) & 0x;
 #endif
 
-c.packedYOffset|= c.packedYOffset<<32;
-c.packedYOffset|= c.packedYOffset<<16;
+c.packedYOffset |= c.packedYOffset<<32;
+c.packedYOffset |= c.packedYOffset<<16;
 
-c.packedYScale|= c.packedYScale<<32;
-c.packedYScale|= c.packedYScale<<16;
+c.packedYScale |= c.packedYScale<<32;
+c.packedYScale |= c.packedYScale<<16;
 
-if(mode & LEVEL_FIX)QPCorrecture= (int)(scale*256*256 + 0.5);
-elseQPCorrecture= 256*256;
-}else{
+if(mode & LEVEL_FIX)QPCorrecture = (int)(scale*256*256 + 0.5);
+elseQPCorrecture = 256*256;
+} else {
 c.packedYScale= 0x0100010001000100LL;
 c.packedYOffset= 0;
 QPCorrecture= 256*256;
@@ -3714,14 +3708,14 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 
 for(y=0; y>qpVShift)*QPStride];
-int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
+const int8_t *QPptr = &QPs[(y>>qpVShift)*QPStride];
+int8_t *nonBQPptr = &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
 int QP=0, nonBQP=0;
 /* can we mess with a 8x16 block from srcBlock/d

[FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 3/6] postproc: Moved inline asm for packing QP to seperate function

2015-04-22 Thread Tucker DiNapoli
This patch contains the code for the avx2/sse2 versions of the new
function, but they are deliberately ignored, since the support for
avx2/sse2 isn't yet present (the next commit fixes this).

This is a temporary measure until full sse2/avx2 implementation is
complete, but it works with sse2/avx2 as inline asm. 

Moving this to a separate file would add overhead due to having to call a 
function,
if this is a reasonable trade off for removing inline asm than I can eaisly do 
that.
---
 libpostproc/postprocess_template.c | 61 +++---
 1 file changed, 51 insertions(+), 10 deletions(-)

diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index b7296c4..083be9d 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3249,7 +3249,6 @@ static inline void RENAME(prefetchnta)(const void *p)
 : : "r" (p)
 );
 }
-
 static inline void RENAME(prefetcht0)(const void *p)
 {
 __asm__ volatile(   "prefetcht0 (%0)\n\t"
@@ -3305,6 +3304,55 @@ static inline void RENAME(prefetcht2)(const void *p)
 return;
 }
 #endif
+/*
+  This is temporary. Ultimately the inline asm should be removed completely
+  and moved to another file (though this has some performance overhead), but 
for
+  now this code is necessary.
+  Get around the issues with inline avx by using an explicit register
+  and simplify code by abstracting simd detail like in yasm code
+*/
+#if TEMPLATE_PP_MMX
+static inline void RENAME(packQP)(PPContext c)
+{
+#if 0 //TEMPLATE_PP_AVX2 goes here
+__asm__ volatile(
+"vmovdqa (%1), %%ymm0\n\t"
+"vpermq $0, %%ymm0, %%ymm0 \n\t"
+"vpunpcklbw %%ymm0, %%ymm0, %%ymm0  \n\t" // 0, 0, 0, 0, 0, 0, OP, QP
+"vpunpcklwd %%ymm0, %%ymm0, %%ymm0  \n\t" // 0, 0, 0, 0, 0, 0, QP, QP
+"vpunpckldq %%ymm0, %%ymm0, %%ymm0  \n\t" //QP,...,QP
+"vpunpcklqdq %%ymm0, %%ymm0, %%ymm0  \n\t" //copy to upper quadword(s)
+"vmovdqa %%ymm0, %0"
+: "=m" (c.pQPb_block)
+: "r" (c.QP_block)
+: "%ymm0"
+);
+#else
+#if 0 //TEMPLATE_PP_SSE2 goes here
+#define M0 "%xmm0"
+#define MOVA "movdqa"
+#else
+#define M0 "%mm0"
+#define MOVA "movq"
+#endif
+__asm__ volatile(
+MOVA" (%1), %"M0"\n\t"
+"punpcklbw %"M0", %"M0"  \n\t" // 0, 0, 0, 0, 0, 0, OP, QP
+"punpcklwd %"M0", %"M0"  \n\t" // 0, 0, 0, 0, 0, 0, QP, QP
+"punpckldq %"M0", %"M0"  \n\t" //QP,...,QP
+#if 0 //TEMPLATE_PP_SSE2
+"punpcklqdq %"M0", %"M0"  \n\t" //copy to upper quadword(s)
+#endif
+MOVA" %"M0", %0"
+: "=m" (c.pQPb_block)
+: "r" (c.QP_block)
+: M0
+);
+#undef M0
+#undef MOVA
+#endif
+}
+#endif
 /**
  * Filter array of bytes (Y or U or V values)
  */
@@ -3516,6 +3564,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 for(qp_index=0; qp_index < (endx-startx)/BLOCK_SIZE; qp_index++){
 QP = QPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
 nonBQP = nonBQPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
+
 if(!isColor){
 QP= (QP* QPCorrecture + 256*128)>>16;
 nonBQP= (nonBQP* QPCorrecture + 256*128)>>16;
@@ -3524,15 +3573,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 c.QP_block[qp_index] = QP;
 c.nonBQP_block[qp_index] = nonBQP;
 #if TEMPLATE_PP_MMX
-__asm__ volatile(
-"movd %1, %%mm7 \n\t"
-"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
-"movq %%mm7, %0 \n\t"
-: "=m" (c.pQPb_block[qp_index])
-: "r" (QP)
-);
+RENAME(packQP)(c);
 #endif
 }
   for(; x < endx; x+=BLOCK_SIZE){
-- 
2.3.5

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


[FFmpeg-devel] [PATCH] fate: add cinepak encoder vsynth tests

2015-04-22 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/vcodec.mak| 6 +-
 tests/ref/vsynth/vsynth1-cinepak | 4 
 tests/ref/vsynth/vsynth2-cinepak | 4 
 tests/ref/vsynth/vsynth_lena-cinepak | 4 
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/vsynth/vsynth1-cinepak
 create mode 100644 tests/ref/vsynth/vsynth2-cinepak
 create mode 100644 tests/ref/vsynth/vsynth_lena-cinepak

diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index 0aba87b..1ad5e96 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -18,6 +18,10 @@ fate-vsynth%-asv1:   ENCOPTS = -qscale 10
 FATE_VCODEC-$(call ENCDEC, ASV2, AVI)   += asv2
 fate-vsynth%-asv2:   ENCOPTS = -qscale 10
 
+FATE_VCODEC-$(call ENCDEC, CINEPAK, MOV) += cinepak
+fate-vsynth%-cinepak:ENCOPTS  = -vcodec cinepak -frames 3
+fate-vsynth%-cinepak:FMT  = mov
+
 FATE_VCODEC-$(call ENCDEC, CLJR, AVI)   += cljr
 fate-vsynth%-cljr:   ENCOPTS = -strict -1
 
@@ -320,7 +324,7 @@ FATE_VSYNTH_LENA = $(FATE_VCODEC:%=fate-vsynth_lena-%)
 RESIZE_OFF   = dnxhd-720p dnxhd-720p-rd dnxhd-720p-10bit dnxhd-1080i \
dv dv-411 dv-50 avui snow snow-hpel snow-ll
 # Incorrect parameters - usually size or color format restrictions
-INC_PAR_OFF  = h261 h261-trellis h263 h263p h263-obmc msvideo1 \
+INC_PAR_OFF  = cinepak h261 h261-trellis h263 h263p h263-obmc msvideo1 \
roqvideo rv10 rv20 y41p qtrlegray
 VSYNTH3_OFF  = $(RESIZE_OFF) $(INC_PAR_OFF)
 
diff --git a/tests/ref/vsynth/vsynth1-cinepak b/tests/ref/vsynth/vsynth1-cinepak
new file mode 100644
index 000..f1dfcd8
--- /dev/null
+++ b/tests/ref/vsynth/vsynth1-cinepak
@@ -0,0 +1,4 @@
+546c7c1069f9e418aa787f469b693b94 *tests/data/fate/vsynth1-cinepak.mov
+99465 tests/data/fate/vsynth1-cinepak.mov
+bee091c200262be3427a233a2812388c *tests/data/fate/vsynth1-cinepak.out.rawvideo
+stddev:8.46 PSNR: 29.58 MAXDIFF:  105 bytes:  7603200/   456192
diff --git a/tests/ref/vsynth/vsynth2-cinepak b/tests/ref/vsynth/vsynth2-cinepak
new file mode 100644
index 000..18eb1d5
--- /dev/null
+++ b/tests/ref/vsynth/vsynth2-cinepak
@@ -0,0 +1,4 @@
+cc0879f1993cdd6231e2c3b9c2c015a0 *tests/data/fate/vsynth2-cinepak.mov
+88400 tests/data/fate/vsynth2-cinepak.mov
+12c480911ebb89762dc49af003b176c7 *tests/data/fate/vsynth2-cinepak.out.rawvideo
+stddev:5.07 PSNR: 34.02 MAXDIFF:   59 bytes:  7603200/   456192
diff --git a/tests/ref/vsynth/vsynth_lena-cinepak 
b/tests/ref/vsynth/vsynth_lena-cinepak
new file mode 100644
index 000..39b1d68
--- /dev/null
+++ b/tests/ref/vsynth/vsynth_lena-cinepak
@@ -0,0 +1,4 @@
+e3837018f84929f07019ae2eccd303e2 *tests/data/fate/vsynth_lena-cinepak.mov
+88900 tests/data/fate/vsynth_lena-cinepak.mov
+f54ffa70f335ac7b701d7ae34462e001 
*tests/data/fate/vsynth_lena-cinepak.out.rawvideo
+stddev:4.09 PSNR: 35.88 MAXDIFF:   46 bytes:  7603200/   456192
-- 
2.3.5

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


Re: [FFmpeg-devel] [PATCH] avformat: drop libquvi demuxer

2015-04-22 Thread Carl Eugen Hoyos
Lou Logan  lrcd.com> writes:

> libquvi is dead.

Shouldn't this be deprecated and removed after 
the next release?

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH 6/6] avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 05:27:19PM +0200, wm4 wrote:
> On Wed, 22 Apr 2015 17:10:30 +0200
> Nicolas George  wrote:
> 
> > Le tridi 3 floréal, an CCXXIII, wm4 a écrit :
> > >  #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but 
> > > keep it separate.
> > > +#define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate 
> > > seeks for some formats
> > 
> > Better with the 0, but I suspect it needs a safety gap to avoid future
> > conflicts with the fork.
> > 
> > Regards,
> > 
> 
> AVFMT_FLAG_KEEP_SIDE_DATA already does not exist in Libav. (Mainly
> because the associated side-data "inline" mechanism is 100% insane
> and FFmpeg-only.)
> 
> There's actually a gap after AVFMT_FLAG_BITEXACT, which is probably
> meant to avoid ABI issues if Libav adds something.

IIRC yes

and patch applied

thanks

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] [PATCH] vp9: remove another optimization branch in iadst16 which causes overflows.

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 03:48:59PM -0400, Ronald S. Bultje wrote:
> See sample vp90-2-14-resize-fp-tiles-16-8.webm from the vp9 test vector
> set to reproduce the issue.
> ---
>  libavcodec/x86/vp9itxfm.asm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

applied

thanks

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

In a rich man's house there is no place to spit but his face.
-- 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] [FFMpeg-Devel][GSoC][PATCH 2/6] postproc: Made QP, nonBQP, and pQPb arrays

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:27:27PM -0400, Tucker DiNapoli wrote:
> From: Tucker DiNapoli 
> 
> Also pulled QP initialization out of inner loop, which removed some redundent 
> code.
> 
> Added some dummy fields to PPContext to allow current code to work while
> changing the rest of the postprocessing code to support the arrays.
> 
> I also increased alignment requirements for some fields in the PPContext 
> struct to
> support future avx2 code.
> ---
>  libpostproc/postprocess_internal.h | 10 -
>  libpostproc/postprocess_template.c | 81 
> ++
>  2 files changed, 46 insertions(+), 45 deletions(-)

applied

thanks

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

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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


Re: [FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 3/6] postproc: Moved inline asm for packing QP to seperate function

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:27:28PM -0400, Tucker DiNapoli wrote:
> This patch contains the code for the avx2/sse2 versions of the new
> function, but they are deliberately ignored, since the support for
> avx2/sse2 isn't yet present (the next commit fixes this).
> 
> This is a temporary measure until full sse2/avx2 implementation is
> complete, but it works with sse2/avx2 as inline asm. 
> 
> Moving this to a separate file would add overhead due to having to call a 
> function,
> if this is a reasonable trade off for removing inline asm than I can eaisly 
> do that.
> ---
>  libpostproc/postprocess_template.c | 61 
> +++---
>  1 file changed, 51 insertions(+), 10 deletions(-)
> 
> diff --git a/libpostproc/postprocess_template.c 
> b/libpostproc/postprocess_template.c
> index b7296c4..083be9d 100644
> --- a/libpostproc/postprocess_template.c
> +++ b/libpostproc/postprocess_template.c
> @@ -3249,7 +3249,6 @@ static inline void RENAME(prefetchnta)(const void *p)
>  : : "r" (p)
>  );
>  }
> -
>  static inline void RENAME(prefetcht0)(const void *p)
>  {
>  __asm__ volatile(   "prefetcht0 (%0)\n\t"
> @@ -3305,6 +3304,55 @@ static inline void RENAME(prefetcht2)(const void *p)
>  return;
>  }
>  #endif
> +/*
> +  This is temporary. Ultimately the inline asm should be removed completely
> +  and moved to another file (though this has some performance overhead), but 
> for
> +  now this code is necessary.
> +  Get around the issues with inline avx by using an explicit register
> +  and simplify code by abstracting simd detail like in yasm code
> +*/
> +#if TEMPLATE_PP_MMX
> +static inline void RENAME(packQP)(PPContext c)
> +{

> +#if 0 //TEMPLATE_PP_AVX2 goes here

adding disabled code and enabling it in a subsequent commit is not ok


> +__asm__ volatile(
> +"vmovdqa (%1), %%ymm0\n\t"
> +"vpermq $0, %%ymm0, %%ymm0 \n\t"
> +"vpunpcklbw %%ymm0, %%ymm0, %%ymm0  \n\t" // 0, 0, 0, 0, 0, 0, OP, QP
> +"vpunpcklwd %%ymm0, %%ymm0, %%ymm0  \n\t" // 0, 0, 0, 0, 0, 0, QP, QP
> +"vpunpckldq %%ymm0, %%ymm0, %%ymm0  \n\t" //QP,...,QP
> +"vpunpcklqdq %%ymm0, %%ymm0, %%ymm0  \n\t" //copy to upper 
> quadword(s)
> +"vmovdqa %%ymm0, %0"
> +: "=m" (c.pQPb_block)
> +: "r" (c.QP_block)
> +: "%ymm0"
> +);

QP_block is just 16 bytes, AVX* is not needed


[...]
> @@ -3516,6 +3564,7 @@ static void RENAME(postProcess)(const uint8_t src[], 
> int srcStride, uint8_t dst[
>  for(qp_index=0; qp_index < (endx-startx)/BLOCK_SIZE; qp_index++){
>  QP = QPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
>  nonBQP = nonBQPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
> +
>  if(!isColor){
>  QP= (QP* QPCorrecture + 256*128)>>16;
>  nonBQP= (nonBQP* QPCorrecture + 256*128)>>16;

this doesnt belong in this patch


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 4/6] postproc: Updated postprocess_template to use new sse/avx deinterlace functions

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:27:29PM -0400, Tucker DiNapoli wrote:
> This commit adds several new files containing yasm assembly code, they are:
> PPContext.asm; Defines the PPContext struct using the yasm struc command
> PPUtil.asm; Various utility macros used in the other asm code
> block_copy.asm; Implements the block copy function, the sse2 and avx2
> versions copy multiple blocks at once.
> deinterlace.asm; Contains implemenations of the postprocessing filters
> with support for sse2 and avx2.
> 
> Adding these new functions to postprocess_template entailed adding a new
> templates for AVX2 and modifying the current SSE2 template to use the
> sse2 functions.
> A new deinterlace function was added to move the logic of which
> deinterlace function to use out of the postprocess function and make
> adding the new functions eaiser.
> 
> Being as the filters don't reproduce the exact results as the mmx/c versions 
> they are
> not actually used, the code to enable them is present, but commented out.
> ---

Please remove all code that does not work
and resubmit what does work and can be enabled

If code doesnt work it cannot be pushed to git, and pushing to git
is required for the qualification task

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 4/6] postproc: Updated postprocess_template to use new sse/avx deinterlace functions

2015-04-22 Thread Michael Niedermayer
On Thu, Apr 23, 2015 at 01:03:09AM +0200, Michael Niedermayer wrote:
> On Wed, Apr 22, 2015 at 04:27:29PM -0400, Tucker DiNapoli wrote:
> > This commit adds several new files containing yasm assembly code, they are:
> > PPContext.asm; Defines the PPContext struct using the yasm struc command
> > PPUtil.asm; Various utility macros used in the other asm code
> > block_copy.asm; Implements the block copy function, the sse2 and avx2
> > versions copy multiple blocks at once.
> > deinterlace.asm; Contains implemenations of the postprocessing filters
> > with support for sse2 and avx2.
> > 
> > Adding these new functions to postprocess_template entailed adding a new
> > templates for AVX2 and modifying the current SSE2 template to use the
> > sse2 functions.
> > A new deinterlace function was added to move the logic of which
> > deinterlace function to use out of the postprocess function and make
> > adding the new functions eaiser.
> > 
> > Being as the filters don't reproduce the exact results as the mmx/c 
> > versions they are
> > not actually used, the code to enable them is present, but commented out.
> > ---
> 
> Please remove all code that does not work
> and resubmit what does work and can be enabled
> 
> If code doesnt work it cannot be pushed to git, and pushing to git
> is required for the qualification task

also if i enable the code like below, i just get green and black
stripes, how can this be tested ?

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 63b01a5..20df267 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -545,13 +545,13 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, 
int step,
 #define TEMPLATE_PP_AVX2 1
 #include "postprocess_template.c"
 #else
-/*#if HAVE_AVX2_INLINE
+#if HAVE_AVX2_INLINE
 #define TEMPLATE_PP_AVX2 1
 #include "postprocess_template.c"
 #elif HAVE_SSE2_INLINE
 #define TEMPLATE_PP_SSE2 1
-#include "postprocess_template.c"*/
-#if HAVE_MMXEXT_INLINE
+#include "postprocess_template.c"
+#elif HAVE_MMXEXT_INLINE
 #define TEMPLATE_PP_MMXEXT 1
 #include "postprocess_template.c"
 #elif HAVE_AMD3DNOW_INLINE
@@ -579,9 +579,9 @@ static inline void postProcess(const uint8_t src[], int 
srcStride, uint8_t dst[]
 #if CONFIG_RUNTIME_CPUDETECT
 #if ARCH_X86 && HAVE_INLINE_ASM
 // ordered per speed fastest first
-/*if  (c->cpuCaps & AV_CPU_FLAG_AVX2) pp = postProcess_avx2;
-else if (c->cpuCaps & AV_CPU_FLAG_SSE2) pp = postProcess_sse2;*/
-if (c->cpuCaps & AV_CPU_FLAG_MMXEXT)   pp = postProcess_MMX2;
+if  (c->cpuCaps & AV_CPU_FLAG_AVX2) pp = postProcess_avx2;
+else if (c->cpuCaps & AV_CPU_FLAG_SSE2) pp = postProcess_sse2;
+else if (c->cpuCaps & AV_CPU_FLAG_MMXEXT)   pp = postProcess_MMX2;
 else if (c->cpuCaps & AV_CPU_FLAG_3DNOW)pp = postProcess_3DNow;
 else if (c->cpuCaps & AV_CPU_FLAG_MMX)  pp = postProcess_MMX;
 #elif HAVE_ALTIVEC

[...]


-- 
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] [FFMpeg-Devel][GSoC][PATCH 5/6] postproc: Added support for sse2/avx2 versions of the do_a_deblock function

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:27:30PM -0400, Tucker DiNapoli wrote:
> I added a new file with the sse2/avx2 code for do_a_deblock.
> I also moved the code for running vertical deblock filters into it's own
> function, both to clean up the postprocess funciton and to make it
> easier to integrate the new sse2/avx2 versions of these filters.
> ---
>  libpostproc/postprocess_template.c | 123 +++---
>  libpostproc/x86/Makefile   |   1 +
>  libpostproc/x86/deblock.asm| 454 
> +
>  3 files changed, 545 insertions(+), 33 deletions(-)
>  create mode 100644 libpostproc/x86/deblock.asm

how can this be tested ?
the newly added code seems to be never run

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


[FFmpeg-devel] [PATCH 2/2] vp9: add fate test for segmentation image-edge issue.

2015-04-22 Thread Ronald S. Bultje
Sample available at:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-15-segkey_adpq.webm
---
 tests/fate/vpx.mak|   1 +
 tests/ref/fate/vp9-15-segkey_adpq | 155 ++
 2 files changed, 156 insertions(+)
 create mode 100644 tests/ref/fate/vp9-15-segkey_adpq

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 9847be6..bde7dee 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -103,6 +103,7 @@ $(eval $(call FATE_VP9_SUITE,06-bilinear,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,09-lf_deltas,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,10-show-existing-frame,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,10-show-existing-frame2,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,15-segkey_adpq,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,2pass-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,parallelmode-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,segmentation-aq-akiyo,$(1),$(2)))
diff --git a/tests/ref/fate/vp9-15-segkey_adpq 
b/tests/ref/fate/vp9-15-segkey_adpq
new file mode 100644
index 000..f12db8b
--- /dev/null
+++ b/tests/ref/fate/vp9-15-segkey_adpq
@@ -0,0 +1,155 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1001/3
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   613440, d4f0e4b606ddb40b482aecb24cf3bc63
+0,  1,  1,1,   613440, 692ec092bc5928fa6430d056e883759a
+0,  2,  2,1,   613440, dad790df33430899fed98886a24b37e5
+0,  3,  3,1,   613440, 7e66e793ac9462a40dd5b963fb62e667
+0,  4,  4,1,   613440, 0d795c6e20f42f09aca0ddb9dffaa6e8
+0,  5,  5,1,   613440, 0ef3739c4ab2c51f0ab8e290eadad77e
+0,  6,  6,1,   613440, 04a15f765960263c1b4a5a8822e17322
+0,  7,  7,1,   613440, 116d518830c958bf46759fd79bc74198
+0,  8,  8,1,   613440, 58ea67addab05825cc2e5f2ab99fca4b
+0,  9,  9,1,   613440, 590f6e5deea6dde21dc1098fa2017c2f
+0, 10, 10,1,   613440, 895479957b0882ccce4159782dee8deb
+0, 11, 11,1,   613440, cc8e05afdfb6f9c7042fd6f9e9d49140
+0, 12, 12,1,   613440, 3e47c556a63af90f1ca4609f97f25d2c
+0, 13, 13,1,   613440, e5ca5dce8cbd39412db2fe219d6d2594
+0, 14, 14,1,   613440, c62b456e12230660d26eb7226f257d0c
+0, 15, 15,1,   613440, e184c961b373de465d3242f32f7cf3ed
+0, 16, 16,1,   613440, 7466b91858f740fc28965a63effe05d6
+0, 17, 17,1,   613440, c8f06a3b1e471c4e7a9efd71a30dfe3b
+0, 18, 18,1,   613440, d4fb95148963b2eaff0211ddc5117c13
+0, 19, 19,1,   613440, c646526b40277289520d47ed8ca3b644
+0, 20, 20,1,   613440, e441ae686fa444e4e3584543611043ba
+0, 21, 21,1,   613440, 68d707ef6909bfbc02dcbd9e392a04f6
+0, 22, 22,1,   613440, 1ff285d17a26622b61bd2651754602b1
+0, 23, 23,1,   613440, c272192987e44e54e5335e6416bd15a5
+0, 24, 24,1,   613440, 8f6f02572181eb4855dcd4c957e57d2e
+0, 25, 25,1,   613440, baf03eb567fd092eeb6f08ff5e098350
+0, 26, 26,1,   613440, 479c78bd3da0892b8d4e32c99ec4739f
+0, 27, 27,1,   613440, d39a52f6e30ef10462bdef1006809e88
+0, 28, 28,1,   613440, d58395369806221efe9ba88513319d8a
+0, 29, 29,1,   613440, 459e77e83c510ee1d79bf069752d44e5
+0, 30, 30,1,   613440, 438027c8eacb9c795f8267a151ef5a4e
+0, 31, 31,1,   613440, ea6b73fb0d4b23ebbdaeb0267135d083
+0, 32, 32,1,   613440, 48160c624d4d5050a4c8abcbe0edf4b2
+0, 33, 33,1,   613440, 6fc6d5b4751cf137fc0204c0026f2503
+0, 34, 34,1,   613440, 5ea20f6483fc5cde854313ed8288c7ca
+0, 35, 35,1,   613440, dafa41fa3468f684ca5538593cd1a0de
+0, 36, 36,1,   613440, b73d3336c83a27874e24b691c34c3421
+0, 37, 37,1,   613440, d0b0488a5871a49442746ac8ea1343bc
+0, 38, 38,1,   613440, df6fe9cb354624b69908730f24f51b88
+0, 39, 39,1,   613440, a388b159a024ace9437976206e62473c
+0, 40, 40,1,   613440, 9007423410201a70b6997477ed9040f6
+0, 41, 41,1,   613440, 7f7425cc018ad391e06b867f51d69513
+0, 42, 42,1,   613440, 2ef51a3a15c627f803eee7f351cdfa4e
+0, 43, 43,1,   613440, 260cded2461ab87181d650c58a8a0656
+0, 44, 44,1,   613440, fdd7a93b5f25ec2b74d93736fa7bb475
+0, 45, 45,1,   613440, 810bb95ef0221b50ef12c7d0a4740fec
+0,   

[FFmpeg-devel] [PATCH 1/2] vp9: use aligned size to write segmentation map into cache.

2015-04-22 Thread Ronald S. Bultje
The unaligned size is not handled in setctx_2d(), causing edges of images
to have improper segmentation prediction, which causes visual artifacts
at image edges a few frames later.
---
 libavcodec/vp9.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 8d9ba0d..1935f94 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1352,8 +1352,8 @@ static void decode_mode(AVCodecContext *ctx)
 VP9Block *b = s->b;
 int row = s->row, col = s->col, row7 = s->row7;
 enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs];
-int w4 = FFMIN(s->cols - col, bwh_tab[1][b->bs][0]);
-int h4 = FFMIN(s->rows - row, bwh_tab[1][b->bs][1]), y;
+int bw4 = bwh_tab[1][b->bs][0], w4 = FFMIN(s->cols - col, bw4);
+int bh4 = bwh_tab[1][b->bs][1], h4 = FFMIN(s->rows - row, bh4), y;
 int have_a = row > 0, have_l = col > s->tiling.tile_col_start;
 int vref, filter_id;
 
@@ -1395,7 +1395,7 @@ static void decode_mode(AVCodecContext *ctx)
 if (s->segmentation.enabled &&
 (s->segmentation.update_map || s->keyframe || s->intraonly)) {
 setctx_2d(&s->frames[CUR_FRAME].segmentation_map[row * 8 * s->sb_cols 
+ col],
-  w4, h4, 8 * s->sb_cols, b->seg_id);
+  bw4, bh4, 8 * s->sb_cols, b->seg_id);
 }
 
 b->skip = s->segmentation.enabled &&
-- 
2.1.2

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


[FFmpeg-devel] [PATCH 2/2] vp9: add fate test for intraonly frames.

2015-04-22 Thread Ronald S. Bultje
Sample available at:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-16-intra-only.webm
---
 tests/fate/vpx.mak   |  1 +
 tests/ref/fate/vp9-16-intra-only | 10 ++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/ref/fate/vp9-16-intra-only

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index bde7dee..ac7db5c 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -104,6 +104,7 @@ $(eval $(call FATE_VP9_SUITE,09-lf_deltas,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,10-show-existing-frame,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,10-show-existing-frame2,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,15-segkey_adpq,$(1),$(2)))
+$(eval $(call FATE_VP9_SUITE,16-intra-only,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,2pass-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,parallelmode-akiyo,$(1),$(2)))
 $(eval $(call FATE_VP9_SUITE,segmentation-aq-akiyo,$(1),$(2)))
diff --git a/tests/ref/fate/vp9-16-intra-only b/tests/ref/fate/vp9-16-intra-only
new file mode 100644
index 000..5bbfaea
--- /dev/null
+++ b/tests/ref/fate/vp9-16-intra-only
@@ -0,0 +1,10 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 12/359
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   152064, d57529601178948afa4818c3c8938884
+0,  1,  1,1,   152064, d47e00250c45733d64af067a417bcd06
+0,  2,  2,1,   152064, 984e41cd8350808ac6129746b2377818
+0,  4,  4,1,   152064, 76ba63001170b8992fc72be5c4ace731
+0,  5,  5,1,   152064, c4e7f96a8fd58d901b1d881926ddae09
-- 
2.1.2

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


[FFmpeg-devel] [PATCH 1/2] vp9: fix intraonly frame decoding.

2015-04-22 Thread Ronald S. Bultje
---
 libavcodec/vp9.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 1935f94..1310798 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -3111,8 +3111,8 @@ static void decode_sb(AVCodecContext *ctx, int row, int 
col, struct VP9Filter *l
 VP9Context *s = ctx->priv_data;
 int c = ((s->above_partition_ctx[col] >> (3 - bl)) & 1) |
 (((s->left_partition_ctx[row & 0x7] >> (3 - bl)) & 1) << 1);
-const uint8_t *p = s->keyframe ? vp9_default_kf_partition_probs[bl][c] :
- s->prob.p.partition[bl][c];
+const uint8_t *p = s->keyframe || s->intraonly ? 
vp9_default_kf_partition_probs[bl][c] :
+ 
s->prob.p.partition[bl][c];
 enum BlockPartition bp;
 ptrdiff_t hbs = 4 >> bl;
 AVFrame *f = s->frames[CUR_FRAME].tf.f;
@@ -3791,7 +3791,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void 
*frame,
 return res;
 f = s->frames[CUR_FRAME].tf.f;
 f->key_frame = s->keyframe;
-f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+f->pict_type = (s->keyframe || s->intraonly) ? AV_PICTURE_TYPE_I : 
AV_PICTURE_TYPE_P;
 ls_y = f->linesize[0];
 ls_uv =f->linesize[1];
 
@@ -3801,7 +3801,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void 
*frame,
 ff_thread_release_buffer(ctx, &s->next_refs[i]);
 if (s->refreshrefmask & (1 << i)) {
 res = ff_thread_ref_frame(&s->next_refs[i], 
&s->frames[CUR_FRAME].tf);
-} else {
+} else if (s->refs[i].f->data[0]) {
 res = ff_thread_ref_frame(&s->next_refs[i], &s->refs[i]);
 }
 if (res < 0)
-- 
2.1.2

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


[FFmpeg-devel] [PATCH] avformat/atrac3plus: fix compilation warning

2015-04-22 Thread Ilya Gordeev

Compiling ffmpeg I'v got this message:
libavcodec/atrac3plus.c:1784:46: warning: array subscript is below array bounds 
[-Warray-bounds]

It's because compiler discards its suggestion about "ctx->num_quant_units" (1<=num_quant_units<=32) when 
"ctx" passed to "decode_quant_wordlen(gb, ctx, num_channels, avctx)" and anything can happen to fields of 
"ctx".

Warning disappears if we place accessing to "trac3p_qu_to_subband[ctx->num_quant_units - 
1]" before calling "decode_quant_wordlen(gb, ctx, num_channels, avctx)". Patch is in 
attachment.

See also ticket #4343 (there patch is wrong!)
From 42f85eb3325f18ad46796d76da2760300a308a7e Mon Sep 17 00:00:00 2001
From: Ilya Gordeev 
Date: Thu, 23 Apr 2015 01:45:03 +0500
Subject: [PATCH] avformat/atrac3plus: fix compilation warning

Signed-off-by: Ilya Gordeev 
---
 libavcodec/atrac3plus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index f998a7f..32350ac 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -1775,13 +1775,13 @@ int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
 return AVERROR_INVALIDDATA;
 }
 
+ctx->num_subbands = atrac3p_qu_to_subband[ctx->num_quant_units - 1] + 1;
 ctx->mute_flag = get_bits1(gb);
 
 /* decode various sound parameters */
 if ((ret = decode_quant_wordlen(gb, ctx, num_channels, avctx)) < 0)
 return ret;
 
-ctx->num_subbands   = atrac3p_qu_to_subband[ctx->num_quant_units - 1] + 1;
 ctx->num_coded_subbands = ctx->used_quant_units
   ? atrac3p_qu_to_subband[ctx->used_quant_units - 1] + 1
   : 0;
-- 
2.3.1

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


Re: [FFmpeg-devel] [FFMpeg-Devel][GSoC][PATCH 4/6] postproc: Updated postprocess_template to use new sse/avx deinterlace functions

2015-04-22 Thread Michael Niedermayer
On Wed, Apr 22, 2015 at 04:27:29PM -0400, Tucker DiNapoli wrote:
[...]
> +%include "PPUtil.asm"
> +;; All deinterlace functions operate on N 8x8 blocks at a time, where N
> +;; is the size (in bytes) of the simd registers being used divided
> +;; by 8, so 2 for xmm, and 4 for ymm.
> +
> +;; Deinterlace blocks using linear interpolation
> +;; Set each line 2n+1 to (line 2n + line 2n+2)/2
> +%macro gen_deinterlace_interpolate_linear 0
> +cglobal deInterlaceInterpolateLinear, 2, 4, 5;, src, stride
> +lea r0, [r0 + r1 * 4]
> +lea r2, [r0 + r1]
> +lea r3, [r2 + r1 * 4]
> +
> +mova m0, [r0] ;0
> +mova m1, [r2 + r1] ;2
> +mova m2, [r0 + 4*r1] ;4
> +mova m3, [r3 + r1] ;6
> +mova m4, [r0 + 8*r1] ;8
> +
> +pavgb m0, m1 ;1
> +pavgb m1, m2 ;3
> +pavgb m2, m3 ;5
> +pavgb m3, m4 ;7
> +
> +mova [r2], m0
> +mova [r2 + r1 * 2], m1
> +mova [r3], m2
> +mova [r3 + r1 * 2], m3
> +RET
> +%endmacro

the loop should be inside the asm, not in c calling the asm every
8/16/32 pixels
the same applies to all the deinterlace functions but changing that
is probably not possibly before the deadline

what is important now is that you submit some working and testable
code, GSoC and the qualications are only about code that can be
commited and that passes review not unfinished pieces of "work in
progress code" because that isnt really what we want to see at the
end of GSoC either if it can be avoided.


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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] avformat/atrac3plus: fix compilation warning

2015-04-22 Thread Michael Niedermayer
On Thu, Apr 23, 2015 at 12:41:39AM +0300, Ilya Gordeev wrote:
> Compiling ffmpeg I'v got this message:
> libavcodec/atrac3plus.c:1784:46: warning: array subscript is below array 
> bounds [-Warray-bounds]
> 
> It's because compiler discards its suggestion about "ctx->num_quant_units" 
> (1<=num_quant_units<=32) when "ctx" passed to "decode_quant_wordlen(gb, ctx, 
> num_channels, avctx)" and anything can happen to fields of "ctx".

i dont understand what you are trying to say

if num_quant_units can be <=0 then theres a bug and i dont see how
your patch fixes such a bug, if not the compiler is broken, and i
dont think we should randomly move code around because of that

which compiler is that ?


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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


  1   2   >