[FFmpeg-devel] [PATCH 2/2] avcodec/scpr: rework frame handling

2017-03-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/scpr.c | 49 +++--
 1 file changed, 19 insertions(+), 30 deletions(-)

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index a37e99a..2d190db 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -45,7 +45,6 @@ typedef struct PixelModel {
 
 typedef struct SCPRContext {
 AVFrame*last_frame;
-AVFrame*current_frame;
 GetByteContext  gb;
 RangeCoder  rc;
 PixelModel  pixel_model[3][4096];
@@ -751,12 +750,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 AVFrame *frame = data;
 int ret, type;
 
-if (avctx->bits_per_coded_sample == 16) {
-if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
-return ret;
-}
-
-if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0)
+if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
 return ret;
 
 bytestream2_init(gb, avpkt->data, avpkt->size);
@@ -767,16 +761,16 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 s->get_freq = get_freq0;
 s->decode = decode0;
 frame->key_frame = 1;
-ret = decompress_i(avctx, (uint32_t *)s->current_frame->data[0],
-   s->current_frame->linesize[0] / 4);
+ret = decompress_i(avctx, (uint32_t *)frame->data[0],
+   frame->linesize[0] / 4);
 } else if (type == 18) {
 s->get_freq = get_freq;
 s->decode = decode;
 frame->key_frame = 1;
-ret = decompress_i(avctx, (uint32_t *)s->current_frame->data[0],
-   s->current_frame->linesize[0] / 4);
+ret = decompress_i(avctx, (uint32_t *)frame->data[0],
+   frame->linesize[0] / 4);
 } else if (type == 17) {
-uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
+uint32_t clr, *dst = (uint32_t *)frame->data[0];
 int x, y;
 
 frame->key_frame = 1;
@@ -796,17 +790,18 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 for (x = 0; x < avctx->width; x++) {
 dst[x] = clr;
 }
-dst += s->current_frame->linesize[0] / 4;
+dst += frame->linesize[0] / 4;
 }
 } else if (type == 0 || type == 1) {
 frame->key_frame = 0;
 
-ret = av_frame_copy(s->current_frame, s->last_frame);
+ret = av_frame_copy(frame, s->last_frame);
 if (ret < 0)
 return ret;
+av_frame_make_writable(frame);
 
-ret = decompress_p(avctx, (uint32_t *)s->current_frame->data[0],
-   s->current_frame->linesize[0] / 4,
+ret = decompress_p(avctx, (uint32_t *)frame->data[0],
+   frame->linesize[0] / 4,
(uint32_t *)s->last_frame->data[0],
s->last_frame->linesize[0] / 4);
 } else {
@@ -816,18 +811,16 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 if (ret < 0)
 return ret;
 
-if (avctx->bits_per_coded_sample != 16) {
-ret = av_frame_ref(data, s->current_frame);
-if (ret < 0)
-return ret;
-} else {
+av_frame_unref(s->last_frame);
+s->last_frame = av_frame_clone(frame);
+if (!s->last_frame)
+return AVERROR(ENOMEM);
+
+if (avctx->bits_per_coded_sample == 16) {
 uint8_t *dst = frame->data[0];
 int x, y;
 
-ret = av_frame_copy(frame, s->current_frame);
-if (ret < 0)
-return ret;
-
+av_frame_make_writable(s->last_frame);
 for (y = 0; y < avctx->height; y++) {
 for (x = 0; x < avctx->width * 4; x++) {
 dst[x] = dst[x] << 3;
@@ -838,8 +831,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 
 frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : 
AV_PICTURE_TYPE_P;
 
-FFSWAP(AVFrame *, s->current_frame, s->last_frame);
-
 *got_frame = 1;
 
 return avpkt->size;
@@ -871,8 +862,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 
 s->last_frame = av_frame_alloc();
-s->current_frame = av_frame_alloc();
-if (!s->last_frame || !s->current_frame)
+if (!s->last_frame)
 return AVERROR(ENOMEM);
 
 return 0;
@@ -884,7 +874,6 @@ static av_cold int decode_close(AVCodecContext *avctx)
 
 av_freep(&s->blocks);
 av_frame_free(&s->last_frame);
-av_frame_free(&s->current_frame);
 
 return 0;
 }
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 1/2] avcodec/scpr: avoid negative linesize

2017-03-12 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/scpr.c | 89 ++-
 1 file changed, 48 insertions(+), 41 deletions(-)

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 465926a..a37e99a 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -290,6 +290,14 @@ static int decode_unit(SCPRContext *s, PixelModel *pixel, 
unsigned step, unsigne
 return 0;
 }
 
+static int vflip(int pos, int h, int linesize)
+{
+int y = pos / linesize;
+int x = pos % linesize;
+
+return (h - y) * linesize + x;
+}
+
 static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize)
 {
 SCPRContext *s = avctx->priv_data;
@@ -299,6 +307,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 unsigned backstep = linesize - avctx->width;
 const int cxshift = s->cxshift;
 unsigned lx, ly, ptype;
+const int hy = avctx->height - 1;
 
 reinit_tables(s);
 bytestream2_skip(gb, 2);
@@ -331,7 +340,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 clr = (b << 16) + (g << 8) + r;
 k += run;
 while (run-- > 0) {
-dst[y * linesize + x] = clr;
+dst[vflip(y * linesize + x, hy, linesize)] = clr;
 lx = x;
 ly = y;
 x++;
@@ -379,7 +388,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 if (y >= avctx->height)
 return AVERROR_INVALIDDATA;
 
-dst[y * linesize + x] = clr;
+dst[vflip(y * linesize + x, hy, linesize)] = clr;
 lx = x;
 ly = y;
 x++;
@@ -394,7 +403,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 if (y >= avctx->height)
 return AVERROR_INVALIDDATA;
 
-dst[y * linesize + x] = dst[ly * linesize + lx];
+dst[vflip(y * linesize + x, hy, linesize)] = dst[vflip(ly * 
linesize + lx, hy, linesize)];
 lx = x;
 ly = y;
 x++;
@@ -403,15 +412,15 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 y++;
 }
 }
-clr = dst[ly * linesize + lx];
+clr = dst[vflip(ly * linesize + lx, hy, linesize)];
 break;
 case 2:
 while (run-- > 0) {
 if (y < 1 || y >= avctx->height)
 return AVERROR_INVALIDDATA;
 
-clr = dst[y * linesize + x + off + 1];
-dst[y * linesize + x] = clr;
+clr = dst[vflip(y * linesize + x + off + 1, hy, linesize)];
+dst[vflip(y * linesize + x, hy, linesize)] = clr;
 lx = x;
 ly = y;
 x++;
@@ -435,17 +444,17 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 z = 0;
 }
 
-r = odst[(ly * linesize + lx) * 4] +
-odst[((y * linesize + x) + off - z) * 4 + 4] -
-odst[((y * linesize + x) + off - z) * 4];
-g = odst[(ly * linesize + lx) * 4 + 1] +
-odst[((y * linesize + x) + off - z) * 4 + 5] -
-odst[((y * linesize + x) + off - z) * 4 + 1];
-b = odst[(ly * linesize + lx) * 4 + 2] +
-odst[((y * linesize + x) + off - z) * 4 + 6] -
-odst[((y * linesize + x) + off - z) * 4 + 2];
+r = odst[vflip((ly * linesize + lx) * 4, hy, linesize * 4)] +
+odst[vflip(((y * linesize + x) + off - z) * 4 + 4, hy, 
linesize * 4)] -
+odst[vflip(((y * linesize + x) + off - z) * 4, hy, 
linesize * 4)];
+g = odst[vflip((ly * linesize + lx) * 4 + 1, hy, linesize * 
4)] +
+odst[vflip(((y * linesize + x) + off - z) * 4 + 5, hy, 
linesize * 4)] -
+odst[vflip(((y * linesize + x) + off - z) * 4 + 1, hy, 
linesize * 4)];
+b = odst[vflip((ly * linesize + lx) * 4 + 2, hy, linesize * 
4)] +
+odst[vflip(((y * linesize + x) + off - z) * 4 + 6, hy, 
linesize * 4)] -
+odst[vflip(((y * linesize + x) + off - z) * 4 + 2, hy, 
linesize * 4)];
 clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF);
-dst[y * linesize + x] = clr;
+dst[vflip(y * linesize + x, hy, linesize)] = clr;
 lx = x;
 ly = y;
 x++;
@@ -467,8 +476,8 @@ static int decompress_i(AVCodecContext *avctx, uint32_t 
*dst, int linesize)
 z = 0;
 }
 
-clr = dst[y * linesize + x + off - z];
-dst[y * linesize + x] = clr;
+clr = dst[vflip(y * linesize + x + o

Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: add complex vertcal lowpassfilter

2017-03-12 Thread Thomas Mundt
> James Almer  schrieb am Sa, 11.3.2017:
>>On 3/11/2017 12:39 PM, Thomas Mundt wrote:
>>> James Almer  schrieb am Fr, 10.3.2017:
 On 3/8/2017 1:58 PM, Thomas Mundt wrote:
 Hi,

 attached patch adds a complex (-1 2 6 2 -1) vertcal lowpassfilter to 
 vf_interlace. This will better retain detail and reduce blurring compared 
 to the existing (1 2 1) filter.

 Please comment.
 diff --git a/libavfilter/interlace.h b/libavfilter/interlace.h
 index da073ae..7ad457e 100644
 --- a/libavfilter/interlace.h
 +++ b/libavfilter/interlace.h
 @@ -51,6 +51,8 @@ typedef struct InterlaceContext {
  AVFrame *cur, *next;   // the two frames from which the new one is 
 obtained
  void (*lowpass_line)(uint8_t *dstp, ptrdiff_t linesize, const uint8_t 
 *srcp,
   const uint8_t *srcp_above, const uint8_t 
 *srcp_below);
 +void (*lowpass_line_complex)(uint8_t *dstp, ptrdiff_t linesize,
 + const uint8_t *srcp, int mref, int pref);
>>>
>>> Why not keep a single prototype, passing mref and pref for both linear
>>> and complex? You can calculate srcp_above and srcp_below for linear like
>>> you're doing it for complex in both the c and asm versions.
>>>
>> 
>> This would make sense. I just didn´t wanted to change more than necessary in 
>> one patch and I´m not such an expert in simd programming.
>> This is my second attempt ever.
>> Also there is the same function in tinterlace filter that also uses this 
>> asm. So I would also need to change the function in tinterlace.
>
> Yes, this would need separate patches. One to change the prototype,
> c and asm versions of the linear function for both filters, then
> another (One per interlace filter or one for both) adding the
> complex lowpass filter.
>
OK, c is fine, but I´m stumbling with asm since I´m a newbie there.
I changed in all files:
lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize,
   const uint8_t *srcp, const uint8_t *srcp_above,
   const uint8_t *srcp_below)
to
lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize,
   const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref)

But when I change asm to
cglobal lowpass_line, 5, 5, 7
add r0, r1
add r2, r1
neg r1
pcmpeqb m6, m6
.loop:
mova m0, [r2+r1+r3]
mova m1, [r2+r1+r3+mmsize]
pavgb m0, [r2+r1+r4]
pavgb m1, [r2+r1+r4+mmsize]
pxor m0, m6
pxor m1, m6
pxor m2, m6, [r2+r1]
pxor m3, m6, [r2+r1+mmsize]
pavgb m0, m2
pavgb m1, m3
pxor m0, m6
pxor m1, m6
mova [r0+r1], m0
mova [r0+r1+mmsize], m1
add r1, 2*mmsize
jl .loop
REP_RET

I get error: invalid effective address
It works when I use the same scheme as I use in complex asm, but this adds some 
extra calculations which might not be OK.

>> I could do all this as a subsequent patch. Do you have a suggestion how to 
>> deal with the option name of complex filter in tinterlace?
>> There it´s a flag with the names "low_pass_filter" and "vlpf", so I could 
>> add "complex_low_pass_filter" and "vclpf"?
>
> With flags you could in theory enable both linear and complex at
> the same time, so you'd need to add code to abort in such cases
> or default to one of them.
> I'd say add a lowpass option similar to vf_interlace's, and leave
> the flags as is.

I´m not sure how to add an additional lowpass option without breaking the flag. 
I might need a hint.
Simplest to me would be adding the complex flag and when both flags are set 
using the complex function.
Otherwise the user won´t have set it.


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


Re: [FFmpeg-devel] [PATCH 1/2] tests/api-seek: make the crc array uint32_t

2017-03-12 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 08:33:52PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/api/api-seek-test.c | 17 +
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH 2/2] tests/api-seek: fix memory leak on realloc() failure

2017-03-12 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 08:33:53PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/api/api-seek-test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
> index 6ef3b91933..503968fa13 100644
> --- a/tests/api/api-seek-test.c
> +++ b/tests/api/api-seek-test.c
> @@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts)
>  if (size_of_array == 0)
>  size_of_array = 10;
>  size_of_array *= 2;
> -crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
> -pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
> +crc_array = av_realloc_f(crc_array, size_of_array, sizeof(uint32_t));
> +pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t));
>  if ((crc_array == NULL) || (pts_array == NULL)) {
>  av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store 
> crcs\n");
>  return AVERROR(ENOMEM);

thats not enough, one of the reallocs can fail and one can succeed
the succeeded one would leak unless iam missing something


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH 2/2] tests/api-seek: fix memory leak on realloc() failure

