[FFmpeg-devel] [PATCH] avfilter/vf_psnr vf_ssim: abort filtering when shortest video ends

2015-06-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
 libavfilter/vf_psnr.c | 2 ++
 libavfilter/vf_ssim.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 406be88..5639d16 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -212,6 +212,8 @@ static av_cold int init(AVFilterContext *ctx)
 }
 
 s-dinput.process = do_psnr;
+s-dinput.shortest = 1;
+s-dinput.repeatlast = 1;
 return 0;
 }
 
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 604fb44..23e8eef 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -238,7 +238,7 @@ static av_cold int init(AVFilterContext *ctx)
 
 s-dinput.process = do_ssim;
 s-dinput.shortest = 1;
-s-dinput.repeatlast = 0;
+s-dinput.repeatlast = 1;
 return 0;
 }
 
-- 
1.7.11.2

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


Re: [FFmpeg-devel] GSoC update

2015-06-26 Thread Nicolas George
Le septidi 7 messidor, an CCXXIII, Stephan Holljes a écrit :
 Thanks, I understand the datastructures and their interaction a lot
 better now. I discussed it with a friend yesterday too and there a lot
 of the things started to make more sense.
 I'm currently working on the implementation, when questions arise I
 will ask again.

Good. Please try to pose a WIP patch today to make sure you are really in
the right track.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] avcodec: Add flag for experimental HWAccels and use it for VDPAU/HEVC

2015-06-26 Thread Philip Langdale
This HWAccel isn't really usable right now due to an nvidia driver bug,
so we don't want it selected by default.

HWAccels have a capabilities field and there's a comment about flags,
but no flags exist today, so let's add one for experimental hwaccels.

