Re: [FFmpeg-devel] Ideas to replace the options system

2015-12-08 Thread Tobias Rapp

On 05.12.2015 00:54, James Darnley wrote:

On 2015-12-04 15:33, Nicolas George wrote:

Why do we need a new options system?

   Most importantly: escaping hell


OMG yes!  I have seen several times the amount of backslashes Windows
users are forced to use to provide a path to some of the filters.

You raise a lot of good points that need to be considered from design,
user-dev, and user-user perspectives.  I haven't read through in great
detail but did glance at the heading and TL;DRs.

I have a couple of probably controversial opinions about this:

- Only allow "simple" string arguments on the command line.  If escapes
or complexity is needed then force people to use a script file.

- Deprecate and remove the expression evaluation that currently exists
and replace it with an existing scripting language.  Sorry to the people
that worked hard on it.  It works fine.  Perhaps the escaping hell
causes my bad perception of it.

[...]
I think that replacing the option system with a scripting language will 
put the entry level too high for most users. The basic problem seems to 
be how to better represent option hierarchy. Maybe some JSON-like syntax 
would make it simpler:


ffmpeg -f lavfi -i '{"aevalsrc": {"exprs": ["sin(420*2*PI*t)", 
"cos(430*2*PI*t)"], "c": ["FC", "BC"]}, "s": 48000}' ...


If you have to escape double quote characters in your shell environment 
it gets really worse, though. So likely the syntax should be adjusted to 
allow for both, single and double quotes. Further it would be nice to 
allow the key being non-quoted:


ffmpeg -f lavfi -i "{aevalsrc: {exprs: ['sin(420*2*PI*t)', 
'cos(430*2*PI*t)'], c: ['FC', 'BC']}, s: 48000}" ...


Just some idea.

Regards,
Tobias

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


[FFmpeg-devel] [PATCHv2] avcodec/h264: Set CORRUPT flag on output frames that are not fully recovered

2015-12-08 Thread Sebastian Dröge
From: Sebastian Dröge 

In the merge commit 78265fcfeee153e5e26ad4dbc7831a84ade447d6 this behaviour
was broken and the CORRUPT flag would never ever be set on a frame. However
the flag on the AVCodecContext was taken into account properly, including
AV_CODEC_FLAG2_SHOW_ALL.

The reason for this was that the recovered field of the next output picture
was always set to TRUE whenever one of the two AVCodecContext flags was set,
which made it impossible to detect later, before outputting, if the frame was
really recovered or not. Now don't set it to TRUE unless the frame is really
recovered and check the AVCodecContext flags right before outputting.

Signed-off-by: Sebastian Dröge 
---
 libavcodec/h264.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6453c44..3d11328 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1556,8 +1556,6 @@ again:
 // "recovered".
 if (h->nal_unit_type == NAL_IDR_SLICE)
 h->frame_recovered |= FRAME_RECOVERED_IDR;
-h->frame_recovered |= 3*!!(avctx->flags2 & 
AV_CODEC_FLAG2_SHOW_ALL);
-h->frame_recovered |= 3*!!(avctx->flags & 
AV_CODEC_FLAG_OUTPUT_CORRUPT);
 #if 1
 h->cur_pic_ptr->recovered |= h->frame_recovered;
 #else
@@ -1863,7 +1861,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void 
*data,
 
 /* Wait for second field. */
 *got_frame = 0;
-if (h->next_output_pic && (
+if (h->next_output_pic && ((avctx->flags & 
AV_CODEC_FLAG_OUTPUT_CORRUPT) ||
+   (avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) ||
h->next_output_pic->recovered)) {
 if (!h->next_output_pic->recovered)
 h->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;
-- 
2.6.2

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264: Set CORRUPT flag on output frames that are not fully recovered

2015-12-08 Thread Sebastian Dröge
On Di, 2015-12-08 at 01:28 +0100, Michael Niedermayer wrote:
> 
> this breaks "-flags2 showall", many (ugly) frames are no longer shown
> one sample showing this is:

Indeed, I changed behaviour here. It should work the same as before
now.

Before and after my patch there is no difference
between AV_CODEC_FLAG2_SHOW_ALL and AV_CODEC_FLAG_OUTPUT_CORRUPT
though.

signature.asc
Description: This is a digitally signed message part
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] HEVC DSP and x86 MC SIMD improvements from Libav

2015-12-08 Thread Hendrik Leppkes
Hey guys,

Libav pushed some changes to the HEVC DSP and a new set of x86 MC
SIMD, which of course conflicts with our version of it.

From a quick cursory look, their implementation seems to have a bunch
of advantages, namely 32-bit support in many functions, and SSE2
implementations while ours is all SSE4 or up.
Our code instead has AVX2 variants, which theirs does not have (if
that actually is faster, I cannot say)

Since I lack the expertise to do this properly on my own, I'll not be
merging any of these changes.

If any of our resident SIMD experts have an interest in adopting their
improvements, I'm willing to help out as best as I can.

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


[FFmpeg-devel] [PATCH] lavf/img2enc: add atomic_writing option

2015-12-08 Thread Clément Bœsch
From: Clément Bœsch 

This behaviour change caused a regression on our side recently, we might
want to disable the option by default.
---
 libavformat/img2enc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index c2e6e4d..9291802 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -73,7 +73,8 @@ static int write_header(AVFormatContext *s)
  && desc->nb_components >= 3;
 }
 
-img->use_rename = proto && !strcmp(proto, "file");
+img->use_rename = img->use_rename < 0 ? proto && !strcmp(proto, "file")
+  : img->use_rename;
 
 return 0;
 }