2017-03-12 Thread James Almer
On 3/12/2017 10:12 AM, Michael Niedermayer wrote:
> On Sat, Mar 11, 2017 at 08:33:53PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  tests/api/api-seek-test.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
>> index 6ef3b91933..503968fa13 100644
>> --- a/tests/api/api-seek-test.c
>> +++ b/tests/api/api-seek-test.c
>> @@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts)
>>  if (size_of_array == 0)
>>  size_of_array = 10;
>>  size_of_array *= 2;
>> -crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
>> -pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
>> +crc_array = av_realloc_f(crc_array, size_of_array, 
>> sizeof(uint32_t));
>> +pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t));
>>  if ((crc_array == NULL) || (pts_array == NULL)) {
>>  av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store 
>> crcs\n");
>>  return AVERROR(ENOMEM);
> 
> thats not enough, one of the reallocs can fail and one can succeed
> the succeeded one would leak unless iam missing something

The program calls av_freep for both arrays as part of the cleaning
process at the end but apparently only on success and not on failure,
so you're right that it's not enough.

The entire program leaks everything on any kind failure, not just
failed allocation. I'll see about sending a patch to properly uninit
everything on failure.

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


[FFmpeg-devel] [PATCH] test/api-seek: clean up properly on failure

2017-03-12 Thread James Almer
Also propagate better error values.

Signed-off-by: James Almer 
---
To be applied before the realloc memleak fix.

 tests/api/api-seek-test.c | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index 6ef3b91933..b33a5dd158 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -197,19 +197,22 @@ static int seek_test(const char *input_filename, const 
char *start, const char *
 result = avformat_find_stream_info(fmt_ctx, NULL);
 if (result < 0) {
 av_log(NULL, AV_LOG_ERROR, "Can't get stream info\n");
-return result;
+goto end;
 }
 
 start_ts = read_seek_range(start);
 end_ts = read_seek_range(end);
-if ((start_ts < 0) || (end_ts < 0))
-return -1;
+if ((start_ts < 0) || (end_ts < 0)) {
+result = -1;
+goto end;
+}
 
 //TODO: add ability to work with audio format
 video_stream = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, 
NULL, 0);
 if (video_stream < 0) {
   av_log(NULL, AV_LOG_ERROR, "Can't find video stream in input file\n");
-  return -1;
+  result = video_stream;
+  goto end;
 }
 
 origin_par = fmt_ctx->streams[video_stream]->codecpar;
@@ -217,52 +220,56 @@ static int seek_test(const char *input_filename, const 
char *start, const char *
 codec = avcodec_find_decoder(origin_par->codec_id);
 if (!codec) {
 av_log(NULL, AV_LOG_ERROR, "Can't find decoder\n");
-return -1;
+  result = AVERROR_DECODER_NOT_FOUND;
+  goto end;
 }
 
 ctx = avcodec_alloc_context3(codec);
 if (!ctx) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n");
-return AVERROR(ENOMEM);
+result = AVERROR(ENOMEM);
+goto end;
 }
 
 result = avcodec_parameters_to_context(ctx, origin_par);
 if (result) {
 av_log(NULL, AV_LOG_ERROR, "Can't copy decoder context\n");
-return result;
+goto end;
 }
 
 result = avcodec_open2(ctx, codec, NULL);
 if (result < 0) {
 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
-return result;
+goto end;
 }
 
 fr = av_frame_alloc();
 if (!fr) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate frame\n");
-return AVERROR(ENOMEM);
+result = AVERROR(ENOMEM);
+goto end;
 }
 
 result = compute_crc_of_packets(fmt_ctx, video_stream, ctx, fr, 0, 0, 1);
 if (result != 0)
-return -1;
+goto end;
 
 for (i = start_ts; i < end_ts; i += 100) {
 for (j = i + 100; j < end_ts; j += 100) {
 result = compute_crc_of_packets(fmt_ctx, video_stream, ctx, fr, i, 
j, 0);
 if (result != 0)
-return -1;
+break;
 }
 }
 
+end:
 av_freep(&crc_array);
 av_freep(&pts_array);
 av_frame_free(&fr);
 avcodec_close(ctx);
 avformat_close_input(&fmt_ctx);
 avcodec_free_context(&ctx);
-return 0;
+return result;
 }
 
 int main(int argc, char **argv)
-- 
2.12.0

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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Paras Chadha
On Sat, Mar 11, 2017 at 5:47 PM, Michael Niedermayer  wrote:

> On Sat, Mar 11, 2017 at 05:33:30PM +0530, Paras Chadha wrote:
> > Here is the patch with all the changes mentioned above
> >
> > Signed-off-by: Paras 
> > ---
> >  Changelog   |   1 +
> >  doc/general.texi|   2 +
> >  libavcodec/Makefile |   1 +
> >  libavcodec/allcodecs.c  |   1 +
> >  libavcodec/avcodec.h|   1 +
> >  libavcodec/codec_desc.c |   7 +
> >  libavcodec/version.h|   4 +-
> >  libavcodec/xpmdec.c | 430
> > 
> >  libavformat/img2.c  |   1 +
> >  9 files changed, 446 insertions(+), 2 deletions(-)
> >  create mode 100644 libavcodec/xpmdec.c
>
> Applying: Add XPM decoder
> error: corrupt patch at line 33
> error: could not build fake ancestor
> Patch failed at 0001 Add XPM decoder
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Sorry, about that. Please look at the latest patch sent by me yesterday.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavf: Remove unnecessary escaping of ' in string literals

2017-03-12 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 06:54:58PM +0100, Alexander Strasser wrote:
> Signed-off-by: Alexander Strasser 
> ---
>  libavformat/avio.c  | 4 ++--
>  libavformat/utils.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

LGTM

thx

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


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


Re: [FFmpeg-devel] [PATCH 2/2] lavf: Be more explicit in logging white/black list matches

2017-03-12 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 06:55:17PM +0100, Alexander Strasser wrote:
> The current form of the messages indicating matches in the white
> or black lists seems to be a bit too much relying on context.
> 
> Make the messages more explicit.
> 
> This also matches the way codec white list errors are reported.
> 
> Signed-off-by: Alexander Strasser 
> ---
>  libavformat/avio.c  | 4 ++--
>  libavformat/utils.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH v2] swresample/swresample: do not reset tsf on swr_alloc_set_opts

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 12:58:56AM +0700, Muhammad Faiz wrote:
> so tsf option in aresample will have effect
> previously tsf/internal_sample_format had no effect
> 
> fate is updated
> s32p previously used fltp internally
> dblp previously used fltp/dblp internally
> 
> Signed-off-by: Muhammad Faiz 
> ---
>  libswresample/swresample.c   |  3 --
>  tests/fate/libswresample.mak | 80 
> ++--
>  2 files changed, 40 insertions(+), 43 deletions(-)

should be ok

thx

[...]
-- 
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] test/api-seek: clean up properly on failure

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 10:51:27AM -0300, James Almer wrote:
> Also propagate better error values.
> 
> Signed-off-by: James Almer 
> ---
> To be applied before the realloc memleak fix.
> 
>  tests/api/api-seek-test.c | 31 +++
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
> index 6ef3b91933..b33a5dd158 100644
> --- a/tests/api/api-seek-test.c
> +++ b/tests/api/api-seek-test.c
> @@ -197,19 +197,22 @@ static int seek_test(const char *input_filename, const 
> char *start, const char *
>  result = avformat_find_stream_info(fmt_ctx, NULL);
>  if (result < 0) {
>  av_log(NULL, AV_LOG_ERROR, "Can't get stream info\n");
> -return result;
> +goto end;
>  }
>  
>  start_ts = read_seek_range(start);
>  end_ts = read_seek_range(end);
> -if ((start_ts < 0) || (end_ts < 0))
> -return -1;
> +if ((start_ts < 0) || (end_ts < 0)) {
> +result = -1;
> +goto end;
> +}
>  
>  //TODO: add ability to work with audio format
>  video_stream = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, 
> NULL, 0);
>  if (video_stream < 0) {
>av_log(NULL, AV_LOG_ERROR, "Can't find video stream in input file\n");
> -  return -1;
> +  result = video_stream;
> +  goto end;
>  }
>  
>  origin_par = fmt_ctx->streams[video_stream]->codecpar;

> @@ -217,52 +220,56 @@ static int seek_test(const char *input_filename, const 
> char *start, const char *
>  codec = avcodec_find_decoder(origin_par->codec_id);
>  if (!codec) {
>  av_log(NULL, AV_LOG_ERROR, "Can't find decoder\n");
> -return -1;
> +  result = AVERROR_DECODER_NOT_FOUND;
> +  goto end;
>  }

The indention depth looks odd here

should be fine otherwise assuming result is always set appropriately

thx

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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


Re: [FFmpeg-devel] [PATCH] test/api-seek: clean up properly on failure

2017-03-12 Thread James Almer
On 3/12/2017 2:10 PM, Michael Niedermayer wrote:
> On Sun, Mar 12, 2017 at 10:51:27AM -0300, James Almer wrote:
>> Also propagate better error values.
>>
>> Signed-off-by: James Almer 
>> ---
>> To be applied before the realloc memleak fix.
>>
>>  tests/api/api-seek-test.c | 31 +++
>>  1 file changed, 19 insertions(+), 12 deletions(-)
>>
>> diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
>> index 6ef3b91933..b33a5dd158 100644
>> --- a/tests/api/api-seek-test.c
>> +++ b/tests/api/api-seek-test.c
>> @@ -197,19 +197,22 @@ static int seek_test(const char *input_filename, const 
>> char *start, const char *
>>  result = avformat_find_stream_info(fmt_ctx, NULL);
>>  if (result < 0) {
>>  av_log(NULL, AV_LOG_ERROR, "Can't get stream info\n");
>> -return result;
>> +goto end;
>>  }
>>  
>>  start_ts = read_seek_range(start);
>>  end_ts = read_seek_range(end);
>> -if ((start_ts < 0) || (end_ts < 0))
>> -return -1;
>> +if ((start_ts < 0) || (end_ts < 0)) {
>> +result = -1;
>> +goto end;
>> +}
>>  
>>  //TODO: add ability to work with audio format
>>  video_stream = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, 
>> NULL, 0);
>>  if (video_stream < 0) {
>>av_log(NULL, AV_LOG_ERROR, "Can't find video stream in input file\n");
>> -  return -1;
>> +  result = video_stream;
>> +  goto end;
>>  }
>>  
>>  origin_par = fmt_ctx->streams[video_stream]->codecpar;
> 
>> @@ -217,52 +220,56 @@ static int seek_test(const char *input_filename, const 
>> char *start, const char *
>>  codec = avcodec_find_decoder(origin_par->codec_id);
>>  if (!codec) {
>>  av_log(NULL, AV_LOG_ERROR, "Can't find decoder\n");
>> -return -1;
>> +  result = AVERROR_DECODER_NOT_FOUND;
>> +  goto end;
>>  }
> 
> The indention depth looks odd here
> 
> should be fine otherwise assuming result is always set appropriately
> 
> thx

Pushed

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


Re: [FFmpeg-devel] [PATCH 2/2] tests/api-seek: fix memory leak on realloc() failure

2017-03-12 Thread James Almer
On 3/12/2017 10:12 AM, Michael Niedermayer wrote:
> On Sat, Mar 11, 2017 at 08:33:53PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  tests/api/api-seek-test.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
>> index 6ef3b91933..503968fa13 100644
>> --- a/tests/api/api-seek-test.c
>> +++ b/tests/api/api-seek-test.c
>> @@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts)
>>  if (size_of_array == 0)
>>  size_of_array = 10;
>>  size_of_array *= 2;
>> -crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
>> -pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
>> +crc_array = av_realloc_f(crc_array, size_of_array, 
>> sizeof(uint32_t));
>> +pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t));
>>  if ((crc_array == NULL) || (pts_array == NULL)) {
>>  av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store 
>> crcs\n");
>>  return AVERROR(ENOMEM);
> 
> thats not enough, one of the reallocs can fail and one can succeed
> the succeeded one would leak unless iam missing something

Pushed after addressing the cleanup on failure issues.

Thanks.

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


Re: [FFmpeg-devel] [PATCH 1/2] tests/api-seek: make the crc array uint32_t

2017-03-12 Thread James Almer
On 3/12/2017 9:42 AM, Michael Niedermayer wrote:
> On Sat, Mar 11, 2017 at 08:33:52PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  tests/api/api-seek-test.c | 17 +
>>  1 file changed, 9 insertions(+), 8 deletions(-)
>>
> 
> LGTM
> 
> thx

Pushed

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


[FFmpeg-devel] [PATCH] avfilter/vf_lut3d: actually skip lines when encountering DOMAIN_ string

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

diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index b136cda..7a294b0 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -320,6 +320,7 @@ static int parse_cube(AVFilterContext *ctx, FILE *f)
 struct rgbvec *vec = &lut3d->lut[i][j][k];
 
 do {
+try_again:
 NEXT_LINE(0);
 if (!strncmp(line, "DOMAIN_", 7)) {
 float *vals = NULL;
@@ -330,7 +331,7 @@ static int parse_cube(AVFilterContext *ctx, FILE *f)
 sscanf(line + 11, "%f %f %f", vals, vals + 1, 
vals + 2);
 av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | 
max: %f %f %f\n",
min[0], min[1], min[2], max[0], max[1], 
max[2]);
-continue;
+goto try_again;
 }
 } while (skip_line(line));
 if (sscanf(line, "%f %f %f", &vec->r, &vec->g, 
&vec->b) != 3)
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Marton Balint