Signed-off-by: Philip Langdale phil...@overt.org
---
 libavcodec/avcodec.h| 8 +++-
 libavcodec/utils.c  | 7 +++
 libavcodec/vdpau_hevc.c | 1 +
 libavcodec/version.h| 2 +-
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 761d3c1..ddbf0a3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -894,6 +894,12 @@ typedef struct RcOverride{
  */
 #define CODEC_CAP_LOSSLESS 0x8000
 
+/**
+ * HWAccel is experimental and is thus avoided in favor of non experimental
+ * codecs
+ */
+#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
+
 #if FF_API_MB_TYPE
 //The following defines may change, don't expect compatibility if you use them.
 #define MB_TYPE_INTRA4x4   0x0001
@@ -3336,7 +3342,7 @@ typedef struct AVHWAccel {
 
 /**
  * Hardware accelerated codec capabilities.
- * see FF_HWACCEL_CODEC_CAP_*
+ * see HWACCEL_CODEC_CAP_*
  */
 int capabilities;
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7696582..40ea544 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1176,6 +1176,13 @@ static int setup_hwaccel(AVCodecContext *avctx,
 return AVERROR(ENOENT);
 }
 
+if (hwa-capabilities  HWACCEL_CODEC_CAP_EXPERIMENTAL 
+avctx-strict_std_compliance  FF_COMPLIANCE_EXPERIMENTAL) {
+av_log(avctx, AV_LOG_WARNING, Ignoring experimental hwaccel: %s\n,
+   hwa-name);
+return AVERROR(ENOTSUP);
+}
+
 if (hwa-priv_data_size) {
 avctx-internal-hwaccel_priv_data = av_mallocz(hwa-priv_data_size);
 if (!avctx-internal-hwaccel_priv_data)
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 99e1a8d..928513b 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -427,6 +427,7 @@ AVHWAccel ff_hevc_vdpau_hwaccel = {
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_HEVC,
 .pix_fmt= AV_PIX_FMT_VDPAU,
+.capabilities   = HWACCEL_CODEC_CAP_EXPERIMENTAL,
 .start_frame= vdpau_hevc_start_frame,
 .end_frame  = vdpau_hevc_end_frame,
 .decode_slice   = vdpau_hevc_decode_slice,
diff --git a/libavcodec/version.h b/libavcodec/version.h
index eff8820..1073588 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include libavutil/version.h
 
 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR  45
+#define LIBAVCODEC_VERSION_MINOR  46
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.1.4

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


[FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-26 Thread Paul B Mahol
Signed-off-by: Paul B Mahol one...@gmail.com
---
Waiting for comments and flames.
---
 doc/filters.texi   |  57 +++
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_drawgraph.c | 231 +
 4 files changed, 290 insertions(+)
 create mode 100644 libavfilter/vf_drawgraph.c

diff --git a/doc/filters.texi b/doc/filters.texi
index d9f913f..3125fbf 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3965,6 +3965,62 @@ 
drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
 @end example
 @end itemize
 
+@section drawgraph
+
+Draw a graph using input video metadata.
+
+It accepts the following parameters:
+
+@table @option
+@item metadata
+Set frame metadata key from which metadata values will be used to draw a graph.
+
+@item min
+Set minimal value of metadata value.
+
+@item max
+Set maximal value of metadata value.
+
+@item background
+Set graph background color.
+
+@item foreground
+Set foreground color.
+
+@item mode
+Set graph mode.
+
+Available values for mode is:
+@table @samp
+@item bar
+@item dot
+@end table
+
+Default is @code{bar}.
+
+@item slide
+Set slide mode.
+
+Available values for slide is:
+@table @samp
+@item frame
+@item replace
+@item scroll
+@end table
+
+Default is @code{frame}.
+
+@item size
+Set size of graph video. For the syntax of this option, check the
+@ref{video size syntax,,Video size section in the ffmpeg-utils 
manual,ffmpeg-utils}.
+The default value is @code{400x400}.
+@end table
+
+Example using metadata from @ref{signalstats} filter:
+@example
+signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
+@end example
+
 @section drawgrid
 
 Draw a grid on the input image.
@@ -8604,6 +8660,7 @@ Swap the second and third planes of the input:
 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
 @end example
 
+@anchor{signalstats}
 @section signalstats
 Evaluate various visual metrics that assist in determining issues associated
 with the digitization of analog video media.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 55cd055..54a8bbb 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -117,6 +117,7 @@ OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o
+OBJS-$(CONFIG_DRAWGRAPH_FILTER)  += vf_drawgraph.o
 OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3898498..b9508f5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -133,6 +133,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
 REGISTER_FILTER(DRAWBOX,drawbox,vf);
+REGISTER_FILTER(DRAWGRAPH,  drawgraph,  vf);
 REGISTER_FILTER(DRAWGRID,   drawgrid,   vf);
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
 REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
diff --git a/libavfilter/vf_drawgraph.c b/libavfilter/vf_drawgraph.c
new file mode 100644
index 000..405e5fb
--- /dev/null
+++ b/libavfilter/vf_drawgraph.c
@@ -0,0 +1,231 @@
+/*
+ * 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 float.h
+
+#include libavutil/opt.h
+#include avfilter.h
+#include formats.h
+#include internal.h
+#include video.h
+
+typedef struct DrawGraphContext {
+const AVClass *class;
+
+char  *key;
+float min;
+float max;
+uint8_t   bg[4];
+uint8_t   fg[4];
+int   mode;
+int   slide;
+int   w, h;
+
+AVFrame   *out;
+int   x;
+} DrawGraphContext;
+
+#define OFFSET(x) offsetof(DrawGraphContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption drawgraph_options[] = {
+{ metadata, set metadata key, OFFSET(key), 

Re: [FFmpeg-devel] [PATCH] nutdec: check maxpos in read_sm_data before reading count

2015-06-26 Thread Andreas Cadhalpun
On 26.06.2015 01:36, Michael Niedermayer wrote:
 On Thu, Jun 25, 2015 at 11:46:41PM +0200, Andreas Cadhalpun wrote:
 Otherwise sm_size can be larger than size, which results in a negative
 packet size.

 Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 ---
  libavformat/nutdec.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 
 

 diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
 index 13fb399..43bd27b 100644
 --- a/libavformat/nutdec.c
 +++ b/libavformat/nutdec.c
 @@ -888,7 +888,7 @@ fail:
  
  static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, 
 int is_meta, int64_t maxpos)
  {
 -int count = ffio_read_varlen(bc);
 +int count;
  int skip_start = 0;
  int skip_end = 0;
  int channels = 0;
 @@ -898,6 +898,11 @@ static int read_sm_data(AVFormatContext *s, AVIOContext 
 *bc, AVPacket *pkt, int
  int height = 0;
  int i, ret;
  
 +if (avio_tell(bc) = maxpos)
 +return AVERROR_INVALIDDATA;
 +
 +count = ffio_read_varlen(bc);
 
 ffio_read_varlen() could move the position beyond maxpos yet return
 0 so the loop with teh checks inside is skiped

That is exactly the problem, because then sm_size can be larger than size.
An alternative would be to directly check for that, like in attached patch.

Best regards,
Andreas
From 25322c14b9ca46cc1c841dfdcc37ee42d16ea639 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Date: Fri, 26 Jun 2015 19:25:05 +0200
Subject: [PATCH] nutdec: ensure non-negative packet size

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
---
 libavformat/nutdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 13fb399..3d6fb64 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1136,6 +1136,12 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
 goto fail;
 }
 sm_size = avio_tell(bc) - pkt-pos;
+if (size  sm_size) {
+av_log(s, AV_LOG_ERROR, size %d smaller than sm_size %d\n,
+   size, sm_size);
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 size  -= sm_size;
 pkt-size -= sm_size;
 }
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] s302m: fix arithmetic exception

2015-06-26 Thread Andreas Cadhalpun
On 26.06.2015 01:27, Michael Niedermayer wrote:
 On Fri, Jun 26, 2015 at 12:05:09AM +0200, Andreas Cadhalpun wrote:
 If 'buf_size * 8' is smaller than 'avctx-channels *
 (avctx-bits_per_raw_sample + 4)' it resulted in a division by zero.

 Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 ---
  libavcodec/s302m.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
 index 5cf9eb5..36c8e7c 100644
 --- a/libavcodec/s302m.c
 +++ b/libavcodec/s302m.c
 @@ -86,9 +86,9 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, 
 const uint8_t *buf,
  avctx-channel_layout = AV_CH_LAYOUT_5POINT1_BACK | 
 AV_CH_LAYOUT_STEREO_DOWNMIX;
  }
  avctx-bit_rate= 48000 * avctx-channels * 
 (avctx-bits_per_raw_sample + 4) +
 - 32 * (48000 / (buf_size * 8 /
 -(avctx-channels *
 - (avctx-bits_per_raw_sample + 
 4;
 + 32 * (48000 * avctx-channels
 +* (avctx-bits_per_raw_sample + 4))
 +/ (buf_size * 8);
 
 i dont think the new code matches the nb_samples vs. buf_size vs.
 samplerate of s302m_decode_frame()

I don't think the old code did either.

 maybe the nb_samples calculation could be factored out and used for
 bitrate computation too

It can just be reused, which also nicely avoids the division by zero.
New patch attached.

Best regards,
Andreas

From 20bca467900d0b0d4ec6fe64140f4d4d251d0bbe Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Date: Fri, 26 Jun 2015 19:31:03 +0200
Subject: [PATCH] s302m: fix arithmetic exception

If nb_samples is zero, the bit_rate calculation results in a division by
zero.

Since ff_get_buffer fails if frame-nb_samples is zero, this can be
fixed by moving the bit_rate calculation after that function call.

That also makes it possible to reuse the already calculated
frame-nb_samples value.

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
---
 libavcodec/s302m.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
index 5cf9eb5..24130d8 100644
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@ -85,10 +85,6 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
 case 8:
 avctx-channel_layout = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX;
 }
-avctx-bit_rate= 48000 * avctx-channels * (avctx-bits_per_raw_sample + 4) +
- 32 * (48000 / (buf_size * 8 /
-(avctx-channels *
- (avctx-bits_per_raw_sample + 4;
 
 return frame_size;
 }
@@ -117,6 +113,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
 if ((ret = ff_get_buffer(avctx, frame, 0))  0)
 return ret;
 
+avctx-bit_rate = 48000 * avctx-channels * (avctx-bits_per_raw_sample + 4) +
+  32 * 48000 / frame-nb_samples;
 buf_size = (frame-nb_samples * avctx-channels / 2) * block_size;
 
 if (avctx-bits_per_raw_sample == 24) {
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avcodec: Add flag for experimental HWAccels and use it for VDPAU/HEVC

2015-06-26 Thread Philip Langdale

On 2015-06-26 09:09, wm4 wrote:

diff --git a/libavcodec/version.h b/libavcodec/version.h
index eff8820..1073588 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include libavutil/version.h

 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR  45
+#define LIBAVCODEC_VERSION_MINOR  46
 #define LIBAVCODEC_VERSION_MICRO 100

 #define LIBAVCODEC_VERSION_INT  
AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \


LGTM, but not sure if the flag really has to be public API. This is
pretty much just a one-time thing with the vdpau code.


Yeah, I wasn't sure. Do codec flags count as public API? Maybe this 
isn't

a version bump at all or maybe just micro.

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


Re: [FFmpeg-devel] [PATCH] mpegaudiodec: copy AVFloatDSPContext from first context to all contexts

2015-06-26 Thread Andreas Cadhalpun
On 26.06.2015 01:38, Michael Niedermayer wrote:
 On Fri, Jun 26, 2015 at 12:32:48AM +0200, Andreas Cadhalpun wrote:
 This fixes a segfault when decoding multi-channel MP3onMP4 files.

 This is similar to commit cb72230d for MPADSPContext.

 Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 ---
  libavcodec/mpegaudiodec_template.c | 1 +
  1 file changed, 1 insertion(+)
 
 should be ok

Pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] vc1dec: use get_bits_long and limit the read bits to 32

2015-06-26 Thread Andreas Cadhalpun
On 26.06.2015 01:11, Michael Niedermayer wrote:
 On Thu, Jun 25, 2015 at 10:54:17PM +0200, Andreas Cadhalpun wrote:
 get_bits should not be used with more than 25 bits.

 Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 ---
  libavcodec/vc1dec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
 index 3fa39a5..d7a0cef 100644
 --- a/libavcodec/vc1dec.c
 +++ b/libavcodec/vc1dec.c
 @@ -469,7 +469,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
  count = avctx-extradata_size*8 - get_bits_count(gb);
  if (count  0) {
 
  av_log(avctx, AV_LOG_INFO, Extra data: %i bits left, value: 
 %X\n,
 
 maybe this should use value32: or something

value32 isn't really informative either.

 -   count, get_bits(gb, count));
 +   count, get_bits_long(gb, FFMIN(count, 32)));
 
 LGTM

Pushed.

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


Re: [FFmpeg-devel] [PATCH 2/3] electronicarts: demux alpha stream

2015-06-26 Thread Carl Eugen Hoyos
Peter Ross pross at xvid.org writes:

 Electronic Arts VP6 files may contain two video 
 streams: one for the primary video stream and 
 another for the alpha mask. The file format
 uses identical data structures for both streams.

Is there a command line that allows to output 
the (intended) opaque ring in transparent 
background?

Thank you, Carl Eugen

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


[FFmpeg-devel] [PATCHv2] avcodec: Add support for per-frame AFD output in h264

2015-06-26 Thread Kieran Kunhya
From: Kieran Kunhya kie...@kunhya.com

---
 libavcodec/h264.c | 10 ++
 libavcodec/h264.h |  3 +++
 libavcodec/h264_sei.c |  6 ++
 3 files changed, 19 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 9be317c..1cbd4cb 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -608,6 +608,7 @@ static int h264_init_context(AVCodecContext *avctx, 
H264Context *h)
 h-frame_recovered   = 0;
 h-prev_frame_num= -1;
 h-sei_fpa.frame_packing_arrangement_cancel_flag = -1;
+h-has_afd   = 0;
 
 h-next_outputed_poc = INT_MIN;
 for (i = 0; i  MAX_DELAYED_PIC_COUNT; i++)
@@ -869,6 +870,15 @@ static void decode_postinit(H264Context *h, int 
setup_finished)
 }
 }
 
+if (h-has_afd) {
+AVFrameSideData *sd =
+av_frame_new_side_data(cur-f, AV_FRAME_DATA_AFD, 1);
+if (sd) {
+*sd-data   = h-afd;
+h-has_afd = 0;
+}
+}
+
 cur-mmco_reset = h-mmco_reset;
 h-mmco_reset = 0;
 
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 548510d..7565e03 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -781,6 +781,9 @@ typedef struct H264Context {
 
 int missing_fields;
 
+uint8_t afd;
+int has_afd;
+
 
 // Timestamp stuff
 int sei_buffering_period_present;   /// Buffering period SEI flag
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 8e1697a..b6ec5c7 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -132,7 +132,13 @@ static int decode_user_data_itu_t_t35(H264Context *h, int 
size)
 return -1;
 skip_bits(h-gb, 4);
 dtg_active_format = get_bits(h-gb, 4);
+#if FF_API_AFD
+FF_DISABLE_DEPRECATION_WARNINGS
 h-avctx-dtg_active_format = dtg_active_format;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_AFD */
+h-has_afd = 1;
+h-afd = dtg_active_format;
 } else {
 skip_bits(h-gb, 6);
 }
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] s302m: fix arithmetic exception

2015-06-26 Thread Michael Niedermayer
On Fri, Jun 26, 2015 at 07:38:40PM +0200, Andreas Cadhalpun wrote:
 On 26.06.2015 01:27, Michael Niedermayer wrote:
  On Fri, Jun 26, 2015 at 12:05:09AM +0200, Andreas Cadhalpun wrote:
  If 'buf_size * 8' is smaller than 'avctx-channels *
  (avctx-bits_per_raw_sample + 4)' it resulted in a division by zero.
 
  Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
  ---
   libavcodec/s302m.c | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
 
  diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
  index 5cf9eb5..36c8e7c 100644
  --- a/libavcodec/s302m.c
  +++ b/libavcodec/s302m.c
  @@ -86,9 +86,9 @@ static int s302m_parse_frame_header(AVCodecContext 
  *avctx, const uint8_t *buf,
   avctx-channel_layout = AV_CH_LAYOUT_5POINT1_BACK | 
  AV_CH_LAYOUT_STEREO_DOWNMIX;
   }
   avctx-bit_rate= 48000 * avctx-channels * 
  (avctx-bits_per_raw_sample + 4) +
  - 32 * (48000 / (buf_size * 8 /
  -(avctx-channels *
  - (avctx-bits_per_raw_sample + 
  4;
  + 32 * (48000 * avctx-channels
  +* (avctx-bits_per_raw_sample + 4))
  +/ (buf_size * 8);
  
  i dont think the new code matches the nb_samples vs. buf_size vs.
  samplerate of s302m_decode_frame()
 
 I don't think the old code did either.
 
  maybe the nb_samples calculation could be factored out and used for
  bitrate computation too
 
 It can just be reused, which also nicely avoids the division by zero.
 New patch attached.
 
 Best regards,
 Andreas
 

  s302m.c |6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)
 520ac68a80950ff219ae396182eb56679c46ee64  
 0001-s302m-fix-arithmetic-exception.patch
 From 20bca467900d0b0d4ec6fe64140f4d4d251d0bbe Mon Sep 17 00:00:00 2001
 From: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 Date: Fri, 26 Jun 2015 19:31:03 +0200
 Subject: [PATCH] s302m: fix arithmetic exception

LGTM

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] GSoC update

2015-06-26 Thread Nicolas George
L'octidi 8 messidor, an CCXXIII, Stephan Holljes a écrit :
 I think I implemented everything necessary, but I don't know how to
 test it. The old behaviour of accepting a single client is now also
 broken.

Since that behaviour was already established, breaking it without notice is
not an option :(

 How do I detect which behaviour the user wants? Should I introduce a new
 option for http and tcp connections or make the listen field take more
 values than just 0 and 1?

Increasing the range for listen is a good idea.

I am afraid it will make the accept functions a but awkward, having to work
with either two contexts (server and client) or only one (server that will
become client).

 Attached are patches with the changes I made so far. It compiles, but
 breaks http server capabilities for now.

To actually test multi-client code, it will be necessary to write a
multi-client sample application. Fortunately, that should not be very hard.


 From 22f958ad8d0058865c94847ca8cd2488e2a61c9e Mon Sep 17 00:00:00 2001
 From: Stephan Holljes klaxa1...@googlemail.com
 Date: Fri, 26 Jun 2015 20:48:49 +0200
 Subject: [PATCH 1/6] lavf/network: split ff_listen_bind into ff_listen and
  ff_accept
 
 Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
 ---
  libavformat/network.c | 27 +--
  libavformat/network.h |  4 
  2 files changed, 25 insertions(+), 6 deletions(-)
 
 diff --git a/libavformat/network.c b/libavformat/network.c
 index 47ade8c..8d61746 100644
 --- a/libavformat/network.c
 +++ b/libavformat/network.c
 @@ -187,12 +187,11 @@ int ff_socket(int af, int type, int proto)
  return fd;
  }
  
 -int ff_listen_bind(int fd, const struct sockaddr *addr,
 -   socklen_t addrlen, int timeout, URLContext *h)
 +int ff_listen(int fd, const struct sockaddr *addr,
 +  socklen_t addrlen)
  {
  int ret;
  int reuse = 1;
 -struct pollfd lp = { fd, POLLIN, 0 };
  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse))) {
  av_log(NULL, AV_LOG_WARNING, setsockopt(SO_REUSEADDR) failed\n);
  }
 @@ -203,6 +202,13 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
  ret = listen(fd, 1);
  if (ret)
  return ff_neterrno();
 +return ret;
 +}
 +
 +int ff_accept(int fd, int timeout, URLContext *h)
 +{
 +int ret;
 +struct pollfd lp = { fd, POLLIN, 0 };
  
  ret = ff_poll_interrupt(lp, 1, timeout, h-interrupt_callback);
  if (ret  0)
 @@ -211,15 +217,24 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
  ret = accept(fd, NULL, NULL);
  if (ret  0)
  return ff_neterrno();
 -
 -closesocket(fd);
 -
  if (ff_socket_nonblock(ret, 1)  0)
  av_log(NULL, AV_LOG_DEBUG, ff_socket_nonblock failed\n);
  
  return ret;
  }
  
 +int ff_listen_bind(int fd, const struct sockaddr *addr,
 +   socklen_t addrlen, int timeout, URLContext *h)
 +{
 +int ret;
 +if ((ret = ff_listen(fd, addr, addrlen))  0)
 +return ret;
 +ret = ff_accept(fd, timeout, h);
 +closesocket(fd);
 +return ret;
 +
 +}
 +
  int ff_listen_connect(int fd, const struct sockaddr *addr,
socklen_t addrlen, int timeout, URLContext *h,
int will_try_next)
 diff --git a/libavformat/network.h b/libavformat/network.h
 index 86fb656..44e109c 100644
 --- a/libavformat/network.h
 +++ b/libavformat/network.h
 @@ -254,6 +254,10 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
 socklen_t addrlen, int timeout,
 URLContext *h);
  
 +int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen);
 +
 +int ff_accept(int fd, int timeout, URLContext *h);
 +
  /**
   * Connect to a file descriptor and poll for result.
   *
 -- 
 2.1.0
 

 From 4d0b5e42882f180d76a3a64da96dc87bf0ba0635 Mon Sep 17 00:00:00 2001
 From: Stephan Holljes klaxa1...@googlemail.com
 Date: Fri, 26 Jun 2015 20:50:35 +0200
 Subject: [PATCH 2/6] lavf/avio: add ffurl_accept
 
 Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
 ---
  libavformat/avio.c | 5 +
  libavformat/url.h  | 9 +
  2 files changed, 14 insertions(+)
 
 diff --git a/libavformat/avio.c b/libavformat/avio.c
 index aff8d10..153230f 100644
 --- a/libavformat/avio.c
 +++ b/libavformat/avio.c
 @@ -211,6 +211,11 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
  return 0;
  }
  
 +int ffurl_accept(URLContext *sc, URLContext *cc)
 +{
 +return sc-prot-url_accept(sc, cc);
 +}
 +
  #define URL_SCHEME_CHARS\
  abcdefghijklmnopqrstuvwxyz\
  ABCDEFGHIJKLMNOPQRSTUVWXYZ\
 diff --git a/libavformat/url.h b/libavformat/url.h
 index 99a3201..34fdea2 100644
 --- a/libavformat/url.h
 +++ b/libavformat/url.h
 @@ -58,6 +58,7 @@ typedef struct URLProtocol {
   * for those nested protocols.
   */
  int (*url_open2)(URLContext *h, const char *url, int 

Re: [FFmpeg-devel] [PATCH] s302m: fix arithmetic exception

2015-06-26 Thread Andreas Cadhalpun
On 26.06.2015 23:04, Michael Niedermayer wrote:
 On Fri, Jun 26, 2015 at 07:38:40PM +0200, Andreas Cadhalpun wrote:
  s302m.c |6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)
 520ac68a80950ff219ae396182eb56679c46ee64  
 0001-s302m-fix-arithmetic-exception.patch
 From 20bca467900d0b0d4ec6fe64140f4d4d251d0bbe Mon Sep 17 00:00:00 2001
 From: Andreas Cadhalpun andreas.cadhal...@googlemail.com
 Date: Fri, 26 Jun 2015 19:31:03 +0200
 Subject: [PATCH] s302m: fix arithmetic exception
 
 LGTM