@@ -206,6 +207,7 @@ static const AVOption muxoptions[] = {
 { "update",   "continuously overwrite one file", OFFSET(update),  
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0,   1, ENC },
 { "start_number", "set first number in the sequence", OFFSET(img_number), 
AV_OPT_TYPE_INT,  { .i64 = 1 }, 0, INT_MAX, ENC },
 { "strftime", "use strftime for filename", OFFSET(use_strftime),  
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
+{ "atomic_writing", "write files atomically (using temporary files and 
renames)", OFFSET(use_rename), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, ENC },
 { NULL },
 };
 
-- 
2.6.3

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


Re: [FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-08 Thread Lvqier

Hi Hendrik,

The attached is another patch which uses av_reallocp to fix this issue.

/Best Regards,
lvqier - lvq...@gmail.com 
/

**
青春如烟,唱一首笑忘歌

On 12/5/15 11:23 PM, Lvqier wrote:

Ok, I will try av_reallocp

/Best Regards,
lvqier - lvq...@gmail.com 
/
**
青春如烟,唱一首笑忘歌
On 12/5/15 7:27 PM, Hendrik Leppkes wrote:

On Sat, Dec 5, 2015 at 11:02 AM, Qier LU  wrote:

Hi Michael,

The attached is against git master.


The patch is probably fine now. Maybe it would be saner to actually
use av_reallocp on the filename to avoid having to allocate and free
it in different places?

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




diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8432d0f..f230251 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -206,8 +206,7 @@ static int set_segment_filename(AVFormatContext *s)
 if (seg->entry_prefix)
 size += strlen(seg->entry_prefix);
 
-seg->cur_entry.filename = av_mallocz(size);
-if (!seg->cur_entry.filename)
+if (av_reallocp(&seg->cur_entry.filename, size))
 return AVERROR(ENOMEM);
 snprintf(seg->cur_entry.filename, size, "%s%s",
  seg->entry_prefix ? seg->entry_prefix : "",
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-08 Thread Hendrik Leppkes
On Tue, Dec 8, 2015 at 11:19 AM, Lvqier  wrote:
> Hi Hendrik,
>
> The attached is another patch which uses av_reallocp to fix this issue.
>

Thanks, that looks almost good. But you should check for a negative
return value, as all errors are negative.

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


Re: [FFmpeg-devel] Ideas to replace the options system

2015-12-08 Thread Paul B Mahol
On 12/4/15, Nicolas George  wrote:
> Hi.
>
> This is a rather long explanation on ideas I have to replace the options
> system with something better. I will not work on it before I have made
> significant progress on de-recursiving lavfi, but I can still think of it
> and mature its design while walking in the street or waiting for the
> subway.
>
> And of course, if someone else wants to start working on something similar,
> so much the better.
>
> TL;DR: I have put small summaries marked by this tag at the end of most
> long
> sections.

I would like to add dynamic options changing without need to reconfigure graph.

Current process_command way is to much generic and hard to maintain.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-08 Thread Lvqier

On 12/8/15 6:26 PM, Hendrik Leppkes wrote:

On Tue, Dec 8, 2015 at 11:19 AM, Lvqier  wrote:

Hi Hendrik,

 The attached is another patch which uses av_reallocp to fix this issue.


Thanks, that looks almost good. But you should check for a negative
return value, as all errors are negative.
Do you mean that the set_segment_filename function should return the 
value which returns from av_reallocp instead of AVERROR(ENOMEM) when it 
fails?


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


--
/Best Regards,
lvqier - lvq...@gmail.com 
/

**
青春如烟,唱一首笑忘歌

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


Re: [FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-08 Thread Hendrik Leppkes
On Tue, Dec 8, 2015 at 11:46 AM, Lvqier  wrote:
> On 12/8/15 6:26 PM, Hendrik Leppkes wrote:
>>
>> On Tue, Dec 8, 2015 at 11:19 AM, Lvqier  wrote:
>>>
>>> Hi Hendrik,
>>>
>>>  The attached is another patch which uses av_reallocp to fix this
>>> issue.
>>>
>> Thanks, that looks almost good. But you should check for a negative
>> return value, as all errors are negative.
>
> Do you mean that the set_segment_filename function should return the value
> which returns from av_reallocp instead of AVERROR(ENOMEM) when it fails?

That would be an option too, but right now you just do
if(av_reallop(..)), at the least this should be if (av_reallocp(...) <
0)

or even better:
ret = av_reallocp(...);
if (ret < 0)
return ret;


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


Re: [FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-08 Thread Lvqier

On 12/8/15 7:05 PM, Hendrik Leppkes wrote:

On Tue, Dec 8, 2015 at 11:46 AM, Lvqier  wrote:

On 12/8/15 6:26 PM, Hendrik Leppkes wrote:

On Tue, Dec 8, 2015 at 11:19 AM, Lvqier  wrote:

Hi Hendrik,

  The attached is another patch which uses av_reallocp to fix this
issue.


Thanks, that looks almost good. But you should check for a negative
return value, as all errors are negative.

Do you mean that the set_segment_filename function should return the value
which returns from av_reallocp instead of AVERROR(ENOMEM) when it fails?

That would be an option too, but right now you just do
if(av_reallop(..)), at the least this should be if (av_reallocp(...) <
0)

or even better:
ret = av_reallocp(...);
if (ret < 0)
 return ret;
Thank you, I will follow your advice. Please help review this version. I 
have studied some code where av_reallocp is used before sending it out.


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


--
/Best Regards,
lvqier - lvq...@gmail.com 
/

**
青春如烟,唱一首笑忘歌

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8432d0f..0c1f633 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -183,6 +183,7 @@ static int set_segment_filename(AVFormatContext *s)
 SegmentContext *seg = s->priv_data;
 AVFormatContext *oc = seg->avf;
 size_t size;
+int ret;
 
 if (seg->segment_idx_wrap)
 seg->segment_idx %= seg->segment_idx_wrap;
@@ -206,9 +207,8 @@ static int set_segment_filename(AVFormatContext *s)
 if (seg->entry_prefix)
 size += strlen(seg->entry_prefix);
 
-seg->cur_entry.filename = av_mallocz(size);
-if (!seg->cur_entry.filename)
-return AVERROR(ENOMEM);
+if ((ret = av_reallocp(&seg->cur_entry.filename, size)) < 0)
+return ret;
 snprintf(seg->cur_entry.filename, size, "%s%s",
  seg->entry_prefix ? seg->entry_prefix : "",
  av_basename(oc->filename));
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter: add swaprect filter

2015-12-08 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi  |  54 ++
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_swaprect.c | 267 ++
 4 files changed, 323 insertions(+)
 create mode 100644 libavfilter/vf_swaprect.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 274532d..37c9c2b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10897,6 +10897,60 @@ Interpolate) pixel art scaling algorithm.
 
 Useful for enlarging pixel art images without reducing sharpness.
 
+@section swaprect
+
+Swap two rectangular objects in video.
+
+This filter accepts the following options:
+
+@table @option
+@item w
+Set object width.
+
+@item h
+Set object height.
+
+@item x1
+Set 1st rect x coordinate.
+
+@item y1
+Set 1st rect y coordinate.
+
+@item x2
+Set 2nd rect x coordinate.
+
+@item y2
+Set 2nd rect y coordinate.
+
+All expressions are evaluated once for each frame.
+@end table
+
+The all options are expressions containing the following constants:
+
+@table @option
+@item w
+@item h
+The input width and height.
+
+@item a
+same as @var{w} / @var{h}
+
+@item sar
+input sample aspect ratio
+
+@item dar
+input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
+
+@item n
+The number of the input frame, starting from 0.
+
+@item t
+The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
+
+@item pos
+the position in the file of the input frame, NAN if unknown
+@end table
+
 @section swapuv
 Swap U & V plane.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 8884d1d..4d1376b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -233,6 +233,7 @@ OBJS-$(CONFIG_SSIM_FILTER)   += vf_ssim.o 
dualinput.o framesync.
 OBJS-$(CONFIG_STEREO3D_FILTER)   += vf_stereo3d.o
 OBJS-$(CONFIG_SUBTITLES_FILTER)  += vf_subtitles.o
 OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o
+OBJS-$(CONFIG_SWAPRECT_FILTER)   += vf_swaprect.o
 OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o
 OBJS-$(CONFIG_TBLEND_FILTER) += vf_blend.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_TELECINE_FILTER)   += vf_telecine.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0eeef53..94a951b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -254,6 +254,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(STEREO3D,   stereo3d,   vf);
 REGISTER_FILTER(SUBTITLES,  subtitles,  vf);
 REGISTER_FILTER(SUPER2XSAI, super2xsai, vf);
+REGISTER_FILTER(SWAPRECT,   swaprect,   vf);
 REGISTER_FILTER(SWAPUV, swapuv, vf);
 REGISTER_FILTER(TBLEND, tblend, vf);
 REGISTER_FILTER(TELECINE,   telecine,   vf);
diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c
new file mode 100644
index 000..a5e1fab
--- /dev/null
+++ b/libavfilter/vf_swaprect.c
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2015 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 "libavutil/avstring.h"
+#include "libavutil/eval.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct SwapRectContext {
+const AVClass *class;
+char *w, *h;
+char *x1, *y1;
+char *x2, *y2;
+
+int nb_planes;
+int pixsteps[4];
+
+const AVPixFmtDescriptor *desc;
+uint8_t *temp;
+} SwapRectContext;
+
+#define OFFSET(x) offsetof(SwapRectContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
+static const AVOption swaprect_options[] = {
+{ "w",  "set rect width", OFFSET(w),  
AV_OPT_TYPE_STRING, {.str="w/2"}, 0, 0, .flags = FLAGS },
+{ "h",  "set rect height",OFFSET(h),  
AV_OPT_TYPE_STRING, {.str="h/2"}, 0, 0, .flags = FLAGS },
+{ "x1", "set 1st rect x top left coordinate", OFFSET(x1), 
AV_OPT_TYPE_STRING, {.str="w/2"}, 0, 0, .flags = FLAGS },
+{ "y1", "set 1st rect y top left coordinate", OFFSET(y1), 
AV_OPT_TYPE_STRING, {.str="

[FFmpeg-devel] [PATCH 0/3] Workaround for large JPEG over RTP

2015-12-08 Thread Andrey Utkin
RFCs for JPEG over RTP don't support dimensions larger than 2040 pixels, but it
is possible to work around if we stick with information from SDP.

Andrey Utkin (3):
  sdp: print a=framesize for MJPEG
  rtpdec_jpeg: use framesize from SDP if present
  Don't forget to run SDP parsing callback for static RTP types

 libavformat/rtpdec_jpeg.c | 46 +++---
 libavformat/rtsp.c|  2 +-
 libavformat/sdp.c |  2 ++
 3 files changed, 46 insertions(+), 4 deletions(-)

-- 
2.6.3

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


[FFmpeg-devel] [PATCH 1/3] sdp: print a=framesize for MJPEG

2015-12-08 Thread Andrey Utkin
Signed-off-by: Andrey Utkin 
---
 libavformat/sdp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 2ab37a8..27112ef 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -657,6 +657,8 @@ static char *sdp_write_media_attributes(char *buff, int 
size, AVCodecContext *c,
 if (payload_type >= RTP_PT_PRIVATE)
 av_strlcatf(buff, size, "a=rtpmap:%d JPEG/9\r\n",
  payload_type);
+av_strlcatf(buff, size, "a=framesize:%d %d-%d\r\n",
+payload_type, c->width, c->height);
 break;
 case AV_CODEC_ID_ADPCM_G722:
 if (payload_type >= RTP_PT_PRIVATE)
-- 
2.6.3

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


[FFmpeg-devel] [PATCH 2/3] rtpdec_jpeg: use framesize from SDP if present

2015-12-08 Thread Andrey Utkin
This enables us to process pics larger than 2040 pixels in dimensions,
overcoming the limitation of RFC 2435.

Signed-off-by: Andrey Utkin 
---
 libavformat/rtpdec_jpeg.c | 46 +++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 6bf88f8..0a83468 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -24,9 +24,11 @@
 #include "rtpdec.h"
 #include "rtpdec_formats.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"
 #include "libavcodec/jpegtables.h"
 #include "libavcodec/mjpeg.h"
 #include "libavcodec/bytestream.h"
+#include "libavformat/rtpdec_formats.h"
 
 /**
  * RTP/JPEG specific private data.
@@ -35,6 +37,14 @@ struct PayloadContext {
 AVIOContext *frame; ///< current frame buffer
 uint32_ttimestamp;  ///< current frame timestamp
 int hdr_size;   ///< size of the current frame header
+/**
+ * Flag, shows whether we got framesize explicitly from SDP.
+ * If set, override dimensions from RTP header.
+ * Workaround for dimensions larger than 2040 (limitation of RFC 2435).
+ */
+int sdp_framesize_set;
+int sdp_width;
+int sdp_height;
 uint8_t qtables[128][128];
 uint8_t qtables_len[128];
 };
@@ -215,7 +225,8 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
  const uint8_t *buf, int len, uint16_t seq,
  int flags)
 {
-uint8_t type, q, width, height;
+uint8_t type, q;
+uint32_t width, height;
 const uint8_t *qtables = NULL;
 uint16_t qtable_len;
 uint32_t off;
@@ -230,8 +241,13 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 off= AV_RB24(buf + 1);  /* fragment byte offset */
 type   = AV_RB8(buf + 4);   /* id of jpeg decoder params */
 q  = AV_RB8(buf + 5);   /* quantization factor (or table id) */
-width  = AV_RB8(buf + 6);   /* frame width in 8 pixel blocks */
-height = AV_RB8(buf + 7);   /* frame height in 8 pixel blocks */
+if (jpeg->sdp_framesize_set) {
+width  = FF_CEIL_RSHIFT(jpeg->sdp_width, 3);
+height = FF_CEIL_RSHIFT(jpeg->sdp_height, 3);
+} else {
+width  = AV_RB8(buf + 6);   /* frame width in 8 pixel blocks */
+height = AV_RB8(buf + 7);   /* frame height in 8 pixel blocks */
+}
 buf += 8;
 len -= 8;
 
@@ -384,11 +400,35 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 return AVERROR(EAGAIN);
 }
 
+static int parse_jpeg_sdp_line(AVFormatContext *s, int st_index,
+   PayloadContext *jpeg_data, const char *line)
+{
+AVStream *stream;
+const char *p = line;
+
+if (st_index < 0)
+return 0;
+
+stream = s->streams[st_index];
+
+if (av_strstart(p, "framesize:", &p)) {
+ff_h264_parse_framesize(stream->codec, p);
+av_log(s, AV_LOG_DEBUG, "Got framesize %ux%u from SDP, this will 
override values from RTP header\n",
+stream->codec->width, stream->codec->height);
+jpeg_data->sdp_framesize_set = 1;
+jpeg_data->sdp_width  = stream->codec->width;
+jpeg_data->sdp_height = stream->codec->height;
+}
+
+return 0;
+}
+
 RTPDynamicProtocolHandler ff_jpeg_dynamic_handler = {
 .enc_name  = "JPEG",
 .codec_type= AVMEDIA_TYPE_VIDEO,
 .codec_id  = AV_CODEC_ID_MJPEG,
 .priv_data_size= sizeof(PayloadContext),
+.parse_sdp_a_line  = parse_jpeg_sdp_line,
 .close = jpeg_close_context,
 .parse_packet  = jpeg_parse_packet,
 .static_payload_id = 26,
-- 
2.6.3

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


[FFmpeg-devel] [PATCH 3/3] Don't forget to run SDP parsing callback for static RTP types

2015-12-08 Thread Andrey Utkin
Signed-off-by: Andrey Utkin 
---
 libavformat/rtsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 39539e9..4c0a057 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -567,7 +567,7 @@ static void sdp_parse_line(AVFormatContext *s, 
SDPParseState *s1,
 // let dynamic protocol handlers have a stab at the line.
 get_word(buf1, sizeof(buf1), &p);
 payload_type = atoi(buf1);
-if (s1->seen_rtpmap) {
+if (s1->seen_rtpmap || payload_type < RTP_PT_PRIVATE) {
 parse_fmtp(s, rt, payload_type, buf);
 } else {
 s1->seen_fmtp = 1;
-- 
2.6.3

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


Re: [FFmpeg-devel] [PATCH 2/2] configure: libbsd support for arc4random()

2015-12-08 Thread wm4
On Sun,  6 Dec 2015 22:56:33 -0500
Ganesh Ajjanagadde  wrote:

> On non-BSD machines, there exists a package libbsd for providing BSD
> functionality. This can be used to get support for arc4random.
> 
> Thus, an opt-in --enable-libbsd is added to configure for this
> functionality.
> 
> Tested on GNU/Linux.
> 

This doesn't seem worth the trouble at all. Who is even going to use
it, and why, and what additional hidden bugs will it cause?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] configure: libbsd support for arc4random()

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 7:27 AM, wm4  wrote:
> On Sun,  6 Dec 2015 22:56:33 -0500
> Ganesh Ajjanagadde  wrote:
>
>> On non-BSD machines, there exists a package libbsd for providing BSD
>> functionality. This can be used to get support for arc4random.
>>
>> Thus, an opt-in --enable-libbsd is added to configure for this
>> functionality.
>>
>> Tested on GNU/Linux.
>>
>
> This doesn't seem worth the trouble at all. Who is even going to use
> it, and why, and what additional hidden bugs will it cause?

arc4random is a far superior interface, in that it can never fail. See
http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt for
details.
As for hidden bugs, apart from configuration/detection issues, I see none.
If anything, it is easier to use /dev/urandom incorrectly.
Ultimately any code change is a tradeoff, with different people
feeling differently about various things.
I still feel that it is worth inclusion due to its technical merits.

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


Re: [FFmpeg-devel] [PATCH] lavf/segment: add option to write empty filler segments as needed

2015-12-08 Thread Stefano Sabatini
On date Monday 2015-12-07 14:24:44 -0600, Rodger Combs encoded:
> ---
>  libavformat/segment.c | 22 +++---
>  1 file changed, 15 insertions(+), 7 deletions(-)

Missing docs.
 
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 8432d0f..acd266b 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -113,6 +113,7 @@ typedef struct SegmentContext {
>  char *reference_stream_specifier; ///< reference stream specifier
>  int   reference_stream_index;
>  int   break_non_keyframes;
> +int   write_empty;
>  
>  int use_rename;
>  char temp_list_filename[1024];
> @@ -763,6 +764,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  if (!seg->avf)
>  return AVERROR(EINVAL);
>  
> +calc_times:
>  if (seg->times) {
>  end_pts = seg->segment_count < seg->nb_times ?
>  seg->times[seg->segment_count] : INT64_MAX;
> @@ -794,11 +796,11 @@ static int seg_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  
>  if (pkt->stream_index == seg->reference_stream_index &&
>  (pkt->flags & AV_PKT_FLAG_KEY || seg->break_non_keyframes) &&
> -seg->segment_frame_count > 0 &&
> +(seg->segment_frame_count > 0 || seg->write_empty) &&
>  (seg->cut_pending || seg->frame_count >= start_frame ||
>   (pkt->pts != AV_NOPTS_VALUE &&

>av_compare_ts(pkt->pts, st->time_base,
> -end_pts-seg->time_delta, AV_TIME_BASE_Q) >= 0))) {
> +end_pts - seg->time_delta, AV_TIME_BASE_Q) >= 0))) {

unrelated

>  /* sanitize end time in case last packet didn't have a defined 
> duration */
>  if (seg->cur_entry.last_duration == 0)
>  seg->cur_entry.end_time = (double)pkt->pts * 
> av_q2d(st->time_base);
> @@ -813,11 +815,16 @@ static int seg_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  seg->cur_entry.index = seg->segment_idx + seg->segment_idx_wrap * 
> seg->segment_idx_wrap_nb;
>  seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base);
>  seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, 
> AV_TIME_BASE_Q);
> -seg->cur_entry.end_time = seg->cur_entry.start_time +
> -pkt->pts != AV_NOPTS_VALUE ? (double)(pkt->pts + pkt->duration) 
> * av_q2d(st->time_base) : 0;
> -} else if (pkt->pts != AV_NOPTS_VALUE && pkt->stream_index == 
> seg->reference_stream_index) {
> -seg->cur_entry.end_time =
> -FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + 
> pkt->duration) * av_q2d(st->time_base));
> +seg->cur_entry.end_time = seg->cur_entry.start_time;
> +

> +if (seg->times || (!seg->frames && !seg->use_clocktime) && 
> seg->write_empty)
> +goto calc_times;

I dislike this goto here, since I'd like to keep the distinction between
the logic setting end_pts/start_frame and the one selecting whether to
close the segment.

> +}
> +

> +if (pkt->stream_index == seg->reference_stream_index) {
> +if (pkt->pts != AV_NOPTS_VALUE)
> +seg->cur_entry.end_time =
> +FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + 
> pkt->duration) * av_q2d(st->time_base));

This factorization is fine, but should be probably sent as a separate patch.

[...]

Thanks.
-- 
FFmpeg = Fanciful & Fierce Multimedia Patchable Explosive Generator
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] configure: libbsd support for arc4random()

2015-12-08 Thread Clément Bœsch
On Tue, Dec 08, 2015 at 07:34:51AM -0500, Ganesh Ajjanagadde wrote:
> On Tue, Dec 8, 2015 at 7:27 AM, wm4  wrote:
> > On Sun,  6 Dec 2015 22:56:33 -0500
> > Ganesh Ajjanagadde  wrote:
> >
> >> On non-BSD machines, there exists a package libbsd for providing BSD
> >> functionality. This can be used to get support for arc4random.
> >>
> >> Thus, an opt-in --enable-libbsd is added to configure for this
> >> functionality.
> >>
> >> Tested on GNU/Linux.
> >>
> >
> > This doesn't seem worth the trouble at all. Who is even going to use
> > it, and why, and what additional hidden bugs will it cause?
> 
> arc4random is a far superior interface, in that it can never fail. See
> http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt for
> details.
> As for hidden bugs, apart from configuration/detection issues, I see none.
> If anything, it is easier to use /dev/urandom incorrectly.
> Ultimately any code change is a tradeoff, with different people
> feeling differently about various things.
> I still feel that it is worth inclusion due to its technical merits.
> 

Note that the behaviour of arc4random differs between implementations.

http://insanecoding.blogspot.gr/2014/05/libressl-porting-update.html

-- 
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 2/2] configure: libbsd support for arc4random()

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 8:16 AM, Clément Bœsch  wrote:
> On Tue, Dec 08, 2015 at 07:34:51AM -0500, Ganesh Ajjanagadde wrote:
>> On Tue, Dec 8, 2015 at 7:27 AM, wm4  wrote:
>> > On Sun,  6 Dec 2015 22:56:33 -0500
>> > Ganesh Ajjanagadde  wrote:
>> >
>> >> On non-BSD machines, there exists a package libbsd for providing BSD
>> >> functionality. This can be used to get support for arc4random.
>> >>
>> >> Thus, an opt-in --enable-libbsd is added to configure for this
>> >> functionality.
>> >>
>> >> Tested on GNU/Linux.
>> >>
>> >
>> > This doesn't seem worth the trouble at all. Who is even going to use
>> > it, and why, and what additional hidden bugs will it cause?
>>
>> arc4random is a far superior interface, in that it can never fail. See
>> http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt for
>> details.
>> As for hidden bugs, apart from configuration/detection issues, I see none.
>> If anything, it is easier to use /dev/urandom incorrectly.
>> Ultimately any code change is a tradeoff, with different people
>> feeling differently about various things.
>> I still feel that it is worth inclusion due to its technical merits.
>>
>
> Note that the behaviour of arc4random differs between implementations.
>
> http://insanecoding.blogspot.gr/2014/05/libressl-porting-update.html

That is for libressl, not libbsd, though the remark may still apply.
And there is no real fundamental issue: FFmpeg's seeding code anyway
varies between platforms, in the worst case using time.

Second, a getrandom system call has been added to the kernel, so
libbsd/libressl should upgrade to the new interface over time.

Whatever, if people don't want this, I will drop 2/2 but keep within
my own tree for a future date potentially.

1/2 is still very much worthwhile: platforms supporting natively
arc4random should use it (e.g the BSD's).

>
> --
> Clément B.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] configure: libbsd support for arc4random()

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 9:01 AM, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 8, 2015 at 8:16 AM, Clément Bœsch  wrote:
>> On Tue, Dec 08, 2015 at 07:34:51AM -0500, Ganesh Ajjanagadde wrote:
>>> On Tue, Dec 8, 2015 at 7:27 AM, wm4  wrote:
>>> > On Sun,  6 Dec 2015 22:56:33 -0500
>>> > Ganesh Ajjanagadde  wrote:
>>> >
>>> >> On non-BSD machines, there exists a package libbsd for providing BSD
>>> >> functionality. This can be used to get support for arc4random.
>>> >>
>>> >> Thus, an opt-in --enable-libbsd is added to configure for this
>>> >> functionality.
>>> >>
>>> >> Tested on GNU/Linux.
>>> >>
>>> >
>>> > This doesn't seem worth the trouble at all. Who is even going to use
>>> > it, and why, and what additional hidden bugs will it cause?
>>>
>>> arc4random is a far superior interface, in that it can never fail. See
>>> http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt for
>>> details.
>>> As for hidden bugs, apart from configuration/detection issues, I see none.
>>> If anything, it is easier to use /dev/urandom incorrectly.
>>> Ultimately any code change is a tradeoff, with different people
>>> feeling differently about various things.
>>> I still feel that it is worth inclusion due to its technical merits.
>>>
>>
>> Note that the behaviour of arc4random differs between implementations.
>>
>> http://insanecoding.blogspot.gr/2014/05/libressl-porting-update.html
>
> That is for libressl, not libbsd, though the remark may still apply.
> And there is no real fundamental issue: FFmpeg's seeding code anyway
> varies between platforms, in the worst case using time.