On Sat, 11 Mar 2017, Paras Chadha wrote:


On Sat, Mar 11, 2017 at 5:40 AM, Moritz Barsnick  wrote:



> +static int color_table_compare(const void *lhs, const void *rhs)
> +{
> +return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
> +}
> +
> +static const ColorEntry color_table[] = {
> +{ "AliceBlue",{ 0xF0, 0xF8, 0xFF } },
> +{ "AntiqueWhite", { 0xFA, 0xEB, 0xD7 } },
> +{ "Aqua", { 0x00, 0xFF, 0xFF } },
[...]

Is this duplicated from libavutil/parseutils.c?



Yes, it is duplicated from parseutils.c
XPM format also specifies a color None which is transparent, it has been
added to the array.
Also ColorEntry is changed a bit.
These changes are in my next patch.



Why don't you improve the code in parseutils then, and use that? 
Duplicating code is generally not welcome without a good reason.






> +static uint32_t hexstring_to_rgba(const char *p, int len){
> +uint32_t ret = 0xFF00;
> +const ColorEntry *entry;
> +char color_name[100];
> +
> +if(*p == '#'){
> +p++;
> +len--;
> +if (len == 3) {
> +ret |= (convert(p[2]) <<  4) |
> +   (convert(p[1]) << 12) |
> +   (convert(p[0]) << 20);

So is this a modified or redesigned av_parse_color()? Just wondering.



Yes, it is redesigned version of av_parse_color(). It is a bit fast than
the original.


So please integrate your changes in parseutils, and use that if you can, 
unless there is a reason for the duplication.


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paras Chadha a écrit :
> ffmpeg | branch: master | Paras Chadha  | Sun Mar 12 
> 02:49:23 2017 +0530| [5dab7b91adf65eb35d4ae0e76fbd988d55b0d764] | committer: 
> Paul B Mahol
> 
> avcodec: add XPM decoder and demuxer
> 
> Signed-off-by: Paras Chadha 

It was a bit premature, was it not? Marton still had comments, and I had
hoped to give it a look too, if time permits (I am rather swamped since
a few weeks).

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH V3] vf_hwupload: Add missing return value check

2017-03-12 Thread Mark Thompson
On 10/03/17 01:23, Jun Zhao wrote:
> V3: just remove noop ff_formats_unref() and add missing return value checks 
> to suppress build warning. 

Tested, LGTM, applied.

Thanks,

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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Paul B Mahol
On 3/12/17, Marton Balint  wrote:
>
> On Sat, 11 Mar 2017, Paras Chadha wrote:
>
>> On Sat, Mar 11, 2017 at 5:40 AM, Moritz Barsnick  wrote:
>>
>>>
>>> > +static int color_table_compare(const void *lhs, const void *rhs)
>>> > +{
>>> > +return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
>>> > +}
>>> > +
>>> > +static const ColorEntry color_table[] = {
>>> > +{ "AliceBlue",{ 0xF0, 0xF8, 0xFF } },
>>> > +{ "AntiqueWhite", { 0xFA, 0xEB, 0xD7 } },
>>> > +{ "Aqua", { 0x00, 0xFF, 0xFF } },
>>> [...]
>>>
>>> Is this duplicated from libavutil/parseutils.c?
>>>
>>
>> Yes, it is duplicated from parseutils.c
>> XPM format also specifies a color None which is transparent, it has been
>> added to the array.
>> Also ColorEntry is changed a bit.
>> These changes are in my next patch.
>>
>
> Why don't you improve the code in parseutils then, and use that?
> Duplicating code is generally not welcome without a good reason.

There is very good reason. There are even values for colors that conflict
with one presented in parseutils. There are even more colors to be added to XPM.

>
>>
>>>
>>> > +static uint32_t hexstring_to_rgba(const char *p, int len){
>>> > +uint32_t ret = 0xFF00;
>>> > +const ColorEntry *entry;
>>> > +char color_name[100];
>>> > +
>>> > +if(*p == '#'){
>>> > +p++;
>>> > +len--;
>>> > +if (len == 3) {
>>> > +ret |= (convert(p[2]) <<  4) |
>>> > +   (convert(p[1]) << 12) |
>>> > +   (convert(p[0]) << 20);
>>>
>>> So is this a modified or redesigned av_parse_color()? Just wondering.
>>>
>>
>> Yes, it is redesigned version of av_parse_color(). It is a bit fast than
>> the original.
>
> So please integrate your changes in parseutils, and use that if you can,
> unless there is a reason for the duplication.

parseutils have different code and its code is slower.
We tried to use it and found its not what XPM decoder needs.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paras Chadha a ecrit :
>> ffmpeg | branch: master | Paras Chadha  | Sun Mar
>> 12 02:49:23 2017 +0530| [5dab7b91adf65eb35d4ae0e76fbd988d55b0d764] |
>> committer: Paul B Mahol
>>
>> avcodec: add XPM decoder and demuxer
>>
>> Signed-off-by: Paras Chadha 
>
> It was a bit premature, was it not? Marton still had comments, and I had
> hoped to give it a look too, if time permits (I am rather swamped since
> a few weeks).

You could reply with something like: please do not push, wait for my reply.

I'm happy with code as it is.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paul B Mahol a écrit :
> You could reply with something like: please do not push, wait for my reply.

Yes, I COULD have done that.

On the other hand, you SHOULD have waited to push: first replying to
Marton's comments, and then giving him a fair amount of time to reply.

Pushing a simple patch when there are no comments is one thing. Pushing
a big patch when people have commented without replying, and even less
give them to follow up is not only breaking developer guidelines but
also basic courtesy.

> I'm happy with code as it is.

This is a necessary condition, but not a sufficient one.

I will not demand you to revert, that would be silly, but please do not
do it again. And consider Marton's future comments (ans possibly mine)
exactly as binding as if the patch had not yet been applied.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
>> You could reply with something like: please do not push, wait for my
>> reply.
>
> Yes, I COULD have done that.
>
> On the other hand, you SHOULD have waited to push: first replying to
> Marton's comments, and then giving him a fair amount of time to reply.
>
> Pushing a simple patch when there are no comments is one thing. Pushing
> a big patch when people have commented without replying, and even less
> give them to follow up is not only breaking developer guidelines but
> also basic courtesy.
>
>> I'm happy with code as it is.
>
> This is a necessary condition, but not a sufficient one.
>
> I will not demand you to revert, that would be silly, but please do not
> do it again. And consider Marton's future comments (ans possibly mine)
> exactly as binding as if the patch had not yet been applied.

OK, I'm impatiently awaiting your review.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paul B Mahol a écrit :
> On 3/12/17, Nicolas George  wrote:
> > Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
> >> You could reply with something like: please do not push, wait for my
> >> reply.
> >
> > Yes, I COULD have done that.
> >
> > On the other hand, you SHOULD have waited to push: first replying to
> > Marton's comments, and then giving him a fair amount of time to reply.
> >
> > Pushing a simple patch when there are no comments is one thing. Pushing
> > a big patch when people have commented without replying, and even less
> > give them to follow up is not only breaking developer guidelines but
> > also basic courtesy.
> >
> >> I'm happy with code as it is.
> >
> > This is a necessary condition, but not a sufficient one.
> >
> > I will not demand you to revert, that would be silly, but please do not
> > do it again. And consider Marton's future comments (ans possibly mine)
> > exactly as binding as if the patch had not yet been applied.
> 
> OK, I'm impatiently awaiting your review.

Please acknowledge the rest of my message. Even if my own review never
arrives, the rest applies.

And if you were acting as mentor, I am sorry to say that you let a few
very dubious constructs pass.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec: add XPM decoder and demuxer

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
>> On 3/12/17, Nicolas George  wrote:
>> > Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
>> >> You could reply with something like: please do not push, wait for my
>> >> reply.
>> >
>> > Yes, I COULD have done that.
>> >
>> > On the other hand, you SHOULD have waited to push: first replying to
>> > Marton's comments, and then giving him a fair amount of time to reply.
>> >
>> > Pushing a simple patch when there are no comments is one thing. Pushing
>> > a big patch when people have commented without replying, and even less
>> > give them to follow up is not only breaking developer guidelines but
>> > also basic courtesy.
>> >
>> >> I'm happy with code as it is.
>> >
>> > This is a necessary condition, but not a sufficient one.
>> >
>> > I will not demand you to revert, that would be silly, but please do not
>> > do it again. And consider Marton's future comments (ans possibly mine)
>> > exactly as binding as if the patch had not yet been applied.
>>
>> OK, I'm impatiently awaiting your review.
>
> Please acknowledge the rest of my message. Even if my own review never
> arrives, the rest applies.

Yes sir.

>
> And if you were acting as mentor, I am sorry to say that you let a few
> very dubious constructs pass.

I'm all ears.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_lut3d: actually skip lines when encountering DOMAIN_ string

2017-03-12 Thread Clément Bœsch
On Sun, Mar 12, 2017 at 07:00:32PM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/vf_lut3d.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
> index b136cda..7a294b0 100644
> --- a/libavfilter/vf_lut3d.c
> +++ b/libavfilter/vf_lut3d.c
> @@ -320,6 +320,7 @@ static int parse_cube(AVFilterContext *ctx, FILE *f)
>  struct rgbvec *vec = &lut3d->lut[i][j][k];
>  
>  do {
> +try_again:
>  NEXT_LINE(0);
>  if (!strncmp(line, "DOMAIN_", 7)) {
>  float *vals = NULL;
> @@ -330,7 +331,7 @@ static int parse_cube(AVFilterContext *ctx, FILE *f)
>  sscanf(line + 11, "%f %f %f", vals, vals + 
> 1, vals + 2);
>  av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | 
> max: %f %f %f\n",
> min[0], min[1], min[2], max[0], 
> max[1], max[2]);
> -continue;
> +goto try_again;
>  }
>  } while (skip_line(line));
>  if (sscanf(line, "%f %f %f", &vec->r, &vec->g, 
> &vec->b) != 3)

meh.

I would prefer a loop_again var to be used in the while condition, but
fine with me.

Thanks

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paras Chadha a écrit :
> Xpm decoder was added
> Also added xpm_pipe demuxer with its probe function
> 
> Signed-off-by: Paras Chadha 
> ---
>  Changelog|   1 +
>  doc/general.texi |   2 +
>  libavcodec/Makefile  |   1 +
>  libavcodec/allcodecs.c   |   1 +
>  libavcodec/avcodec.h |   1 +
>  libavcodec/codec_desc.c  |   7 +
>  libavcodec/version.h |   4 +-
>  libavcodec/xpmdec.c  | 426 
> +++
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/img2.c   |   1 +
>  libavformat/img2dec.c|  10 ++
>  12 files changed, 454 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/xpmdec.c
> 
> diff --git a/Changelog b/Changelog
> index 13628ca..716b6ff 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -26,6 +26,7 @@ version :
>  - native Opus encoder
>  - ScreenPressor decoder
>  - incomplete ClearVideo decoder
> +- XPM decoder
> 
>  version 3.2:
>  - libopenmpt demuxer
> diff --git a/doc/general.texi b/doc/general.texi
> index 30450c0..83f54b3 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -607,6 +607,8 @@ following image formats are supported:
>  @tab WebP image format, encoding supported through external library 
> libwebp
>  @item XBM  @tab X @tab X
>  @tab X BitMap image format
> +@item XPM  @tab X @tab X
> +@tab X PixMap image format
>  @item XFace @tab X @tab X
>  @tab X-Face image format
>  @item XWD  @tab X @tab X
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 65ccbad..b8d7a00 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -650,6 +650,7 @@ OBJS-$(CONFIG_XFACE_ENCODER)   += xfaceenc.o 
> xface.o
>  OBJS-$(CONFIG_XL_DECODER)  += xl.o
>  OBJS-$(CONFIG_XMA1_DECODER)+= wmaprodec.o wma.o wma_common.o
>  OBJS-$(CONFIG_XMA2_DECODER)+= wmaprodec.o wma.o wma_common.o
> +OBJS-$(CONFIG_XPM_DECODER) += xpmdec.o
>  OBJS-$(CONFIG_XSUB_DECODER)+= xsubdec.o
>  OBJS-$(CONFIG_XSUB_ENCODER)+= xsubenc.o
>  OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 074efd4..b7d03ad 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -378,6 +378,7 @@ static void register_all(void)
>  REGISTER_ENCDEC (XBM,   xbm);
>  REGISTER_ENCDEC (XFACE, xface);
>  REGISTER_DECODER(XL,xl);
> +REGISTER_DECODER(XPM,   xpm);
>  REGISTER_ENCDEC (XWD,   xwd);
>  REGISTER_ENCDEC (Y41P,  y41p);
>  REGISTER_DECODER(YLC,   ylc);
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 30ac236..e32f579 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -439,6 +439,7 @@ enum AVCodecID {
>  AV_CODEC_ID_FMVC,
>  AV_CODEC_ID_SCPR,
>  AV_CODEC_ID_CLEARVIDEO,
> +AV_CODEC_ID_XPM,
> 
>  /* various PCM "codecs" */
>  AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
> start of audio codecs
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 06bcfc3..88cfddb 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -1591,6 +1591,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
>  .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
>  },
>  {
> +.id= AV_CODEC_ID_XPM,
> +.type  = AVMEDIA_TYPE_VIDEO,
> +.name  = "xpm",
> +.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
> +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
> +},
> +{
>  .id= AV_CODEC_ID_XWD,
>  .type  = AVMEDIA_TYPE_VIDEO,
>  .name  = "xwd",
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index b00e011..3ed5a71 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,8 +28,8 @@
>  #include "libavutil/version.h"
> 
>  #define LIBAVCODEC_VERSION_MAJOR  57
> -#define LIBAVCODEC_VERSION_MINOR  82
> -#define LIBAVCODEC_VERSION_MICRO 102
> +#define LIBAVCODEC_VERSION_MINOR  83
> +#define LIBAVCODEC_VERSION_MICRO 100
> 
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> LIBAVCODEC_VERSION_MINOR, \
> diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
> new file mode 100644
> index 000..7a1f4e1
> --- /dev/null
> +++ b/libavcodec/xpmdec.c
> @@ -0,0 +1,426 @@
> +/*
> + * XPM image format
> + *
> + * Copyright (c) 2012 Paul B Mahol
> + * Copyright (c) 2017 Paras Chadha
> + *
> + * 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

Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paras Chadha a ecrit :
>> Xpm decoder was added
>> Also added xpm_pipe demuxer with its probe function
>>

[...]

>> +typedef struct XPMContext {
>
>> +uint32_t  *pixels;
>> +int  pixels_size;
>
> The spacing is strange.

OK.

>
>> +} XPMDecContext;
>> +
>> +typedef struct ColorEntry {
>> +const char *name;///< a string representing the name of
>> the color
>> +uint32_trgb_color;///< RGB values for the color
>> +} ColorEntry;
>> +
>> +static int color_table_compare(const void *lhs, const void *rhs)
>> +{
>> +return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
>> +}
>> +
>> +static const ColorEntry color_table[] = {
>
> 
>
> The code duplication with parseutils is unacceptable, and I find the
> reasons given by Paul weak. In particular, I do not see any conflict
> with the database on my X.org version.

Because conflicting entries have not been added yet. Last time I
compared it was different.
Also when Last time I tried it was soo slow that made 10k colors very
slow to decode.

>
>> +};
>> +
>
>> +static int convert(uint8_t x)
>
> convert is not a very good name.

OK, what you propose?

>
>> +{
>
>> +if (x >= 'a') {
>> +x -= 87;
>> +} else if (x >= 'A') {
>> +x -= 55;
>> +} else {
>
> Avoid magic numbers in the code; x - 87 = x - 'a' + 10,
> x - 55 = x - 'A' + 10, and "& ~32" can avoid making two cases anyway.

OK

>
>> +x -= '0';
>> +}
>> +return x;
>> +}
>> +
>
>> +/*
>> +**  functions same as strcspn but ignores characters in reject if they
>> are inside a C style comment...
>> +**  @param string, reject - same as that of strcspn
>> +**  @return length till any character in reject does not occur in string
>> +*/
>
> This is not a valid Doxygen comment.

OK

>
>> +static size_t mod_strcspn(const char *string, const char *reject)
>> +{
>> +int i, j;
>> +
>
>> +for (i = 0; string && string[i]; i++) {
>
> The first clause of the condition is silly.

Yes, correct.

>
>> +if (string[i] == '/' && string[i+1] == '*') {
>> +i += 2;
>
>> +while ( string && string[i] && (string[i] != '*' ||
>> string[i+1] != '/') )
>
> Nit: no spaces within parentheses. And ditto for the first clause.

OK

>
>> +i++;
>
>> +i++;
>
> If the loop exits due to the "string[i]" part, this leaves I beyond the
> end of the string, causing an illegal access on the next rounds.

OK

>
>> +} else if (string[i] == '/' && string[i+1] == '/') {
>> +i += 2;
>
>> +while ( string && string[i] && string[i] != '\n' )
>
> Ditto for the first clause.

OK

>
>> +i++;
>> +} else {
>
>> +for (j = 0; reject && reject[j]; j++) {
>> +if (string[i] == reject[j])
>> +break;
>
> Use strchr().

That is slower.

>
>> +}
>> +if (reject && reject[j])
>> +break;
>> +}
>> +}
>> +return i;
>> +}
>> +
>
>> +static uint32_t hexstring_to_rgba(const char *p, int len)
>
> This is a misnomer.

What it should be instead?

>
>> +{
>> +uint32_t ret = 0xFF00;
>> +const ColorEntry *entry;
>> +char color_name[100];
>> +
>> +if (*p == '#') {
>> +p++;
>> +len--;
>> +if (len == 3) {
>> +ret |= (convert(p[2]) <<  4) |
>> +   (convert(p[1]) << 12) |
>> +   (convert(p[0]) << 20);
>> +} else if (len == 4) {
>> +ret  = (convert(p[3]) <<  4) |
>> +   (convert(p[2]) << 12) |
>> +   (convert(p[1]) << 20) |
>> +   (convert(p[0]) << 28);
>> +} else if (len == 6) {
>> +ret |=  convert(p[5])|
>> +   (convert(p[4]) <<  4) |
>> +   (convert(p[3]) <<  8) |
>> +   (convert(p[2]) << 12) |
>> +   (convert(p[1]) << 16) |
>> +   (convert(p[0]) << 20);
>> +} else if (len == 8) {
>> +ret  =  convert(p[7])|
>> +   (convert(p[6]) <<  4) |
>> +   (convert(p[5]) <<  8) |
>> +   (convert(p[4]) << 12) |
>> +   (convert(p[3]) << 16) |
>> +   (convert(p[2]) << 20) |
>> +   (convert(p[1]) << 24) |
>> +   (convert(p[0]) << 28);
>> +}
>> +} else {
>
>> +strncpy(color_name, p, len);
>> +color_name[len] = '\0';
>
> This is completely wrong.

What should it be instead?

>
>> +
>> +entry = bsearch(color_name,
>> +color_table,
>> +(sizeof(color_table)/sizeof(color_table[0])),
>> +sizeof(ColorEntry),
>> +color_table_compare);
>> +
>> +if (!entry)
>> +return ret;
>> +
>> +ret = entry

Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paul B Mahol a écrit :
> Because conflicting entries have not been added yet. Last time I
> compared it was different.

Well, unlike some people on this mailing-list, I actually check my facts
before sending a mail. And I repeat, I did not see any conflict.

> Also when Last time I tried it was soo slow that made 10k colors very
> slow to decode.

Then make it faster, since obviously you are capable of it, but
duplicating it is unacceptable.

> > convert is not a very good name.
> 
> OK, what you propose?

hex_char_to_number(), for example.

> >> +for (j = 0; reject && reject[j]; j++) {
> >> +if (string[i] == reject[j])
> >> +break;
> > Use strchr().
> That is slower.

I very much doubt that.

> >> +static uint32_t hexstring_to_rgba(const char *p, int len)
> > This is a misnomer.
> What it should be instead?

Probably "color_string_to_rgba()".

> >> +strncpy(color_name, p, len);
> >> +color_name[len] = '\0';
> > This is completely wrong.
> What should it be instead?

It should check len against sizeof(color_name), obviously. Could you not
find it yourself? The magic number in the size of the array should have
been a dead giveaway.

> Better not return error and instead display what is already decoded.

I strongly disagree.

> > Also, you forgot to parse colors in standard X11 scheme
> > "rgb://".
> Are there such files?

Of course.

> > If I read this correctly, you are skipping random characters until a
> > quote is found. This is not how a robust parser should be written.
> Come on.

Are you trying to communicate?

> >> +if (sscanf(ptr, "\"%u %u %u %u\",",
> >> +   &avctx->width, &avctx->height, &ncolors, &cpp) != 4) {
> > This is not properly checking the final quote and comma.
> Really?

Yes, really. Check the man page of sscanf() if you do not remember how
it works.

> >> +size = 1;
> >> +j = 1;
> >> +for (i = 0; i < cpp; i++) {
> >> +size += j*94;
> >> +j *= 95;
> >> +}
> >> +size *= 4;
> >
> > This is a DoS waiting to happen.
> Come on. I fuzzed this with afl-fuzzer up to 25 cycles.

You should have given 25 seconds of thought instead. An attacker has
only to make cpp just large enough to eat all memory and give a few
colors to force the allocation of very sparse entries to actually access
it to make a DoS.

> >> +if (size < 0) {
> > This is deliberately invoking an undefined behaviour.
> How?

The arithmetic can not make size negative, only an integer overflow.

Furthermore, if there are several integer overflows, size can come back
positive but smaller than what will be accessed later, which is really
really bad.

Actually, I think you just pushed an exploitable security hole.

> >> +ptr += mod_strcspn(ptr, ",") + 1;
> > Same remark as above: skipping random contents. Same for other uses of
> > mod_strcspn().
> It is not skipping random contents.

Oh? Then pray tell me what part of the code detects an invalid file with
random text at between the quote and the comma?

> > index looks like a misnomer.
> It is name for index to pixels in XPM structure.

An index is a number, this is not a number.

> > This whole loop can go beyond the end of the input buffer very easily.
> Input buffer is padded with NULLs.

My bad, re-reading it more carefully, you were right on this instance.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] libavfilter/af_ambisonic.c Added File for Ambisonic Filter

2017-03-12 Thread Sanchit Sinha
Any changes required in this one?

On Mar 11, 2017 10:53 PM, "Sanchit Sinha"  wrote:

>
>
>
>
>
> On Sat, Mar 11, 2017 at 10:38 PM, Paul B Mahol  wrote:
>
>> On 3/11/17, Sanchit Sinha  wrote:
>> > On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha <
>> sanchit15...@iiitd.ac.in>
>> > wrote:
>> >
>>
>> tabs are forbidden use 4 spaces for identation, remove commented out code.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
>
> --
> Sanchit Sinha
> B.Tech- CSE
> IIIT-Delhi
> Roll-2015083
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Change type of spherical stuff to uint64_t

2017-03-12 Thread Michael Niedermayer
Using the same type across platforms is more robust and avoids platform
specific issues from differences in range.
Also fixed point integers are on a semantical level not size_t

Signed-off-by: Michael Niedermayer 
---
 ffprobe.c |  2 +-
 libavformat/dump.c|  6 +++---
 libavutil/spherical.c | 10 +-
 libavutil/spherical.h | 16 
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index b104390990..a73566b7a3 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1793,7 +1793,7 @@ static void print_pkt_side_data(WriterContext *w,
 print_str("projection", "cubemap");
 print_int("padding", spherical->padding);
 } else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-size_t l, t, r, b;
+uint64_t l, t, r, b;
 av_spherical_tile_bounds(spherical, par->width, par->height,
  &l, &t, &r, &b);
 print_str("projection", "tiled equirectangular");
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 505d572301..0a1208a375 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -370,12 +370,12 @@ static void dump_spherical(void *ctx, AVCodecParameters 
*par, AVPacketSideData *
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
 
 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-size_t l, t, r, b;
+uint64_t l, t, r, b;
 av_spherical_tile_bounds(spherical, par->width, par->height,
  &l, &t, &r, &b);
-av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+av_log(ctx, AV_LOG_INFO, "[%"PRIu64", %"PRIu64", %"PRIu64", %"PRIu64"] 
", l, t, r, b);
 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
-av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+av_log(ctx, AV_LOG_INFO, "[pad %"PRIu64"] ", spherical->padding);
 }
 }
 
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index 0ca2dd367a..1e9805c2a5 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -34,14 +34,14 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
 }
 
 void av_spherical_tile_bounds(AVSphericalMapping *map,
-  size_t width, size_t height,
-  size_t *left, size_t *top,
-  size_t *right, size_t *bottom)
+  uint64_t width, uint64_t height,
+  uint64_t *left, uint64_t*top,
+  uint64_t *right, uint64_t *bottom)
 {
 /* conversion from 0.32 coordinates to pixels */
-uint64_t orig_width  = (uint64_t) width  * UINT32_MAX /
+uint64_t orig_width  = width  * UINT32_MAX /
(UINT32_MAX - map->bound_right  - map->bound_left);
-uint64_t orig_height = (uint64_t) height * UINT32_MAX /
+uint64_t orig_height = height * UINT32_MAX /
(UINT32_MAX - map->bound_bottom - map->bound_top);
 
 /* add a (UINT32_MAX - 1) to round up integer division */
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index db9bdc0be5..92a82199b2 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
  *   projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
  *   and should be ignored in all other cases.
  */
-size_t bound_left;   ///< Distance from the left edge
-size_t bound_top;///< Distance from the top edge
-size_t bound_right;  ///< Distance from the right edge
-size_t bound_bottom; ///< Distance from the bottom edge
+uint64_t bound_left;   ///< Distance from the left edge
+uint64_t bound_top;///< Distance from the top edge
+uint64_t bound_right;  ///< Distance from the right edge
+uint64_t bound_bottom; ///< Distance from the bottom edge
 /**
  * @}
  */
@@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
  *   (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
  *   cases.
  */
-size_t padding;
+uint64_t padding;
 } AVSphericalMapping;
 
 /**
@@ -203,9 +203,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size);
  * @param bottom Pixels from the bottom edge.
  */
 void av_spherical_tile_bounds(AVSphericalMapping *map,
-  size_t width, size_t height,
-  size_t *left, size_t *top,
-  size_t *right, size_t *bottom);
+  uint64_t width, uint64_t height,
+  uint64_t *left, uint64_t *top,
+  uint64_t *right, uint64_t *bottom);
 /**
  * @}
  * @}
-- 
2.11.0

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

Re: [FFmpeg-devel] [PATCH v2] swresample/swresample: do not reset tsf on swr_alloc_set_opts

2017-03-12 Thread Muhammad Faiz
On Mon, Mar 13, 2017 at 12:08 AM, Michael Niedermayer
 wrote:
> On Sun, Mar 12, 2017 at 12:58:56AM +0700, Muhammad Faiz wrote:
>> so tsf option in aresample will have effect
>> previously tsf/internal_sample_format had no effect
>>
>> fate is updated
>> s32p previously used fltp internally
>> dblp previously used fltp/dblp internally
>>
>> Signed-off-by: Muhammad Faiz 
>> ---
>>  libswresample/swresample.c   |  3 --
>>  tests/fate/libswresample.mak | 80 
>> ++--
>>  2 files changed, 40 insertions(+), 43 deletions(-)
>
> should be ok
>
> thx

Applied

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


Re: [FFmpeg-devel] [PATCH] Documentation: -vf colormatrix options

2017-03-12 Thread Kieran Kunhya
On Sat, 11 Mar 2017 at 20:56 Katherine Frances Nagels 
wrote:

> Hi ffmpeg-devel,
>
> This is my first time submitting a patch, so I hope I'm on the right track.
>
> I noticed that not all of the -vf colormatrix options described in ffmpeg
> -h filter=colormatrix are included in the docs at
> https://ffmpeg.org/ffmpeg-all.html#colormatrix.
> Therefore, I've added the missing options.
>

Looks good to me.

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


Re: [FFmpeg-devel] [PATCH] Documentation: -vf colormatrix options

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 09:49:37AM +1300, Katherine Frances Nagels wrote:
> Hi ffmpeg-devel,
> 
> This is my first time submitting a patch, so I hope I'm on the right track.
> 
> I noticed that not all of the -vf colormatrix options described in ffmpeg
> -h filter=colormatrix are included in the docs at
> https://ffmpeg.org/ffmpeg-all.html#colormatrix.
> Therefore, I've added the missing options.
> 
> I've attached the patch (via git format-patch -1), here are the contents
> directly:
> 
> From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
> > From: Katherine Nagels 
> > Date: Sun, 12 Mar 2017 09:39:47 +1300
> > Subject: [PATCH] Update colormatrix values ---
> > doc/filters.texi | 15 ---
> > 1 file changed, 12 insertions(+), 3 deletions(-) diff --git
> > a/doc/filters.texi b/doc/filters.texi
> > index 192a81a..950ff81 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -5260,15 +5260,24 @@ The accepted values are:
> > @item bt709
> > BT.709
> >
> > +@item fcc
> > +FCC
> > +
> > @item bt601
> > BT.601
> >
> > +@item bt470
> > +BT.470
> > +
> > +@item bt470bg
> > +BT.470BG
> > +
> > +@item smpte170m
> > +SMPTE-170M
> > +
> > @item smpte240m
> > SMPTE-240M
> >
> > -@item fcc
> > -FCC
> > -
> > @item bt2020
> > BT.2020
> > @end table
> > --
> > 2.7.4
> 
> 
> Thank you.
> 
> Best, Katherine

>  filters.texi |   15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 836420957f84fcf3b9c9253d2419d632520b05c2  0001-Update-colormatrix-values.patch
> From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
> From: Katherine Nagels 
> Date: Sun, 12 Mar 2017 09:39:47 +1300

> Subject: [PATCH] Update colormatrix values

This commit message does not comply to to our formating requiremets
its also too general. "update" can mean alot


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] Change type of spherical stuff to uint64_t

2017-03-12 Thread James Almer
On 3/12/2017 5:06 PM, Michael Niedermayer wrote:
> Using the same type across platforms is more robust and avoids platform
> specific issues from differences in range.
> Also fixed point integers are on a semantical level not size_t

LGTM. You could even use uint32_t as it's more than enough for these
fields, which are all explicitly 0.32 fixed point values as mentioned
in the doxy.

Maybe a minor/micro bump? Even if doesn't really affect anything since
it's barely a five days old addition, it's still an API/ABI break and
it would be nice to signal it in some way.

> 
> Signed-off-by: Michael Niedermayer 
> ---
>  ffprobe.c |  2 +-
>  libavformat/dump.c|  6 +++---
>  libavutil/spherical.c | 10 +-
>  libavutil/spherical.h | 16 
>  4 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index b104390990..a73566b7a3 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -1793,7 +1793,7 @@ static void print_pkt_side_data(WriterContext *w,
>  print_str("projection", "cubemap");
>  print_int("padding", spherical->padding);
>  } else if (spherical->projection == 
> AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
> -size_t l, t, r, b;
> +uint64_t l, t, r, b;
>  av_spherical_tile_bounds(spherical, par->width, par->height,
>   &l, &t, &r, &b);
>  print_str("projection", "tiled equirectangular");
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 505d572301..0a1208a375 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -370,12 +370,12 @@ static void dump_spherical(void *ctx, AVCodecParameters 
> *par, AVPacketSideData *
>  av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
>  
>  if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
> -size_t l, t, r, b;
> +uint64_t l, t, r, b;
>  av_spherical_tile_bounds(spherical, par->width, par->height,
>   &l, &t, &r, &b);
> -av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
> +av_log(ctx, AV_LOG_INFO, "[%"PRIu64", %"PRIu64", %"PRIu64", 
> %"PRIu64"] ", l, t, r, b);
>  } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
> -av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
> +av_log(ctx, AV_LOG_INFO, "[pad %"PRIu64"] ", spherical->padding);
>  }
>  }
>  
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index 0ca2dd367a..1e9805c2a5 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -34,14 +34,14 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
>  }
>  
>  void av_spherical_tile_bounds(AVSphericalMapping *map,
> -  size_t width, size_t height,
> -  size_t *left, size_t *top,
> -  size_t *right, size_t *bottom)
> +  uint64_t width, uint64_t height,
> +  uint64_t *left, uint64_t*top,
> +  uint64_t *right, uint64_t *bottom)
>  {
>  /* conversion from 0.32 coordinates to pixels */
> -uint64_t orig_width  = (uint64_t) width  * UINT32_MAX /
> +uint64_t orig_width  = width  * UINT32_MAX /
> (UINT32_MAX - map->bound_right  - 
> map->bound_left);
> -uint64_t orig_height = (uint64_t) height * UINT32_MAX /
> +uint64_t orig_height = height * UINT32_MAX /
> (UINT32_MAX - map->bound_bottom - map->bound_top);
>  
>  /* add a (UINT32_MAX - 1) to round up integer division */
> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
> index db9bdc0be5..92a82199b2 100644
> --- a/libavutil/spherical.h
> +++ b/libavutil/spherical.h
> @@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
>   *   projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
>   *   and should be ignored in all other cases.
>   */
> -size_t bound_left;   ///< Distance from the left edge
> -size_t bound_top;///< Distance from the top edge
> -size_t bound_right;  ///< Distance from the right edge
> -size_t bound_bottom; ///< Distance from the bottom edge
> +uint64_t bound_left;   ///< Distance from the left edge
> +uint64_t bound_top;///< Distance from the top edge
> +uint64_t bound_right;  ///< Distance from the right edge
> +uint64_t bound_bottom; ///< Distance from the bottom edge

uint32_t is imo more than enough

>  /**
>   * @}
>   */
> @@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
>   *   (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
>   *   cases.
>   */
> -size_t padding;
> +uint64_t padding;
>  } AVSphericalMapping;
>  
>  /**
> @@ -203,9 +203,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size);
>   * @param botto

Re: [FFmpeg-devel] [PATCH] libavfilter/af_ambisonic.c Added File for Ambisonic Filter

2017-03-12 Thread Paul B Mahol
On 3/12/17, Sanchit Sinha  wrote:
> Any changes required in this one?

Please do not top post.

Expect vertical alignment, no changes are needed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/vp9: avx2 implementation of ipred_dl_16x16_16

2017-03-12 Thread Ilia
vp9_diag_downleft_16x16_10bpp_c: 263.0
vp9_diag_downleft_16x16_10bpp_sse2: 44.7
vp9_diag_downleft_16x16_10bpp_ssse3: 32.5
vp9_diag_downleft_16x16_10bpp_avx: 31.9
vp9_diag_downleft_16x16_10bpp_avx2: 25.7
vp9_diag_downleft_16x16_12bpp_c: 264.7
vp9_diag_downleft_16x16_12bpp_sse2: 44.4
vp9_diag_downleft_16x16_12bpp_ssse3: 32.0
vp9_diag_downleft_16x16_12bpp_avx: 32.4
vp9_diag_downleft_16x16_12bpp_avx2: 25.5

Benchmarked with 1 runs

Signed-off-by: Ilia 
---
 libavcodec/x86/vp9dsp_init_16bpp.c|  2 ++
 libavcodec/x86/vp9intrapred_16bpp.asm | 39 +++
 2 files changed, 41 insertions(+)

diff --git a/libavcodec/x86/vp9dsp_init_16bpp.c 
b/libavcodec/x86/vp9dsp_init_16bpp.c
index eb67499..4576ff1 100644
--- a/libavcodec/x86/vp9dsp_init_16bpp.c
+++ b/libavcodec/x86/vp9dsp_init_16bpp.c
@@ -51,6 +51,7 @@ decl_ipred_fns(h,   16, mmxext, sse2);
 decl_ipred_fns(dc,  16, mmxext, sse2);
 decl_ipred_fns(dc_top,  16, mmxext, sse2);
 decl_ipred_fns(dc_left, 16, mmxext, sse2);
+decl_ipred_fn(dl,   16, 16, avx2);
 
 #define decl_ipred_dir_funcs(type) \
 decl_ipred_fns(type, 16, sse2,  sse2); \
@@ -133,6 +134,7 @@ av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
 init_fpel_func(2, 1,  32, avg, _16, avx2);
 init_fpel_func(1, 1,  64, avg, _16, avx2);
 init_fpel_func(0, 1, 128, avg, _16, avx2);
+init_ipred_func(dl, DIAG_DOWN_LEFT, 16, 16, avx2);
 }
 
 #endif /* HAVE_YASM */
diff --git a/libavcodec/x86/vp9intrapred_16bpp.asm 
b/libavcodec/x86/vp9intrapred_16bpp.asm
index c0ac16d..212e413 100644
--- a/libavcodec/x86/vp9intrapred_16bpp.asm
+++ b/libavcodec/x86/vp9intrapred_16bpp.asm
@@ -847,6 +847,45 @@ DL_FUNCS
 INIT_XMM avx
 DL_FUNCS
 
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+cglobal vp9_ipred_dl_16x16_16, 2, 4, 5, dst, stride, l, a
+movifnidn   aq, amp
+movam0, [aq]   ; abcdefghijklmnop
+vpbroadcastw   xm1, [aq+30]; 
+vperm2i128  m2, m0, m1, q0201  ; ijklmnop
+vpalignrm3, m2, m0, 2  ; bcdefghijklmnopp
+vpalignrm4, m2, m0, 4  ; cdefghijklmnoppp
+LOWPASS  0,  3,  4 ; BCDEFGHIJKLMNOPp
+vperm2i128  m2, m0, m1, q0201  ; JKLMNOPp
+DEFINE_ARGS dst, stride, stride3, cnt
+mov   cntd, 2
+lea   stride3q, [strideq*3]
+.loop:
+mova  [dstq+strideq*0], m0
+vpalignrm3, m2, m0, 2
+vpalignrm4, m2, m0, 4
+mova  [dstq+strideq*1], m3
+mova  [dstq+strideq*2], m4
+vpalignrm3, m2, m0, 6
+vpalignrm4, m2, m0, 8
+mova  [dstq+stride3q ], m3
+lea   dstq, [dstq+strideq*4]
+mova  [dstq+strideq*0], m4
+vpalignrm3, m2, m0, 10
+vpalignrm4, m2, m0, 12
+mova  [dstq+strideq*1], m3
+mova  [dstq+strideq*2], m4
+vpalignrm3, m2, m0, 14
+mova  [dstq+stride3q ], m3
+lea   dstq, [dstq+strideq*4]
+movam0, m2
+vperm2i128  m2, m2, m2, q0101  ; 
+dec   cntd
+jg .loop
+RET
+%endif
+
 %macro DR_FUNCS 1 ; stack_mem_for_32x32_32bit_function
 cglobal vp9_ipred_dr_4x4_16, 4, 4, 3, dst, stride, l, a
 movhm0, [lq]; wxyz
-- 
2.8.3

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


[FFmpeg-devel] [PATCH] Change type of spherical stuff to uint32_t

2017-03-12 Thread Michael Niedermayer
Using the same type across platforms is more robust and avoids platform
specific issues from differences in range.
Also fixed point integers are on a semantical level not size_t

Previous version reviewed-by: James Almer 
Signed-off-by: Michael Niedermayer 
---
 ffprobe.c |  2 +-
 libavformat/dump.c|  6 +++---
 libavutil/spherical.c |  6 +++---
 libavutil/spherical.h | 16 
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index b104390990..b3466b1708 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1793,7 +1793,7 @@ static void print_pkt_side_data(WriterContext *w,
 print_str("projection", "cubemap");
 print_int("padding", spherical->padding);
 } else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-size_t l, t, r, b;
+uint32_t l, t, r, b;
 av_spherical_tile_bounds(spherical, par->width, par->height,
  &l, &t, &r, &b);
 print_str("projection", "tiled equirectangular");
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 505d572301..a6309cbf71 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -370,12 +370,12 @@ static void dump_spherical(void *ctx, AVCodecParameters 
*par, AVPacketSideData *
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
 
 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-size_t l, t, r, b;
+uint32_t l, t, r, b;
 av_spherical_tile_bounds(spherical, par->width, par->height,
  &l, &t, &r, &b);
-av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+av_log(ctx, AV_LOG_INFO, "[%"PRIu32", %"PRIu32", %"PRIu32", %"PRIu32"] 
", l, t, r, b);
 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
-av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
 }
 }
 
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index 0ca2dd367a..66056961a0 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -34,9 +34,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
 }
 
 void av_spherical_tile_bounds(AVSphericalMapping *map,
-  size_t width, size_t height,
-  size_t *left, size_t *top,
-  size_t *right, size_t *bottom)
+  uint32_t width, uint32_t height,
+  uint32_t *left, uint32_t*top,
+  uint32_t *right, uint32_t *bottom)
 {
 /* conversion from 0.32 coordinates to pixels */
 uint64_t orig_width  = (uint64_t) width  * UINT32_MAX /
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index db9bdc0be5..ff25c139ee 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
  *   projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
  *   and should be ignored in all other cases.
  */
-size_t bound_left;   ///< Distance from the left edge
-size_t bound_top;///< Distance from the top edge
-size_t bound_right;  ///< Distance from the right edge
-size_t bound_bottom; ///< Distance from the bottom edge
+uint32_t bound_left;   ///< Distance from the left edge
+uint32_t bound_top;///< Distance from the top edge
+uint32_t bound_right;  ///< Distance from the right edge
+uint32_t bound_bottom; ///< Distance from the bottom edge
 /**
  * @}
  */
@@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
  *   (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
  *   cases.
  */
-size_t padding;
+uint32_t padding;
 } AVSphericalMapping;
 
 /**
@@ -203,9 +203,9 @@ AVSphericalMapping *av_spherical_alloc(size_t *size);
  * @param bottom Pixels from the bottom edge.
  */
 void av_spherical_tile_bounds(AVSphericalMapping *map,
-  size_t width, size_t height,
-  size_t *left, size_t *top,
-  size_t *right, size_t *bottom);
+  uint32_t width, uint32_t height,
+  uint32_t *left, uint32_t *top,
+  uint32_t *right, uint32_t *bottom);
 /**
  * @}
  * @}
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
>> Because conflicting entries have not been added yet. Last time I
>> compared it was different.
>
> Well, unlike some people on this mailing-list, I actually check my facts
> before sending a mail. And I repeat, I did not see any conflict.

https://en.wikipedia.org/wiki/X11_color_names#Clashes_between_web_and_X11_colors_in_the_CSS_color_scheme

>
>> Also when Last time I tried it was soo slow that made 10k colors very
>> slow to decode.
>
> Then make it faster, since obviously you are capable of it, but
> duplicating it is unacceptable.

Please, give yourself a big break.

>
>> > convert is not a very good name.
>>
>> OK, what you propose?
>
> hex_char_to_number(), for example.

OK

>
>> >> +for (j = 0; reject && reject[j]; j++) {
>> >> +if (string[i] == reject[j])
>> >> +break;
>> > Use strchr().
>> That is slower.
>
> I very much doubt that.
>
>> >> +static uint32_t hexstring_to_rgba(const char *p, int len)
>> > This is a misnomer.
>> What it should be instead?
>
> Probably "color_string_to_rgba()".

OK

>
>> >> +strncpy(color_name, p, len);
>> >> +color_name[len] = '\0';
>> > This is completely wrong.
>> What should it be instead?
>
> It should check len against sizeof(color_name), obviously. Could you not
> find it yourself? The magic number in the size of the array should have
> been a dead giveaway.

OK

>
>> Better not return error and instead display what is already decoded.
>
> I strongly disagree.

I absolutely disagree with you on this one.

>
>> > Also, you forgot to parse colors in standard X11 scheme
>> > "rgb://".
>> Are there such files?
>
> Of course.

I yet have to find such files in wild.

>
>> > If I read this correctly, you are skipping random characters until a
>> > quote is found. This is not how a robust parser should be written.
>> Come on.
>
> Are you trying to communicate?

I will just ignore this one.

>
>> >> +if (sscanf(ptr, "\"%u %u %u %u\",",
>> >> +   &avctx->width, &avctx->height, &ncolors, &cpp) != 4) {
>> > This is not properly checking the final quote and comma.
>> Really?
>
> Yes, really. Check the man page of sscanf() if you do not remember how
> it works.

I will just ignore this one.

>
>> >> +size = 1;
>> >> +j = 1;
>> >> +for (i = 0; i < cpp; i++) {
>> >> +size += j*94;
>> >> +j *= 95;
>> >> +}
>> >> +size *= 4;
>> >
>> > This is a DoS waiting to happen.
>> Come on. I fuzzed this with afl-fuzzer up to 25 cycles.
>
> You should have given 25 seconds of thought instead. An attacker has
> only to make cpp just large enough to eat all memory and give a few
> colors to force the allocation of very sparse entries to actually access
> it to make a DoS.

I will just ignore this one.

>
>> >> +if (size < 0) {
>> > This is deliberately invoking an undefined behaviour.
>> How?
>
> The arithmetic can not make size negative, only an integer overflow.
>
> Furthermore, if there are several integer overflows, size can come back
> positive but smaller than what will be accessed later, which is really
> really bad.
>
> Actually, I think you just pushed an exploitable security hole.

I dont think so. But anyway will be "fixed".

>
>> >> +ptr += mod_strcspn(ptr, ",") + 1;
>> > Same remark as above: skipping random contents. Same for other uses of
>> > mod_strcspn().
>> It is not skipping random contents.
>
> Oh? Then pray tell me what part of the code detects an invalid file with
> random text at between the quote and the comma?

Better to be robust and show image instead on breaking on corrupted stuff
like nonascii chars in comments.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Nicolas George
Le duodi 22 ventôse, an CCXXV, Paul B Mahol a écrit :
> I absolutely disagree with you on this one.

I may have formulated the things a bit sarcastically, but the technical
facts remain, and you need to address them.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Paul B Mahol
On 3/12/17, Nicolas George  wrote:
> Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :
>> I absolutely disagree with you on this one.
>
> I may have formulated the things a bit sarcastically, but the technical
> facts remain, and you need to address them.

Yes, I addressed this specific one - Ignoring it.

Dumping all data because of single corrupted byte is bad idea.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Documentation: -vf colormatrix options

2017-03-12 Thread Katherine Frances Nagels
Apologies - now with more useful commit message.
I actually remade the commit since I realized I wasn't connected to my
usual git login. I hope you can kill the other commit. Sorry for this. :(

Contents as before:

>From 99c2763fe7e455bf1d5acd68ae7080509da89ce1 Mon Sep 17 00:00:00 2001
From: kfrn 
Date: Mon, 13 Mar 2017 11:57:11 +1300
Subject: [PATCH] doc/filters: Add colourspace values for colormatrix filter

---
 doc/filters.texi | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 192a81a..950ff81 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5260,15 +5260,24 @@ The accepted values are:
 @item bt709
 BT.709

+@item fcc
+FCC
+
 @item bt601
 BT.601

+@item bt470
+BT.470
+
+@item bt470bg
+BT.470BG
+
+@item smpte170m
+SMPTE-170M
+
 @item smpte240m
 SMPTE-240M

-@item fcc
-FCC
-
 @item bt2020
 BT.2020
 @end table
-- 
2.7.4



On Mon, Mar 13, 2017 at 9:29 AM, Michael Niedermayer  wrote:

> On Sun, Mar 12, 2017 at 09:49:37AM +1300, Katherine Frances Nagels wrote:
> > Hi ffmpeg-devel,
> >
> > This is my first time submitting a patch, so I hope I'm on the right
> track.
> >
> > I noticed that not all of the -vf colormatrix options described in ffmpeg
> > -h filter=colormatrix are included in the docs at
> > https://ffmpeg.org/ffmpeg-all.html#colormatrix.
> > Therefore, I've added the missing options.
> >
> > I've attached the patch (via git format-patch -1), here are the contents
> > directly:
> >
> > From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
> > > From: Katherine Nagels 
> > > Date: Sun, 12 Mar 2017 09:39:47 +1300
> > > Subject: [PATCH] Update colormatrix values ---
> > > doc/filters.texi | 15 ---
> > > 1 file changed, 12 insertions(+), 3 deletions(-) diff --git
> > > a/doc/filters.texi b/doc/filters.texi
> > > index 192a81a..950ff81 100644
> > > --- a/doc/filters.texi
> > > +++ b/doc/filters.texi
> > > @@ -5260,15 +5260,24 @@ The accepted values are:
> > > @item bt709
> > > BT.709
> > >
> > > +@item fcc
> > > +FCC
> > > +
> > > @item bt601
> > > BT.601
> > >
> > > +@item bt470
> > > +BT.470
> > > +
> > > +@item bt470bg
> > > +BT.470BG
> > > +
> > > +@item smpte170m
> > > +SMPTE-170M
> > > +
> > > @item smpte240m
> > > SMPTE-240M
> > >
> > > -@item fcc
> > > -FCC
> > > -
> > > @item bt2020
> > > BT.2020
> > > @end table
> > > --
> > > 2.7.4
> >
> >
> > Thank you.
> >
> > Best, Katherine
>
> >  filters.texi |   15 ---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> > 836420957f84fcf3b9c9253d2419d632520b05c2  0001-Update-colormatrix-
> values.patch
> > From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
> > From: Katherine Nagels 
> > Date: Sun, 12 Mar 2017 09:39:47 +1300
>
> > Subject: [PATCH] Update colormatrix values
>
> This commit message does not comply to to our formating requiremets
> its also too general. "update" can mean alot
>
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No snowflake in an avalanche ever feels responsible. -- Voltaire
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 99c2763fe7e455bf1d5acd68ae7080509da89ce1 Mon Sep 17 00:00:00 2001
From: kfrn 
Date: Mon, 13 Mar 2017 11:57:11 +1300
Subject: [PATCH] doc/filters: Add colourspace values for colormatrix filter

---
 doc/filters.texi | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 192a81a..950ff81 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5260,15 +5260,24 @@ The accepted values are:
 @item bt709
 BT.709
 
+@item fcc
+FCC
+
 @item bt601
 BT.601
 
+@item bt470
+BT.470
+
+@item bt470bg
+BT.470BG
+
+@item smpte170m
+SMPTE-170M
+
 @item smpte240m
 SMPTE-240M
 
-@item fcc
-FCC
-
 @item bt2020
 BT.2020
 @end table
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] Change type of spherical stuff to uint32_t

2017-03-12 Thread James Almer
On 3/12/2017 6:16 PM, Michael Niedermayer wrote:
> Using the same type across platforms is more robust and avoids platform
> specific issues from differences in range.
> Also fixed point integers are on a semantical level not size_t
> 
> Previous version reviewed-by: James Almer 
> Signed-off-by: Michael Niedermayer 
> ---
>  ffprobe.c |  2 +-
>  libavformat/dump.c|  6 +++---
>  libavutil/spherical.c |  6 +++---
>  libavutil/spherical.h | 16 
>  4 files changed, 15 insertions(+), 15 deletions(-)

Needs FATE update.

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


Re: [FFmpeg-devel] [PATCH] Change type of spherical stuff to uint32_t

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

On Sun, Mar 12, 2017 at 7:32 PM, James Almer  wrote:

> On 3/12/2017 6:16 PM, Michael Niedermayer wrote:
> > Using the same type across platforms is more robust and avoids platform
> > specific issues from differences in range.
> > Also fixed point integers are on a semantical level not size_t
> >
> > Previous version reviewed-by: James Almer 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  ffprobe.c |  2 +-
> >  libavformat/dump.c|  6 +++---
> >  libavutil/spherical.c |  6 +++---
> >  libavutil/spherical.h | 16 
> >  4 files changed, 15 insertions(+), 15 deletions(-)
>
> Needs FATE update.


Since this is Vittorio's code, it's probably good to ask him [CC]? From
memory, he seemed to prefer size_t.

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


Re: [FFmpeg-devel] configure: clang -Oz for small size build to reduce size further

2017-03-12 Thread Wang Bin
How to benchmark codecs?
Here is my configuration and result size.  The total size of -Oz static or
dynamic libraries is about 1M smaller.

configure --disable-debug --enable-shared --enable-runtime-cpudetect
--enable-hwaccels --enable-avresample --disable-postproc
--install_name_dir=@rpath --enable-pic
--extra-cflags="-mmacosx-version-min=10.7"
--extra-ldflags="-mmacosx-version-min=10.7 -Wl,-rpath,@loader_path
-Wl,-rpath,@loader_path/../Frameworks -Wl,-rpath,@loader_path/lib
-Wl,-rpath,@loader_path/../lib" --enable-small

-Os
-rwxr-xr-x  1 501  20  10545284  3 10 11:11 ./libavcodec.57.64.101.dylib
-rw-r--r--  1 501  20  13434432  3 10 11:11 ./libavcodec.a
-rwxr-xr-x  1 501  20  57784  3 10 11:11 ./libavdevice.57.1.100.dylib
-rw-r--r--  1 501  20  53464  3 10 11:11 ./libavdevice.a
-rwxr-xr-x  1 501  20  1564396  3 10 11:11 ./libavfilter.6.65.100.dylib
-rw-r--r--  1 501  20  2268040  3 10 11:11 ./libavfilter.a
-rwxr-xr-x  1 501  20  1774664  3 10 11:11 ./libavformat.57.56.101.dylib
-rw-r--r--  1 501  20  2823792  3 10 11:11 ./libavformat.a
-rwxr-xr-x  1 501  20  117700  3 10 11:11 ./libavresample.3.1.0.dylib
-rw-r--r--  1 501  20  162760  3 10 11:11 ./libavresample.a
-rwxr-xr-x  1 501  20  298520  3 10 11:11 ./libavutil.55.34.101.dylib
-rw-r--r--  1 501  20  395512  3 10 11:11 ./libavutil.a
-rwxr-xr-x  1 501  20  106968  3 10 11:11 ./libswresample.2.3.100.dylib
-rw-r--r--  1 501  20  153400  3 10 11:11 ./libswresample.a
-rwxr-xr-x  1 501  20  497460  3 10 11:11 ./libswscale.4.2.100.dylib
-rw-r--r--  1 501  20  614184  3 10 11:11 ./libswscale.a

-Oz
-rwxr-xr-x  1 501  20  9665732  3 10 11:39 ./libavcodec.57.64.101.dylib
-rw-r--r--  1 501  20  12597816  3 10 11:39 ./libavcodec.a
-rwxr-xr-x  1 501  20  57736  3 10 11:39 ./libavdevice.57.1.100.dylib
-rw-r--r--  1 501  20  53376  3 10 11:39 ./libavdevice.a
-rwxr-xr-x  1 501  20  1515268  3 10 11:39 ./libavfilter.6.65.100.dylib
-rw-r--r--  1 501  20  2223024  3 10 11:39 ./libavfilter.a
-rwxr-xr-x  1 501  20  1733824  3 10 11:39 ./libavformat.57.56.101.dylib
-rw-r--r--  1 501  20  2787728  3 10 11:39 ./libavformat.a
-rwxr-xr-x  1 501  20  113652  3 10 11:39 ./libavresample.3.1.0.dylib
-rw-r--r--  1 501  20  160920  3 10 11:39 ./libavresample.a
-rwxr-xr-x  1 501  20  294424  3 10 11:39 ./libavutil.55.34.101.dylib
-rw-r--r--  1 501  20  390624  3 10 11:39 ./libavutil.a
-rwxr-xr-x  1 501  20  102864  3 10 11:39 ./libswresample.2.3.100.dylib
-rw-r--r--  1 501  20  148336  3 10 11:39 ./libswresample.a
-rwxr-xr-x  1 501  20  481020  3 10 11:39 ./libswscale.4.2.100.dylib
-rw-r--r--  1 501  20  599000  3 10 11:39 ./libswscale.a
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/4] avcodec/simple_idct_template: Fix several integer overflows

2017-03-12 Thread Michael Niedermayer
Benchmarks with START_TIMER indicate that the code is faster with unsigned, 
(that is
with the patch), there was quite some fluctuation in the numbers so this may be 
just
random

Fixes: 811/clusterfuzz-testcase-6465493076541440

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/simple_idct_template.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/libavcodec/simple_idct_template.c 
b/libavcodec/simple_idct_template.c
index f5744e0a39..c669767761 100644
--- a/libavcodec/simple_idct_template.c
+++ b/libavcodec/simple_idct_template.c
@@ -112,7 +112,7 @@ static inline void FUNC(idctRowCondDC_extrashift)(int16_t 
*row, int extra_shift)
 static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
 #endif
 {
-int a0, a1, a2, a3, b0, b1, b2, b3;
+SUINT a0, a1, a2, a3, b0, b1, b2, b3;
 
 #if HAVE_FAST_64BIT
 #define ROW0_MASK (0xLL << 48 * HAVE_BIGENDIAN)
@@ -187,14 +187,14 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int 
extra_shift)
 MAC(b3, -W1, row[7]);
 }
 
-row[0] = (a0 + b0) >> (ROW_SHIFT + extra_shift);
-row[7] = (a0 - b0) >> (ROW_SHIFT + extra_shift);
-row[1] = (a1 + b1) >> (ROW_SHIFT + extra_shift);
-row[6] = (a1 - b1) >> (ROW_SHIFT + extra_shift);
-row[2] = (a2 + b2) >> (ROW_SHIFT + extra_shift);
-row[5] = (a2 - b2) >> (ROW_SHIFT + extra_shift);
-row[3] = (a3 + b3) >> (ROW_SHIFT + extra_shift);
-row[4] = (a3 - b3) >> (ROW_SHIFT + extra_shift);
+row[0] = (int)(a0 + b0) >> (ROW_SHIFT + extra_shift);
+row[7] = (int)(a0 - b0) >> (ROW_SHIFT + extra_shift);
+row[1] = (int)(a1 + b1) >> (ROW_SHIFT + extra_shift);
+row[6] = (int)(a1 - b1) >> (ROW_SHIFT + extra_shift);
+row[2] = (int)(a2 + b2) >> (ROW_SHIFT + extra_shift);
+row[5] = (int)(a2 - b2) >> (ROW_SHIFT + extra_shift);
+row[3] = (int)(a3 + b3) >> (ROW_SHIFT + extra_shift);
+row[4] = (int)(a3 - b3) >> (ROW_SHIFT + extra_shift);
 }
 
 #define IDCT_COLS do {  \
@@ -253,25 +253,25 @@ static inline void FUNC(idctSparseCol_extrashift)(int16_t 
*col)
 static inline void FUNC(idctSparseColPut)(pixel *dest, int line_size,
   int16_t *col)
 {
-int a0, a1, a2, a3, b0, b1, b2, b3;
+SUINT a0, a1, a2, a3, b0, b1, b2, b3;
 
 IDCT_COLS;
 
-dest[0] = av_clip_pixel((a0 + b0) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a0 + b0) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a1 + b1) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a1 + b1) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a2 + b2) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a2 + b2) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a3 + b3) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a3 + b3) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a3 - b3) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a3 - b3) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a2 - b2) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a2 - b2) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a1 - b1) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a1 - b1) >> COL_SHIFT);
 dest += line_size;
-dest[0] = av_clip_pixel((a0 - b0) >> COL_SHIFT);
+dest[0] = av_clip_pixel((int)(a0 - b0) >> COL_SHIFT);
 }
 
 static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size,
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 1/4] avcodec/wavpack: Fix runtime error: shift exponent 137 is too large for 32-bit type 'int'

2017-03-12 Thread Michael Niedermayer
Fixes: 808/clusterfuzz-testcase-4715513349406720

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

diff --git a/libavcodec/wavpack.h b/libavcodec/wavpack.h
index 445d593c3b..c949390f51 100644
--- a/libavcodec/wavpack.h
+++ b/libavcodec/wavpack.h
@@ -171,7 +171,7 @@ static av_always_inline int wp_exp2(int16_t val)
 
 res   = wp_exp2_table[val & 0xFF] | 0x100;
 val >>= 8;
-if (val > 31)
+if (val > 31U)
 return INT_MIN;
 res   = (val > 9) ? (res << (val - 9)) : (res >> (9 - val));
 return neg ? -res : res;
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 2/4] avcodec/targa: Skip hflip on blank images

2017-03-12 Thread Michael Niedermayer
Fixes: timeout with 810/clusterfuzz-testcase-5249282825256960

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/targa.c | 41 +
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index 215c0f51f6..93e0ef7905 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -265,32 +265,33 @@ static int decode_frame(AVCodecContext *avctx,
 line = advance_line(dst, line, stride, &y, h, interleave);
 } while (line);
 }
-}
 
-if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
-int x;
-for (y = 0; y < h; y++) {
-void *line = &p->data[0][y * p->linesize[0]];
-for (x = 0; x < w >> 1; x++) {
-switch (bpp) {
-case 32:
-FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t 
*)line)[w - x - 1]);
-break;
-case 24:
-FFSWAP(uint8_t, ((uint8_t *)line)[3 * x], ((uint8_t 
*)line)[3 * w - 3 * x - 3]);
-FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t 
*)line)[3 * w - 3 * x - 2]);
-FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t 
*)line)[3 * w - 3 * x - 1]);
-break;
-case 16:
-FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t 
*)line)[w - x - 1]);
-break;
-case 8:
-FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[w 
- x - 1]);
+if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
+int x;
+for (y = 0; y < h; y++) {
+void *line = &p->data[0][y * p->linesize[0]];
+for (x = 0; x < w >> 1; x++) {
+switch (bpp) {
+case 32:
+FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t 
*)line)[w - x - 1]);
+break;
+case 24:
+FFSWAP(uint8_t, ((uint8_t *)line)[3 * x], 
((uint8_t *)line)[3 * w - 3 * x - 3]);
+FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], 
((uint8_t *)line)[3 * w - 3 * x - 2]);
+FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], 
((uint8_t *)line)[3 * w - 3 * x - 1]);
+break;
+case 16:
+FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t 
*)line)[w - x - 1]);
+break;
+case 8:
+FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t 
*)line)[w - x - 1]);
+}
 }
 }
 }
 }
 
+
 *got_frame = 1;
 
 return avpkt->size;
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 4/4] avcodec/wavpack: Fix runtime error: shift exponent 32 is too large for 32-bit type 'int'

2017-03-12 Thread Michael Niedermayer
Fixes: 822/clusterfuzz-testcase-4873433189974016

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

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 943e46a25c..bc94b27c04 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -846,7 +846,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int 
block_no,
 continue;
 }
 bytestream2_get_buffer(&gb, val, 4);
-if (val[0] > 32) {
+if (val[0] > 31) {
 av_log(avctx, AV_LOG_ERROR,
"Invalid INT32INFO, extra_bits = %d (> 32)\n", val[0]);
 continue;
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH] libavfilter/af_ambisonic.c Added File for Ambisonic Filter

2017-03-12 Thread Sanchit Sinha
On Mon, Mar 13, 2017 at 2:36 AM, Paul B Mahol  wrote:

> On 3/12/17, Sanchit Sinha  wrote:
> > Any changes required in this one?
>
> Please do not top post.
>
> Expect vertical alignment, no changes are needed.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From dbfed83e1f6ed215025878e3e0e27b55f86bb29c Mon Sep 17 00:00:00 2001
From: Sanchit Sinha 
Date: Mon, 13 Mar 2017 08:39:43 +0530
Subject: [PATCH] lavf/af_ambisonic.c added lavf/Makefile and allfilters.c
 updated changelog update

Signed-off-by: Sanchit Sinha 
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 122 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 125 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..4ebbd5a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..59c99f3
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * Copyright (c) 2017 Paul B Mahol
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+const AVClass *class;
+} AmbisonicContext;
+
+static const AVOption ambisonic_options[] = {
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layout = NULL;
+int ret;
+
+if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+(ret = ff_set_common_formats (ctx, formats )) < 0 ||
+(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_4POINT0)) < 0 ||
+(ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+return ret;
+
+formats = ff_all_samplerates();
+return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterContext *ctx = inlink->dst;
+AVFilterLink *outlink = ctx->outputs[0];
+AVFrame *out;
+int itr;
+float *w,*x,*y,*c1,*c2,*c3,*c4;
+float root8 = sqrt(8);
+float lf=0,lb=0,rb=0,rf=0;
+
+if (av_frame_is_writable(in)) {
+out = in;
+} else {
+out = ff_get_audio_buffer(inlink, in->nb_samples);
+if (!out){
+av_frame_free(&in);
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+}
+
+w=(float *)in->extended_data[0];
+x=(float *)in->extended_data[1];
+y=(float *)in->extended_data[2];
+c1=(float *)out->extended_data[0];
+c2=(float *)out->extended_data[1];
+c3=(float *)out->extended_data[2];
+c4=(float *)out->extended_data[3];
+
+for(itr=0;itrnb_samples;itr++){
+lf = root8 * (2*(w[itr])+x[itr]+y[itr]);
+lb = root8 * (2*(w[itr])-x[itr]+y[itr]);
+rb = root8 * (2*(w[itr])-x[itr]-y[itr]);
+rf = root8 * (2*(w[itr])+x[itr]-y[itr]);
+c1[itr] = lf;
+c2[itr] = rf;
+c3[itr] = lb;
+c4[itr] = rb;

Re: [FFmpeg-devel] [PATCH] Change type of spherical stuff to uint32_t

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 08:54:07PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Mar 12, 2017 at 7:32 PM, James Almer  wrote:
> 
> > On 3/12/2017 6:16 PM, Michael Niedermayer wrote:
> > > Using the same type across platforms is more robust and avoids platform
> > > specific issues from differences in range.
> > > Also fixed point integers are on a semantical level not size_t
> > >
> > > Previous version reviewed-by: James Almer 
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  ffprobe.c |  2 +-
> > >  libavformat/dump.c|  6 +++---
> > >  libavutil/spherical.c |  6 +++---
> > >  libavutil/spherical.h | 16 
> > >  4 files changed, 15 insertions(+), 15 deletions(-)
> >
> > Needs FATE update.
> 
> 
> Since this is Vittorio's code, it's probably good to ask him [CC]? From

yes,

semi on topic: but i think people interrested in FFmpeg
development and the direction the code goes should subscribe to
ffmpeg-devel. This CC-ing is not too practical

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-12 Thread Marton Balint



On Sun, 12 Mar 2017, Paul B Mahol wrote:


On 3/12/17, Nicolas George  wrote:

Le duodi 22 ventose, an CCXXV, Paul B Mahol a ecrit :

I absolutely disagree with you on this one.


I may have formulated the things a bit sarcastically, but the technical
facts remain, and you need to address them.


Yes, I addressed this specific one - Ignoring it.

Dumping all data because of single corrupted byte is bad idea.


You should set either AVFrame->flags to AV_FRAME_FLAG_CORRUPT or 
AVFrame->decode_error_flags to something, so the API user can distinguish 
between a frame with possible guessed colors and a frame without such 
guesses.


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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 03:04:04AM +0100, Michael Niedermayer wrote:
> Fixes: 764/clusterfuzz-testcase-6273034652483584
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mpeg12dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

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

No great genius has ever existed without some touch of madness. -- 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/3] avcodec/rv34: Fix runtime error: signed integer overflow: 36880 * 66288 cannot be represented in type 'int'

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 03:04:05AM +0100, Michael Niedermayer wrote:
> Fixes: 768/clusterfuzz-testcase-4807444305805312
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/rv34.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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/3] avcodec/vp6: clear dimensions on failed resolution change in vp6_parse_header()

2017-03-12 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 03:04:06AM +0100, Michael Niedermayer wrote:
> Fixes: 807/clusterfuzz-testcase-6470061042696192
> Fixes null pointer dereference
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vp6.c | 13 -
>  1 file changed, 8 insertions(+), 5 deletions(-)

applied

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


[FFmpeg-devel] [PATCH] avcodec/videotoolbox: add rc_max_bitrate control into videotoolbox

2017-03-12 Thread Steven Liu
add kVTCompressionPropertyKey_DataRateLimits support by rc_max_bitrate

Signed-off-by: Steven Liu 
---
 libavcodec/videotoolboxenc.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 005f5d6..9738152 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -898,6 +898,7 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 {
 VTEncContext *vtctx = avctx->priv_data;
 SInt32   bit_rate = avctx->bit_rate;
+SInt32   max_rate = avctx->rc_max_rate;
 CFNumberRef  bit_rate_num;
 
 int status = VTCompressionSessionCreate(kCFAllocatorDefault,
@@ -938,6 +939,32 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+int64_t bytes_per_second_value = max_rate >> 3;
+CFNumberRef bytes_per_second = CFNumberCreate(kCFAllocatorDefault,
+  kCFNumberSInt64Type,
+  &bytes_per_second_value);
+int64_t two_second_value = 2;
+CFNumberRef two_second = CFNumberCreate(kCFAllocatorDefault,
+kCFNumberSInt64Type,
+&two_second_value);
+const void* nums[2] = { bytes_per_second, two_second };
+CFArrayRef data_rate_limits = CFArrayCreate(kCFAllocatorDefault,
+nums,
+2,
+&kCFTypeArrayCallBacks);
+
+status = VTSessionSetProperty((VTCompressionSessionRef)(vtctx->session),
+  kVTCompressionPropertyKey_DataRateLimits,
+  data_rate_limits);
+CFRelease(bytes_per_second);
+CFRelease(two_second);
+CFRelease(data_rate_limits);
+
+if (status) {
+av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate property: 
%d\n", status);
+return AVERROR_EXTERNAL;
+}
+
 if (profile_level) {
 status = VTSessionSetProperty(vtctx->session,
   kVTCompressionPropertyKey_ProfileLevel,
-- 
2.10.1.382.ga23ca1b.dirty



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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: second_levels flags process function extract

2017-03-12 Thread Steven Liu
2017-03-11 12:31 GMT+08:00 Steven Liu :

> the SECOND_LEVEL* flags process and name is too long
> extract all of them output to funtions, make code clear
>
> Signed-off-by: Steven Liu 
> ---
>  libavformat/hlsenc.c | 239 +-
> -
>  1 file changed, 136 insertions(+), 103 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b8122f1..5df2514 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -470,17 +470,9 @@ static HLSSegment *find_segment_by_filename(HLSSegment
> *segment, const char *fil
>  return (HLSSegment *) NULL;
>  }
>
> -/* Create a new segment and append it to the segment list */
> -static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls,
> double duration,
> -  int64_t pos, int64_t size)
> +static int sls_flags_filename_process(struct AVFormatContext *s,
> HLSContext *hls, HLSSegment *en, double duration,
> + int64_t pos, int64_t size)
>  {
> -HLSSegment *en = av_malloc(sizeof(*en));
> -const char  *filename;
> -int ret;
> -
> -if (!en)
> -return AVERROR(ENOMEM);
> -
>  if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE |
> HLS_SECOND_LEVEL_SEGMENT_DURATION)) &&
>  strlen(hls->current_segment_final_filename_fmt)) {
>  av_strlcpy(hls->avf->filename, 
> hls->current_segment_final_filename_fmt,
> sizeof(hls->avf->filename));
> @@ -521,7 +513,127 @@ static int hls_append_segment(struct AVFormatContext
> *s, HLSContext *hls, double
>  av_free(filename);
>  }
>  }
> +return 0;
> +}
> +
> +static int sls_flag_check_duration_size_index(HLSContext *hls)
> +{
> +int ret = 0;
> +
> +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) {
> + av_log(hls, AV_LOG_ERROR,
> +"second_level_segment_duration hls_flag requires
> use_localtime to be true\n");
> + ret = AVERROR(EINVAL);
> +}
> +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) {
> + av_log(hls, AV_LOG_ERROR,
> +"second_level_segment_size hls_flag requires
> use_localtime to be true\n");
> + ret = AVERROR(EINVAL);
> +}
> +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_INDEX) {
> +av_log(hls, AV_LOG_ERROR,
> +   "second_level_segment_index hls_flag requires
> use_localtime to be true\n");
> +ret = AVERROR(EINVAL);
> +}
> +
> +return ret;
> +}
> +
> +static int sls_flag_check_duration_size(HLSContext *hls)
> +{
> +const char *proto = avio_find_protocol_name(hls->basename);
> +int segment_renaming_ok = proto && !strcmp(proto, "file");
> +int ret = 0;
> +
> +if ((hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) &&
> !segment_renaming_ok) {
> + av_log(hls, AV_LOG_ERROR,
> +"second_level_segment_duration hls_flag works only with
> file protocol segment names\n");
> + ret = AVERROR(EINVAL);
> +}
> +if ((hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) &&
> !segment_renaming_ok) {
> + av_log(hls, AV_LOG_ERROR,
> +"second_level_segment_size hls_flag works only with file
> protocol segment names\n");
> + ret = AVERROR(EINVAL);
> +}
> +
> +return ret;
> +}
> +
> +static void sls_flag_file_rename(HLSContext *hls, char *old_filename) {
> +if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE |
> HLS_SECOND_LEVEL_SEGMENT_DURATION)) &&
> +strlen(hls->current_segment_final_filename_fmt)) {
> +ff_rename(old_filename, hls->avf->filename, hls);
> +}
> +}
> +
> +static int sls_flag_use_localtime_filename(AVFormatContext *oc,
> HLSContext *c)
> +{
> +if (c->flags & HLS_SECOND_LEVEL_SEGMENT_INDEX) {
> +char * filename = av_strdup(oc->filename);  // %%d will be %d
> after strftime
> +if (!filename)
> +return AVERROR(ENOMEM);
> +if (replace_int_data_in_filename(oc->filename,
> sizeof(oc->filename),
> +#if FF_API_HLS_WRAP
> +filename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence)
> < 1) {
> +#else
> +filename, 'd', c->sequence) < 1) {
> +#endif
> +av_log(c, AV_LOG_ERROR, "Invalid second level segment
> filename template '%s', "
> +"you can try to remove second_level_segment_index
> flag\n",
> +   filename);
> +av_free(filename);
> +return AVERROR(EINVAL);
> +}
> +av_free(filename);
> +}
> +if (c->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE |
> HLS_SECOND_LEVEL_SEGMENT_DURATION)) {
> +av_strlcpy(c->current_segment_final_filename_fmt, oc->filename,
> +   sizeof(c->current_segment_final_filename_fmt));
> +if (c->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) {
> +char * filename = av_strdup(oc->filename);  // %%s will be %s
> after strftime
> +if (!filename)
> +return AVERROR(ENOMEM);
> +