Pushed.

Best regards,
Andreas

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


[FFmpeg-devel] [PATCH] avutil/intmath: use bzhi gcc builtin in av_mod_uintp2()

2015-06-26 Thread James Almer
Signed-off-by: James Almer jamr...@gmail.com
---
 libavutil/x86/intmath.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index c42fa83..85f15a4 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -39,6 +39,12 @@
 
 #if defined(__BMI2__)
 
+#if AV_GCC_VERSION_AT_LEAST(5,1)
+#define av_mod_uintp2 __builtin_ia32_bzhi_si
+#else
+/* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
+ * implement it using inline assembly
+ */
 #define av_mod_uintp2 av_mod_uintp2_bmi2
 static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, 
unsigned p)
 {
@@ -50,6 +56,7 @@ static av_always_inline av_const unsigned 
av_mod_uintp2_bmi2(unsigned a, unsigne
 return x;
 }
 }
+#endif /* AV_GCC_VERSION_AT_LEAST */
 
 #endif /* __BMI2__ */
 
-- 
2.4.4

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


Re: [FFmpeg-devel] [PATCH 2/2] movtextenc.c: Support for Bold, Italic and Underlined styles

2015-06-26 Thread Niklesh Lalwani
On 27-Jun-2015 12:36 AM, Philip Langdale phil...@overt.org wrote:

 On 2015-06-26 09:48, Niklesh Lalwani wrote:

 The output produced here was actually different from the expected. Hence
 the test failed. I produced ASS file for both the original file and the
 encoded file. The ass file produced from the encoded mp4 file seemed to
be
 dropping all text after \N
 After a lot of digging, I found out that while appending '\n' into the
 buffer in encoding, it is to be considered as a single character and not
2.
 Making this change in movtextenc.c solved the issue and now I have