To clarify above: the seed is not meant for security anyway, since if
that was the case FFmpeg's seeding is fundamentally broken, falling
down to time is not safe. But this is clarified in the docs.

I also suspect arc4random is faster than /dev/urandom for seeding, and
may provide benchmarks iff this patch has a chance of getting
accepted.

Also, another reason this patch is potentially useful is because by
harnessing libbsd, one can access other things like arc4random_buf,
arc4random_uniform (for uniform distribution), etc.

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


Re: [FFmpeg-devel] [PATCHv2] avcodec/h264: Set CORRUPT flag on output frames that are not fully recovered

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 10:24:09AM +0200, Sebastian Dröge wrote:
> From: Sebastian Dröge 
> 
> In the merge commit 78265fcfeee153e5e26ad4dbc7831a84ade447d6 this behaviour
> was broken and the CORRUPT flag would never ever be set on a frame. However
> the flag on the AVCodecContext was taken into account properly, including
> AV_CODEC_FLAG2_SHOW_ALL.
> 
> The reason for this was that the recovered field of the next output picture
> was always set to TRUE whenever one of the two AVCodecContext flags was set,
> which made it impossible to detect later, before outputting, if the frame was
> really recovered or not. Now don't set it to TRUE unless the frame is really
> recovered and check the AVCodecContext flags right before outputting.
> 
> Signed-off-by: Sebastian Dröge 
> ---
>  libavcodec/h264.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

applied

thanks

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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] fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param

2015-12-08 Thread James Almer
On 12/8/2015 4:10 AM, Matthieu Bouron wrote:
> On Mon, Dec 7, 2015 at 11:41 PM, Michael Niedermayer 
> wrote:
> 
>> On Mon, Dec 07, 2015 at 10:42:39AM +0100, Matthieu Bouron wrote:
>>> From: Matthieu Bouron 
>>>
>>> ---
>>>  tests/fate/api.mak | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/fate/api.mak b/tests/fate/api.mak
>>> index 0aa00a7..0761de7 100644
>>> --- a/tests/fate/api.mak
>>> +++ b/tests/fate/api.mak
>>> @@ -24,9 +24,9 @@ FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2,
>> PNG) += fate-api-png-codec-p
>>>  fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
>>>  fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test
>> $(TARGET_SAMPLES)/png1/lena-rgba.png
>>>
>>> -FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
>> fate-api-jpeg-codec-param
>>> -fate-api-jpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
>>> -fate-api-jpeg-codec-param: CMD = run
>> $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
>>> +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
>> fate-api-mjpeg-codec-param
>>> +fate-api-mjpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
>>> +fate-api-mjpeg-codec-param: CMD = run
>> $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
>>
>> did you forget git add ?
>>
>> reference file './tests/ref/fate/api-mjpeg-codec-param' not found
>> ./tests/fate-run.sh: 307: ./tests/fate-run.sh: cannot open
>> tests/data/fate/api-mjpeg-codec-param.diff: No such file
>> Test api-mjpeg-codec-param failed. Look at
>> tests/data/fate/api-mjpeg-codec-param.err for details.
>>
> 
> Yes, sorry. New patch attached.

Next time please remember to use -M with git format-patch. It will detect file
renames and prevent the patch from being bloated.
No point in resending the patch now for this, just pointing it out for future
patches.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 08:10:11AM +0100, Matthieu Bouron wrote:
> On Mon, Dec 7, 2015 at 11:41 PM, Michael Niedermayer 
> wrote:
> 
> > On Mon, Dec 07, 2015 at 10:42:39AM +0100, Matthieu Bouron wrote:
> > > From: Matthieu Bouron 
> > >
> > > ---
> > >  tests/fate/api.mak | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tests/fate/api.mak b/tests/fate/api.mak
> > > index 0aa00a7..0761de7 100644
> > > --- a/tests/fate/api.mak
> > > +++ b/tests/fate/api.mak
> > > @@ -24,9 +24,9 @@ FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2,
> > PNG) += fate-api-png-codec-p
> > >  fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > >  fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test
> > $(TARGET_SAMPLES)/png1/lena-rgba.png
> > >
> > > -FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
> > fate-api-jpeg-codec-param
> > > -fate-api-jpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > > -fate-api-jpeg-codec-param: CMD = run
> > $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
> > > +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
> > fate-api-mjpeg-codec-param
> > > +fate-api-mjpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > > +fate-api-mjpeg-codec-param: CMD = run
> > $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
> >
> > did you forget git add ?
> >
> > reference file './tests/ref/fate/api-mjpeg-codec-param' not found
> > ./tests/fate-run.sh: 307: ./tests/fate-run.sh: cannot open
> > tests/data/fate/api-mjpeg-codec-param.diff: No such file
> > Test api-mjpeg-codec-param failed. Look at
> > tests/data/fate/api-mjpeg-codec-param.err for details.
> >
> 
> Yes, sorry. New patch attached.

>  b/tests/fate/api.mak   |6 
>  b/tests/ref/fate/api-mjpeg-codec-param |  310 
> +
>  tests/ref/fate/api-jpeg-codec-param|  310 
> -
>  3 files changed, 313 insertions(+), 313 deletions(-)
> 3ea6d72b5c535db30c0423e450c3b1a99950ebdc  
> 0001-fate-api-jpeg-codec-param-rename-to-api-mjpeg-codec-.patch
> From 4ba00cbcdb354c5491b02f745079b388f8411f77 Mon Sep 17 00:00:00 2001
> From: Matthieu Bouron 
> Date: Mon, 7 Dec 2015 10:40:03 +0100
> Subject: [PATCH 1/2] fate/api-jpeg-codec-param: rename to
>  api-mjpeg-codec-param

LGTM
thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] lavf/img2enc: add atomic_writing option

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 10:47:23AM +0100, Clément Bœsch wrote:
> From: Clément Bœsch 
> 
> This behaviour change caused a regression on our side recently, we might
> want to disable the option by default.
> ---
>  libavformat/img2enc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

should be ok

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

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


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


Re: [FFmpeg-devel] [PATCH] swscale/utils: replace pow by exp2

2015-12-08 Thread Michael Niedermayer
On Mon, Dec 07, 2015 at 11:07:17PM -0500, Ganesh Ajjanagadde wrote:
> exp2 is a faster function.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libswscale/utils.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec/jpeg2000: replace naive pow call with smarter exp2fi

2015-12-08 Thread Michael Niedermayer
On Mon, Dec 07, 2015 at 09:50:49PM -0500, Ganesh Ajjanagadde wrote:
> pow is a very wasteful function for this purpose. A low hanging fruit
> would be simply to replace with exp2f, and that does yield some speedup.
> However, there are 2 drawbacks of this:
> 1. It does not exploit the integer nature of the argument.
> 2. (minor) Some platforms lack a proper exp2f routine, making benefits 
> available
> only to non broken libm.
> 3. exp2f does not solve the same issue that plagues pow, namely terrible
> worst case performance. This is a fundamental issue known as the
> "table-maker's dilemma" recognized by Prof. Kahan himself and
> subsequently elaborated and researched by many others. All this is clear from 
> benchmarks below.
> 
> This exploits the IEEE-754 format to get very good performance even in
> the worst case for integer powers of 2. This solves all the issues noted
> above. Function tested with clang usan over [-1000, 1000] (beyond range of
> relevance for this, which is [-255, 255]), patch itself with FATE.
> 
> Benchmarks obtained on x86-64, Haswell, GNU-Linux via 10^5 iterations of
> the pow call, START/STOP, and command ffplay 
> ~/samples/jpeg2000/chiens_dcinema2K.mxf.
> Low number of runs also given to prove the point about worst case:
> 
> pow:
>  216270 decicycles in pow,   1 runs,  0 skips
>  110175 decicycles in pow,   2 runs,  0 skips
>   56085 decicycles in pow,   4 runs,  0 skips
>   29013 decicycles in pow,   8 runs,  0 skips
>   15472 decicycles in pow,  16 runs,  0 skips
>8689 decicycles in pow,  32 runs,  0 skips
>5295 decicycles in pow,  64 runs,  0 skips
>3599 decicycles in pow, 128 runs,  0 skips
>2748 decicycles in pow, 256 runs,  0 skips
>2304 decicycles in pow, 511 runs,  1 skips
>2072 decicycles in pow,1022 runs,  2 skips
>1963 decicycles in pow,2044 runs,  4 skips
>1894 decicycles in pow,4091 runs,  5 skips
>1860 decicycles in pow,8184 runs,  8 skips
> 
> exp2f:
>  134140 decicycles in pow,   1 runs,  0 skips
>   68110 decicycles in pow,   2 runs,  0 skips
>   34530 decicycles in pow,   4 runs,  0 skips
>   17677 decicycles in pow,   8 runs,  0 skips
>9175 decicycles in pow,  16 runs,  0 skips
>4931 decicycles in pow,  32 runs,  0 skips
>2808 decicycles in pow,  64 runs,  0 skips
>1747 decicycles in pow, 128 runs,  0 skips
>1208 decicycles in pow, 256 runs,  0 skips
> 952 decicycles in pow, 512 runs,  0 skips
> 822 decicycles in pow,1024 runs,  0 skips
> 765 decicycles in pow,2047 runs,  1 skips
> 722 decicycles in pow,4094 runs,  2 skips
> 693 decicycles in pow,8190 runs,  2 skips
> 
> exp2fi:
>2740 decicycles in pow,   1 runs,  0 skips
>1530 decicycles in pow,   2 runs,  0 skips
> 955 decicycles in pow,   4 runs,  0 skips
> 622 decicycles in pow,   8 runs,  0 skips
> 477 decicycles in pow,  16 runs,  0 skips
> 368 decicycles in pow,  32 runs,  0 skips
> 317 decicycles in pow,  64 runs,  0 skips
> 291 decicycles in pow, 128 runs,  0 skips
> 277 decicycles in pow, 256 runs,  0 skips
> 268 decicycles in pow, 512 runs,  0 skips
> 265 decicycles in pow,1024 runs,  0 skips
> 263 decicycles in pow,2048 runs,  0 skips
> 263 decicycles in pow,4095 runs,  1 skips
> 260 decicycles in pow,8191 runs,  1 skips
> 
> Signed-off-by: Ganesh Ajjanagadde 

probably ok

thx

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH 08/10] avfilter/vf_colorkey: avoid unnecessary floating point multiply

2015-12-08 Thread Michael Niedermayer
On Mon, Dec 07, 2015 at 06:07:03PM -0500, Ganesh Ajjanagadde wrote:
> On Sun, Nov 22, 2015 at 12:05 PM, Ganesh Ajjanagadde
>  wrote:
> > Normalization can be pulled outside the sqrt.
> >
> > Signed-off-by: Ganesh Ajjanagadde 
> > ---
> >  libavfilter/vf_colorkey.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
> > index 2f670d9..4daf2f5 100644
> > --- a/libavfilter/vf_colorkey.c
> > +++ b/libavfilter/vf_colorkey.c
> > @@ -42,7 +42,7 @@ static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, 
> > uint8_t r, uint8_t g, uin
> >  int dg = (int)g - ctx->colorkey_rgba[1];
> >  int db = (int)b - ctx->colorkey_rgba[2];
> >
> > -double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
> > +double diff = sqrt(dr * dr + dg * dg + db * db) / 255.0;
> >
> >  if (ctx->blend > 0.0001) {
> >  return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * 
> > 255.0;
> > --
> > 2.6.2
> >
> 
> Really just a cosmetic (i.e I have reworded commit message), if people
> don't want it, I will drop. Just requesting a resolution on it.

iam not maintainer of this but LGTM

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


[FFmpeg-devel] [PATCH 1/2] diracdec: Move strides to bytes, and pointer types to uint8_t. Also template functions for move to support 10-bit Parts of this patch were written by Rostislav Pehlivanov

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac.c   |  10 +-
 libavcodec/dirac.h   |   3 +-
 libavcodec/dirac_dwt.c   | 530 ++---
 libavcodec/dirac_dwt.h   |  20 +-
 libavcodec/dirac_dwt_template.c  | 615 +++
 libavcodec/diracdec.c| 233 +--
 libavcodec/diracdsp.c|  25 +-
 libavcodec/diracdsp.h|   4 +-
 libavcodec/x86/dirac_dwt.c   |  65 +++--
 libavcodec/x86/diracdsp_mmx.c|   4 +-
 libavcodec/x86/diracdsp_yasm.asm |   4 +-
 libavformat/oggparsedirac.c  |   4 +-
 12 files changed, 874 insertions(+), 643 deletions(-)
 create mode 100644 libavcodec/dirac_dwt_template.c

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 07db919..aa82dd9 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -118,7 +118,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
 /* [DIRAC_STD] 10.3 Parse Source Parameters.
  * source_parameters(base_video_format) */
 static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
-   dirac_source_params *source)
+   dirac_source_params *source, int *bit_depth)
 {
 AVRational frame_rate = { 0, 0 };
 unsigned luma_depth = 8, luma_offset = 16;
@@ -239,6 +239,9 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
 if (luma_depth > 8)
 av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n");
 
+
+*bit_depth = luma_depth;
+
 avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, 
&chroma_y_shift);
 if ((source->width % (1height);
diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
index b0f955b..14653f1 100644
--- a/libavcodec/dirac.h
+++ b/libavcodec/dirac.h
@@ -55,6 +55,7 @@ typedef struct dirac_source_params {
 } dirac_source_params;
 
 int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext 
*gb,
-   dirac_source_params *source);
+   dirac_source_params *source,
+   int *bit_depth);
 
 #endif /* AVCODEC_DIRAC_H */
diff --git a/libavcodec/dirac_dwt.c b/libavcodec/dirac_dwt.c
index ee3665e..ae847f7 100644
--- a/libavcodec/dirac_dwt.c
+++ b/libavcodec/dirac_dwt.c
@@ -25,523 +25,40 @@
 #include "dirac_dwt.h"
 #include "libavcodec/x86/dirac_dwt.h"
 
+#define TEMPLATE_8bit
+#include "dirac_dwt_template.c"
+#undef TEMPLATE_8bit
 