matching
 ASS outputs for both the files.
 However, the test still fails even though I have exact same ASS files.
 PS - there is no style information associated here as far as I can see.
 Please correct me if I'm going wrong here.


 This test produces another mp4 file - not just an ASS subtitle (which is
 what the other movtextenc test does. So something else you've done has
 altered the output - perhaps through metadata or adding a box that wasn't
 there before, etc.


You are right. My movenc.c file was different ( I didn't undo the commit to
set the subtitle dimensions in my working branch which I submitted here
some time back)
Got the latest movenc.c file from git, and the test doesn't give any errors
now ( after making the change in movtextenc.c which I mentioned before)

Updated patch attached.

Thanks,
Niklesh


0001-movtextenc.c-Support-for-Bold-Italic-and-Underlined-.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: Add flag for experimental HWAccels and use it for VDPAU/HEVC

2015-06-26 Thread wm4
On Fri, 26 Jun 2015 08:45:09 -0700
Philip Langdale phil...@overt.org wrote:

 This HWAccel isn't really usable right now due to an nvidia driver bug,
 so we don't want it selected by default.
 
 HWAccels have a capabilities field and there's a comment about flags,
 but no flags exist today, so let's add one for experimental hwaccels.
 
 Signed-off-by: Philip Langdale phil...@overt.org
 ---
  libavcodec/avcodec.h| 8 +++-
  libavcodec/utils.c  | 7 +++
  libavcodec/vdpau_hevc.c | 1 +
  libavcodec/version.h| 2 +-
  4 files changed, 16 insertions(+), 2 deletions(-)
 
 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index 761d3c1..ddbf0a3 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -894,6 +894,12 @@ typedef struct RcOverride{
   */
  #define CODEC_CAP_LOSSLESS 0x8000
  
 +/**
 + * HWAccel is experimental and is thus avoided in favor of non experimental
 + * codecs
 + */
 +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
 +
  #if FF_API_MB_TYPE
  //The following defines may change, don't expect compatibility if you use 
 them.
  #define MB_TYPE_INTRA4x4   0x0001
 @@ -3336,7 +3342,7 @@ typedef struct AVHWAccel {
  
  /**
   * Hardware accelerated codec capabilities.
 - * see FF_HWACCEL_CODEC_CAP_*
 + * see HWACCEL_CODEC_CAP_*
   */
  int capabilities;
  
 diff --git a/libavcodec/utils.c b/libavcodec/utils.c
 index 7696582..40ea544 100644
 --- a/libavcodec/utils.c
 +++ b/libavcodec/utils.c
 @@ -1176,6 +1176,13 @@ static int setup_hwaccel(AVCodecContext *avctx,
  return AVERROR(ENOENT);
  }
  
 +if (hwa-capabilities  HWACCEL_CODEC_CAP_EXPERIMENTAL 
 +avctx-strict_std_compliance  FF_COMPLIANCE_EXPERIMENTAL) {
 +av_log(avctx, AV_LOG_WARNING, Ignoring experimental hwaccel: %s\n,
 +   hwa-name);
 +return AVERROR(ENOTSUP);
 +}
 +
  if (hwa-priv_data_size) {
  avctx-internal-hwaccel_priv_data = av_mallocz(hwa-priv_data_size);
  if (!avctx-internal-hwaccel_priv_data)
 diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
 index 99e1a8d..928513b 100644
 --- a/libavcodec/vdpau_hevc.c
 +++ b/libavcodec/vdpau_hevc.c
 @@ -427,6 +427,7 @@ AVHWAccel ff_hevc_vdpau_hwaccel = {
  .type   = AVMEDIA_TYPE_VIDEO,
  .id = AV_CODEC_ID_HEVC,
  .pix_fmt= AV_PIX_FMT_VDPAU,
 +.capabilities   = HWACCEL_CODEC_CAP_EXPERIMENTAL,
  .start_frame= vdpau_hevc_start_frame,
  .end_frame  = vdpau_hevc_end_frame,
  .decode_slice   = vdpau_hevc_decode_slice,
 diff --git a/libavcodec/version.h b/libavcodec/version.h
 index eff8820..1073588 100644
 --- a/libavcodec/version.h
 +++ b/libavcodec/version.h
 @@ -29,7 +29,7 @@
  #include libavutil/version.h
  
  #define LIBAVCODEC_VERSION_MAJOR 56
 -#define LIBAVCODEC_VERSION_MINOR  45
 +#define LIBAVCODEC_VERSION_MINOR  46
  #define LIBAVCODEC_VERSION_MICRO 100
  
  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

LGTM, but not sure if the flag really has to be public API. This is
pretty much just a one-time thing with the vdpau code.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] movtextenc.c: Support for Bold, Italic and Underlined styles

2015-06-26 Thread Niklesh Lalwani
The output produced here was actually different from the expected. Hence
the test failed. I produced ASS file for both the original file and the
encoded file. The ass file produced from the encoded mp4 file seemed to be
dropping all text after \N
After a lot of digging, I found out that while appending '\n' into the
buffer in encoding, it is to be considered as a single character and not 2.
Making this change in movtextenc.c solved the issue and now I have matching
ASS outputs for both the files.
However, the test still fails even though I have exact same ASS files.
PS - there is no style information associated here as far as I can see.
Please correct me if I'm going wrong here.

Thanks,
Niklesh
On Tue, 23 Jun 2015 22:09:20 +0200
Michael Niedermayer michae...@gmx.at wrote:

 On Wed, Jun 24, 2015 at 01:25:53AM +0530, Niklesh Lalwani wrote:
  Updated patch.
  Compiles without any warnings. Tested too.

 this changes the fate checksum

 --- ./tests/ref/fate/binsub-movtextenc  2015-06-23 21:52:17.741843656
 +0200 +++ tests/data/fate/binsub-movtextenc   2015-06-23
 22:06:37.389861767 +0200 @@ -1 +1 @@
 -ef264064c522389d0cf267c4d6235561
 +59cad033309cebac08fda1ebd01677ac
 TESTsub-cc
 Test binsub-movtextenc failed. Look at
 tests/data/fate/binsub-movtextenc.err for details. make: ***
 [fate-binsub-movtextenc] Error 1 make: *** Waiting for unfinished
 jobs

 if thats intended then the chnage should be included in the patch


Likely this is because we're now carrying over formatting that we were
dropping before. Niklesh, you should look at the fate sample file and
verify this is what we should expect.

--phil
___
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] avcodec: Add flag for experimental HWAccels and use it for VDPAU/HEVC

2015-06-26 Thread Michael Niedermayer
On Fri, Jun 26, 2015 at 08:45:09AM -0700, Philip Langdale wrote:
 This HWAccel isn't really usable right now due to an nvidia driver bug,
 so we don't want it selected by default.
 
 HWAccels have a capabilities field and there's a comment about flags,
 but no flags exist today, so let's add one for experimental hwaccels.
 
 Signed-off-by: Philip Langdale phil...@overt.org
 ---
  libavcodec/avcodec.h| 8 +++-
  libavcodec/utils.c  | 7 +++
  libavcodec/vdpau_hevc.c | 1 +
  libavcodec/version.h| 2 +-
  4 files changed, 16 insertions(+), 2 deletions(-)
 
 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index 761d3c1..ddbf0a3 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -894,6 +894,12 @@ typedef struct RcOverride{
   */
  #define CODEC_CAP_LOSSLESS 0x8000
  
 +/**
 + * HWAccel is experimental and is thus avoided in favor of non experimental
 + * codecs
 + */
 +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200

this should have a AV prefix if it is public API

if instead its left as private API then the version change should be
micro only

i dont know which way makes more sense

patch LGTM either way

[...]
-- 
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] avutil/intmath: use bzhi gcc builtin in av_mod_uintp2()

2015-06-26 Thread James Almer
On 26/06/15 4:56 PM, Carl Eugen Hoyos wrote:
 On Friday 26 June 2015 09:52:31 pm James Almer wrote:
 
 +#if AV_GCC_VERSION_AT_LEAST(5,1)
 +#define av_mod_uintp2 __builtin_ia32_bzhi_si
 
 Since there are compilers != gcc that define GCC 
 (for example icc), this needs a configure check imo.

Does it define __GNUC__ with a value =5 like I'm checking above? And
if it defines __GNUC__, shouldn't it support the relevant builtins or
defines?

 
 What is the advantage over the inline version?

The bzhi instruction sets the ZF flag among others, but GCC apparently
doesn't take it into consideration when it's used inside the __asm__()
block, so something like if (av_mod_uintp2(foo, bar)) will result in
a bzhi instruction followed by a test instruction.
This doesn't happen if you use the builtin.

 
 Carl Eugen
 ___
 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] [PATCHv2] avcodec: Add support for per-frame AFD output in h264

2015-06-26 Thread Michael Niedermayer
On Fri, Jun 26, 2015 at 09:55:06PM +0100, Kieran Kunhya wrote:
 From: Kieran Kunhya kie...@kunhya.com
 
 ---
  libavcodec/h264.c | 10 ++
  libavcodec/h264.h |  3 +++
  libavcodec/h264_sei.c |  6 ++
  3 files changed, 19 insertions(+)

applied

thanks

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


[FFmpeg-devel] [PATCH 10/11] aaccoder: implement intensity stereo

2015-06-26 Thread Rostislav Pehlivanov
This commit implements intensity stereo band marking and makes use of the 
previous commits in the series to encode such bands and spectral coefficients. 
It also adds the new option aac_is, which is 0 by default, used to control 
wheter such coding is done or not. The interaction of intensity stereo and 
mid/side coding are again taken from the decoder, more specifically the way MS 
changes the phase of IS spectral coefficients.
---
 libavcodec/aaccoder.c | 99 +++
 libavcodec/aacenc.c   | 11 --
 libavcodec/aacenc.h   |  2 ++
 3 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 3cd9fa2..6b64c8e 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -1178,6 +1178,101 @@ static void search_for_pns(AACEncContext *s, 
AVCodecContext *avctx, SingleChanne
 }
 }
 
+static void search_for_is(AACEncContext *s, AVCodecContext *avctx, 
ChannelElement *cpe,
+  const float lambda)
+{
+float IS[128];
+float *L34 = s-scoefs, *R34 = s-scoefs + 128, *I34 = s-scoefs + 128*2;
+SingleChannelElement *sce0 = cpe-ch[0];
+SingleChannelElement *sce1 = cpe-ch[1];
+int start = 0, count = 0, i, w, w2, g;
+const float freq_mult = 
avctx-sample_rate/(1024.0f/sce0-ics.num_windows)/2.0f;
+
+memset(cpe-is_mask, 0, sizeof(uint8_t)*128);
+
+for (w = 0; w  128; w++)
+if (sce1-band_type[w] = INTENSITY_BT2)
+sce1-band_type[w] = 0;
+
+if (!cpe-common_window)
+return;
+for (w = 0; w  sce0-ics.num_windows; w += sce0-ics.group_len[w]) {
+for (g = 0;  g  sce0-ics.num_swb; g++) {
+if (start*freq_mult  INT_STEREO_LOW_LIMIT 
+cpe-ch[0].band_type[w*16+g] != NOISE_BT  
!cpe-ch[0].zeroes[w*16+g] 
+cpe-ch[1].band_type[w*16+g] != NOISE_BT  
!cpe-ch[1].zeroes[w*16+g]) {
+float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f;
+float s_coef0 = 0.0f, s_coef1 = 0.0f, dist1 = 0.0f, dist2 = 
0.0f;
+for (w2 = 0; w2  sce0-ics.group_len[w]; w2++) {
+FFPsyBand *band0 = 
s-psy.ch[s-cur_channel+0].psy_bands[(w+w2)*16+g];
+FFPsyBand *band1 = 
s-psy.ch[s-cur_channel+1].psy_bands[(w+w2)*16+g];
+float dist_spec_err = 0.0f, sener101, sener101_34;
+float minthr = FFMIN(band0-threshold, band1-threshold);
+float maxval = find_max_val(1, sce0-ics.swb_sizes[g], 
I34);
+int is_sf_idx = FFMAX(1, sce0-sf_idx[(w+w2)*16+g]-4);
+int is_band_type = find_min_book(maxval, is_sf_idx);
+for (i = 0; i  sce0-ics.swb_sizes[g]; i++) {
+float coef0 = sce0-pcoeffs[start+w2*128+i];
+float coef1 = sce1-pcoeffs[start+w2*128+i];
+ener0 += sqrt(coef0*coef0);
+ener1 += sqrt(coef1*coef1);
+s_coef0 += coef0;
+s_coef1 += coef1;
+ener01 += sqrt((coef0 + coef1)*(coef0 + coef1));
+}
+sener101 = ener1/ener01;
+sener101_34 = sqrt(sener101 * sqrt(sener101));
+int p = s_coef0*s_coef1 = 0.0f ? 1 : -1;
+if (cpe-ms_mask[w*16+g])
+p *= 1 - 2 * cpe-ms_mask[w*16 + g];
+for (i = 0; i  sce0-ics.swb_sizes[g]; i++) {
+IS[i] = (sce0-pcoeffs[start+w2*128+i] + 
p*sce1-pcoeffs[start+w2*128+i]) * ener0/ener01;
+}
+abs_pow34_v(L34, sce0-coeffs+start+w2*128, 
sce0-ics.swb_sizes[g]);
+abs_pow34_v(R34, sce1-coeffs+start+w2*128, 
sce0-ics.swb_sizes[g]);
+abs_pow34_v(I34, IS,
sce0-ics.swb_sizes[g]);
+dist1 += quantize_band_cost(s, sce0-coeffs + start + 
w2*128,
+L34,
+sce0-ics.swb_sizes[g],
+sce0-sf_idx[(w+w2)*16+g],
+sce0-band_type[(w+w2)*16+g],
+lambda / band0-threshold, 
INFINITY, NULL);
+dist1 += quantize_band_cost(s, sce1-coeffs + start + 
w2*128,
+R34,
+sce1-ics.swb_sizes[g],
+sce1-sf_idx[(w+w2)*16+g],
+sce1-band_type[(w+w2)*16+g],
+lambda / band1-threshold, 
INFINITY, NULL);
+dist2 += quantize_band_cost(s, IS,
+I34,
+   

[FFmpeg-devel] [PATCH 11/11] aaccoder: zero ms_mask bands on execution

2015-06-26 Thread Rostislav Pehlivanov
Coders other than twoloop require this to be set or else the marked bands would 
continue to be encoded via M/S until the end of the file.
---
 libavcodec/aaccoder.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 6b64c8e..5a6a243 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -1281,6 +1281,9 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe,
 float *L34 = s-scoefs, *R34 = s-scoefs + 128, *M34 = s-scoefs + 128*2, 
*S34 = s-scoefs + 128*3;
 SingleChannelElement *sce0 = cpe-ch[0];
 SingleChannelElement *sce1 = cpe-ch[1];
+
+memset(cpe-ms_mask, 0, sizeof(uint8_t)*128);
+
 if (!cpe-common_window)
 return;
 for (w = 0; w  sce0-ics.num_windows; w += sce0-ics.group_len[w]) {
-- 
2.1.4

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


Re: [FFmpeg-devel] GSoC update

2015-06-26 Thread Stephan Holljes
On Fri, Jun 26, 2015 at 10:51 AM, Nicolas George geo...@nsup.org wrote:
 Le septidi 7 messidor, an CCXXIII, Stephan Holljes a écrit :
 Thanks, I understand the datastructures and their interaction a lot
 better now. I discussed it with a friend yesterday too and there a lot
 of the things started to make more sense.
 I'm currently working on the implementation, when questions arise I
 will ask again.

 Good. Please try to pose a WIP patch today to make sure you are really in
 the right track.

 Regards,

 --
   Nicolas George

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


I think I implemented everything necessary, but I don't know how to
test it. The old behaviour of accepting a single client is now also
broken. How do I detect which behaviour the user wants? Should I
introduce a new option for http and tcp connections or make the listen
field take more values than just 0 and 1?
Attached are patches with the changes I made so far. It compiles, but
breaks http server capabilities for now.
From 22f958ad8d0058865c94847ca8cd2488e2a61c9e Mon Sep 17 00:00:00 2001
From: Stephan Holljes klaxa1...@googlemail.com
Date: Fri, 26 Jun 2015 20:48:49 +0200
Subject: [PATCH 1/6] lavf/network: split ff_listen_bind into ff_listen and
 ff_accept

Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
---
 libavformat/network.c | 27 +--
 libavformat/network.h |  4 
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 47ade8c..8d61746 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -187,12 +187,11 @@ int ff_socket(int af, int type, int proto)
 return fd;
 }
 
-int ff_listen_bind(int fd, const struct sockaddr *addr,
-   socklen_t addrlen, int timeout, URLContext *h)
+int ff_listen(int fd, const struct sockaddr *addr,
+  socklen_t addrlen)
 {
 int ret;
 int reuse = 1;
-struct pollfd lp = { fd, POLLIN, 0 };
 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse))) {
 av_log(NULL, AV_LOG_WARNING, setsockopt(SO_REUSEADDR) failed\n);
 }
@@ -203,6 +202,13 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
 ret = listen(fd, 1);
 if (ret)
 return ff_neterrno();
+return ret;
+}
+
+int ff_accept(int fd, int timeout, URLContext *h)
+{
+int ret;
+struct pollfd lp = { fd, POLLIN, 0 };
 
 ret = ff_poll_interrupt(lp, 1, timeout, h-interrupt_callback);
 if (ret  0)
@@ -211,15 +217,24 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
 ret = accept(fd, NULL, NULL);
 if (ret  0)
 return ff_neterrno();
-
-closesocket(fd);
-
 if (ff_socket_nonblock(ret, 1)  0)
 av_log(NULL, AV_LOG_DEBUG, ff_socket_nonblock failed\n);
 
 return ret;
 }
 
+int ff_listen_bind(int fd, const struct sockaddr *addr,
+   socklen_t addrlen, int timeout, URLContext *h)
+{
+int ret;
+if ((ret = ff_listen(fd, addr, addrlen))  0)
+return ret;
+ret = ff_accept(fd, timeout, h);
+closesocket(fd);
+return ret;
+
+}
+
 int ff_listen_connect(int fd, const struct sockaddr *addr,
   socklen_t addrlen, int timeout, URLContext *h,
   int will_try_next)
diff --git a/libavformat/network.h b/libavformat/network.h
index 86fb656..44e109c 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -254,6 +254,10 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
socklen_t addrlen, int timeout,
URLContext *h);
 
+int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen);
+
+int ff_accept(int fd, int timeout, URLContext *h);
+
 /**
  * Connect to a file descriptor and poll for result.
  *
-- 
2.1.0

From 4d0b5e42882f180d76a3a64da96dc87bf0ba0635 Mon Sep 17 00:00:00 2001
From: Stephan Holljes klaxa1...@googlemail.com
Date: Fri, 26 Jun 2015 20:50:35 +0200
Subject: [PATCH 2/6] lavf/avio: add ffurl_accept

Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
---
 libavformat/avio.c | 5 +
 libavformat/url.h  | 9 +
 2 files changed, 14 insertions(+)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index aff8d10..153230f 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -211,6 +211,11 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
 return 0;
 }
 
+int ffurl_accept(URLContext *sc, URLContext *cc)
+{
+return sc-prot-url_accept(sc, cc);
+}
+
 #define URL_SCHEME_CHARS\
 abcdefghijklmnopqrstuvwxyz\
 ABCDEFGHIJKLMNOPQRSTUVWXYZ\
diff --git a/libavformat/url.h b/libavformat/url.h
index 99a3201..34fdea2 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -58,6 +58,7 @@ typedef struct URLProtocol {
  * for those nested protocols.
  */
 int 

Re: [FFmpeg-devel] [PATCH 2/2] movtextenc.c: Support for Bold, Italic and Underlined styles

2015-06-26 Thread Philip Langdale

On 2015-06-26 09:48, Niklesh Lalwani wrote:
The output produced here was actually different from the expected. 
Hence

the test failed. I produced ASS file for both the original file and the
encoded file. The ass file produced from the encoded mp4 file seemed to 
be

dropping all text after \N
After a lot of digging, I found out that while appending '\n' into the
buffer in encoding, it is to be considered as a single character and 
not 2.
Making this change in movtextenc.c solved the issue and now I have 
matching

ASS outputs for both the files.
However, the test still fails even though I have exact same ASS files.
PS - there is no style information associated here as far as I can see.
Please correct me if I'm going wrong here.


This test produces another mp4 file - not just an ASS subtitle (which is
what the other movtextenc test does. So something else you've done has
altered the output - perhaps through metadata or adding a box that 
wasn't

there before, etc.


Thanks,
Niklesh
On Tue, 23 Jun 2015 22:09:20 +0200
Michael Niedermayer michae...@gmx.at wrote:


On Wed, Jun 24, 2015 at 01:25:53AM +0530, Niklesh Lalwani wrote:
 Updated patch.
 Compiles without any warnings. Tested too.

this changes the fate checksum

--- ./tests/ref/fate/binsub-movtextenc  2015-06-23 21:52:17.741843656
+0200 +++ tests/data/fate/binsub-movtextenc   2015-06-23
22:06:37.389861767 +0200 @@ -1 +1 @@
-ef264064c522389d0cf267c4d6235561
+59cad033309cebac08fda1ebd01677ac
TESTsub-cc
Test binsub-movtextenc failed. Look at
tests/data/fate/binsub-movtextenc.err for details. make: ***
[fate-binsub-movtextenc] Error 1 make: *** Waiting for unfinished
jobs

if thats intended then the chnage should be included in the patch



Likely this is because we're now carrying over formatting that we were
dropping before. Niklesh, you should look at the fate sample file and
verify this is what we should expect.

--phil
___
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


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


Re: [FFmpeg-devel] [PATCH] lavfi: add drawgraph filter

2015-06-26 Thread Dave Rice
Hi,

 On Jun 26, 2015, at 11:27 AM, Paul B Mahol one...@gmail.com wrote:
 
 Signed-off-by: Paul B Mahol one...@gmail.com
 ---
 Waiting for comments and flames.

Here are some comments and flames:

I noticed that when I set min to a value greater than max. I get a crash with 
Bus error: 10.

There may be an issue with negative values for min/max. When I run:
ffplay -f lavfi -i color=gray -vf 
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
I see a line scroll across the center of the window. When I change min to -255 
I see a line at ~3/4 down the frame, where I would expect -128 to be. Does the 
min and max expect non-negative numbers.

It could be helpful to include equations within foreground, such as:
ffplay -i movie.mkv -vf 
signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255:foreground=if(gt(lavfi.signalstats.YAVG\,128)\,green\,red)
or actually I could probably subsequently use geq to accomplish that.

Can you alias 's' for 'size' as many of the other filters do.

This is very helpful, thanks!
Dave

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


[FFmpeg-devel] [PATCH 07/11] aacenc: add support for coding of IS spectral coefficients

2015-06-26 Thread Rostislav Pehlivanov
This commit adds support for the coding of intensity stereo spectral 
coefficients. It also fixes the Mid/Side coding of band_types higher than 
RESERVED_BT (M/S must not be applied to their spectral coefficients, but 
marking M/S as present in encode_ms_info() is okay). Much of the changes here 
were taken from the decoder and inverted. This commit does not change the 
functionality of the decoder.
---
 libavcodec/aacenc.c | 39 +--
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 3a512ff..a2ff04f 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -312,19 +312,28 @@ static void encode_ms_info(PutBitContext *pb, 
ChannelElement *cpe)
 static void adjust_frame_information(ChannelElement *cpe, int chans)
 {
 int i, w, w2, g, ch;
-int start, maxsfb, cmaxsfb;
+int maxsfb, cmaxsfb;
+IndividualChannelStream *ics;
 
-for (ch = 0; ch  chans; ch++) {
-IndividualChannelStream *ics = cpe-ch[ch].ics;
-start = 0;
-maxsfb = 0;
-cpe-ch[ch].pulse.num_pulse = 0;
+if (cpe-common_window) {
+ics = cpe-ch[0].ics;
 for (w = 0; w  ics-num_windows; w += ics-group_len[w]) {
-for (w2 = 0; w2  ics-group_len[w]; w2++) {
-start = (w+w2) * 128;
+for (w2 =  0; w2  ics-group_len[w]; w2++) {
+int start = (w+w2) * 128;
 for (g = 0; g  ics-num_swb; g++) {
-//apply M/S
-if (cpe-common_window  !ch  cpe-ms_mask[w*16 + g]) {
+//apply Intensity stereo coeffs transformation
+if (cpe-is_mask[w*16 + g]) {
+int p = -1 + 2 * (cpe-ch[1].band_type[w*16+g] - 14);
+float scale = 
sqrtf(cpe-ch[0].is_ener[w*16+g]*cpe-ch[1].is_ener[w*16+g]);
+if (cpe-ms_mask[w*16 + g])
+p *= 1 - 2 * cpe-ms_mask[w*16 + g];
+for (i = 0; i  ics-swb_sizes[g]; i++) {
+cpe-ch[0].coeffs[start+i] = 
(cpe-ch[0].pcoeffs[start+i] + p*cpe-ch[1].pcoeffs[start+i]) * scale;
+cpe-ch[1].coeffs[start+i] = 0.0f;
+}
+} else if (cpe-ms_mask[w*16 + g] 
+   cpe-ch[0].band_type[w*16 + g]  NOISE_BT 
+   cpe-ch[1].band_type[w*16 + g]  NOISE_BT) {
 for (i = 0; i  ics-swb_sizes[g]; i++) {
 cpe-ch[0].coeffs[start+i] = 
(cpe-ch[0].pcoeffs[start+i] + cpe-ch[1].pcoeffs[start+i]) * 0.5f;
 cpe-ch[1].coeffs[start+i] = 
cpe-ch[0].coeffs[start+i] - cpe-ch[1].pcoeffs[start+i];
@@ -332,6 +341,16 @@ static void adjust_frame_information(ChannelElement *cpe, 
int chans)
 }
 start += ics-swb_sizes[g];
 }
+}
+}
+}
+
+for (ch = 0; ch  chans; ch++) {
+IndividualChannelStream *ics = cpe-ch[ch].ics;
+maxsfb = 0;
+cpe-ch[ch].pulse.num_pulse = 0;
+for (w = 0; w  ics-num_windows; w += ics-group_len[w]) {
+for (w2 =  0; w2  ics-group_len[w]; w2++) {
 for (cmaxsfb = ics-num_swb; cmaxsfb  0  
cpe-ch[ch].zeroes[w*16+cmaxsfb-1]; cmaxsfb--)
 ;
 maxsfb = FFMAX(maxsfb, cmaxsfb);
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 08/11] aacenc: use the encode_special_band_scalefactors function

2015-06-26 Thread Rostislav Pehlivanov
This commit makes use of the previously added function and enables the coding 
of IS and PNS scalefactor indices for their corresponding band_types. This 
commit does not alter the functionality of the encoder.
---
 libavcodec/aaccoder.c | 4 
 libavcodec/aacenc.c   | 7 +++
 libavcodec/aacenc.h   | 1 +
 3 files changed, 12 insertions(+)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 02ffe17..10c64c0 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -1210,24 +1210,28 @@ AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
 search_for_quantizers_faac,
 encode_window_bands_info,
 quantize_and_encode_band,
+set_special_band_scalefactors,
 search_for_ms,
 },
 [AAC_CODER_ANMR] = {
 search_for_quantizers_anmr,
 encode_window_bands_info,
 quantize_and_encode_band,
+set_special_band_scalefactors,
 search_for_ms,
 },
 [AAC_CODER_TWOLOOP] = {
 search_for_quantizers_twoloop,
 codebook_trellis_rate,
 quantize_and_encode_band,
+set_special_band_scalefactors,
 search_for_ms,
 },
 [AAC_CODER_FAST] = {
 search_for_quantizers_fast,
 encode_window_bands_info,
 quantize_and_encode_band,
+set_special_band_scalefactors,
 search_for_ms,
 },
 };
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index a2ff04f..562d0cc 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -669,6 +669,13 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 s-coder-search_for_ms(s, cpe, s-lambda);
 }
 }
+if (s-coder-set_special_band_scalefactors) {
+for (ch = 0; ch  chans; ch++) {
+s-cur_channel = start_ch + ch;
+s-coder-set_special_band_scalefactors(s, cpe-ch[ch]);
+}
+}
+s-cur_channel = start_ch;
 adjust_frame_information(cpe, chans);
 if (chans == 2) {
 put_bits(s-pb, 1, cpe-common_window);
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 7c1f277..cc1b06a 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -54,6 +54,7 @@ typedef struct AACCoefficientsEncoder {
  int win, int group_len, const float 
lambda);
 void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext 
*pb, const float *in, int size,
  int scale_idx, int cb, const float 
lambda);
+void (*set_special_band_scalefactors)(struct AACEncContext *s, 
SingleChannelElement *sce);
 void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const 
float lambda);
 } AACCoefficientsEncoder;
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 06/11] aacpsy: Add energy spread for each band

2015-06-26 Thread Rostislav Pehlivanov
This commit adds the energy spread to the struct for each band and removes 2 
unused fields. distortion and perceptual_weight were not referenced in any file 
nor were they set to any value, so it was safe to remove them. The energy 
spread is currently only used in the aac psy model. It's defined as being 
proportional to the tonality of each band.
---
 libavcodec/aacpsy.c   | 1 +
 libavcodec/psymodel.h | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 49ff3fe..3f4a332 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -781,6 +781,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int 
channel,
 
 psy_band-threshold = band-thr;
 psy_band-energy= band-energy;
+psy_band-spread= spread_en[w+g];
 }
 }
 
diff --git a/libavcodec/psymodel.h b/libavcodec/psymodel.h
index 75261ba..2e3ab91 100644
--- a/libavcodec/psymodel.h
+++ b/libavcodec/psymodel.h
@@ -38,8 +38,7 @@ typedef struct FFPsyBand {
 int   bits;
 float energy;
 float threshold;
-float distortion;
-float perceptual_weight;
+float spread;/* Energy spread over the band */
 } FFPsyBand;
 
 /**
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 05/11] aacenc: add support for coding of intensity stereo scalefactor indices

2015-06-26 Thread Rostislav Pehlivanov
This commit adds support for the coding of intensity stereo scalefactor 
indices. It does not do any marking of such bands and as such does no 
functional changes to the encoder. It removes any old twoloop specific code for 
PNS and moves it into a seperate function which handles setting of scalefactor 
indices for PNS and IS bands.
---
 libavcodec/aaccoder.c | 37 +
 libavcodec/aacenc.c   |  6 +-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 3c90d27..02ffe17 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -607,6 +607,43 @@ typedef struct TrellisPath {
 #define TRELLIS_STAGES 121
 #define TRELLIS_STATES (SCALE_MAX_DIFF+1)
 
+static void set_special_band_scalefactors(AACEncContext *s, 
SingleChannelElement *sce)
+{
+int w, g, start = 0;
+int minscaler_n = sce-sf_idx[0], minscaler_i = sce-sf_idx[0];
+int bands = 0;
+
+for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
+start = 0;
+for (g = 0;  g  sce-ics.num_swb; g++) {
+if (sce-band_type[w*16+g] == INTENSITY_BT || 
sce-band_type[w*16+g] == INTENSITY_BT2) {
+sce-sf_idx[w*16+g] = 
av_clip(ceilf(log2f(sce-is_ener[w*16+g])*2), -155, 100);
+minscaler_i = FFMIN(minscaler_i, sce-sf_idx[w*16+g]);
+bands++;
+} else if (sce-band_type[w*16+g] == NOISE_BT) {
+sce-sf_idx[w*16+g] = 
av_clip(4+log2f(sce-pns_ener[w*16+g])*2, -100, 155);
+minscaler_n = FFMIN(minscaler_n, sce-sf_idx[w*16+g]);
+bands++;
+}
+start += sce-ics.swb_sizes[g];
+}
+}
+
+if (!bands)
+return;
+
+/* Clip the scalefactor indices */
+for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
+for (g = 0;  g  sce-ics.num_swb; g++) {
+if (sce-band_type[w*16+g] == INTENSITY_BT || 
sce-band_type[w*16+g] == INTENSITY_BT2) {
+sce-sf_idx[w*16+g] = av_clip(sce-sf_idx[w*16+g], 
minscaler_i, minscaler_i + SCALE_MAX_DIFF);
+} else if (sce-band_type[w*16+g] == NOISE_BT) {
+sce-sf_idx[w*16+g] = av_clip(sce-sf_idx[w*16+g], 
minscaler_n, minscaler_n + SCALE_MAX_DIFF);
+}
+}
+}
+}
+
 static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
SingleChannelElement *sce,
const float lambda)
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 897c3a1..3a512ff 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -389,7 +389,7 @@ static void encode_scale_factors(AVCodecContext *avctx, 
AACEncContext *s,
  SingleChannelElement *sce)
 {
 int diff, off_sf = sce-sf_idx[0], off_pns = sce-sf_idx[0] - NOISE_OFFSET;
-int noise_flag = 1;
+int off_is = 0, noise_flag = 1;
 int i, w;
 
 for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
@@ -402,6 +402,10 @@ static void encode_scale_factors(AVCodecContext *avctx, 
AACEncContext *s,
 put_bits(s-pb, NOISE_PRE_BITS, diff + NOISE_PRE);
 continue;
 }
+} else if (sce-band_type[w*16 + i] == INTENSITY_BT  ||
+   sce-band_type[w*16 + i] == INTENSITY_BT2) {
+diff = sce-sf_idx[w*16 + i] - off_is;
+off_is = sce-sf_idx[w*16 + i];
 } else {
 diff = sce-sf_idx[w*16 + i] - off_sf;
 off_sf = sce-sf_idx[w*16 + i];
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] avutil/intmath: use bzhi gcc builtin in av_mod_uintp2()

2015-06-26 Thread Carl Eugen Hoyos
On Friday 26 June 2015 09:52:31 pm James Almer wrote:

 +#if AV_GCC_VERSION_AT_LEAST(5,1)
 +#define av_mod_uintp2 __builtin_ia32_bzhi_si