-static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
-  int width)
-{
-int i;
-
-for (i = 0; i < width; i++)
-b1[i] -= (b0[i] + b2[i] + 2) >> 2;
-}
-
-
-static av_always_inline
-void interleave(IDWTELEM *dst, IDWTELEM *src0, IDWTELEM *src1, int w2, int 
add, int shift)
-{
-int i;
-for (i = 0; i < w2; i++) {
-dst[2*i  ] = (src0[i] + add) >> shift;
-dst[2*i+1] = (src1[i] + add) >> shift;
-}
-}
-
-static void horizontal_compose_dirac53i(IDWTELEM *b, IDWTELEM *temp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-temp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]);
-for (x = 1; x < w2; x++) {
-temp[x ] = COMPOSE_53iL0 (b[x+w2-1], b[x ], b[x+w2]);
-temp[x+w2-1] = COMPOSE_DIRAC53iH0(temp[x-1], b[x+w2-1], temp[x]);
-}
-temp[w-1] = COMPOSE_DIRAC53iH0(temp[w2-1], b[w-1], temp[w2-1]);
-
-interleave(b, temp, temp+w2, w2, 1, 1);
-}
-
-static void horizontal_compose_dd97i(IDWTELEM *b, IDWTELEM *tmp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-tmp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]);
-for (x = 1; x < w2; x++)
-tmp[x] = COMPOSE_53iL0(b[x+w2-1], b[x], b[x+w2]);
-
-// extend the edges
-tmp[-1]   = tmp[0];
-tmp[w2+1] = tmp[w2] = tmp[w2-1];
-
-for (x = 0; x < w2; x++) {
-b[2*x  ] = (tmp[x] + 1)>>1;
-b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], 
tmp[x+2]) + 1)>>1;
-}
-}
-
-static void horizontal_compose_dd137i(IDWTELEM *b, IDWTELEM *tmp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-tmp[0] = COMPOSE_DD137iL0(b[w2], b[w2], b[0], b[w2  ], b[w2+1]);
-tmp[1] = COMPOSE_DD137iL0(b[w2], b[w2], b[1], b[w2+1], b[w2+2]);
-for (x = 2; x < w2-1; x++)
-tmp[x] = COMPOSE_DD137iL0(b[x+w2-2], b[x+w2-1], b[x], b[x+w2], 
b[x+w2+1]);
-tmp[w2-1] = COMPOSE_DD137iL0(b[w-3], b[w-2], b[w2-1], b[w-1], b[w-1]);
-
-// extend the edges
-tmp[-1]   = tmp[0];
-tmp[w2+1] = tmp[w2] = tmp[w2-1];
-
-for (x = 0; x < w2; x++) {
-b[2*x  ] = (tmp[x] + 1)>>1;
-b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], 
tmp[x+2]) + 1)>>1;
-}
-}
-
-static av_always_inline
-void horizontal_compose_haari(IDWTELEM *b, IDWTELEM *temp, int w, int shift)
-{
-const int w2 = w >> 1;
-int x;
-
-for (

[FFmpeg-devel] [PATCH 2/2] diracdec: Add HQ Profile support

2015-12-08 Thread Kieran Kunhya
From: Rostislav Pehlivanov 

---
 libavcodec/dirac.c  |  31 ++--
 libavcodec/dirac.h  |  28 
 libavcodec/dirac_dwt.h  |   2 +-
 libavcodec/diracdec.c   | 357 +++-
 libavformat/oggparsedirac.c |   3 +-
 5 files changed, 265 insertions(+), 156 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index aa82dd9..67447c5 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -109,10 +109,11 @@ static const struct {
 { AVCOL_PRI_BT709, AVCOL_SPC_BT709,   AVCOL_TRC_UNSPECIFIED /* DCinema 
*/ },
 };
 
-/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats + luma Offset */
-static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
-{ AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV420P  },
-{ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P },
+/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats */
+static const enum AVPixelFormat dirac_pix_fmt[3][3] = {
+{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12},
+{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12},
+{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12},
 };
 
 /* [DIRAC_STD] 10.3 Parse Source Parameters.
@@ -236,13 +237,9 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
 avctx->color_range = pixel_range_presets[idx].color_range;
 }
 
-if (luma_depth > 8)
-av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n");
-
-
 *bit_depth = luma_depth;
 
-avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
+avctx->pix_fmt = 
dirac_pix_fmt[source->chroma_format][source->pixel_range_index-2];
 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, 
&chroma_y_shift);
 if ((source->width % (1level   = svq3_get_ue_golomb(gb);
+version->major  = svq3_get_ue_golomb(gb);
+version->minor  = svq3_get_ue_golomb(gb);
+avctx->profile  = svq3_get_ue_golomb(gb);
+avctx->level= svq3_get_ue_golomb(gb);
 /* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
  * 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
-video_format   = svq3_get_ue_golomb(gb);
+video_format= svq3_get_ue_golomb(gb);
 
-if (version_major < 2)
+if (version->major < 2)
 av_log(avctx, AV_LOG_WARNING, "Stream is old and may not work\n");
-else if (version_major > 2)
+else if (version->major > 2)
 av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n");
 
 if (video_format > 20U)
diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
index 14653f1..b4982f8 100644
--- a/libavcodec/dirac.h
+++ b/libavcodec/dirac.h
@@ -34,6 +34,33 @@
 #include "avcodec.h"
 #include "get_bits.h"
 
+/**
+ * Parse code values:
+ *
+ * Dirac Specification ->
+ * 9.6.1  Table 9.1
+ *
+ * VC-2 Specification  ->
+ * 10.4.1 Table 10.1
+ */
+
+enum DiracParseCodes {
+DIRAC_PCODE_SEQ_HEADER  = 0x00,
+DIRAC_PCODE_END_SEQ = 0x10,
+DIRAC_PCODE_AUX = 0x20,
+DIRAC_PCODE_PAD = 0x30,
+DIRAC_PCODE_PICTURE_CODED   = 0x08,
+DIRAC_PCODE_PICTURE_RAW = 0x48,
+DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,
+DIRAC_PCODE_PICTURE_HQ  = 0xE8,
+DIRAC_PCODE_MAGIC   = 0x42424344,
+};
+
+typedef struct DiracVersionInfo {
+int major;
+int minor;
+} DiracVersionInfo;
+
 typedef struct dirac_source_params {
 unsigned width;
 unsigned height;
@@ -56,6 +83,7 @@ typedef struct dirac_source_params {
 
 int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext 
*gb,
dirac_source_params *source,
+   DiracVersionInfo *version,
int *bit_depth);
 
 #endif /* AVCODEC_DIRAC_H */
diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h
index 41842b5..e885373 100644
--- a/libavcodec/dirac_dwt.h
+++ b/libavcodec/dirac_dwt.h
@@ -24,7 +24,7 @@
 #include 
 
 typedef int DWTELEM;
-typedef short IDWTELEM;
+typedef int IDWTELEM;
 
 #define MAX_DWT_SUPPORT 8
 #define MAX_DECOMPOSITIONS 8
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index b293ac8..e8828df 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -57,7 +57,7 @@
 #define MAX_REFERENCE_FRAMES 8
 #define MAX_DELAY 5 /* limit for main profile for frame coding (TODO: 
field coding) */
 #define MAX_FRAMES (MAX_REFERENCE_FRAMES + MAX_DELAY + 1)
-#define MAX_QUANT 68/* max quant for VC-2 */
+#define MAX_QUANT 255/* max quant for VC-2 */
 #define MAX_BLOCKSIZE 32/* maximum xblen/yblen we support */
 
 /**
@@ -140,6 +140,7 @@ typedef struct DiracContext {
 MpegvideoEncDSPContext mpvencdsp;
 VideoDSPContext vdsp;
 DiracDSPContext diracdsp;
+DiracVersionInfo version;
 GetBitConte

Re: [FFmpeg-devel] [PATCH 3/3] fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param

2015-12-08 Thread Matthieu Bouron
On Tue, Dec 08, 2015 at 07:00:43PM +0100, Michael Niedermayer wrote:
> On Tue, Dec 08, 2015 at 08:10:11AM +0100, Matthieu Bouron wrote:
> > On Mon, Dec 7, 2015 at 11:41 PM, Michael Niedermayer 
> > wrote:
> > 
> > > On Mon, Dec 07, 2015 at 10:42:39AM +0100, Matthieu Bouron wrote:
> > > > From: Matthieu Bouron 
> > > >
> > > > ---
> > > >  tests/fate/api.mak | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/tests/fate/api.mak b/tests/fate/api.mak
> > > > index 0aa00a7..0761de7 100644
> > > > --- a/tests/fate/api.mak
> > > > +++ b/tests/fate/api.mak
> > > > @@ -24,9 +24,9 @@ FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2,
> > > PNG) += fate-api-png-codec-p
> > > >  fate-api-png-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > > >  fate-api-png-codec-param: CMD = run $(APITESTSDIR)/api-codec-param-test
> > > $(TARGET_SAMPLES)/png1/lena-rgba.png
> > > >
> > > > -FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
> > > fate-api-jpeg-codec-param
> > > > -fate-api-jpeg-codec-param: $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > > > -fate-api-jpeg-codec-param: CMD = run
> > > $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
> > > > +FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, IMAGE2, MJPEG) +=
> > > fate-api-mjpeg-codec-param
> > > > +fate-api-mjpeg-codec-param: 
> > > > $(APITESTSDIR)/api-codec-param-test$(EXESUF)
> > > > +fate-api-mjpeg-codec-param: CMD = run
> > > $(APITESTSDIR)/api-codec-param-test $(TARGET_SAMPLES)/exif/image_small.jpg
> > >
> > > did you forget git add ?
> > >
> > > reference file './tests/ref/fate/api-mjpeg-codec-param' not found
> > > ./tests/fate-run.sh: 307: ./tests/fate-run.sh: cannot open
> > > tests/data/fate/api-mjpeg-codec-param.diff: No such file
> > > Test api-mjpeg-codec-param failed. Look at
> > > tests/data/fate/api-mjpeg-codec-param.err for details.
> > >
> > 
> > Yes, sorry. New patch attached.
> 
> >  b/tests/fate/api.mak   |6 
> >  b/tests/ref/fate/api-mjpeg-codec-param |  310 
> > +
> >  tests/ref/fate/api-jpeg-codec-param|  310 
> > -
> >  3 files changed, 313 insertions(+), 313 deletions(-)
> > 3ea6d72b5c535db30c0423e450c3b1a99950ebdc  
> > 0001-fate-api-jpeg-codec-param-rename-to-api-mjpeg-codec-.patch
> > From 4ba00cbcdb354c5491b02f745079b388f8411f77 Mon Sep 17 00:00:00 2001
> > From: Matthieu Bouron 
> > Date: Mon, 7 Dec 2015 10:40:03 +0100
> > Subject: [PATCH 1/2] fate/api-jpeg-codec-param: rename to
> >  api-mjpeg-codec-param
> 
> LGTM
> thx
> 

Pushed. Thanks.

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


Re: [FFmpeg-devel] [PATCH 08/10] avfilter/vf_colorkey: avoid unnecessary floating point multiply

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 1:52 PM, Michael Niedermayer  wrote:
> On Mon, Dec 07, 2015 at 06:07:03PM -0500, Ganesh Ajjanagadde wrote:
>> On Sun, Nov 22, 2015 at 12:05 PM, Ganesh Ajjanagadde
>>  wrote:
>> > Normalization can be pulled outside the sqrt.
>> >
>> > Signed-off-by: Ganesh Ajjanagadde 
>> > ---
>> >  libavfilter/vf_colorkey.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
>> > index 2f670d9..4daf2f5 100644
>> > --- a/libavfilter/vf_colorkey.c
>> > +++ b/libavfilter/vf_colorkey.c
>> > @@ -42,7 +42,7 @@ static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, 
>> > uint8_t r, uint8_t g, uin
>> >  int dg = (int)g - ctx->colorkey_rgba[1];
>> >  int db = (int)b - ctx->colorkey_rgba[2];
>> >
>> > -double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
>> > +double diff = sqrt(dr * dr + dg * dg + db * db) / 255.0;
>> >
>> >  if (ctx->blend > 0.0001) {
>> >  return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) 
>> > * 255.0;
>> > --
>> > 2.6.2
>> >
>>
>> Really just a cosmetic (i.e I have reworded commit message), if people
>> don't want it, I will drop. Just requesting a resolution on it.
>
> iam not maintainer of this but LGTM

Looks like there is something more nontrivial here: why isn't a sqrtf
being done since the numbers are anyway small, and other surrounding
values are floating point. This function lies in relatively speed
relevant code.

Will investigate sometime, unless the maintainer offers insight here.
Patch shelved, thanks.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] aacenc: update max_sfb when num_swb changes

2015-12-08 Thread Rostislav Pehlivanov
LGTM

Thanks, sorry I took so long to see the email
Push when you can

On 6 December 2015 at 21:33, Andreas Cadhalpun <
andreas.cadhal...@googlemail.com> wrote:

> This fixes out-of-bounds reads in avoid_clipping.
>
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/aacenc.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> index 2156fc0..d48fb32 100644
> --- a/libavcodec/aacenc.c
> +++ b/libavcodec/aacenc.c
> @@ -574,6 +574,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
> AVPacket *avpkt,
>  ics->num_windows= wi[ch].num_windows;
>  ics->swb_sizes  = s->psy.bands[ics->num_windows
> == 8];
>  ics->num_swb= tag == TYPE_LFE ? ics->num_swb :
> s->psy.num_bands[ics->num_windows == 8];
> +ics->max_sfb= FFMIN(ics->max_sfb, ics->num_swb);
>  ics->swb_offset = wi[ch].window_type[0] ==
> EIGHT_SHORT_SEQUENCE ?
>  ff_swb_offset_128
> [s->samplerate_index]:
>
>  ff_swb_offset_1024[s->samplerate_index];
> --
> 2.6.2
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] diracdec: Add HQ Profile support

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 07:27:42PM +, Kieran Kunhya wrote:
[...]

> @@ -1057,29 +1129,19 @@ static int dirac_unpack_idwt_params(DiracContext *s)
>  
>  CHECKEDREAD(s->wavelet_depth, tmp > MAX_DWT_LEVELS || tmp < 1, "invalid 
> number of DWT decompositions\n")
>  
> -if (!s->low_delay) {
> -/* Codeblock parameters (core syntax only) */
> -if (get_bits1(gb)) {
> -for (i = 0; i <= s->wavelet_depth; i++) {
> -CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > 
> (s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
> -CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > 
> (s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
> +if (s->low_delay) {
> +s->num_x= svq3_get_ue_golomb(gb);
> +s->num_y= svq3_get_ue_golomb(gb);
> +if (s->ld_picture) {
> +s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
> +s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);
> +if (s->lowdelay.bytes.den <= 0) {
> +av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n");
> +return AVERROR_INVALIDDATA;
>  }
> -
> -CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock 
> mode\n")
> -} else
> -for (i = 0; i <= s->wavelet_depth; i++)
> -s->codeblock[i].width = s->codeblock[i].height = 1;
> -} else {
> -/* Slice parameters + quantization matrix*/
> -/*[DIRAC_STD] 11.3.4 Slice coding Parameters (low delay syntax 
> only). slice_parameters() */
> -s->lowdelay.num_x = svq3_get_ue_golomb(gb);
> -s->lowdelay.num_y = svq3_get_ue_golomb(gb);
> -s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
> -s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);
> -
> -if (s->lowdelay.bytes.den <= 0) {
> -av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n");
> -return AVERROR_INVALIDDATA;
> +} else if (s->hq_picture) {
> +s->highquality.prefix_bytes = svq3_get_ue_golomb(gb);
> +s->highquality.size_scaler  = svq3_get_ue_golomb(gb);
>  }
>  
>  /* [DIRAC_STD] 11.3.5 Quantisation matrices (low-delay syntax). 
> quant_matrix() */

Can this patch be split into independant changes ?

it seems some parts are reindented differntly and some fields are
moved like  s->lowdelay.num_* -> s->num_*

this should make it easier to review

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

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


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


Re: [FFmpeg-devel] [PATCH 1/2] diracdec: Move strides to bytes, and pointer types to uint8_t. Also template functions for move to support 10-bit Parts of this patch were written by Rostislav Pehlivano

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 07:27:41PM +, Kieran Kunhya wrote:
[...]

> +if (bit_depth == 8)
> +ret = ff_spatial_idwt_init2_8bit(d, buffer, width, height, stride, 
> type, decomposition_count, temp);
> +else if (bit_depth == 10)
> +ret = ff_spatial_idwt_init2_10bit(d, buffer, width, height, stride, 
> type, decomposition_count, temp);
> +else if (bit_depth == 12)
> +ret = ff_spatial_idwt_init2_12bit(d, buffer, width, height, stride, 
> type, decomposition_count, temp);
> +else
> +av_log(NULL, AV_LOG_WARNING, "Unsupported bit depth = %i\n", 
> bit_depth);

[...]
> @@ -1860,10 +1905,14 @@ static int dirac_decode_data_unit(AVCodecContext 
> *avctx, const uint8_t *buf, int
>  return 0;
>  
>  /* [DIRAC_STD] 10. Sequence header */
> -ret = avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source);
> +ret = avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source,
> + &s->bit_depth);

> +s->pshift = s->bit_depth > 8;
>  if (ret < 0)
>  return ret;
>  
> +s->pshift = s->bit_depth > 8;
[...]


> +static void put_signed_rect_clamped_10bit_c(uint8_t *_dst, int dst_stride, 
> const uint8_t *_src, int src_stride, int width, int height)
> +{
> +int x, y;
> +uint16_t *dst = (uint16_t *)_dst;
> +int32_t *src = (int32_t *)_src;
> +for (y = 0; y < height; y++) {
> +for (x = 0; x < width; x+=4) {
> +dst[x  ] = av_clip(src[x  ] + 512, 0, (1 << 10) - 1);
> +dst[x+1] = av_clip(src[x+1] + 512, 0, (1 << 10) - 1);
> +dst[x+2] = av_clip(src[x+2] + 512, 0, (1 << 10) - 1);
> +dst[x+3] = av_clip(src[x+3] + 512, 0, (1 << 10) - 1);
> +}
> +dst += dst_stride >> 1;
> +src += src_stride >> 2;
>  }
>  }

Is this intended to be in this or a subsequent patch ?

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

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


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


Re: [FFmpeg-devel] [PATCH 1/2] diracdec: Move strides to bytes, and pointer types to uint8_t. Also template functions for move to support 10-bit Parts of this patch were written by Rostislav Pehlivano

2015-12-08 Thread Kieran Kunhya
> Is this intended to be in this or a subsequent patch ?

Meant to be in this patch because 10-bit isn't specific to HQ profile.
Or am I missing something?
Kieran
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] diracdec: Add HQ Profile support

2015-12-08 Thread Kieran Kunhya
> Can this patch be split into independant changes ?
>
> it seems some parts are reindented differntly and some fields are
> moved like  s->lowdelay.num_* -> s->num_*
>
> this should make it easier to review

I could do but the majority of the patch is still the addition of HQ profile...
Kieran
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] diracdec: Move strides to bytes, and pointer types to uint8_t. Also template functions for move to support 10-bit Parts of this patch were written by Rostislav Pehlivano

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 09:49:19PM +, Kieran Kunhya wrote:
> > Is this intended to be in this or a subsequent patch ?
> 
> Meant to be in this patch because 10-bit isn't specific to HQ profile.
> Or am I missing something?

no, just thought this one was just intended to be cosmetic and
restructuring

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

Observe your enemies, for they first find out your faults. -- Antisthenes


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


Re: [FFmpeg-devel] [PATCH] aacenc: update max_sfb when num_swb changes

2015-12-08 Thread Andreas Cadhalpun
On 08.12.2015 22:00, Rostislav Pehlivanov wrote:
> LGTM
> 
> Thanks, sorry I took so long to see the email
> Push when you can

Pushed.

Maybe you can also have a look at the other problem I mentioned [1].

Best regards,
Andreas

1: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/184683.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] diracdec: Add HQ Profile support

2015-12-08 Thread Michael Niedermayer
On Tue, Dec 08, 2015 at 07:27:42PM +, Kieran Kunhya wrote:
> From: Rostislav Pehlivanov 
> 
> ---
>  libavcodec/dirac.c  |  31 ++--
>  libavcodec/dirac.h  |  28 
>  libavcodec/dirac_dwt.h  |   2 +-
>  libavcodec/diracdec.c   | 357 
> +++-
>  libavformat/oggparsedirac.c |   3 +-
>  5 files changed, 265 insertions(+), 156 deletions(-)
> 
> diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
> index aa82dd9..67447c5 100644
> --- a/libavcodec/dirac.c
> +++ b/libavcodec/dirac.c
> @@ -109,10 +109,11 @@ static const struct {
>  { AVCOL_PRI_BT709, AVCOL_SPC_BT709,   AVCOL_TRC_UNSPECIFIED /* 
> DCinema */ },
>  };
>  
> -/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats + luma Offset */
> -static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
> -{ AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV420P  },
> -{ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P },
> +/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats */
> +static const enum AVPixelFormat dirac_pix_fmt[3][3] = {

[][3] should avoid hardcoding the array size


[...]
> diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h
> index 41842b5..e885373 100644
> --- a/libavcodec/dirac_dwt.h
> +++ b/libavcodec/dirac_dwt.h
> @@ -24,7 +24,7 @@
>  #include 
>  
>  typedef int DWTELEM;
> -typedef short IDWTELEM;
> +typedef int IDWTELEM;

If its easy to seperate this out then it would allow improved
bisectability


[...]
> @@ -224,17 +235,6 @@ typedef struct DiracContext {
>  DiracFrame all_frames[MAX_FRAMES];
>  } DiracContext;
>  
> -/**
> - * Dirac Specification ->
> - * Parse code values. 9.6.1 Table 9.1
> - */
> -enum dirac_parse_code {
> -pc_seq_header = 0x00,
> -pc_eos= 0x10,
> -pc_aux_data   = 0x20,
> -pc_padding= 0x30,
> -};
> -
>  enum dirac_subband {
>  subband_ll = 0,
>  subband_hl = 1,

unrelated, this is already unused before


[...]
> @@ -466,7 +482,7 @@ static av_cold int dirac_decode_end(AVCodecContext *avctx)
>  
>  #define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))
>  
> -static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int 
> qoffset)
> +static av_always_inline int coeff_unpack_golomb(GetBitContext *gb, int 
> qfactor, int qoffset)
>  {
>  int sign, coeff;
>  

> @@ -584,18 +600,6 @@ static inline void codeblock(DiracContext *s, SubBand *b,
>   }
>  }
>  
> -#define PARSE_VALUES(type, x, gb, ebits, buf1, buf2) \
> -type *buf = (type *)buf1; \
> -buf[x] = coeff_unpack_golomb(gb, qfactor, qoffset); \
> -if (get_bits_count(gb) >= ebits) \
> -return; \
> -if (buf2) { \
> -buf = (type *)buf2; \
> -buf[x] = coeff_unpack_golomb(gb, qfactor, qoffset); \
> -if (get_bits_count(gb) >= ebits) \
> -return; \
> -} \
> -

>  /**
>   * Dirac Specification ->
>   * 13.3 intra_dc_prediction(band)
> @@ -719,49 +723,68 @@ static void decode_component(DiracContext *s, int comp)
>  avctx->execute(avctx, decode_subband_golomb, bands, NULL, num_bands, 
> sizeof(SubBand*));
>  }
>  
> -/* [DIRAC_STD] 13.5.5.2 Luma slice subband data. 
> luma_slice_band(level,orient,sx,sy) --> if b2 == NULL */
> -/* [DIRAC_STD] 13.5.5.3 Chroma slice subband data. 
> chroma_slice_band(level,orient,sx,sy) --> if b2 != NULL */
> -static void lowdelay_subband(DiracContext *s, GetBitContext *gb, int quant,
> - int slice_x, int slice_y, int bits_end,
> - SubBand *b1, SubBand *b2)
> +#define PARSE_VALUES(type, x, gb, ebits, buf1, buf2) \

PARSE_VALUES was just added in the previous patch, why is it moved
around after its addition ?
It would be cleaner to place it initially whereever its final location
is intended to be



[...]

> -for (y = top; y < bottom; y++) {
> -for (x = left; x < right; x++) {
> -if (s->pshift) {
> +if (s->pshift) {
> +for (y = top; y < bottom; y++) {
> +for (x = left; x < right; x++) {
>  PARSE_VALUES(int32_t, x, gb, bits_end, buf1, buf2);
> -} else {
> +}
> +
> +buf1 += b1->stride;
> +if (buf2)
> +buf2 += b2->stride;
> +}
> +}
> +else {
> +for (y = top; y < bottom; y++) {
> +for (x = left; x < right; x++) {
>  PARSE_VALUES(int16_t, x, gb, bits_end, buf1, buf2);
>  }
> +
> +buf1 += b1->stride;
> +if (buf2)
> +buf2 += b2->stride;
>  }
> -buf1 += b1->stride;
> -if (buf2)
> -buf2 += b2->stride;
>  }
>  }
>  

this would be more readable without the indention change



> -struct lowdelay_slice {
> +/* Used by Low Delay and High Quality profiles */
> +typedef struct DiracSlice {
>  GetBitContext gb;
>  int slice_x;
>  int slice_y;
>

[FFmpeg-devel] [PATCH 03/11] diracdec: Rename lowdelay_subband to decode_subband because it is shared with HQ profile

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 4c02259..d2a4bac 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -719,11 +719,9 @@ static void decode_component(DiracContext *s, int comp)
 return; \
 } \
 
-/* [DIRAC_STD] 13.5.5.2 Luma slice subband data. 
luma_slice_band(level,orient,sx,sy) --> if b2 == NULL */
-/* [DIRAC_STD] 13.5.5.3 Chroma slice subband data. 
chroma_slice_band(level,orient,sx,sy) --> if b2 != NULL */
-static void lowdelay_subband(DiracContext *s, GetBitContext *gb, int quant,
- int slice_x, int slice_y, int bits_end,
- SubBand *b1, SubBand *b2)
+static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
+   int slice_x, int slice_y, int bits_end,
+   SubBand *b1, SubBand *b2)
 {
 int left   = b1->width  * slice_x/ s->lowdelay.num_x;
 int right  = b1->width  *(slice_x+1) / s->lowdelay.num_x;
@@ -792,8 +790,8 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, 
void *arg)
 for (level = 0; level < s->wavelet_depth; level++)
 for (orientation = !!level; orientation < 4; orientation++) {
 quant = FFMAX(quant_base - s->lowdelay.quant[level][orientation], 
0);
-lowdelay_subband(s, gb, quant, slice->slice_x, slice->slice_y, 
luma_end,
- &s->plane[0].band[level][orientation], NULL);
+decode_subband(s, gb, quant, slice->slice_x, slice->slice_y, 
luma_end,
+   &s->plane[0].band[level][orientation], NULL);
 }
 
 /* consume any unused bits from luma */
@@ -805,9 +803,9 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, 
void *arg)
 for (level = 0; level < s->wavelet_depth; level++)
 for (orientation = !!level; orientation < 4; orientation++) {
 quant = FFMAX(quant_base - s->lowdelay.quant[level][orientation], 
0);
-lowdelay_subband(s, gb, quant, slice->slice_x, slice->slice_y, 
chroma_end,
- &s->plane[1].band[level][orientation],
- &s->plane[2].band[level][orientation]);
+decode_subband(s, gb, quant, slice->slice_x, slice->slice_y, 
chroma_end,
+   &s->plane[1].band[level][orientation],
+   &s->plane[2].band[level][orientation]);
 }
 
 return 0;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 04/11] diracdec: Make slice parameters common between lowdelay and future hq profile

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index d2a4bac..fca722d 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -168,14 +168,15 @@ typedef struct DiracContext {
 unsigned old_delta_quant;
 unsigned codeblock_mode;
 
+unsigned num_x;  /* number of horizontal slices   
*/
+unsigned num_y;  /* number of vertical slices 
*/
+
 struct {
 unsigned width;
 unsigned height;
 } codeblock[MAX_DWT_LEVELS+1];
 
 struct {
-unsigned num_x; /* number of horizontal slices   */
-unsigned num_y; /* number of vertical slices */
 AVRational bytes;   /* average bytes per slice   */
 uint8_t quant[MAX_DWT_LEVELS][4]; /* [DIRAC_STD] E.1 */
 } lowdelay;
@@ -723,10 +724,10 @@ static void decode_subband(DiracContext *s, GetBitContext 
*gb, int quant,
int slice_x, int slice_y, int bits_end,
SubBand *b1, SubBand *b2)
 {
-int left   = b1->width  * slice_x/ s->lowdelay.num_x;
-int right  = b1->width  *(slice_x+1) / s->lowdelay.num_x;
-int top= b1->height * slice_y/ s->lowdelay.num_y;
-int bottom = b1->height *(slice_y+1) / s->lowdelay.num_y;
+int left   = b1->width  * slice_x/ s->num_x;
+int right  = b1->width  *(slice_x+1) / s->num_x;
+int top= b1->height * slice_y/ s->num_y;
+int bottom = b1->height *(slice_y+1) / s->num_y;
 
 int qfactor = qscale_tab[FFMIN(quant, MAX_QUANT)];
 int qoffset = qoffset_intra_tab[FFMIN(quant, MAX_QUANT)];
@@ -761,12 +762,13 @@ static void decode_subband(DiracContext *s, GetBitContext 
*gb, int quant,
 }
 }
 
-struct lowdelay_slice {
+/* Used by Low Delay and High Quality profiles */
+typedef struct DiracSlice {
 GetBitContext gb;
 int slice_x;
 int slice_y;
 int bytes;
-};
+} DiracSlice;
 
 
 /**
@@ -776,7 +778,7 @@ struct lowdelay_slice {
 static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg)
 {
 DiracContext *s = avctx->priv_data;
-struct lowdelay_slice *slice = arg;
+DiracSlice *slice = arg;
 GetBitContext *gb = &slice->gb;
 enum dirac_subband orientation;
 int level, quant, chroma_bits, chroma_end;
@@ -820,10 +822,10 @@ static int decode_lowdelay(DiracContext *s)
 AVCodecContext *avctx = s->avctx;
 int slice_x, slice_y, bytes, bufsize;
 const uint8_t *buf;
-struct lowdelay_slice *slices;
+DiracSlice *slices;
 int slice_num = 0;
 
-slices = av_mallocz_array(s->lowdelay.num_x, s->lowdelay.num_y * 
sizeof(struct lowdelay_slice));
+slices = av_mallocz_array(s->num_x, s->num_y * sizeof(DiracSlice));
 if (!slices)
 return AVERROR(ENOMEM);
 
@@ -832,11 +834,10 @@ static int decode_lowdelay(DiracContext *s)
 buf = s->gb.buffer + get_bits_count(&s->gb)/8;
 bufsize = get_bits_left(&s->gb);
 
-for (slice_y = 0; bufsize > 0 && slice_y < s->lowdelay.num_y; slice_y++)
-for (slice_x = 0; bufsize > 0 && slice_x < s->lowdelay.num_x; 
slice_x++) {
+for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) {
+for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
 bytes = (slice_num+1) * s->lowdelay.bytes.num / 
s->lowdelay.bytes.den
 - slice_num* s->lowdelay.bytes.num / s->lowdelay.bytes.den;
-
 slices[slice_num].bytes   = bytes;
 slices[slice_num].slice_x = slice_x;
 slices[slice_num].slice_y = slice_y;
@@ -849,9 +850,10 @@ static int decode_lowdelay(DiracContext *s)
 else
 bufsize = 0;
 }
+}
 
 avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
-   sizeof(struct lowdelay_slice)); /* [DIRAC_STD] 13.5.2 
Slices */
+   sizeof(struct DiracSlice)); /* [DIRAC_STD] 13.5.2 Slices */
 if (s->pshift) {
 intra_dc_prediction_10(&s->plane[0].band[0][0]);
 intra_dc_prediction_10(&s->plane[1].band[0][0]);
@@ -1078,8 +1080,8 @@ static int dirac_unpack_idwt_params(DiracContext *s)
 } else {
 /* Slice parameters + quantization matrix*/
 /*[DIRAC_STD] 11.3.4 Slice coding Parameters (low delay syntax only). 
slice_parameters() */
-s->lowdelay.num_x = svq3_get_ue_golomb(gb);
-s->lowdelay.num_y = svq3_get_ue_golomb(gb);
+s->num_x = svq3_get_ue_golomb(gb);
+s->num_y = svq3_get_ue_golomb(gb);
 s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
 s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 01/11] diracdec: Move strides to bytes, and pointer types to uint8_t.

2015-12-08 Thread Kieran Kunhya
Start templating functions for move to support 10-bit
Parts of this patch were written by Rostislav Pehlivanov
---
 libavcodec/dirac.c  |  10 +-
 libavcodec/dirac.h  |   3 +-
 libavcodec/diracdec.c   | 253 +++-
 libavformat/oggparsedirac.c |   4 +-
 4 files changed, 166 insertions(+), 104 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 07db919..aa82dd9 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -118,7 +118,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
 /* [DIRAC_STD] 10.3 Parse Source Parameters.
  * source_parameters(base_video_format) */
 static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
-   dirac_source_params *source)
+   dirac_source_params *source, int *bit_depth)
 {
 AVRational frame_rate = { 0, 0 };
 unsigned luma_depth = 8, luma_offset = 16;
@@ -239,6 +239,9 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
 if (luma_depth > 8)
 av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n");
 
+
+*bit_depth = luma_depth;
+
 avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, 
&chroma_y_shift);
 if ((source->width % (1height);
diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
index b0f955b..14653f1 100644
--- a/libavcodec/dirac.h
+++ b/libavcodec/dirac.h
@@ -55,6 +55,7 @@ typedef struct dirac_source_params {
 } dirac_source_params;
 
 int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext 
*gb,
-   dirac_source_params *source);
+   dirac_source_params *source,
+   int *bit_depth);
 
 #endif /* AVCODEC_DIRAC_H */
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index ea16007..62f375f 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -97,11 +97,12 @@ typedef struct {
 typedef struct SubBand {
 int level;
 int orientation;
-int stride;
+int stride; /* in bytes */
 int width;
 int height;
+int pshift;
 int quant;
-IDWTELEM *ibuf;
+uint8_t *ibuf;
 struct SubBand *parent;
 
 /* for low delay */
@@ -117,9 +118,9 @@ typedef struct Plane {
 int idwt_width;
 int idwt_height;
 int idwt_stride;
-IDWTELEM *idwt_buf;
-IDWTELEM *idwt_buf_base;
-IDWTELEM *idwt_tmp;
+uint8_t *idwt_buf;
+uint8_t *idwt_buf_base;
+uint8_t *idwt_tmp;
 
 /* block length */
 uint8_t xblen;
@@ -147,6 +148,9 @@ typedef struct DiracContext {
 int chroma_x_shift;
 int chroma_y_shift;
 
+int bit_depth;  /* bit depth */
+int pshift; /* pixel shift = bit_depth > 8   */
+
 int zero_res;   /* zero residue flag */
 int is_arith;   /* whether coeffs use arith or golomb coding */
 int low_delay;  /* use the low delay syntax  */
@@ -339,9 +343,9 @@ static int alloc_sequence_buffers(DiracContext *s)
 w = FFALIGN(CALC_PADDING(w, MAX_DWT_LEVELS), 8); /* FIXME: Should this 
be 16 for SSE??? */
 h = top_padding + CALC_PADDING(h, MAX_DWT_LEVELS) + max_yblen/2;
 
-s->plane[i].idwt_buf_base = av_mallocz_array((w+max_xblen), h * 
sizeof(IDWTELEM));
-s->plane[i].idwt_tmp  = av_malloc_array((w+16), sizeof(IDWTELEM));
-s->plane[i].idwt_buf  = s->plane[i].idwt_buf_base + top_padding*w;
+s->plane[i].idwt_buf_base = av_mallocz_array((w+max_xblen), h * (2 << 
s->pshift));
+s->plane[i].idwt_tmp  = av_malloc_array((w+16), 2 << s->pshift);
+s->plane[i].idwt_buf  = s->plane[i].idwt_buf_base + 
(top_padding*w)*(2 << s->pshift);
 if (!s->plane[i].idwt_buf_base || !s->plane[i].idwt_tmp)
 return AVERROR(ENOMEM);
 }
@@ -462,38 +466,6 @@ static av_cold int dirac_decode_end(AVCodecContext *avctx)
 
 #define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))
 
-static inline void coeff_unpack_arith(DiracArith *c, int qfactor, int qoffset,
-  SubBand *b, IDWTELEM *buf, int x, int y)
-{
-int coeff, sign;
-int sign_pred = 0;
-int pred_ctx = CTX_ZPZN_F1;
-
-/* Check if the parent subband has a 0 in the corresponding position */
-if (b->parent)
-pred_ctx += !!b->parent->ibuf[b->parent->stride * (y>>1) + (x>>1)] << 
1;
-
-if (b->orientation == subband_hl)
-sign_pred = buf[-b->stride];
-
-/* Determine if the pixel has only zeros in its neighbourhood */
-if (x) {
-pred_ctx += !(buf[-1] | buf[-b->stride] | buf[-1-b->stride]);
-if (b->orientation == subband_lh)
-sign_pred = buf[-1];

[FFmpeg-devel] [PATCH 02/11] diracdec: Template DSP functions adding 10-bit versions

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac_dwt.c   | 530 ++-
 libavcodec/dirac_dwt.h   |  20 +-
 libavcodec/diracdec.c|   8 +-
 libavcodec/diracdsp.c|  25 +-
 libavcodec/diracdsp.h|   4 +-
 libavcodec/x86/dirac_dwt.c   |  65 +++--
 libavcodec/x86/diracdsp_mmx.c|   4 +-
 libavcodec/x86/diracdsp_yasm.asm |   4 +-
 8 files changed, 111 insertions(+), 549 deletions(-)

diff --git a/libavcodec/dirac_dwt.c b/libavcodec/dirac_dwt.c
index ee3665e..ae847f7 100644
--- a/libavcodec/dirac_dwt.c
+++ b/libavcodec/dirac_dwt.c
@@ -25,523 +25,40 @@
 #include "dirac_dwt.h"
 #include "libavcodec/x86/dirac_dwt.h"
 
+#define TEMPLATE_8bit
+#include "dirac_dwt_template.c"
+#undef TEMPLATE_8bit
 
-static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
-  int width)
-{
-int i;
-
-for (i = 0; i < width; i++)
-b1[i] -= (b0[i] + b2[i] + 2) >> 2;
-}
-
-
-static av_always_inline
-void interleave(IDWTELEM *dst, IDWTELEM *src0, IDWTELEM *src1, int w2, int 
add, int shift)
-{
-int i;
-for (i = 0; i < w2; i++) {
-dst[2*i  ] = (src0[i] + add) >> shift;
-dst[2*i+1] = (src1[i] + add) >> shift;
-}
-}
-
-static void horizontal_compose_dirac53i(IDWTELEM *b, IDWTELEM *temp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-temp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]);
-for (x = 1; x < w2; x++) {
-temp[x ] = COMPOSE_53iL0 (b[x+w2-1], b[x ], b[x+w2]);
-temp[x+w2-1] = COMPOSE_DIRAC53iH0(temp[x-1], b[x+w2-1], temp[x]);
-}
-temp[w-1] = COMPOSE_DIRAC53iH0(temp[w2-1], b[w-1], temp[w2-1]);
-
-interleave(b, temp, temp+w2, w2, 1, 1);
-}
-
-static void horizontal_compose_dd97i(IDWTELEM *b, IDWTELEM *tmp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-tmp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]);
-for (x = 1; x < w2; x++)
-tmp[x] = COMPOSE_53iL0(b[x+w2-1], b[x], b[x+w2]);
-
-// extend the edges
-tmp[-1]   = tmp[0];
-tmp[w2+1] = tmp[w2] = tmp[w2-1];
-
-for (x = 0; x < w2; x++) {
-b[2*x  ] = (tmp[x] + 1)>>1;
-b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], 
tmp[x+2]) + 1)>>1;
-}
-}
-
-static void horizontal_compose_dd137i(IDWTELEM *b, IDWTELEM *tmp, int w)
-{
-const int w2 = w >> 1;
-int x;
-
-tmp[0] = COMPOSE_DD137iL0(b[w2], b[w2], b[0], b[w2  ], b[w2+1]);
-tmp[1] = COMPOSE_DD137iL0(b[w2], b[w2], b[1], b[w2+1], b[w2+2]);
-for (x = 2; x < w2-1; x++)
-tmp[x] = COMPOSE_DD137iL0(b[x+w2-2], b[x+w2-1], b[x], b[x+w2], 
b[x+w2+1]);
-tmp[w2-1] = COMPOSE_DD137iL0(b[w-3], b[w-2], b[w2-1], b[w-1], b[w-1]);
-
-// extend the edges
-tmp[-1]   = tmp[0];
-tmp[w2+1] = tmp[w2] = tmp[w2-1];
-
-for (x = 0; x < w2; x++) {
-b[2*x  ] = (tmp[x] + 1)>>1;
-b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], 
tmp[x+2]) + 1)>>1;
-}
-}
-
-static av_always_inline
-void horizontal_compose_haari(IDWTELEM *b, IDWTELEM *temp, int w, int shift)
-{
-const int w2 = w >> 1;
-int x;
-
-for (x = 0; x < w2; x++) {
-temp[x   ] = COMPOSE_HAARiL0(b[x   ], b[x+w2]);
-temp[x+w2] = COMPOSE_HAARiH0(b[x+w2], temp[x]);
-}
-
-interleave(b, temp, temp+w2, w2, shift, shift);
-}
-
-static void horizontal_compose_haar0i(IDWTELEM *b, IDWTELEM *temp, int w)
-{
-horizontal_compose_haari(b, temp, w, 0);
-}
-
-static void horizontal_compose_haar1i(IDWTELEM *b, IDWTELEM *temp, int w)
-{
-horizontal_compose_haari(b, temp, w, 1);
-}
-
-static void horizontal_compose_fidelityi(IDWTELEM *b, IDWTELEM *tmp, int w)
-{
-const int w2 = w >> 1;
-int i, x;
-IDWTELEM v[8];
-
-for (x = 0; x < w2; x++) {
-for (i = 0; i < 8; i++)
-v[i] = b[av_clip(x-3+i, 0, w2-1)];
-tmp[x] = COMPOSE_FIDELITYiH0(v[0], v[1], v[2], v[3], b[x+w2], v[4], 
v[5], v[6], v[7]);
-}
-
-for (x = 0; x < w2; x++) {
-for (i = 0; i < 8; i++)
-v[i] = tmp[av_clip(x-4+i, 0, w2-1)];
-tmp[x+w2] = COMPOSE_FIDELITYiL0(v[0], v[1], v[2], v[3], b[x], v[4], 
v[5], v[6], v[7]);
-}
-
-interleave(b, tmp+w2, tmp, w2, 0, 0);
-}
-
-static void horizontal_compose_daub97i(IDWTELEM *b, IDWTELEM *temp, int w)
-{
-const int w2 = w >> 1;
-int x, b0, b1, b2;
-
-temp[0] = COMPOSE_DAUB97iL1(b[w2], b[0], b[w2]);
-for (x = 1; x < w2; x++) {
-temp[x ] = COMPOSE_DAUB97iL1(b[x+w2-1], b[x ], b[x+w2]);
-temp[x+w2-1] = COMPOSE_DAUB97iH1(temp[x-1], b[x+w2-1], temp[x]);
-}
-temp[w-1] = COMPOSE_DAUB97iH1(temp[w2-1], b[w-1], temp[w2-1]);
-
-// second stage combined with interleave and shift
-b0 = b2 = COMPOSE_DAUB97iL0(temp[w2], temp[0], temp[w2]);
-b[0] = (b0 + 1) >> 1;
-for (x = 1; x < w2; x++) {
-b2 = COMPOSE_DAUB97iL0(temp[x+w2-1], temp[x ], temp[x+w2]);
-b1 = COMPOSE_DAUB97iH0(  b0, temp[x+w2-1], b2);

[FFmpeg-devel] [PATCH 09/11] diracdec: Store version major/minor flags

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 6b1a93b..9bf0fd4 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -294,22 +294,21 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext 
*avctx, GetBitContext *gb,
DiracVersionInfo *version,
int *bit_depth)
 {
-unsigned version_major;
 unsigned video_format, picture_coding_mode;
 int ret;
 
 /* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */
-version_major  = svq3_get_ue_golomb(gb);
-svq3_get_ue_golomb(gb); /* version_minor */
-avctx->profile = svq3_get_ue_golomb(gb);
-avctx->level   = svq3_get_ue_golomb(gb);
+version->major  = svq3_get_ue_golomb(gb);
+version->minor  = svq3_get_ue_golomb(gb);
+avctx->profile  = svq3_get_ue_golomb(gb);
+avctx->level= svq3_get_ue_golomb(gb);
 /* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
  * 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
-video_format   = svq3_get_ue_golomb(gb);
+video_format= svq3_get_ue_golomb(gb);
 
-if (version_major < 2)
+if (version->major < 2)
 av_log(avctx, AV_LOG_WARNING, "Stream is old and may not work\n");
-else if (version_major > 2)
+else if (version->major > 2)
 av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n");
 
 if (video_format > 20U)
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 06/11] diracdec: Add 10-bits to pix_fmt table

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index fd6e869..6b1a93b 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -109,10 +109,11 @@ static const struct {
 { AVCOL_PRI_BT709, AVCOL_SPC_BT709,   AVCOL_TRC_UNSPECIFIED /* DCinema 
*/ },
 };
 
-/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats + luma Offset */
-static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
-{ AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV420P  },
-{ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P },
+/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats */
+static const enum AVPixelFormat dirac_pix_fmt[][3] = {
+{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12},
+{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12},
+{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12},
 };
 
 /* [DIRAC_STD] 10.3 Parse Source Parameters.
@@ -236,13 +237,9 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
 avctx->color_range = pixel_range_presets[idx].color_range;
 }
 
-if (luma_depth > 8)
-av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n");
-
-
 *bit_depth = luma_depth;
 
-avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
+avctx->pix_fmt = 
dirac_pix_fmt[source->chroma_format][source->pixel_range_index-2];
 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, 
&chroma_y_shift);
 if ((source->width % (1

[FFmpeg-devel] [PATCH 05/11] diracdec: Extract version parameters

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac.c  | 1 +
 libavcodec/dirac.h  | 6 ++
 libavcodec/diracdec.c   | 3 ++-
 libavformat/oggparsedirac.c | 3 ++-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index aa82dd9..fd6e869 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -294,6 +294,7 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
 /* [DIRAC_STD] 10. Sequence Header. sequence_header() */
 int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext 
*gb,
dirac_source_params *source,
+   DiracVersionInfo *version,
int *bit_depth)
 {
 unsigned version_major;
diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
index 14653f1..6852e82 100644
--- a/libavcodec/dirac.h
+++ b/libavcodec/dirac.h
@@ -34,6 +34,11 @@
 #include "avcodec.h"
 #include "get_bits.h"
 
+typedef struct DiracVersionInfo {
+int major;
+int minor;
+} DiracVersionInfo;
+
 typedef struct dirac_source_params {
 unsigned width;
 unsigned height;
@@ -56,6 +61,7 @@ typedef struct dirac_source_params {
 
 int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext 
*gb,
dirac_source_params *source,
+   DiracVersionInfo *version,
int *bit_depth);
 
 #endif /* AVCODEC_DIRAC_H */
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index fca722d..5b0634c 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -140,6 +140,7 @@ typedef struct DiracContext {
 MpegvideoEncDSPContext mpvencdsp;
 VideoDSPContext vdsp;
 DiracDSPContext diracdsp;
+DiracVersionInfo version;
 GetBitContext gb;
 dirac_source_params source;
 int seen_sequence_header;
@@ -1913,7 +1914,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, 
const uint8_t *buf, int
 return 0;
 
 /* [DIRAC_STD] 10. Sequence header */
-ret = avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source,
+ret = avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source, 
&s->version,
  &s->bit_depth);
 s->pshift = s->bit_depth > 8;
 if (ret < 0)
diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
index b317f5a..2835ac7 100644
--- a/libavformat/oggparsedirac.c
+++ b/libavformat/oggparsedirac.c
@@ -30,6 +30,7 @@ static int dirac_header(AVFormatContext *s, int idx)
 struct ogg_stream *os = ogg->streams + idx;
 AVStream *st = s->streams[idx];
 dirac_source_params source;
+DiracVersionInfo version;
 GetBitContext gb;
 int ret, bit_depth;
 
@@ -41,7 +42,7 @@ static int dirac_header(AVFormatContext *s, int idx)
 if (ret < 0)
 return ret;
 
-ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source, 
&bit_depth);
+ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source, 
&version, &bit_depth);
 if (ret < 0)
 return ret;
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 07/11] diracdec: Replace dirac parse codes with better ones

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/dirac.h| 22 ++
 libavcodec/diracdec.c | 18 +++---
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
index 6852e82..b4982f8 100644
--- a/libavcodec/dirac.h
+++ b/libavcodec/dirac.h
@@ -34,6 +34,28 @@
 #include "avcodec.h"
 #include "get_bits.h"
 
+/**
+ * Parse code values:
+ *
+ * Dirac Specification ->
+ * 9.6.1  Table 9.1
+ *
+ * VC-2 Specification  ->
+ * 10.4.1 Table 10.1
+ */
+
+enum DiracParseCodes {
+DIRAC_PCODE_SEQ_HEADER  = 0x00,
+DIRAC_PCODE_END_SEQ = 0x10,
+DIRAC_PCODE_AUX = 0x20,
+DIRAC_PCODE_PAD = 0x30,
+DIRAC_PCODE_PICTURE_CODED   = 0x08,
+DIRAC_PCODE_PICTURE_RAW = 0x48,
+DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,
+DIRAC_PCODE_PICTURE_HQ  = 0xE8,
+DIRAC_PCODE_MAGIC   = 0x42424344,
+};
+
 typedef struct DiracVersionInfo {
 int major;
 int minor;
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 5b0634c..c42360d 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -226,17 +226,6 @@ typedef struct DiracContext {
 DiracFrame all_frames[MAX_FRAMES];
 } DiracContext;
 
-/**
- * Dirac Specification ->
- * Parse code values. 9.6.1 Table 9.1
- */
-enum dirac_parse_code {
-pc_seq_header = 0x00,
-pc_eos= 0x10,
-pc_aux_data   = 0x20,
-pc_padding= 0x30,
-};
-
 enum dirac_subband {
 subband_ll = 0,
 subband_hl = 1,
@@ -1909,14 +1898,13 @@ static int dirac_decode_data_unit(AVCodecContext 
*avctx, const uint8_t *buf, int
 
 init_get_bits(&s->gb, &buf[13], 8*(size - DATA_UNIT_HEADER_SIZE));
 
-if (parse_code == pc_seq_header) {
+if (parse_code == DIRAC_PCODE_SEQ_HEADER) {
 if (s->seen_sequence_header)
 return 0;
 
 /* [DIRAC_STD] 10. Sequence header */
 ret = avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source, 
&s->version,
  &s->bit_depth);
-s->pshift = s->bit_depth > 8;
 if (ret < 0)
 return ret;
 
@@ -1929,10 +1917,10 @@ static int dirac_decode_data_unit(AVCodecContext 
*avctx, const uint8_t *buf, int
 return ret;
 
 s->seen_sequence_header = 1;
-} else if (parse_code == pc_eos) { /* [DIRAC_STD] End of Sequence */
+} else if (parse_code == DIRAC_PCODE_END_SEQ) { /* [DIRAC_STD] End of 
Sequence */
 free_sequence_buffers(s);
 s->seen_sequence_header = 0;
-} else if (parse_code == pc_aux_data) {
+} else if (parse_code == DIRAC_PCODE_AUX) {
 if (buf[13] == 1) { /* encoder implementation/version */
 int ver[3];
 /* versions older than 1.0.8 don't store quant delta for
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 11/11] diracdec: Add support for HQ profile

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 119 +-
 1 file changed, 80 insertions(+), 39 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 9c09d51..6a53f38 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -187,6 +187,11 @@ typedef struct DiracContext {
 } lowdelay;
 
 struct {
+unsigned prefix_bytes;
+unsigned size_scaler;
+} highquality;
+
+struct {
 int pan_tilt[2];/* pan/tilt vector   */
 int zrs[2][2];  /* zoom/rotate/shear matrix  */
 int perspective[2]; /* perspective vector*/
@@ -824,6 +829,44 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, 
void *arg)
 }
 
 /**
+ * VC-2 Specification ->
+ * 13.5.3 hq_slice(sx,sy)
+ */
+static int decode_hq_slice(DiracContext *s, GetBitContext *gb,
+   int slice_x, int slice_y)
+{
+int i, quant, level, orientation, quant_idx;
+uint8_t quants[MAX_DWT_LEVELS][4];
+
+skip_bits_long(gb, 8*s->highquality.prefix_bytes);
+quant_idx = get_bits(gb, 8);
+
+/* Slice quantization (slice_quantizers() in the specs) */
+for (level = 0; level < s->wavelet_depth; level++) {
+for (orientation = !!level; orientation < 4; orientation++) {
+quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 
0);
+quants[level][orientation] = quant;
+}
+}
+
+/* Luma + 2 Chroma planes */
+for (i = 0; i < 3; i++) {
+int length = s->highquality.size_scaler * get_bits(gb, 8);
+int bits_left = 8 * length;
+int bits_end = get_bits_count(gb) + bits_left;
+for (level = 0; level < s->wavelet_depth; level++) {
+for (orientation = !!level; orientation < 4; orientation++) {
+decode_subband(s, gb, quants[level][orientation], slice_x, 
slice_y, bits_end,
+   &s->plane[i].band[level][orientation], NULL);
+}
+}
+skip_bits_long(gb, bits_end - get_bits_count(gb));
+}
+
+return 0;
+}
+
+/**
  * Dirac Specification ->
  * 13.5.1 low_delay_transform_data()
  */
@@ -844,26 +887,34 @@ static int decode_lowdelay(DiracContext *s)
 buf = s->gb.buffer + get_bits_count(&s->gb)/8;
 bufsize = get_bits_left(&s->gb);
 
-for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) {
-for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
-bytes = (slice_num+1) * s->lowdelay.bytes.num / 
s->lowdelay.bytes.den
-- slice_num* s->lowdelay.bytes.num / s->lowdelay.bytes.den;
-slices[slice_num].bytes   = bytes;
-slices[slice_num].slice_x = slice_x;
-slices[slice_num].slice_y = slice_y;
-init_get_bits(&slices[slice_num].gb, buf, bufsize);
-slice_num++;
-
-buf += bytes;
-if (bufsize/8 >= bytes)
-bufsize -= bytes*8;
-else
-bufsize = 0;
+if (s->hq_picture) {
+for (slice_y = 0; slice_y < s->num_y; slice_y++) {
+for (slice_x = 0; slice_x < s->num_x; slice_x++) {
+decode_hq_slice(s, &s->gb, slice_x, slice_y);
+}
+}
+} else {
+for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) {
+for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
+bytes = (slice_num+1) * s->lowdelay.bytes.num / 
s->lowdelay.bytes.den
+- slice_num* s->lowdelay.bytes.num / 
s->lowdelay.bytes.den;
+slices[slice_num].bytes   = bytes;
+slices[slice_num].slice_x = slice_x;
+slices[slice_num].slice_y = slice_y;
+init_get_bits(&slices[slice_num].gb, buf, bufsize);
+slice_num++;
+
+buf += bytes;
+if (bufsize/8 >= bytes)
+bufsize -= bytes*8;
+else
+bufsize = 0;
+}
 }
+avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
+   sizeof(DiracSlice)); /* [DIRAC_STD] 13.5.2 Slices */
 }
 
-avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
-   sizeof(struct DiracSlice)); /* [DIRAC_STD] 13.5.2 Slices */
 if (s->dc_prediction) {
 if (s->pshift) {
 intra_dc_prediction_10(&s->plane[0].band[0][0]); /* [DIRAC_STD] 
13.3 intra_dc_prediction() */
@@ -1077,29 +1128,19 @@ static int dirac_unpack_idwt_params(DiracContext *s)
 
 CHECKEDREAD(s->wavelet_depth, tmp > MAX_DWT_LEVELS || tmp < 1, "invalid 
number of DWT decompositions\n")
 
-if (!s->low_delay) {
-/* Codeblock parameters (core syntax only) */
-if (get_bits1(gb)) {
-for (i = 0; i <= s->wavelet_depth; i++) {
-

[FFmpeg-devel] [PATCH 10/11] diracdec: Read picture types by using parse_code

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 57 +--
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index fdcca01..9c09d51 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -154,7 +154,11 @@ typedef struct DiracContext {
 
 int zero_res;   /* zero residue flag */
 int is_arith;   /* whether coeffs use arith or golomb coding */
+int core_syntax;/* use core syntax only  */
 int low_delay;  /* use the low delay syntax  */
+int hq_picture; /* high quality picture, enables low_delay   */
+int ld_picture; /* use low delay picture, turns on low_delay */
+int dc_prediction;  /* has dc prediction */
 int globalmc_flag;  /* use global motion compensation*/
 int num_refs;   /* number of reference pictures  */
 
@@ -860,14 +864,16 @@ static int decode_lowdelay(DiracContext *s)
 
 avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
sizeof(struct DiracSlice)); /* [DIRAC_STD] 13.5.2 Slices */
-if (s->pshift) {
-intra_dc_prediction_10(&s->plane[0].band[0][0]);
-intra_dc_prediction_10(&s->plane[1].band[0][0]);
-intra_dc_prediction_10(&s->plane[2].band[0][0]);
-} else {
-intra_dc_prediction_8(&s->plane[0].band[0][0]);
-intra_dc_prediction_8(&s->plane[1].band[0][0]);
-intra_dc_prediction_8(&s->plane[2].band[0][0]);
+if (s->dc_prediction) {
+if (s->pshift) {
+intra_dc_prediction_10(&s->plane[0].band[0][0]); /* [DIRAC_STD] 
13.3 intra_dc_prediction() */
+intra_dc_prediction_10(&s->plane[1].band[0][0]); /* [DIRAC_STD] 
13.3 intra_dc_prediction() */
+intra_dc_prediction_10(&s->plane[2].band[0][0]); /* [DIRAC_STD] 
13.3 intra_dc_prediction() */
+} else {
+intra_dc_prediction_8(&s->plane[0].band[0][0]);
+intra_dc_prediction_8(&s->plane[1].band[0][0]);
+intra_dc_prediction_8(&s->plane[2].band[0][0]);
+}
 }
 av_free(slices);
 return 0;
@@ -1121,6 +1127,19 @@ static int dirac_unpack_idwt_params(DiracContext *s)
 }
 }
 }
+/* Codeblock parameters (core syntax only) */
+if (s->core_syntax) {
+if (get_bits1(gb)) {
+for (i = 0; i <= s->wavelet_depth; i++) {
+CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > 
(s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
+CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > 
(s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
+}
+CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")
+} else {
+for (i = 0; i <= s->wavelet_depth; i++)
+s->codeblock[i].width = s->codeblock[i].height = 1;
+}
+}
 return 0;
 }
 
@@ -1904,7 +1923,8 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, 
const uint8_t *buf, int
 {
 DiracContext *s   = avctx->priv_data;
 DiracFrame *pic   = NULL;
-int ret, i, parse_code;
+int ret, i;
+uint8_t parse_code;
 unsigned tmp;
 
 if (size < DATA_UNIT_HEADER_SIZE)
@@ -1968,12 +1988,19 @@ static int dirac_decode_data_unit(AVCodecContext 
*avctx, const uint8_t *buf, int
 av_log(avctx, AV_LOG_ERROR, "num_refs of 3\n");
 return AVERROR_INVALIDDATA;
 }
-s->num_refs= tmp;
-s->is_arith= (parse_code & 0x48) == 0x08;  /* [DIRAC_STD] 
using_ac()  */
-s->low_delay   = (parse_code & 0x88) == 0x88;  /* [DIRAC_STD] 
is_low_delay()  */
-pic->reference = (parse_code & 0x0C) == 0x0C;  /* [DIRAC_STD]  
is_reference() */
-pic->avframe->key_frame = s->num_refs == 0; /* [DIRAC_STD] 
is_intra()  */
-pic->avframe->pict_type = s->num_refs + 1;  /* Definition 
of AVPictureType in avutil.h */
+s->num_refs  = tmp;
+s->is_arith  = (parse_code & 0x48) == 0x08;  /* 
[DIRAC_STD] using_ac()*/
+s->low_delay = (parse_code & 0x88) == 0x88;  /* 
[DIRAC_STD] is_low_delay()*/
+s->core_syntax   = (parse_code & 0x88) == 0x08;  /* 
[DIRAC_STD] is_core_syntax()  */
+s->ld_picture= (parse_code & 0xF8) == 0xC8;  /* 
[DIRAC_STD] is_ld_picture()   */
+s->hq_picture= (parse_code & 0xF8) == 0xE8;  /* 
[DIRAC_STD] is_hq_picture()   */
+s->dc_prediction = (parse_code & 0x28) == 0x08;  /* 
[DIRAC_STD] using_dc_prediction() */
+pic->reference   = (parse_code & 0x0C) == 0x0C;  /* 
[DIRAC_STD] is_reference()*/
+pic->avfra

[FFmpeg-devel] [PATCH 08/11] diracdec: Support new extended quantiser range

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 58 ---
 1 file changed, 37 insertions(+), 21 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index c42360d..fdcca01 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -57,7 +57,7 @@
 #define MAX_REFERENCE_FRAMES 8
 #define MAX_DELAY 5 /* limit for main profile for frame coding (TODO: 
field coding) */
 #define MAX_FRAMES (MAX_REFERENCE_FRAMES + MAX_DELAY + 1)
-#define MAX_QUANT 68/* max quant for VC-2 */
+#define MAX_QUANT 255/* max quant for VC-2 */
 #define MAX_BLOCKSIZE 32/* maximum xblen/yblen we support */
 
 /**
@@ -244,26 +244,42 @@ static const uint8_t default_qmat[][4][4] = {
 { { 3,  1,  1,  0}, { 0,  4,  4,  2}, { 0,  6,  6,  5}, { 0,  9,  9,  7} },
 };
 
-static const int qscale_tab[MAX_QUANT+1] = {
-4, 5, 6, 7, 8,10,11,13,
-16,19,23,27,32,38,45,54,
-64,76,91,   108,   128,   152,   181,   215,
-256,   304,   362,   431,   512,   609,   724,   861,
-1024,  1218,  1448,  1722,  2048,  2435,  2896,  3444,
-4096,  4871,  5793,  6889,  8192,  9742, 11585, 13777,
-16384, 19484, 23170, 27554, 32768, 38968, 46341, 55109,
-65536, 77936
+static const int32_t qscale_tab[128] = {
+4, 5, 6, 7,  8,10,11,  
  13,
+   16,19,23,27, 32,38,45,  
  54,
+   64,76,91,   108,128,   152,   181,  
 215,
+  256,   304,   362,   431,512,   609,   724,  
 861,
+ 1024,  1218,  1448,  1722,   2048,  2435,  2896,  
3444,
+ 4096,  4871,  5793,  6889,   8192,  9742, 11585,  
   13777,
+16384, 19484,-13317, 27554,  32768, -1581,  9853,  
  -10518,
+65536, -3164,-16782,-21037, 131072, -6328,  2922,  
   23552,
+   262144,-12658,  5844,-18524, 524288, 15232, 11689,  
   28578,
+  1048576,-10085,-13110, -8471,2097152,-20170, 10267,  
  -16943,
+  4194304,   208,-15954, 31741,8388608,   416,  4579,  
   -2146,
+ 16777216,   832,  9158, -4293,   33554432,  1663,-18172,  
   -8587,
+ 67108864,  3326,   143,-17175,   134217728, 6653,   285,  
   31276,
+268435456, 13306,   570, -3075,   536870912,   -13938,  1140,  
   -6152,
+1073741824,12672,  2281,-12304, -2147483648,   -15205,  4561,  
  -24610,
+ 0,10138,  9122, 16407,   0,   -20274,-18243,  
  -32813,
 };
 
-static const int qoffset_intra_tab[MAX_QUANT+1] = {
-1, 2, 3, 4, 4, 5, 6, 7,
-8,10,12,14,16,19,23,27,
-32,38,46,54,64,76,91,   108,
-128,   152,   181,   216,   256,   305,   362,   431,
-512,   609,   724,   861,  1024,  1218,  1448,  1722,
-2048,  2436,  2897,  3445,  4096,  4871,  5793,  6889,
-8192,  9742, 11585, 13777, 16384, 19484, 23171, 27555,
-32768, 38968
+static const int32_t qoffset_intra_tab[128] = {
+1, 2, 3, 4, 4, 5, 6,   
  7,
+8,10,12,14,  16,19,23, 
   27,
+   32,38,46,54,  64,76,91, 
  108,
+  128,   152,   181,   216, 256,   305,   362, 
  431,
+  512,   609,   724,   861,1024,  1218,  1448, 
 1722,
+ 2048,  2436,  2897,  3445,4096,  4871,  5793, 
 6889,
+ 8192,  9742, -6658, 13777,   16384,  -790,  4927, 
-5258,
+32768, -1581, -8390,-10518,   65536, -3163,  1461, 
11776,
+   131072, -6328,  2922, -9261,  262144,  7616,  5845, 
14289,
+   524288, -5042, -6554, -4235, 1048576,-10084,  5134, 
-8471,
+  2097152,   104, -7976, 15871, 4194304,   208,  2290, 
-1072,
+  8388608,   416,  4579, -2146,16777216,   832, -9085, 
-4293,
+ 33554432,  1663,72, -8587,67108864,  3327,   143, 
15638,
+134217728,  6653,   285, -1537,   268435456, -6968,   570, 
-3075,
+536870912,  6336,  1141, -6151, -1073741823, -7602,  2281, 
   -12304,
+0,  5069,  4561,  8204,   0,-10136, -9121, 
   -16406,
 };
 
 static const int qoffset_inter_tab[MAX_QUANT+1] = {
@@ -719,8 +735,8 @@ static void decode_subband(DiracContext *s, GetBitContext 
*gb, int quant,
 int top= b1->height * slice_y  

[FFmpeg-devel] Bug #3823 (yuvj422p jpeg rtp enc) request for help

2015-12-08 Thread Andrey Utkin
Hi! Could please anybody look at MJPEG RTP encoder issue with yuvj422p
https://trac.ffmpeg.org/ticket/3823#comment:17 ? This pixel format
becomes popular for IP cameras having no RTSP, and there are
constantly issues with RTPizing it. I consider donation for fixing
this.

Thanks.

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


[FFmpeg-devel] [PATCH] diracdec: Fix FPE on invalid low_delay data

2015-12-08 Thread Kieran Kunhya
---
 libavcodec/diracdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 6a53f38..0542ad7 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -2043,6 +2043,11 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, 
const uint8_t *buf, int
 if (s->version.minor == 2 && parse_code == 0x88)
 s->ld_picture = 1;
 
+if (s->low_delay && !(s->ld_picture || s->hq_picture) ) {
+av_log(avctx, AV_LOG_ERROR, "Invalid low delay flag\n");
+return AVERROR_INVALIDDATA;
+}
+
 if ((ret = get_buffer_with_edge(avctx, pic->avframe, (parse_code & 
0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
 return ret;
 s->current_picture = pic;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] [RFC] avcodec/h264_slice: Duplicate addition to avoid ubsan warning

2015-12-08 Thread Michael Niedermayer
From: Michael Niedermayer 

Fixes mozilla bug 1230247

Signed-off-by: Michael Niedermayer 
---
 libavcodec/h264_slice.c |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index bbadfc9..cc82875 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1993,12 +1993,13 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 if (USES_LIST(top_type, list)) {
 const int b_xy  = h->mb2b_xy[top_xy] + 3 * b_stride;
 const int b8_xy = 4 * top_xy + 2;
-int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & 
(MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
+int off = (MB_MBAFF(sl) ? 20 : 2);
+int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & 
(MAX_SLICES - 1)][0]);
 AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
 ref_cache[0 - 1 * 8] =
-ref_cache[1 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
+ref_cache[1 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0] + off];
 ref_cache[2 - 1 * 8] =
-ref_cache[3 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];
+ref_cache[3 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1] + off];
 } else {
 AV_ZERO128(mv_dst - 1 * 8);
 AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 
0x01010101u);
@@ -2007,16 +2008,17 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) {
 if (USES_LIST(left_type[LTOP], list)) {
 const int b_xy  = h->mb2b_xy[left_xy[LTOP]] + 3;
+int off = (MB_MBAFF(sl) ? 20 : 2);
 const int b8_xy = 4 * left_xy[LTOP] + 1;
-int (*ref2frm)[64] =(void*)( 
sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + 
(MB_MBAFF(sl) ? 20 : 2));
+int (*ref2frm)[64] =(void*)( 
sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0]);
 AV_COPY32(mv_dst - 1 +  0, h->cur_pic.motion_val[list][b_xy + 
b_stride * 0]);
 AV_COPY32(mv_dst - 1 +  8, h->cur_pic.motion_val[list][b_xy + 
b_stride * 1]);
 AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + 
b_stride * 2]);
 AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + 
b_stride * 3]);
 ref_cache[-1 +  0] =
-ref_cache[-1 +  8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]];
+ref_cache[-1 +  8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0] + off];
 ref_cache[-1 + 16] =
-ref_cache[-1 + 24] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]];
+ref_cache[-1 + 24] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1] + off];
 } else {
 AV_ZERO32(mv_dst - 1 +  0);
 AV_ZERO32(mv_dst - 1 +  8);
@@ -2041,9 +2043,10 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 
 {
 int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];
-int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 
1)][0] + (MB_MBAFF(sl) ? 20 : 2));
-uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], 
ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
-uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], 
ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
+int off = (MB_MBAFF(sl) ? 20 : 2);
+int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 
1)][0]);
+uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]+off], 
ref2frm[list][ref[1]+off]) & 0x00FF00FF) * 0x0101;
+uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]+off], 
ref2frm[list][ref[3]+off]) & 0x00FF00FF) * 0x0101;
 AV_WN32A(&ref_cache[0 * 8], ref01);
 AV_WN32A(&ref_cache[1 * 8], ref01);
 AV_WN32A(&ref_cache[2 * 8], ref23);
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH 09/11] diracdec: Store version major/minor flags

2015-12-08 Thread Michael Niedermayer
On Wed, Dec 09, 2015 at 12:05:35AM +, Kieran Kunhya wrote:
> ---
>  libavcodec/dirac.c | 15 +++
>  1 file changed, 7 insertions(+), 8 deletions(-)

LGTM

thanks

[...]
-- 
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 03/11] diracdec: Rename lowdelay_subband to decode_subband because it is shared with HQ profile

2015-12-08 Thread Michael Niedermayer
On Wed, Dec 09, 2015 at 12:05:29AM +, Kieran Kunhya wrote:
> ---
>  libavcodec/diracdec.c | 18 --
>  1 file changed, 8 insertions(+), 10 deletions(-)

should be ok

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] Ideas to replace the options system

2015-12-08 Thread Ryan Williams
I like the idea of JSON syntax.
To avoid escaping problems simply read the arguments out of a file instead of 
off the command line.

Suggestion
-vf '@/path/to/filter-syntax' to read filter syntax from a file
-vf '-' to read filter syntax from STDIN


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


Re: [FFmpeg-devel] [PATCH] avfilter/formats: fix segfault when allocation fails

2015-12-08 Thread Ganesh Ajjanagadde
On Sat, Dec 5, 2015 at 2:43 PM, Ganesh Ajjanagadde
 wrote:
> This is a somewhat subtle failure that can occur when the realloc_array
> fails in FORMATS_REF.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavfilter/formats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> index 2b13cbf..95a6b11 100644
> --- a/libavfilter/formats.c
> +++ b/libavfilter/formats.c
> @@ -445,7 +445,7 @@ do {\
>  do {   \
>  int idx = -1;  \
> \
> -if (!*ref) \
> +if (!*ref || !(*ref)->refs)\
>  return;\
> \
>  FIND_REF_INDEX(ref, idx);  \
> --
> 2.6.3
>

Ping; want to get this in together with the avfilter memleak patches. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/jpeg2000: replace naive pow call with smarter exp2fi

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 1:49 PM, Michael Niedermayer  wrote:
> On Mon, Dec 07, 2015 at 09:50:49PM -0500, Ganesh Ajjanagadde wrote:
>> pow is a very wasteful function for this purpose. A low hanging fruit
>> would be simply to replace with exp2f, and that does yield some speedup.
>> However, there are 2 drawbacks of this:
>> 1. It does not exploit the integer nature of the argument.
>> 2. (minor) Some platforms lack a proper exp2f routine, making benefits 
>> available
>> only to non broken libm.
>> 3. exp2f does not solve the same issue that plagues pow, namely terrible
>> worst case performance. This is a fundamental issue known as the
>> "table-maker's dilemma" recognized by Prof. Kahan himself and
>> subsequently elaborated and researched by many others. All this is clear 
>> from benchmarks below.
>>
>> This exploits the IEEE-754 format to get very good performance even in
>> the worst case for integer powers of 2. This solves all the issues noted
>> above. Function tested with clang usan over [-1000, 1000] (beyond range of
>> relevance for this, which is [-255, 255]), patch itself with FATE.
>>
>> Benchmarks obtained on x86-64, Haswell, GNU-Linux via 10^5 iterations of
>> the pow call, START/STOP, and command ffplay 
>> ~/samples/jpeg2000/chiens_dcinema2K.mxf.
>> Low number of runs also given to prove the point about worst case:
>>
>> pow:
>>  216270 decicycles in pow,   1 runs,  0 skips
>>  110175 decicycles in pow,   2 runs,  0 skips
>>   56085 decicycles in pow,   4 runs,  0 skips
>>   29013 decicycles in pow,   8 runs,  0 skips
>>   15472 decicycles in pow,  16 runs,  0 skips
>>8689 decicycles in pow,  32 runs,  0 skips
>>5295 decicycles in pow,  64 runs,  0 skips
>>3599 decicycles in pow, 128 runs,  0 skips
>>2748 decicycles in pow, 256 runs,  0 skips
>>2304 decicycles in pow, 511 runs,  1 skips
>>2072 decicycles in pow,1022 runs,  2 skips
>>1963 decicycles in pow,2044 runs,  4 skips
>>1894 decicycles in pow,4091 runs,  5 skips
>>1860 decicycles in pow,8184 runs,  8 skips
>>
>> exp2f:
>>  134140 decicycles in pow,   1 runs,  0 skips
>>   68110 decicycles in pow,   2 runs,  0 skips
>>   34530 decicycles in pow,   4 runs,  0 skips
>>   17677 decicycles in pow,   8 runs,  0 skips
>>9175 decicycles in pow,  16 runs,  0 skips
>>4931 decicycles in pow,  32 runs,  0 skips
>>2808 decicycles in pow,  64 runs,  0 skips
>>1747 decicycles in pow, 128 runs,  0 skips
>>1208 decicycles in pow, 256 runs,  0 skips
>> 952 decicycles in pow, 512 runs,  0 skips
>> 822 decicycles in pow,1024 runs,  0 skips
>> 765 decicycles in pow,2047 runs,  1 skips
>> 722 decicycles in pow,4094 runs,  2 skips
>> 693 decicycles in pow,8190 runs,  2 skips
>>
>> exp2fi:
>>2740 decicycles in pow,   1 runs,  0 skips
>>1530 decicycles in pow,   2 runs,  0 skips
>> 955 decicycles in pow,   4 runs,  0 skips
>> 622 decicycles in pow,   8 runs,  0 skips
>> 477 decicycles in pow,  16 runs,  0 skips
>> 368 decicycles in pow,  32 runs,  0 skips
>> 317 decicycles in pow,  64 runs,  0 skips
>> 291 decicycles in pow, 128 runs,  0 skips
>> 277 decicycles in pow, 256 runs,  0 skips
>> 268 decicycles in pow, 512 runs,  0 skips
>> 265 decicycles in pow,1024 runs,  0 skips
>> 263 decicycles in pow,2048 runs,  0 skips
>> 263 decicycles in pow,4095 runs,  1 skips
>> 260 decicycles in pow,8191 runs,  1 skips
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>
> probably ok
>
> thx

pushed, thanks

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Asymptotically faster algorithms should always be preferred if you have
> asymptotical amounts of data
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] swscale/utils: replace pow by exp2

2015-12-08 Thread Ganesh Ajjanagadde
On Tue, Dec 8, 2015 at 1:43 PM, Michael Niedermayer  wrote:
> On Mon, Dec 07, 2015 at 11:07:17PM -0500, Ganesh Ajjanagadde wrote:
>> exp2 is a faster function.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libswscale/utils.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> LGTM
>
> thx

pushed, thanks

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If a bugfix only changes things apparently unrelated to the bug with no
> further explanation, that is a good sign that the bugfix is wrong.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/jpeg2000: use powf instead of pow

2015-12-08 Thread Ganesh Ajjanagadde
It may be entirely possible to optimize further by exploiting the fact
that it is always an integer exponent. However, care must be taken since
the base itself is not an integer, i.e a naive repeated squaring or
similar such algorithm may be inaccurate.

Range information can only be obtained by knowledge of the spec, so the
low hanging pow->powf is done.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/jpeg2000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index afd0966..d90c605 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -257,7 +257,7 @@ static void init_band_stepsize(AVCodecContext *avctx,
 break;
 }
 if (codsty->transform == FF_DWT97) {
-band->f_stepsize *= pow(F_LFTG_K, 2*(codsty->nreslevels2decode - 
reslevelno) + lband - 2);
+band->f_stepsize *= powf(F_LFTG_K, 2*(codsty->nreslevels2decode - 
reslevelno) + lband - 2);
 }
 }
 
-- 
2.6.3

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