Since there are compilers != gcc that define GCC 
(for example icc), this needs a configure check imo.

What is the advantage over the inline version?

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


[FFmpeg-devel] [PATCH 02/11] aaccoder: remove previous PNS implementation from twoloop

2015-06-26 Thread Rostislav Pehlivanov
This commit essentially undoes commit c5d4f87e8427c0952278ec247fa8ab1e6e52 
and removes PNS band marking from the twoloop coder.
---
 libavcodec/aaccoder.c | 29 +++--
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 2929f3a..a6e4cc4 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -748,11 +748,9 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 {
 int start = 0, i, w, w2, g;
 int destbits = avctx-bit_rate * 1024.0 / avctx-sample_rate / 
avctx-channels * (lambda / 120.f);
-const float freq_mult = 
avctx-sample_rate/(1024.0f/sce-ics.num_windows)/2.0f;
 float dists[128] = { 0 }, uplims[128] = { 0 };
 float maxvals[128];
-int noise_sf[128] = { 0 };
-int fflag, minscaler, minscaler_n;
+int fflag, minscaler;
 int its  = 0;
 int allz = 0;
 float minthr = INFINITY;
@@ -763,13 +761,12 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 //XXX: some heuristic to determine initial quantizers will reduce search 
time
 //determine zero bands and upper limits
 for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
-start = 0;
 for (g = 0;  g  sce-ics.num_swb; g++) {
 int nz = 0;
 float uplim = 0.0f, energy = 0.0f;
 for (w2 = 0; w2  sce-ics.group_len[w]; w2++) {
 FFPsyBand *band = 
s-psy.ch[s-cur_channel].psy_bands[(w+w2)*16+g];
-uplim += band-threshold;
+uplim  += band-threshold;
 energy += band-energy;
 if (band-energy = band-threshold || band-threshold == 
0.0f) {
 sce-zeroes[(w+w2)*16+g] = 1;
@@ -778,18 +775,10 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 nz = 1;
 }
 uplims[w*16+g] = uplim *512;
-if (s-options.pns  start*freq_mult  NOISE_LOW_LIMIT  energy 
 uplim * 1.2f) {
-noise_sf[w*16+g] = av_clip(4+FFMIN(log2f(energy)*2,255), -100, 
155);
-sce-band_type[w*16+g] = NOISE_BT;
-nz= 1;
-} else { /** Band type will be determined by the twoloop algorithm 
*/
-sce-band_type[w*16+g] = 0;
-}
 sce-zeroes[w*16+g] = !nz;
 if (nz)
 minthr = FFMIN(minthr, uplim);
 allz |= nz;
-start += sce-ics.swb_sizes[g];
 }
 }
 for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
@@ -820,7 +809,6 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 do {
 int tbits, qstep;
 minscaler = sce-sf_idx[0];
-minscaler_n = sce-sf_idx[0];
 //inner loop - quantize spectrum to fit into given number of bits
 qstep = its ? 1 : 32;
 do {
@@ -835,11 +823,7 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 int cb;
 float dist = 0.0f;
 
-if (sce-band_type[w*16+g] == NOISE_BT) {
-minscaler_n = FFMIN(minscaler_n, noise_sf[w*16+g]);
-start += sce-ics.swb_sizes[g];
-continue;
-} else if (sce-zeroes[w*16+g] || sce-sf_idx[w*16+g] = 
218) {
+if (sce-zeroes[w*16+g] || sce-sf_idx[w*16+g] = 218) {
 start += sce-ics.swb_sizes[g];
 continue;
 }
@@ -883,16 +867,9 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 fflag = 0;
 minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
 
-for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w])
-for (g = 0; g  sce-ics.num_swb; g++)
-if (sce-band_type[w*16+g] == NOISE_BT)
-sce-sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], 
minscaler_n, minscaler_n + SCALE_MAX_DIFF);
-
 for (w = 0; w  sce-ics.num_windows; w += sce-ics.group_len[w]) {
 for (g = 0; g  sce-ics.num_swb; g++) {
 int prevsc = sce-sf_idx[w*16+g];
-if (sce-band_type[w*16+g] == NOISE_BT)
-continue;
 if (dists[w*16+g]  uplims[w*16+g]  sce-sf_idx[w*16+g]  
60) {
 if (find_min_book(maxvals[w*16+g], sce-sf_idx[w*16+g]-1))
 sce-sf_idx[w*16+g]--;
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 04/11] aaccoder: add intensity stereo support to encode_window_bands_info quantizer

2015-06-26 Thread Rostislav Pehlivanov
This commit adds support for both PNS and IS (intensity stereo) codebooks to 
the encode_window_bands_info() quantizer, used by the faast, faac and anmr 
non-default, native coders. This does not mean that both extensions now work 
with those coders, some are simply unsuited and will trigger an assertion in 
the encoder while others simply ignore the changed scalefactor indices and band 
types. This commit simply adds support for encoding said band types with the 
alternative coders. Future commits to the coders will be required to make them 
suitable.
---
 libavcodec/aaccoder.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index f069a3b..3c90d27 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -350,7 +350,7 @@ typedef struct BandCodingPath {
 static void encode_window_bands_info(AACEncContext *s, SingleChannelElement 
*sce,
  int win, int group_len, const float 
lambda)
 {
-BandCodingPath path[120][CB_TOT];
+BandCodingPath path[120][CB_TOT_ALL];
 int w, swb, cb, start, size;
 int i, j;
 const int max_sfb  = sce-ics.max_sfb;
@@ -363,7 +363,7 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 
 abs_pow34_v(s-scoefs, sce-coeffs, 1024);
 start = win*128;
-for (cb = 0; cb  CB_TOT; cb++) {
+for (cb = 0; cb  CB_TOT_ALL; cb++) {
 path[0][cb].cost = 0.0f;
 path[0][cb].prev_idx = -1;
 path[0][cb].run  = 0;
@@ -371,7 +371,7 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 for (swb = 0; swb  max_sfb; swb++) {
 size = sce-ics.swb_sizes[swb];
 if (sce-zeroes[win*16 + swb]) {
-for (cb = 0; cb  CB_TOT; cb++) {
+for (cb = 0; cb  CB_TOT_ALL; cb++) {
 path[swb+1][cb].prev_idx = cb;
 path[swb+1][cb].cost = path[swb][cb].cost;
 path[swb+1][cb].run  = path[swb][cb].run + 1;
@@ -381,9 +381,16 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 int mincb = next_mincb;
 next_minrd = INFINITY;
 next_mincb = 0;
-for (cb = 0; cb  CB_TOT; cb++) {
+for (cb = 0; cb  CB_TOT_ALL; cb++) {
 float cost_stay_here, cost_get_here;
 float rd = 0.0f;
+if (cb = 12  sce-band_type[win*16+swb]  
aac_cb_out_map[cb] ||
+cb   aac_cb_in_map[sce-band_type[win*16+swb]]  
sce-band_type[win*16+swb]  aac_cb_out_map[cb]) {
+path[swb+1][cb].prev_idx = -1;
+path[swb+1][cb].cost = INFINITY;
+path[swb+1][cb].run  = path[swb][cb].run + 1;
+continue;
+}
 for (w = 0; w  group_len; w++) {
 FFPsyBand *band = 
s-psy.ch[s-cur_channel].psy_bands[(win+w)*16+swb];
 rd += quantize_band_cost(s, sce-coeffs + start + w*128,
@@ -417,11 +424,12 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 //convert resulting path from backward-linked list
 stack_len = 0;
 idx   = 0;
-for (cb = 1; cb  CB_TOT; cb++)
+for (cb = 1; cb  CB_TOT_ALL; cb++)
 if (path[max_sfb][cb].cost  path[max_sfb][idx].cost)
 idx = cb;
 ppos = max_sfb;
 while (ppos  0) {
+av_assert1(idx = 0);
 cb = idx;
 stackrun[stack_len] = path[ppos][cb].run;
 stackcb [stack_len] = cb;
@@ -452,7 +460,7 @@ static void encode_window_bands_info(AACEncContext *s, 
SingleChannelElement *sce
 static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
   int win, int group_len, const float lambda)
 {
-BandCodingPath path[120][CB_TOT];
+BandCodingPath path[120][CB_TOT_ALL];
 int w, swb, cb, start, size;
 int i, j;
 const int max_sfb  = sce-ics.max_sfb;
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 03/11] aaccoder: add intensity stereo coding support for the trellis quantizer

2015-06-26 Thread Rostislav Pehlivanov
This commit extends the trellis quantizer (used by the default twoloop coder) 
to accept and correctly encode codebooks needed for intensity stereo and 
perceptual noise substitution.
---
 libavcodec/aaccoder.c | 81 +--
 1 file changed, 46 insertions(+), 35 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index a6e4cc4..f069a3b 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -43,8 +43,23 @@
 /** Frequency in Hz for lower limit of noise substitution **/
 #define NOISE_LOW_LIMIT 4000
 
+/* Energy spread threshold value below which no PNS is used, this corresponds 
to
+ * typically around 17Khz, after which PNS usage decays ending at 19Khz */
+#define NOISE_SPREAD_THRESHOLD 152234544.0f
+
+/* Above ~1.26*threshold all normally-zeroed values are PNS'd. Lambda divides
+ * the defined value below as to try to get a ~1.26 multiplier so that there is
+ * a balance between noise and zero bands leaving more bits for actual signal 
*/
+#define NOISE_LAMBDA_NUMERATOR 252.1f
+
+/** Frequency in Hz for lower limit of intensity stereo   **/
+#define INT_STEREO_LOW_LIMIT 6000
+
 /** Total number of usable codebooks **/
-#define CB_TOT 13
+#define CB_TOT 12
+
+/** Total number of codebooks, including special ones **/
+#define CB_TOT_ALL 15
 
 /** bits needed to code codebook run value for long windows */
 static const uint8_t run_value_bits_long[64] = {
@@ -64,9 +79,9 @@ static const uint8_t * const run_value_bits[2] = {
 };
 
 /** Map to convert values from BandCodingPath index to a codebook index **/
-static const uint8_t aac_cb_out_map[CB_TOT]  = {0,1,2,3,4,5,6,7,8,9,10,11,13};
+static const uint8_t aac_cb_out_map[CB_TOT_ALL]  = 
{0,1,2,3,4,5,6,7,8,9,10,11,13,14,15};
 /** Inverse map to convert from codebooks to BandCodingPath indices **/
-static const uint8_t aac_cb_in_map[CB_TOT+1] = 
{0,1,2,3,4,5,6,7,8,9,10,11,0,12};
+static const uint8_t aac_cb_in_map[CB_TOT_ALL+1] = 
{0,1,2,3,4,5,6,7,8,9,10,11,0,12,13,14};
 
 /**
  * Quantize one coefficient.
@@ -118,7 +133,7 @@ static av_always_inline float 
quantize_and_encode_band_cost_template(
 const float *scaled, int size, int scale_idx,
 int cb, const float lambda, const float uplim,
 int *bits, int BT_ZERO, int BT_UNSIGNED,
-int BT_PAIR, int BT_ESC, int BT_NOISE)
+int BT_PAIR, int BT_ESC, int BT_NOISE, int 
BT_STEREO)
 {
 const int q_idx = POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512;
 const float Q   = ff_aac_pow2sf_tab [q_idx];
@@ -131,14 +146,7 @@ static av_always_inline float 
quantize_and_encode_band_cost_template(
 int resbits = 0;
 int off;
 
-if (BT_ZERO) {
-for (i = 0; i  size; i++)
-cost += in[i]*in[i];
-if (bits)
-*bits = 0;
-return cost * lambda;
-}
-if (BT_NOISE) {
+if (BT_ZERO || BT_NOISE || BT_STEREO) {
 for (i = 0; i  size; i++)
 cost += in[i]*in[i];
 if (bits)
@@ -231,26 +239,27 @@ static float quantize_and_encode_band_cost_NONE(struct 
AACEncContext *s, PutBitC
 return 0.0f;
 }
 
-#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, 
BT_PAIR, BT_ESC, BT_NOISE) \
-static float quantize_and_encode_band_cost_ ## NAME(   
 \
-struct AACEncContext *s,   
 \
-PutBitContext *pb, const float *in,
 \
-const float *scaled, int size, int scale_idx,  
 \
-int cb, const float lambda, const float uplim, 
 \
-int *bits) {   
 \
-return quantize_and_encode_band_cost_template( 
 \
-s, pb, in, scaled, size, scale_idx,
 \
-BT_ESC ? ESC_BT : cb, lambda, uplim, bits, 
 \
-BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, 
BT_NOISE);   \
+#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, 
BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO) \
+static float quantize_and_encode_band_cost_ ## NAME(   
  \
+struct AACEncContext *s,   
  \
+PutBitContext *pb, const float *in,
  \
+const float *scaled, int size, int scale_idx,  
  \
+int cb, const float lambda, const float uplim, 
  \
+int *bits) {   
  \
+return 

[FFmpeg-devel] [PATCH 00/11] aac: Implement intensity stereo encoding support

2015-06-26 Thread Rostislav Pehlivanov
This commit implements intensity stereo support for the encoder, as well as 
finalizing the Perceptual Noise Substitution encoding support. Most of the 
changes here conform to the official ISO 13818-7 specifications. Due to the 
ambiguity of the specifications, certain deviations have been taken, but 
nevertheless, the resulting encoded files are correctly interpreted by all of 
the decoders tested.
People are encouraged in testing the commits, as well as making use of the new 
features by enabling aac_pns and aac_is, the former of which will drastically 
increase the quality of the encoded files at low bitrates while the latter will 
allow for better encoding efficiency and thus a decrease in filesize, all while 
maintaining maximum quality.
Comments and tests on the perceptual noise substitution parameters added in 
aaccoder.c (NOISE_LAMBDA_NUMERATOR and NOISE_SPREAD_THRESHOLD) would be very 
appreciated and would go a long way towards making aac_pns be enabled by 
default.
The series of commits was developed in cooperation with Claudio Freire, who has 
several major quality improvements to the quantizers and coders to be added 
soon. As such, some the things which might not make a lot sense (particularly 
in marking zeroed bands with more energy than threshold as noise) are due to 
the future changes due.

Rostislav Pehlivanov (11):
  aac: add additional fields needed by the encoder for intensity stereo
  aaccoder: remove previous PNS implementation from twoloop
  aaccoder: add intensity stereo coding support for the trellis
quantizer
  aaccoder: add intensity stereo support to encode_window_bands_info
quantizer
  aacenc: add support for coding of intensity stereo scalefactor indices
  aacpsy: Add energy spread for each band
  aacenc: add support for coding of IS spectral coefficients
  aacenc: use the encode_special_band_scalefactors function
  aaccoder: add a new perceptual noise substitution implementation
  aaccoder: implement intensity stereo
  aaccoder: zero ms_mask bands on execution

 libavcodec/aac.h  |   9 +-
 libavcodec/aaccoder.c | 311 +++---
 libavcodec/aacenc.c   |  69 ---
 libavcodec/aacenc.h   |   4 +
 libavcodec/aacpsy.c   |   1 +
 libavcodec/psymodel.h |   3 +-
 6 files changed, 313 insertions(+), 84 deletions(-)

-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 04/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [4/4]

2015-06-26 Thread Michael Niedermayer
On Thu, Jun 11, 2015 at 04:08:49PM +0200, Nedeljko Babic wrote:
 From: Jovan Zelincevic jovan.zelince...@imgtec.com
 
 Build system modified
 
 Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
 ---
  configure |  1 +
  libavcodec/Makefile   | 13 ++---
  libavcodec/aacdec.c   |  1 -
  libavcodec/aacdec_fixed.c |  1 -
  libavcodec/allcodecs.c|  1 +
  5 files changed, 12 insertions(+), 5 deletions(-)

this adds some build warnings:
In file included from libavcodec/aacdec_fixed.c:426:0:
libavcodec/aacdec_template.c: In function ‘apply_tns’:
libavcodec/aacdec_template.c:2360:13: warning: passing argument 1 of 
‘compute_lpc_coefs’ from incompatible pointer type [enabled by default]
libavcodec/lpc.h:155:19: note: expected ‘const float *’ but argument is of type 
‘int *’
libavcodec/aacdec_template.c:2360:13: warning: passing argument 3 of 
‘compute_lpc_coefs’ from incompatible pointer type [enabled by default]
libavcodec/lpc.h:155:19: note: expected ‘float *’ but argument is of type ‘int 
*’
libavcodec/aacdec_template.c: In function ‘imdct_and_windowing_ld’:
libavcodec/aacdec_template.c:2570:5: warning: ISO C90 forbids mixed 
declarations and code [-Wdeclaration-after-statement]
libavcodec/aacdec_template.c: In function ‘imdct_and_windowing_eld’:
libavcodec/aacdec_template.c:2599:64: warning: pointer type mismatch in 
conditional expression [enabled by default]
In file included from libavcodec/aacdec_fixed.c:426:0:
libavcodec/aacdec_template.c: In function ‘spectral_to_sample’:
libavcodec/aacdec_template.c:2739:25: warning: passing argument 4 of 
‘ff_sbr_apply’ from incompatible pointer type [enabled by default]
libavcodec/aacsbr.h:46:6: note: expected ‘float *’ but argument is of type ‘int 
*’
libavcodec/aacdec_template.c:2739:25: warning: passing argument 5 of 
‘ff_sbr_apply’ from incompatible pointer type [enabled by default]
libavcodec/aacsbr.h:46:6: note: expected ‘float *’ but argument is of type ‘int 
*’

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


[FFmpeg-devel] [PATCH] library.mak: add rpath to shared libraries

2015-06-26 Thread Ganesh Ajjanagadde
Fixes Ticket4673

Signed-off-by: Ganesh Ajjanagadde gajjanaga...@gmail.com
---
 library.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library.mak b/library.mak
index 29460b8..401da7c 100644
--- a/library.mak
+++ b/library.mak
@@ -58,7 +58,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
 
 $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
$(SLIB_CREATE_DEF_CMD)
-   $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
+   $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) 
$(FFEXTRALIBS)
$(SLIB_EXTRA_CMD)
 
 ifdef SUBDIR
-- 
2.4.4

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


Re: [FFmpeg-devel] [PATCH 2/2] fate/api-tests: Move api-flac-test to API tests directory.

2015-06-26 Thread Michael Niedermayer
On Thu, Jun 25, 2015 at 06:37:11PM +0100, George Boyle wrote:
 ---
  libavcodec/Makefile|   2 -
  libavcodec/api-flac-test.c | 266 
 -
  tests/Makefile |   1 +
  tests/api/Makefile |   1 +
  tests/api/api-flac-test.c  | 266 
 +
  tests/fate/api.mak |   8 ++
  tests/fate/libavcodec.mak  |   6 -
  7 files changed, 276 insertions(+), 274 deletions(-)
  delete mode 100644 libavcodec/api-flac-test.c
  create mode 100644 tests/api/api-flac-test.c
  create mode 100644 tests/fate/api.mak

applied

thanks

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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] fate/api-tests: Add directory and Makefile for API tests

2015-06-26 Thread Michael Niedermayer
On Thu, Jun 25, 2015 at 06:37:10PM +0100, George Boyle wrote:
 The intention of this change is to allow separation of API tests from the
 existing tests, and also to have a place for the API test source/executable
 files so they're not mixed in with the actual library code.
 ---
  tests/Makefile |  7 +--
  tests/api/Makefile | 15 +++
  2 files changed, 20 insertions(+), 2 deletions(-)
  create mode 100644 tests/api/Makefile

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec: Add flag for experimental HWAccels and use it for VDPAU/HEVC

2015-06-26 Thread Philip Langdale
On Fri, 26 Jun 2015 23:10:43 +0200
Michael Niedermayer michae...@gmx.at wrote:

 On Fri, Jun 26, 2015 at 08:45:09AM -0700, Philip Langdale wrote:
  This HWAccel isn't really usable right now due to an nvidia driver
  bug, so we don't want it selected by default.
  
  HWAccels have a capabilities field and there's a comment about
  flags, but no flags exist today, so let's add one for experimental
  hwaccels.
  
  Signed-off-by: Philip Langdale phil...@overt.org
  ---
   libavcodec/avcodec.h| 8 +++-
   libavcodec/utils.c  | 7 +++
   libavcodec/vdpau_hevc.c | 1 +
   libavcodec/version.h| 2 +-
   4 files changed, 16 insertions(+), 2 deletions(-)
  
  diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
  index 761d3c1..ddbf0a3 100644
  --- a/libavcodec/avcodec.h
  +++ b/libavcodec/avcodec.h
  @@ -894,6 +894,12 @@ typedef struct RcOverride{
*/
   #define CODEC_CAP_LOSSLESS 0x8000
   
  +/**
  + * HWAccel is experimental and is thus avoided in favor of non
  experimental
  + * codecs
  + */
  +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
 
 this should have a AV prefix if it is public API
 
 if instead its left as private API then the version change should be
 micro only
 
 i dont know which way makes more sense
 
 patch LGTM either way
 
 [...]

Pushed with a micro bump. As this isn't a feature that's been used
before, we can decide it should be promoted to public at some future
time. It would be hard to do the opposite.

Thanks,

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


Re: [FFmpeg-devel] [PATCH] nutdec: check maxpos in read_sm_data before reading count

2015-06-26 Thread Michael Niedermayer
On Fri, Jun 26, 2015 at 07:28:36PM +0200, Andreas Cadhalpun wrote:
 On 26.06.2015 01:36, Michael Niedermayer wrote:
  On Thu, Jun 25, 2015 at 11:46:41PM +0200, Andreas Cadhalpun wrote:
  Otherwise sm_size can be larger than size, which results in a negative
  packet size.
 
  Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
  ---
   libavformat/nutdec.c | 7 ++-
   1 file changed, 6 insertions(+), 1 deletion(-)
  
  
  
 
  diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
  index 13fb399..43bd27b 100644
  --- a/libavformat/nutdec.c
  +++ b/libavformat/nutdec.c
  @@ -888,7 +888,7 @@ fail:
   
   static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket 
  *pkt, int is_meta, int64_t maxpos)
   {
  -int count = ffio_read_varlen(bc);
  +int count;
   int skip_start = 0;
   int skip_end = 0;
   int channels = 0;
  @@ -898,6 +898,11 @@ static int read_sm_data(AVFormatContext *s, 
  AVIOContext *bc, AVPacket *pkt, int
   int height = 0;
   int i, ret;
   
  +if (avio_tell(bc) = maxpos)
  +return AVERROR_INVALIDDATA;
  +
  +count = ffio_read_varlen(bc);
  
  ffio_read_varlen() could move the position beyond maxpos yet return
  0 so the loop with teh checks inside is skiped
 
 That is exactly the problem, because then sm_size can be larger than size.
 An alternative would be to directly check for that, like in attached patch.

wouldnt checking after the loop im read_sm_data() before returning
success be more robust ?
It would exit sooner if the problem occurs in the first call
and avoid potential integer overflows

but iam fine with any solution that works

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- 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 01/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [1/4]

2015-06-26 Thread Michael Niedermayer
On Fri, Jun 12, 2015 at 08:15:51AM +, Nedeljko Babic wrote:
 On Thu, Jun 11, 2015 at 4:08 PM, Nedeljko Babic
 nedeljko.ba...@imgtec.com wrote:
  From: Jovan Zelincevic jovan.zelince...@imgtec.com
 
  Move existing code to the new template files
 
 
 Please setup your Git to track renames (add -M parameter), this is
 really hard to review in this form.
 
 This patch is just moving parts of the code that can be used in both float and
 in fixed aac in appropriate template files.
 
 It does not do renames (or anything else for that matter).
 
 For example, the parts of code are moved from aacdec.c to new 
 aacdec_template.c,
 but original file is still present with what was left of the code.
 
 Adding -M will not change anything in the patch.
 
 I tried from -M20% to -M75% just to be sure.

this needs -C
like in

git format-patch  -1 -C -C -C #P


 libavcodec/aacdec.c| 3132 +---
 libavcodec/{aacdec.c = aacdec_template.c} |  543 
 libavcodec/cbrt_tablegen.c |   16 -
 .../{cbrt_tablegen.c = cbrt_tablegen_template.c}  |0
 libavcodec/sinewin_tablegen.c  |   25 -
 ...ewin_tablegen.c = sinewin_tablegen_template.c} |0
 6 files changed, 57 insertions(+), 3659 deletions(-)
 copy libavcodec/{aacdec.c = aacdec_template.c} (87%)
 copy libavcodec/{cbrt_tablegen.c = cbrt_tablegen_template.c} (100%)
 copy libavcodec/{sinewin_tablegen.c = sinewin_tablegen_template.c} (100%)


[...]
-- 
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 04/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [4/4]

2015-06-26 Thread Cary Tetrick
Are there any patches supporting Intel QSV encoding that will work with
recent versions of ffmpeg on Windows?
Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Check for x265_api_get

2015-06-26 Thread James Almer
On 26/06/15 10:23 AM, Derek Buitenhuis wrote:
 Any other x265 symbol may not exported, e.g. if the build is a
 multilib (10-bit and 8-bit in one) build.
 
 This is the only symbol we directly call, and is available in the
 build number we check for.
 
 Fixes the configure check on multilib x265 builds.

Make sure to backport this to the 2.7 branch as well, then.

 
 Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
 ---
  configure | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/configure b/configure
 index 27522fe..3765376 100755
 --- a/configure
 +++ b/configure
 @@ -5192,7 +5192,7 @@ enabled libx264{ use_pkg_config x264 
 stdint.h x264.h x264_encode
   warn using libx264 without pkg-config; } 
 } 
   { check_cpp_condition x264.h X264_BUILD = 
 118 ||
 die ERROR: libx264 must be installed and 
 version must be = 0.118.; }
 -enabled libx265require_pkg_config x265 x265.h 
 x265_encoder_encode 
 +enabled libx265require_pkg_config x265 x265.h x265_api_get 
   { check_cpp_condition x265.h X265_BUILD = 57 
 ||
 die ERROR: libx265 version must be = 57.; }
  enabled libxavsrequire libxavs xavs.h xavs_encoder_encode 
 -lxavs
 

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


Re: [FFmpeg-devel] [PATCH] configure: Check for x265_api_get

2015-06-26 Thread Steve Borho
On 06/26, Derek Buitenhuis wrote:
 Any other x265 symbol may not exported, e.g. if the build is a
 multilib (10-bit and 8-bit in one) build.
 
 This is the only symbol we directly call, and is available in the
 build number we check for.
 
 Fixes the configure check on multilib x265 builds.

LGTM

 Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
 ---
  configure | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/configure b/configure
 index 27522fe..3765376 100755
 --- a/configure
 +++ b/configure
 @@ -5192,7 +5192,7 @@ enabled libx264{ use_pkg_config x264 
 stdint.h x264.h x264_encode
   warn using libx264 without pkg-config; } 
 } 
   { check_cpp_condition x264.h X264_BUILD = 
 118 ||
 die ERROR: libx264 must be installed and 
 version must be = 0.118.; }
 -enabled libx265require_pkg_config x265 x265.h 
 x265_encoder_encode 
 +enabled libx265require_pkg_config x265 x265.h x265_api_get 
   { check_cpp_condition x265.h X265_BUILD = 57 
 ||
 die ERROR: libx265 version must be = 57.; }
  enabled libxavsrequire libxavs xavs.h xavs_encoder_encode 
 -lxavs
 -- 
 1.8.3.1
 

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


[FFmpeg-devel] [PATCH] Fixes the bug of comparing zero bytes. Also new check for linesize is added.

2015-06-26 Thread Ludmila Glinskih
---
 libavcodec/api-flac-test.c | 22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/libavcodec/api-flac-test.c b/libavcodec/api-flac-test.c
index 402d4df..4cd0db7 100644
--- a/libavcodec/api-flac-test.c
+++ b/libavcodec/api-flac-test.c
@@ -112,10 +112,10 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 AVFrame *in_frame, *out_frame;
 uint8_t *raw_in = NULL, *raw_out = NULL;
 int in_offset = 0, out_offset = 0;
-int frame_data_size = 0;
 int result = 0;
 int got_output = 0;
 int i = 0;
+int in_frame_bytes, out_frame_bytes;
 
 in_frame = av_frame_alloc();
 if (!in_frame) {
@@ -156,8 +156,13 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 
 generate_raw_frame((uint16_t*)(in_frame-data[0]), i, 
enc_ctx-sample_rate,
enc_ctx-channels, enc_ctx-frame_size);
-memcpy(raw_in + in_offset, in_frame-data[0], in_frame-linesize[0]);
-in_offset += in_frame-linesize[0];
+in_frame_bytes = in_frame-nb_samples * in_frame-channels * 
sizeof(uint16_t);
+if (in_frame_bytes != in_frame-linesize[0]) {
+av_log(NULL, AV_LOG_ERROR, Incorrect value of input frame 
linesize\n);
+return 1;
+}
+memcpy(raw_in + in_offset, in_frame-data[0], in_frame_bytes);
+in_offset += in_frame_bytes;
 result = avcodec_encode_audio2(enc_ctx, enc_pkt, in_frame, 
got_output);
 if (result  0) {
 av_log(NULL, AV_LOG_ERROR, Error encoding audio frame\n);
@@ -192,14 +197,19 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 av_log(NULL, AV_LOG_ERROR, Error frames before and after 
decoding has different sample format\n);
 return AVERROR_UNKNOWN;
 }
-memcpy(raw_out + out_offset, out_frame-data[0], 
out_frame-linesize[0]);
-out_offset += out_frame-linesize[0];
+out_frame_bytes = out_frame-nb_samples * out_frame-channels 
* sizeof(uint16_t);
+if (out_frame_bytes  out_frame-linesize[0]) {
+av_log(NULL, AV_LOG_ERROR, Incorrect value of output 
frame linesize\n);
+return 1;
+}
+memcpy(raw_out + out_offset, out_frame-data[0], 
out_frame_bytes);
+out_offset += out_frame_bytes;
 }
 }
 av_free_packet(enc_pkt);
 }
 
-if (memcmp(raw_in, raw_out, frame_data_size * NUMBER_OF_FRAMES) != 0) {
+if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_FRAMES) != 0) {
 av_log(NULL, AV_LOG_ERROR, Output differs\n);
 return 1;
 }
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 2/3] electronicarts: demux alpha stream

2015-06-26 Thread Peter Ross
On Fri, Jun 26, 2015 at 05:47:16PM +, Carl Eugen Hoyos wrote:
 Peter Ross pross at xvid.org writes:
 
  Electronic Arts VP6 files may contain two video 
  streams: one for the primary video stream and 
  another for the alpha mask. The file format
  uses identical data structures for both streams.
 
 Is there a command line that allows to output 
 the (intended) opaque ring in transparent 
 background?
 
 Thank you, Carl Eugen

ffmpeg -i SmallRing.vp6 -filter_complex '[0:0][0:1] alphamerge' out%d.png

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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


[FFmpeg-devel] [PATCH] avutil/intmath: use bzhi gcc builtin in av_mod_uintp2()

2015-06-26 Thread James Almer
Signed-off-by: James Almer jamr...@gmail.com
---
Now making sure it's not used with ICC.

 libavutil/x86/intmath.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index c42fa83..8127e10 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -39,6 +39,12 @@
 
 #if defined(__BMI2__)
 
+#if AV_GCC_VERSION_AT_LEAST(5,1)  !defined(__INTEL_COMPILER)
+#define av_mod_uintp2 __builtin_ia32_bzhi_si
+#else
+/* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
+ * implement it using inline assembly
+ */
 #define av_mod_uintp2 av_mod_uintp2_bmi2
 static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, 
unsigned p)
 {
@@ -50,6 +56,7 @@ static av_always_inline av_const unsigned 
av_mod_uintp2_bmi2(unsigned a, unsigne
 return x;
 }
 }
+#endif /* AV_GCC_VERSION_AT_LEAST */
 
 #endif /* __BMI2__ */
 
-- 
2.4.4

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


[FFmpeg-devel] Intel QSV encoder

2015-06-26 Thread Cary Tetrick
Sorry, sent with wrong subject.

Are there any patches supporting Intel QSV encoding that will work with
recent versions of ffmpeg on Windows?
Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel