Re: [FFmpeg-devel] [PATCH]Autodetect dds frames

2015-06-30 Thread Carl Eugen Hoyos
Michael Niedermayer  gmx.at> writes:

> >  Makefile |1 +
> >  allformats.c |1 +
> >  img2dec.c|   12 
> >  3 files changed, 14 insertions(+)
> > 694e8baeb11c153fd9b814eb22dabf5ad0c16c09  patchdds.diff
> 
> LGTM

The patch was merged.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH]lavf/img2: Only autodetect valid Quickdraw images

2015-06-30 Thread Carl Eugen Hoyos
On Tuesday 19 May 2015 06:15:49 pm Michael Niedermayer wrote:
> >  return AVPROBE_SCORE_EXTENSION + 1;
>
> i think this should be higher with that change
>
> also i think a somewhat lower score could still be output 
> for less valid but still decodeable files

The patch was merged with these changes.

Thank you, Carl Eugen
___
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-30 Thread Nedeljko Babic
>>
>> Cause for these warnings is similar as for the first ones: needed
>> definitions are added in later patches (that make changes in sbr module).
>> When all the patches are applied there are no warnings here.
>
>if it breaks nothing then temporary warnings are probably ok.
>Some people might argue about that though ...
>
>its probably a good idea to amend the commit message to explain the
>cause and future disappearance of the warnings

Ok. I'll change commit message for this patch in new patch set.

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


Re: [FFmpeg-devel] GSoC update

2015-06-30 Thread Stephan Holljes
Hi,

On Sun, Jun 28, 2015 at 10:06 PM, Nicolas George  wrote:
> Le decadi 10 messidor, an CCXXIII, Stephan Holljes a écrit :
>> Hi,
>> attached patches are the current state of work.
>> It's probably still a bit rough around the edges, but I think I made
>> some progress.
>> The sample code in doc/examples does not write any data as of yet, but
>> the HTTP handshake works.
>
> A few quick remarks, without entering into the fine details since the patch
> series will likely evolve still quite a bit.
>
>> From b43aeaa27f6ca7df476aa194b2f78aa1b49516d0 Mon Sep 17 00:00:00 2001
>> From: Stephan Holljes 
>> Date: Sun, 28 Jun 2015 06:06:16 +0200
>> Subject: [PATCH 01/10] lavf/network: split ff_listen_bind into ff_listen and
>>  ff_accept
>>
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/network.c | 27 +--
>>  libavformat/network.h |  4 
>>  2 files changed, 25 insertions(+), 6 deletions(-)
>
> This one looks good to me, except a small doxy would be nice for the two new
> functions.
>
>> From 39faa1ea315bb51452446e291fd5d93d7eb3a988 Mon Sep 17 00:00:00 2001
>> From: Stephan Holljes 
>> Date: Sun, 28 Jun 2015 06:12:37 +0200
>> Subject: [PATCH 02/10] lavf/avio: add ffurl_accept and ffurl_handshake
>>
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/avio.c | 15 +++
>>  libavformat/url.h  | 12 
>>  2 files changed, 27 insertions(+)
>
> ffurl_accept() requires two arguments, but I suspect ffurl_handshake() only
> requires one, the client. A doxy would be nice for ffurl_handshake().
>
> Also, the client argument of ffurl_accept() and url_accept() should probably
> a pointer to pointer, like ffurl_alloc(), so that it can allocate the
> context itself.

Fixed here and in all instances. This took me a lot longer than I want to admit.

>
>> From 8b473ba9acffecf98f8252eeccb413bcfbbf38c5 Mon Sep 17 00:00:00 2001
>> From: Stephan Holljes 
>> Date: Sun, 28 Jun 2015 06:13:36 +0200
>> Subject: [PATCH 03/10] lavf/avio: add avio_accept and avio_handshake
>>
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/avio.h|  2 ++
>>  libavformat/aviobuf.c | 21 +
>>  2 files changed, 23 insertions(+)
>
> That part looks mostly good.
>
>> From 8ba3d1ef528cdd9209764b0f696b8df81ea46870 Mon Sep 17 00:00:00 2001
>> From: Stephan Holljes 
>> Date: Sun, 28 Jun 2015 06:16:02 +0200
>> Subject: [PATCH 04/10] lavf/http: add http_accept and http_handshake
>>
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/http.c | 38 ++
>>  1 file changed, 38 insertions(+)
>
> I believe this patch can not come before the one for TCP.
>
>>
>> diff --git a/libavformat/http.c b/libavformat/http.c
>> index 676bfd5..7219f08 100644
>> --- a/libavformat/http.c
>> +++ b/libavformat/http.c
>> @@ -382,6 +382,38 @@ static int http_open(URLContext *h, const char *uri, 
>> int flags,
>>  return ret;
>>  }
>>
>> +static int http_accept(URLContext *s, URLContext *c)
>> +{
>> +int ret;
>> +HTTPContext *sh = s->priv_data;
>> +HTTPContext *ch = c->priv_data;
>> +URLContext *sl = sh->hd;
>> +URLContext *cl;
>
>> +if ((ret = ffurl_alloc(&cl, sl->filename, AVIO_FLAG_READ_WRITE, 
>> &sl->interrupt_callback)) < 0)
>> +goto fail;
>> +if ((ret = ffurl_accept(sl, cl)) < 0)
>> +goto fail;
>> +ch->hd = cl;
>> +fail:
>> +return ret;
>> +}
>
> This looks mostly correct, but I suspect it would be more convenient to make
> url_accept() responsible for allocating the client context. Otherwise, the
> application is responsible for allocating a client context with the correct
> protocol and settings, this is fragile.
>
>> +
>> +static int http_handshake(URLContext *s, URLContext *c) {
>> +int ret, err, new_location;
>> +HTTPContext *sh = s->priv_data;
>> +HTTPContext *ch = c->priv_data;
>> +URLContext *sl = sh->hd;
>> +URLContext *cl = ch->hd;
>> +static const char header[] = "HTTP/1.1 200 OK\r\nContent-Type: 
>> application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n";
>> +if ((err = http_read_header(c, &new_location)) < 0)
>> +goto fail;
>> +if ((ret = ffurl_write(cl, header, strlen(header))) < 0)
>> +goto fail;
>> +fail:
>> +handle_http_errors(c, err);
>> +return ret;
>> +}
>
> As you can see, the s argument is never used.
>
> Also, it should probably call ffurl_handshake() on the underlying socket:
> for TCP it is a nop, but for TLS, for example, it is blocking.
>
>> +
>>  static int http_getc(HTTPContext *s)
>>  {
>>  int len;
>> @@ -1346,6 +1378,8 @@ HTTP_CLASS(http);
>>  URLProtocol ff_http_protocol = {
>>  .name= "http",
>>  .url_open2   = http_open,
>> +.url_accept  = http_accept,
>> +.url_handshake   = http_handshake,
>>  .url_read= http_read,
>>  .url_write   = http_write,
>>  .url_seek= http_seek,
>> @@ -1364,6 +1398,8 @@ HTTP_CLASS

Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Nicolas Derouineau
Hello, 
Thanks for your comments. Here's an updated version of the patch.
Did you have any troubles opening the bitstreams ?

BR,



Nicolas DEROUINEAU
Research Engineer
VITEC

T.  +33 1 46 73 06 06
E.  nicolas.derouin...@vitec.com
W. www.vitec.com


De : Michael Niedermayer 
Envoyé : lundi 29 juin 2015 15:49
À : FFmpeg development discussions and patches; Nicolas Derouineau
Cc : Nicolas Tizon; Erwan Raffin; Didier Nicholson; Yahia Benmoussa
Objet : Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

Hi

On Mon, Jun 29, 2015 at 01:01:48PM +, Nicolas Derouineau wrote:
> Two patches are now here enclosed:
>
> The first one enable metadata parsing. The second one add a new options in 
> the file avcodec/options_table.h
>
> Tested with:
>
> ./ffplay -debug green_metadata ~/GreenMetaDataSEI.264

Where can we find the sample file ?


>
> Best Regards,
>
> Nicolas DEROUINEAU
> Research Engineer
> VITEC
>
> T.  +33 1 46 73 06 06
> E.  nicolas.derouin...@vitec.com
> W. www.vitec.com
>
> 
> De : ffmpeg-devel-boun...@ffmpeg.org  de la 
> part de Nicolas Derouineau 
> Envoyé : lundi 29 juin 2015 14:20
> À : FFmpeg development discussions and patches
> Objet : Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata
>
> Hello,
> Thank you for your comments.
>
> Please find enclosed the updated patch.
>
> I have tested it with the following cmdline:
>
> ./ffplay -debug 1048576 ~/GreenMetaDataSEI.264
>
> I know that this debug flag should be define somewhere as a string in order 
> to display it with:
>
> ./ffplay --help
>
> Could someone point me to the correct location to do this ?
>
> Ps: Reference Bitstreams are still available here: 
> ftp-public-greenvideo.insa-rennes.fr
>
> Ps 2: This message may look like a duplicate, but I have been experiencing 
> issues to subscribe to the mailing list.
>
>
>
> Best regards,
> Nicolas DEROUINEAU
> Research Engineer
> VITEC
>
> T.  +33 1 46 73 06 06
> E.  nicolas.derouin...@vitec.com
> W. www.vitec.com
>
> 
> De : Vittorio Giovara 
> Envoyé : vendredi 26 juin 2015 02:56
> À : FFmpeg development discussions and patches
> Cc : Nicolas Derouineau; Yahia Benmoussa; Erwan Raffin; michae...@gmx.at; 
> Didier Nicholson; Nicolas Tizon
> Objet : Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata
>
> On Thu, Jun 25, 2015 at 5:30 PM, Michael Niedermayer
>  wrote:
> > On Thu, Jun 25, 2015 at 11:13:53AM +, Nicolas Derouineau wrote:
> >> Hello,
> >> Please find here enclosed a patch enabling h264 Green Metada SEI parsing 
> >> for FFMPEG. You'll be able to find reference bitstreams containing the 
> >> metadata at the following adress:
> >>
> >> ftp-public-greenvideo.insa-rennes.fr
> >>
> >>
> >> The Nal SEI syntax is the same as the one used in the last JM release 
> >> (19.0).
> >>
> >>
> >> Best Regards,
> >>
> >>
> >>
> >> Nicolas DEROUINEAU
> >> Research Engineer
> >> VITEC
> >>
> >> T.  +33 1 46 73 06 06
> >> E.  nicolas.derouin...@vitec.com
> >> W. www.vitec.com;
> >
> >>  h264.h |   20 ++
> >>  h264_sei.c |   67 
> >>+
> >>  2 files changed, 87 insertions(+)
> >> feb39a55dd6afbaf341df765eafc02266c00a588  
> >> 0002-Enabling-GreenMetadata-SEI-parsing-for-H264-decoder.patch
> >> From 60903bff6429182c84dc5daef0d26695d3f71861 Mon Sep 17 00:00:00 2001
> >> From: Nicolas DEROUINEAU 
> >> Date: Thu, 25 Jun 2015 13:02:39 +0200
> >> Subject: [PATCH 2/2] Enabling GreenMetadata SEI parsing for H264 decoder
> >>
> >> ---
> >>  libavcodec/h264.h | 20 +++
> >>  libavcodec/h264_sei.c | 67 
> >>+++
> >>  2 files changed, 87 insertions(+)
> >>
> >> diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> >> index 548510d..0324dc1 100644
> >> --- a/libavcodec/h264.h
> >> +++ b/libavcodec/h264.h
> >> @@ -137,6 +137,7 @@ typedef enum {
> >>  SEI_TYPE_RECOVERY_POINT = 6,   ///< recovery point (frame # 
> >>to decoder sync)
> >>  SEI_TYPE_FRAME_PACKING  = 45,  ///< frame packing arrangement
> >>  SEI_TYPE_DISPLAY_ORIENTATION= 47,  ///< display orientation
> >> +SEI_TYPE_GREEN_METADATA  = 56  ///< GreenMPEG information
> >>  } SEI_Type;
> >>
> >>  /**
> >> @@ -268,6 +269,22 @@ typedef struct FPA {
> >>  } FPA;
> >>
> >>  /**
> >> + * Green MetaData Information Type
> >> + */
> >> +typedef struct GreenMetaData {
> >> +unsigned char  green_metadata_type;
> >> +unsigned char  period_type;
> >> +unsigned short num_seconds;
> >> +unsigned short num_pictures;
>
> uint16_t and uint8_t would probably be more appropriate here
>
> >> +unsigned char percent_non_zero_macroblocks;
> >> +unsigned char percent_intra_coded_macroblocks;
> >> +unsigned char percent_six_tap_filtering;
> >> +unsigned char percent_alpha_poi

[FFmpeg-devel] [RFC]Add some docs for j2k encoding and remove experimental (instead of: Change the default j2k prediction to 5/3)

2015-06-30 Thread Carl Eugen Hoyos
Hi!

I just tested a patch to make the j2k encoder lossless by default 
but I had not realized that the encoder does listen to -qscale which 
might make more sense.

So instead I suggest the attached documentation update and the 
removal of the experimental flag.

Please comment, Carl Eugen
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index dcdf411..047dc13 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1132,7 +1132,6 @@ AVCodec ff_jpeg2000_encoder = {
 .init   = j2kenc_init,
 .encode2= encode_frame,
 .close  = j2kenc_destroy,
-.capabilities   = CODEC_CAP_EXPERIMENTAL,
 .pix_fmts   = (const enum AVPixelFormat[]) {
 AV_PIX_FMT_RGB24, AV_PIX_FMT_YUV444P, AV_PIX_FMT_GRAY8,
 /*  AV_PIX_FMT_YUV420P,
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 8fed2fc..851c3ae 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1342,6 +1342,21 @@ disabled
 A description of some of the currently available video encoders
 follows.
 
+@section jpeg2000
+
+The native jpeg 2000 encoder is lossy by default, the @code{-q:v}
+option can be used to set the encoding quality. Lossless encoding 
+can be selected with @code{-pred 1}.
+
+@subsection Options
+
+@table @option
+@item format
+Can be set to either @code{j2k} or @code{jp2} (the default) that
+allows to store non-rgb pix_fmts.
+
+@end table
+
 @section libtheora
 
 libtheora Theora encoder wrapper.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Carl Eugen Hoyos
On Tuesday 30 June 2015 11:38:03 am Nicolas Derouineau wrote:

> From f7cff28a44adada6761233d59207b4a9c0373960 Mon Sep 17 00:00:00 2001
> From: Nicolas DEROUINEAU 
> Date: Tue, 30 Jun 2015 10:59:07 +0200
> Subject: [PATCH] Patch to parse SEI GreenMetadata
>
> ---
>  doc/codecs.texi            |    2 ++
>  libavcodec/avcodec.h       |    1 +
>  libavcodec/h264.h          |   21 
>  libavcodec/h264_sei.c      |   59
>  libavcodec/options_table.h |  
>  1 +
>  5 files changed, 84 insertions(+)
>
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 3c035a5..5b3ec9b 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -475,6 +475,8 @@ per-block quantization parameter (QP)
>  motion vector
>  @item dct_coeff
>  
> +@item green_metadata
> +

Shouldn't there be some explanation?

>  @item skip
>  
>  @item startcode
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index ddbf0a3..65c9053 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
>  #define FF_DEBUG_ER          0x0400
>  #define FF_DEBUG_MMCO        0x0800
>  #define FF_DEBUG_BUGS        0x1000
> +#define FF_DEBUG_GREEN_MD    0x1200

I believe this has to come at the end of the list with value 0x2.

[...]

> +        if ( h->sei_green_metadata.green_metadata_type == 2){

Please make this "if (h->sei.. == 2) {" to match the coding style around.

Your av_logs could use a linebreak after the string.

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


[FFmpeg-devel] Implementation of fixed point AAC decoder

2015-06-30 Thread Nedeljko Babic
In this patch set patches are formed using -C option of git format-patch in 
order for the patches to be more readable.

Commit message for one of the patches is changed so some warnings are explained.

Patchset rebased to the newest code base.

Please take a look.

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


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

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Build system modified

There are several warnings occurring during build after this patch is
applied. The cause of most of these warnings is in that some definitions
needed here are logical part of sbr module and are added in later patches.
When this patches are applied these warnings stop occurring.

The only warning that is added here and is not fixed with later patches
is warning that warns that type mismatch for table ff_aac_eld_window_480.

The reason for this warning is in that ER AAC ELD 480 is not integrated in
to the fixed point implementation at this moment and there is no fixed point
version of this table.

Signed-off-by: Nedeljko Babic 
---
 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(-)

diff --git a/configure b/configure
index 6c1c290..56ac6aa 100755
--- a/configure
+++ b/configure
@@ -2124,6 +2124,7 @@ qsvenc_select="qsv"
 
 # decoders / encoders
 aac_decoder_select="imdct15 mdct sinewin"
+aac_fixed_decoder_select="mdct sinewin"
 aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
 aac_latm_decoder_select="aac_decoder aac_latm_parser"
 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index bcb9217..5cd06e7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -102,7 +102,7 @@ OBJS-$(CONFIG_RANGECODER)  += rangecoder.o
 RDFT-OBJS-$(CONFIG_HARDCODED_TABLES)   += sin_tables.o
 OBJS-$(CONFIG_RDFT)+= rdft.o $(RDFT-OBJS-yes)
 OBJS-$(CONFIG_SHARED)  += log2_tab.o
-OBJS-$(CONFIG_SINEWIN) += sinewin.o
+OBJS-$(CONFIG_SINEWIN) += sinewin.o sinewin_fixed.o
 OBJS-$(CONFIG_SNAPPY)  += snappy.o
 OBJS-$(CONFIG_STARTCODE)   += startcode.o
 OBJS-$(CONFIG_TEXTUREDSP)  += texturedsp.o
@@ -119,6 +119,8 @@ OBJS-$(CONFIG_A64MULTI5_ENCODER)   += a64multienc.o 
elbg.o
 OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
   sbrdsp.o aacpsdsp.o
+OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o \
+  aacadtsdec.o mpeg4audio.o kbdwin.o
 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o\
   aacpsy.o aactab.o  \
   psymodel.o mpeg4audio.o kbdwin.o
@@ -922,6 +924,7 @@ HOSTPROGS = aac_tablegen
\
 aacsbr_tablegen \
 cabac_tablegen  \
 cbrt_tablegen   \
+cbrt_fixed_tablegen \
 cos_tablegen\
 dsd_tablegen\
 dv_tablegen \
@@ -930,6 +933,7 @@ HOSTPROGS = aac_tablegen
\
 pcm_tablegen\
 qdm2_tablegen   \
 sinewin_tablegen\
+sinewin_fixed_tablegen  \
 
 CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
 
@@ -948,8 +952,8 @@ else
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
-GEN_HEADERS = cabac_tables.h cbrt_tables.h aacps_tables.h aacsbr_tables.h 
aac_tables.h dsd_tables.h dv_tables.h \
-  sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \
+GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h aac_tables.h dsd_tables.h dv_tables.h \
+  sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
motionpixels_tables.h \
   pcm_tables.h qdm2_tables.h
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
 
@@ -958,13 +962,16 @@ $(GEN_HEADERS): $(SUBDIR)%_tables.h: 
$(SUBDIR)%_tablegen$(HOSTEXESUF)
 
 ifdef CONFIG_HARDCODED_TABLES
 $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
+$(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
 $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
+$(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
 $(SUBDIR)cabac.o: $(SUBDIR)cabac_tables.h
 $(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h
 $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h
 $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
+$(SUBDIR)sinewi

[FFmpeg-devel] [PATCH 06/12] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [2/3]

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Create tables for fixed point code.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/Makefile|   5 +-
 .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} |   7 +-
 .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} |  21 +-
 libavcodec/aacsbr_tablegen.c   |   1 +
 libavcodec/aacsbr_tablegen.h   | 101 +---
 libavcodec/aacsbr_tablegen_common.h| 129 +
 libavcodec/aacsbrdata.h| 522 ++---
 7 files changed, 408 insertions(+), 378 deletions(-)
 copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} (84%)
 copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} (71%)
 create mode 100644 libavcodec/aacsbr_tablegen_common.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5cd06e7..642da3d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -922,6 +922,7 @@ TOOLS = fourcc2pixfmt
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
 aacsbr_tablegen \
+aacsbr_fixed_tablegen   \
 cabac_tablegen  \
 cbrt_tablegen   \
 cbrt_fixed_tablegen \
@@ -952,7 +953,8 @@ else
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
-GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h aac_tables.h dsd_tables.h dv_tables.h \
+GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h \
+  aacsbr_fixed_tables.h aac_tables.h dsd_tables.h dv_tables.h \
   sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
motionpixels_tables.h \
   pcm_tables.h qdm2_tables.h
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
@@ -965,6 +967,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
 $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
 $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
+$(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
 $(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
 $(SUBDIR)cabac.o: $(SUBDIR)cabac_tables.h
diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.c
similarity index 84%
copy from libavcodec/aacsbr_tablegen.c
copy to libavcodec/aacsbr_fixed_tablegen.c
index c3c0f0c..7117dbd 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_fixed_tablegen.c
@@ -22,8 +22,9 @@
 
 #include 
 #define CONFIG_HARDCODED_TABLES 0
+#define USE_FIXED 1
 #include "libavutil/common.h"
-#include "aacsbr_tablegen.h"
+#include "aacsbr_fixed_tablegen.h"
 #include "tableprint.h"
 
 int main(void)
@@ -32,8 +33,8 @@ int main(void)
 
 write_fileheader();
 
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_ds);
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_us);
+WRITE_ARRAY_ALIGNED("static const", 32, int32_t, sbr_qmf_window_ds);
+WRITE_ARRAY_ALIGNED("static const", 32, int32_t, sbr_qmf_window_us);
 
 return 0;
 }
diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.h
similarity index 71%
copy from libavcodec/aacsbr_tablegen.c
copy to libavcodec/aacsbr_fixed_tablegen.h
index c3c0f0c..1439ebe 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_fixed_tablegen.h
@@ -20,20 +20,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
-#define CONFIG_HARDCODED_TABLES 0
-#include "libavutil/common.h"
-#include "aacsbr_tablegen.h"
-#include "tableprint.h"
+#ifndef AVCODEC_AACSBR_FIXED_TABLEGEN_H
+#define AVCODEC_AACSBR_FIXED_TABLEGEN_H
 
-int main(void)
-{
-aacsbr_tableinit();
+#include "aacsbr_tablegen_common.h"
 
-write_fileheader();
+#if CONFIG_HARDCODED_TABLES
+#include "libavcodec/aacsbr_fixed_tables.h"
+#endif /* CONFIG_HARDCODED_TABLES */
 
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_ds);
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_us);
-
-return 0;
-}
+#endif /* AVCODEC_AACSBR_FIXED_TABLEGEN_H */
diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_tablegen.c
index c3c0f0c..4f58270 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_tablegen.c
@@ -22,6 +22,7 @@
 
 #include 
 #define CONFIG_HARDCODED_TABLES 0
+#define USE_FIXED 0
 #include "libavutil/common.h"
 #include "aacsbr_tablegen.h"
 #include "tableprint.h"
diff --git a/libavcodec/aacsbr_tablegen.h b/libavcodec/aacsbr_tablegen.h
index 56fdccc..d86eba7 100644
--- a/libavcodec/aacsbr_tablegen.h
+++ b/libavcodec/aacsbr_tablegen.h
@@ -23,107 +23,10 @@
 #ifndef

[FFmpeg-devel] [PATCH 05/12] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [1/3]

2015-06-30 Thread Nedeljko Babic
From: Djordje Pesut 

Move the existing code to a new template file.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aacsbr.c| 1419 +---
 libavcodec/aacsbr.h|   45 +
 libavcodec/{aacsbr.c => aacsbr_template.c} |  377 
 libavcodec/sbrdsp.c|   75 +-
 libavcodec/sbrdsp_template.c   |   95 ++
 5 files changed, 142 insertions(+), 1869 deletions(-)
 copy libavcodec/{aacsbr.c => aacsbr_template.c} (78%)
 create mode 100644 libavcodec/sbrdsp_template.c

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 7e98834..766c47b 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -42,252 +42,13 @@
 #include 
 #include 
 
-#define ENVELOPE_ADJUSTMENT_OFFSET 2
-#define NOISE_FLOOR_OFFSET 6.0f
-
 #if ARCH_MIPS
 #include "mips/aacsbr_mips.h"
 #endif /* ARCH_MIPS */
 
-/**
- * SBR VLC tables
- */
-enum {
-T_HUFFMAN_ENV_1_5DB,
-F_HUFFMAN_ENV_1_5DB,
-T_HUFFMAN_ENV_BAL_1_5DB,
-F_HUFFMAN_ENV_BAL_1_5DB,
-T_HUFFMAN_ENV_3_0DB,
-F_HUFFMAN_ENV_3_0DB,
-T_HUFFMAN_ENV_BAL_3_0DB,
-F_HUFFMAN_ENV_BAL_3_0DB,
-T_HUFFMAN_NOISE_3_0DB,
-T_HUFFMAN_NOISE_BAL_3_0DB,
-};
-
-/**
- * bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98)
- */
-enum {
-FIXFIX,
-FIXVAR,
-VARFIX,
-VARVAR,
-};
-
-enum {
-EXTENSION_ID_PS = 2,
-};
-
 static VLC vlc_sbr[10];
-static const int8_t vlc_sbr_lav[10] =
-{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-
-#define SBR_INIT_VLC_STATIC(num, size) \
-INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / 
sbr_tmp[num].elem_size, \
-sbr_tmp[num].sbr_bits ,  1,
  1, \
-sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, 
sbr_tmp[num].elem_size, \
-size)
-
-#define SBR_VLC_ROW(name) \
-{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## 
_codes[0]) }
-
 static void aacsbr_func_ptr_init(AACSBRContext *c);
 
-av_cold void ff_aac_sbr_init(void)
-{
-static const struct {
-const void *sbr_codes, *sbr_bits;
-const unsigned int table_size, elem_size;
-} sbr_tmp[] = {
-SBR_VLC_ROW(t_huffman_env_1_5dB),
-SBR_VLC_ROW(f_huffman_env_1_5dB),
-SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
-SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
-SBR_VLC_ROW(t_huffman_env_3_0dB),
-SBR_VLC_ROW(f_huffman_env_3_0dB),
-SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
-SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
-SBR_VLC_ROW(t_huffman_noise_3_0dB),
-SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
-};
-
-// SBR VLC table initialization
-SBR_INIT_VLC_STATIC(0, 1098);
-SBR_INIT_VLC_STATIC(1, 1092);
-SBR_INIT_VLC_STATIC(2, 768);
-SBR_INIT_VLC_STATIC(3, 1026);
-SBR_INIT_VLC_STATIC(4, 1058);
-SBR_INIT_VLC_STATIC(5, 1052);
-SBR_INIT_VLC_STATIC(6, 544);
-SBR_INIT_VLC_STATIC(7, 544);
-SBR_INIT_VLC_STATIC(8, 592);
-SBR_INIT_VLC_STATIC(9, 512);
-
-aacsbr_tableinit();
-
-ff_ps_init();
-}
-
-/** Places SBR in pure upsampling mode. */
-static void sbr_turnoff(SpectralBandReplication *sbr) {
-sbr->start = 0;
-// Init defults used in pure upsampling mode
-sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
-sbr->m[1] = 0;
-// Reset values for first SBR header
-sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
-memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
-}
-
-av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
-{
-if(sbr->mdct.mdct_bits)
-return;
-sbr->kx[0] = sbr->kx[1];
-sbr_turnoff(sbr);
-sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE 
- (1280 - 128);
-sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE 
- (1280 - 128);
-/* SBR requires samples to be scaled to +/-32768.0 to work correctly.
- * mdct scale factors are adjusted to scale up from +/-1.0 at analysis
- * and scale back down at synthesis. */
-ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * 32768.0));
-ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * 32768.0);
-ff_ps_ctx_init(&sbr->ps);
-ff_sbrdsp_init(&sbr->dsp);
-aacsbr_func_ptr_init(&sbr->c);
-}
-
-av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
-{
-ff_mdct_end(&sbr->mdct);
-ff_mdct_end(&sbr->mdct_ana);
-}
-
-static int qsort_comparison_function_int16(const void *a, const void *b)
-{
-return *(const int16_t *)a - *(const int16_t *)b;
-}
-
-static inline int in_table_int16(const int16_t *table, int last_el, int16_t 
needle)
-{
-int i;
-for (i = 0; i <= last_el; i++)
-if (table[i] == needle)
-return 1;
-return 0;
-}
-
-/// Limiter Frequency Band Table (14496-3 sp04 p198)
-static void sbr_make_f_tablelim(SpectralBandReplication *sbr)
-{
-int k;
-if (sbr->bs_limiter_bands >

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

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Add fixed point implementation of functions for generating tables

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aac.h   |  23 +
 libavcodec/aacdectab.h |  34 +-
 libavcodec/aactab.c| 486 +
 libavcodec/aactab.h|   4 +
 .../{cbrt_tablegen.c => cbrt_fixed_tablegen.c} |   3 +
 libavcodec/cbrt_tablegen.c |   3 +
 libavcodec/cbrt_tablegen.h |  17 +-
 libavcodec/cbrt_tablegen_template.c|   2 +-
 libavcodec/sinewin.c   |   1 +
 libavcodec/sinewin.h   |  20 +-
 libavcodec/{sinewin.c => sinewin_fixed.c}  |   1 +
 ...sinewin_tablegen.c => sinewin_fixed_tablegen.c} |   3 +
 libavcodec/sinewin_tablegen.c  |   3 +
 libavcodec/sinewin_tablegen.h  |  31 +-
 libavcodec/sinewin_tablegen_template.c |  20 +-
 libavcodec/tableprint.h|   2 +
 16 files changed, 618 insertions(+), 35 deletions(-)
 copy libavcodec/{cbrt_tablegen.c => cbrt_fixed_tablegen.c} (94%)
 copy libavcodec/{sinewin.c => sinewin_fixed.c} (97%)
 copy libavcodec/{sinewin_tablegen.c => sinewin_fixed_tablegen.c} (93%)

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 75494d2..04553e7 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -30,6 +30,29 @@
 #ifndef AVCODEC_AAC_H
 #define AVCODEC_AAC_H
 
+#ifndef USE_FIXED
+#define USE_FIXED 0
+#endif
+
+#if USE_FIXED
+
+#include "libavutil/softfloat.h"
+
+#define FFT_FLOAT0
+#define FFT_FIXED_32 1
+
+#define Q30(x)  (int)((x)*1073741824.0 + 0.5)
+#define Q31(x)  (int)((x)*2147483648.0 + 0.5)
+
+#else
+
+#define FFT_FLOAT1
+#define FFT_FIXED_32 0
+
+#define Q30(x)  x
+#define Q31(x)  x
+#endif /* USE_FIXED */
+
 #include "libavutil/float_dsp.h"
 #include "avcodec.h"
 #include "imdct15.h"
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index 3e70e06..62c7f87 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -38,9 +38,9 @@
 /* @name ltp_coef
  * Table of the LTP coefficients
  */
-static const float ltp_coef[8] = {
-0.570829, 0.696616, 0.813004, 0.911304,
-0.984900, 1.067894, 1.194601, 1.369533,
+static const INTFLOAT ltp_coef[8] = {
+Q30(0.570829f), Q30(0.696616f), Q30(0.813004f), Q30(0.911304f),
+Q30(0.984900f), Q30(1.067894f), Q30(1.194601f), Q30(1.369533f),
 };
 
 /* @name tns_tmp2_map
@@ -49,28 +49,28 @@ static const float ltp_coef[8] = {
  * respectively.
  * @{
  */
-static const float tns_tmp2_map_1_3[4] = {
- 0., -0.43388373,  0.64278758,  0.34202015,
+static const INTFLOAT tns_tmp2_map_1_3[4] = {
+ Q31(0.f), Q31(-0.43388373f),  Q31(0.64278758f),  Q31(0.34202015f),
 };
 
-static const float tns_tmp2_map_0_3[8] = {
- 0., -0.43388373, -0.78183150, -0.97492790,
- 0.98480773,  0.86602539,  0.64278758,  0.34202015,
+static const INTFLOAT tns_tmp2_map_0_3[8] = {
+ Q31(0.f), Q31(-0.43388373f), Q31(-0.78183150f), Q31(-0.97492790f),
+ Q31(0.98480773f), Q31( 0.86602539f), Q31( 0.64278758f), Q31( 0.34202015f),
 };
 
-static const float tns_tmp2_map_1_4[8] = {
- 0., -0.20791170, -0.40673664, -0.58778524,
- 0.67369562,  0.52643216,  0.36124167,  0.18374951,
+static const INTFLOAT tns_tmp2_map_1_4[8] = {
+ Q31(0.f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
+ Q31(0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
 };
 
-static const float tns_tmp2_map_0_4[16] = {
- 0., -0.20791170, -0.40673664, -0.58778524,
--0.74314481, -0.86602539, -0.95105654, -0.99452192,
- 0.99573416,  0.96182561,  0.89516330,  0.79801720,
- 0.67369562,  0.52643216,  0.36124167,  0.18374951,
+static const INTFLOAT tns_tmp2_map_0_4[16] = {
+Q31( 0.f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
+Q31(-0.74314481f), Q31(-0.86602539f), Q31(-0.95105654f), Q31(-0.99452192f),
+Q31( 0.99573416f), Q31( 0.96182561f), Q31( 0.89516330f), Q31( 0.79801720f),
+Q31( 0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
 };
 
-static const float * const tns_tmp2_map[4] = {
+static const INTFLOAT * const tns_tmp2_map[4] = {
 tns_tmp2_map_0_3,
 tns_tmp2_map_0_4,
 tns_tmp2_map_1_3,
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index 25f6de2..deb9d91 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -35,6 +35,8 @@
 
 DECLARE_ALIGNED(32, float,  ff_aac_kbd_long_1024)[1024];
 DECLARE_ALIGNED(32, float,  ff_aac_kbd_short_128)[128];
+DECLARE_ALIGNED(32, int,ff_aac_kbd_long_1024_fixed)[1024];
+DECLARE_ALIGNED(32, int,ff_aac_kbd_short_128_fixed)[128];
 
 const uint8_t ff_aac_num_swb_1024[] = {
 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40
@@ -1767,

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

2015-06-30 Thread Nedeljko Babic
From: Djordje Pesut 

Add fixed point implementation

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aac.h |  80 ++--
 libavcodec/aacdec.c  |   5 +
 libavcodec/aacdec_fixed.c| 444 +++
 libavcodec/aacdec_template.c | 421 
 libavcodec/mdct_template.c   |   5 +
 5 files changed, 809 insertions(+), 146 deletions(-)
 create mode 100644 libavcodec/aacdec_fixed.c

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 04553e7..f6fd446 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -41,21 +41,53 @@
 #define FFT_FLOAT0
 #define FFT_FIXED_32 1
 
+#define AAC_RENAME(x)   x ## _fixed
+#define AAC_RENAME_32(x)x ## _fixed_32
+#define AAC_FLOAT SoftFloat
+#define INTFLOAT int
+#define SHORTFLOAT int16_t
+#define AAC_SIGNE   int
+#define FIXR(a) ((int)((a) * 1 + 0.5))
+#define FIXR10(a)   ((int)((a) * 1024.0 + 0.5))
+#define Q23(a)  (int)((a) * 8388608.0 + 0.5)
 #define Q30(x)  (int)((x)*1073741824.0 + 0.5)
 #define Q31(x)  (int)((x)*2147483648.0 + 0.5)
+#define RANGE15(x)  x
+#define GET_GAIN(x, y)  (-(y) << (x)) + 1024
+#define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200) >> 26)
+#define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x2000) >> 30)
+#define AAC_MUL31(x, y) (int)(((int64_t)(x) * (y) + 0x4000) >> 31)
 
 #else
 
 #define FFT_FLOAT1
 #define FFT_FIXED_32 0
 
+#define AAC_RENAME(x)   x
+#define AAC_RENAME_32(x)x
+#define AAC_FLOAT float
+#define INTFLOAT float
+#define SHORTFLOAT float
+#define AAC_SIGNE   unsigned
+#define FIXR(x) ((float)(x))
+#define FIXR10(x)   ((float)(x))
+#define Q23(x)  x
 #define Q30(x)  x
 #define Q31(x)  x
+#define RANGE15(x)  (32768.0 * (x))
+#define GET_GAIN(x, y)  powf((x), -(y))
+#define AAC_MUL26(x, y) ((x) * (y))
+#define AAC_MUL30(x, y) ((x) * (y))
+#define AAC_MUL31(x, y) ((x) * (y))
+
 #endif /* USE_FIXED */
 
 #include "libavutil/float_dsp.h"
+#include "libavutil/fixed_dsp.h"
 #include "avcodec.h"
+#if !USE_FIXED
 #include "imdct15.h"
+#endif
 #include "fft.h"
 #include "mpeg4audio.h"
 #include "sbr.h"
@@ -149,12 +181,12 @@ typedef struct OutputConfiguration {
  * Predictor State
  */
 typedef struct PredictorState {
-float cor0;
-float cor1;
-float var0;
-float var1;
-float r0;
-float r1;
+AAC_FLOAT cor0;
+AAC_FLOAT cor1;
+AAC_FLOAT var0;
+AAC_FLOAT var1;
+AAC_FLOAT r0;
+AAC_FLOAT r1;
 } PredictorState;
 
 #define MAX_PREDICTORS 672
@@ -175,7 +207,7 @@ typedef struct PredictorState {
 typedef struct LongTermPrediction {
 int8_t present;
 int16_t lag;
-float coef;
+INTFLOAT coef;
 int8_t used[MAX_LTP_LONG_SFB];
 } LongTermPrediction;
 
@@ -209,7 +241,7 @@ typedef struct TemporalNoiseShaping {
 int length[8][4];
 int direction[8][4];
 int order[8][4];
-float coef[8][4][TNS_MAX_ORDER];
+INTFLOAT coef[8][4][TNS_MAX_ORDER];
 } TemporalNoiseShaping;
 
 /**
@@ -246,7 +278,7 @@ typedef struct ChannelCoupling {
 int ch_select[8];  /**< [0] shared list of gains; [1] list of gains 
for right channel;
 *   [2] list of gains for left channel; [3] lists 
of gains for both channels
 */
-float gain[16][120];
+INTFLOAT gain[16][120];
 } ChannelCoupling;
 
 /**
@@ -258,18 +290,18 @@ typedef struct SingleChannelElement {
 Pulse pulse;
 enum BandType band_type[128];   ///< band types
 int band_type_run_end[120]; ///< band type run end 
points
-float sf[120];  ///< scalefactors
+INTFLOAT sf[120];   ///< scalefactors
 int sf_idx[128];///< scalefactor indices 
(used by encoder)
 uint8_t zeroes[128];///< band is not coded 
(used by encoder)
 float  is_ener[128];///< Intensity stereo pos 
(used by encoder)
 float pns_ener[128];///< Noise energy values 
(used by encoder)
-DECLARE_ALIGNED(32, float,   pcoeffs)[1024];///< coefficients for 
IMDCT, pristine
-DECLARE_ALIGNED(32, float,   coeffs)[1024]; ///< coefficients for 
IMDCT, maybe processed
-DECLARE_ALIGNED(32, float,   saved)[1536];  ///< overlap
-DECLARE_ALIGNED(32, float,   ret_buf)[2048];///< PCM output buffer
-DECLARE_ALIGNED(16, float,   ltp_state)[3072];  ///< time signal for LTP
+DECLARE_ALIGNED(32, INTFLOAT, pcoeffs)[1024];   ///< coefficients for 
IMDCT, pristine
+DECLARE_ALIGNED(32, INTFLOAT, coeffs)[1024];///< coefficients for 
IMDCT, maybe processed
+DECLARE_ALIGNED(32, INTFLOAT, saved)[1536]; ///< overlap
+DECLARE_ALIGNED(32, INTFLOAT, ret_buf)[

[FFmpeg-devel] [PATCH 08/12] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [1/2]

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Add fixed point implementation of functions for generating tables.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aacps_fixed_tablegen.c|  24 +++
 libavcodec/aacps_fixed_tablegen.h| 402 +++
 libavcodec/aacps_tablegen.c  |  73 +--
 libavcodec/aacps_tablegen_template.c | 107 ++
 4 files changed, 535 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/aacps_fixed_tablegen.c
 create mode 100644 libavcodec/aacps_fixed_tablegen.h
 create mode 100644 libavcodec/aacps_tablegen_template.c

diff --git a/libavcodec/aacps_fixed_tablegen.c 
b/libavcodec/aacps_fixed_tablegen.c
new file mode 100644
index 000..9e30699
--- /dev/null
+++ b/libavcodec/aacps_fixed_tablegen.c
@@ -0,0 +1,24 @@
+/*
+ * Generate a header file for hardcoded Parametric Stereo tables
+ *
+ * Copyright (c) 2010 Alex Converse 
+ *
+ * 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
+ */
+
+#define USE_FIXED 1
+#include "aacps_tablegen_template.c"
diff --git a/libavcodec/aacps_fixed_tablegen.h 
b/libavcodec/aacps_fixed_tablegen.h
new file mode 100644
index 000..9474206
--- /dev/null
+++ b/libavcodec/aacps_fixed_tablegen.h
@@ -0,0 +1,402 @@
+/*
+ * Header file for hardcoded Parametric Stereo tables
+ *
+ * Copyright (c) 2010 Alex Converse 
+ *
+ * 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
+ *
+ * Note: Rounding-to-nearest used unless otherwise stated
+ *
+ */
+
+#ifndef AACPS_FIXED_TABLEGEN_H
+#define AACPS_FIXED_TABLEGEN_H
+
+#include 
+#include 
+
+#if CONFIG_HARDCODED_TABLES
+#define ps_tableinit()
+#define TABLE_CONST const
+#include "libavcodec/aacps_fixed_tables.h"
+#else
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
+
+#include "aac_defines.h"
+#include "libavutil/softfloat.h"
+#define NR_ALLPASS_BANDS20 30
+#define NR_ALLPASS_BANDS34 50
+#define PS_AP_LINKS 3
+#define TABLE_CONST
+static int pd_re_smooth[8*8*8];
+static int pd_im_smooth[8*8*8];
+static int HA[46][8][4];
+static int HB[46][8][4];
+static DECLARE_ALIGNED(16, int, f20_0_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, int, f34_0_12)[12][8][2];
+static DECLARE_ALIGNED(16, int, f34_1_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, int, f34_2_4) [ 4][8][2];
+static TABLE_CONST DECLARE_ALIGNED(16, int, Q_fract_allpass)[2][50][3][2];
+static DECLARE_ALIGNED(16, int, phi_fract)[2][50][2];
+
+static const int g0_Q8[] = {
+Q31(0.00746082949812f), Q31(0.02270420949825f), Q31(0.04546865930473f), 
Q31(0.07266113929591f),
+Q31(0.09885108575264f), Q31(0.11793710567217f), Q31(0.125f)
+};
+
+static const int g0_Q12[] = {
+Q31(0.04081179924692f), Q31(0.03812810994926f), Q31(0.05144908135699f), 
Q31(0.06399831151592f),
+Q31(0.07428313801106f), Q31(0.08100347892914f), Q31(0.08f)
+};
+
+static const int g1_Q8[] = {
+Q31(0.01565675600122f), Q31(0.03752716391991f), Q31(0.05417891378782f), 
Q31(0.08417044116767f),
+Q31(0.10307344158036f), Q31(0.1452249753f), Q31(0.125f)
+};
+
+static const int g2_Q4[] = {
+Q31(-0.05908211155639f), Q31(-0.04871498374946f), Q31(0.0f),   
Q31(0.07778723915851f),
+Q31( 0.16486303567403f), Q31( 0.23279856662996f), Q31(0.25f)
+};
+
+static const int sintbl_4[4]   = {   0,  1073741824,   0, 
-1073741824 };
+static const int costbl_4[4]   = {  1073741824,   0, -1073741824,  
 0 };
+static const int sintbl_8[8]   = {   0,   759250125,  1073741824,   
759250125,
+ 0,  -759250125, -1073741824,  

[FFmpeg-devel] [PATCH 11/12] tests: Add aac_fixed decoder test

2015-06-30 Thread Nedeljko Babic
Signed-off-by: Nedeljko Babic 
---
 tests/fate/aac.mak | 58 +-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 34823be..7ebec45 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -70,6 +70,61 @@ FATE_AAC += fate-aac-er_eld2100np_48_ep0
 fate-aac-er_eld2100np_48_ep0: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/er_eld2100np_48_ep0.mp4
 fate-aac-er_eld2100np_48_ep0: REF = $(SAMPLES)/aac/er_eld2100np_48.s16
 
+FATE_AAC_FIXED += fate-aac-fixed-al04_44
+fate-aac-fixed-al04_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al04_44.mp4
+fate-aac-fixed-al04_44: REF = $(SAMPLES)/aac/al04_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al05_44
+fate-aac-fixed-al05_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al05_44.mp4
+fate-aac-fixed-al05_44: REF = $(SAMPLES)/aac/al05_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al06_44
+fate-aac-fixed-al06_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al06_44.mp4
+fate-aac-fixed-al06_44: REF = $(SAMPLES)/aac/al06_44_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al15_44
+fate-aac-fixed-al15_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al15_44.mp4
+fate-aac-fixed-al15_44: REF = $(SAMPLES)/aac/al15_44_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al17_44
+fate-aac-fixed-al17_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al17_44.mp4
+fate-aac-fixed-al17_44: REF = $(SAMPLES)/aac/al17_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al18_44
+fate-aac-fixed-al18_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al18_44.mp4
+fate-aac-fixed-al18_44: REF = $(SAMPLES)/aac/al18_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_2
+fate-aac-fixed-al_sbr_hq_cm_48_2: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_cm_48_2.mp4
+fate-aac-fixed-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_5.1
+fate-aac-fixed-al_sbr_hq_cm_48_5.1: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_cm_48_5.1.mp4
+fate-aac-fixed-al_sbr_hq_cm_48_5.1: REF = 
$(SAMPLES)/aac/al_sbr_hq_cm_48_5.1_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48
+fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_sr_48_2_fsaac48.mp4
+fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: REF = 
$(SAMPLES)/aac/al_sbr_hq_sr_48_2_fsaac48.s16
+
+#FATE_AAC_FIXED += fate-aac-fixed-al_sbr_ps_06_ur
+#fate-aac-fixed-al_sbr_ps_06_ur: CMD = pcm -c aac_fixed-i 
$(TARGET_SAMPLES)/aac/al_sbr_ps_06_new.mp4
+#fate-aac-fixed-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-ap05_48
+fate-aac-fixed-ap05_48: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/ap05_48.mp4
+fate-aac-fixed-ap05_48: REF = $(SAMPLES)/aac/ap05_48.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_ad6000np_44_ep0
+fate-aac-fixed-er_ad6000np_44_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_ad6000np_44_ep0.mp4
+fate-aac-fixed-er_ad6000np_44_ep0: REF = $(SAMPLES)/aac/er_ad6000np_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_eld1001np_44_ep0
+fate-aac-fixed-er_eld1001np_44_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_eld1001np_44_ep0.mp4
+fate-aac-fixed-er_eld1001np_44_ep0: REF = $(SAMPLES)/aac/er_eld1001np_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_eld2000np_48_ep0
+fate-aac-fixed-er_eld2000np_48_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_eld2000np_48_ep0.mp4
+fate-aac-fixed-er_eld2000np_48_ep0: REF = 
$(SAMPLES)/aac/er_eld2000np_48_ep0.s16
 
 fate-aac-ct%: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/CT_DecoderCheck/$(@:fate-aac-ct-%=%)
 fate-aac-ct%: REF = $(SAMPLES)/aac/CT_DecoderCheck/aacPlusv2.wav
@@ -114,8 +169,9 @@ fate-aac-latm_stereo_to_51: REF = 
$(SAMPLES)/aac/latm_stereo_to_51_ref.s16
 FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
 FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
 FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
+FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED)
 
-FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes)
+FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) $(FATE_AAC_FIXED-yes)
 
 $(FATE_AAC_ALL): CMP  = oneoff
 $(FATE_AAC_ALL): FUZZ = 2
-- 
1.8.2.1

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


[FFmpeg-devel] [PATCH 12/12] Edit documentation and versioning

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Signed-off-by: Nedeljko Babic 
---
 Changelog| 1 +
 doc/general.texi | 2 +-
 doc/mips.txt | 4 
 libavcodec/version.h | 2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 6e9ca8e..00f67de 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version :
 - rewritten ASF demuxer
 - showvolume filter
 - Many improvements to the JPEG 2000 decoder
+- AAC fixed-point decoding
 
 
 version 2.7:
diff --git a/doc/general.texi b/doc/general.texi
index 68ff58b..150acd0 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -840,7 +840,7 @@ following image formats are supported:
 @item Name @tab Encoding @tab Decoding @tab Comments
 @item 8SVX exponential   @tab @tab  X
 @item 8SVX fibonacci @tab @tab  X
-@item AAC+   @tab  E  @tab  X
+@item AAC+   @tab  E  @tab  IX
 @tab encoding supported through external library libaacplus
 @item AAC@tab  E  @tab  X
 @tab encoding supported through external library libfaac and libvo-aacenc
diff --git a/doc/mips.txt b/doc/mips.txt
index 8c6779f..a84e89a 100644
--- a/doc/mips.txt
+++ b/doc/mips.txt
@@ -47,12 +47,16 @@ Files that have MIPS copyright notice in them:
 * libavutil/mips/
   float_dsp_mips.c
   libm_mips.h
+  softfloat_tables.h
 * libavcodec/
   fft_fixed_32.c
   fft_init_table.c
   fft_table.h
   mdct_fixed_32.c
 * libavcodec/mips/
+  aacdec_fixed.c
+  aacsbr_fixed.c
+  aacsbr_template.c
   aaccoder_mips.c
   aacpsy_mips.h
   ac3dsp_mips.c
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6e95c86..d95b514 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 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
1.8.2.1

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


[FFmpeg-devel] [PATCH 10/12] libavcodec: Minor macro polishing

2015-06-30 Thread Nedeljko Babic
Use macros from aac_defines.h for adding suffixes
 instead of local macros.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/cbrt_tablegen.h |  5 ++---
 libavcodec/cbrt_tablegen_template.c|  2 +-
 libavcodec/sinewin.h   | 17 +
 libavcodec/sinewin_tablegen.h  | 21 +
 libavcodec/sinewin_tablegen_template.c | 14 --
 5 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
index 07ef392..27a3e3a 100644
--- a/libavcodec/cbrt_tablegen.h
+++ b/libavcodec/cbrt_tablegen.h
@@ -26,12 +26,11 @@
 #include 
 #include 
 #include "libavutil/attributes.h"
+#include "libavcodec/aac_defines.h"
 
 #if USE_FIXED
-#define CBRT_RENAME(a) a ## _fixed
 #define CBRT(x) (int)floor((x).f * 8192 + 0.5)
 #else
-#define CBRT_RENAME(a) a
 #define CBRT(x) x.i
 #endif
 
@@ -46,7 +45,7 @@
 #else
 static uint32_t cbrt_tab[1 << 13];
 
-static av_cold void CBRT_RENAME(cbrt_tableinit)(void)
+static av_cold void AAC_RENAME(cbrt_tableinit)(void)
 {
 if (!cbrt_tab[(1<<13) - 1]) {
 int i;
diff --git a/libavcodec/cbrt_tablegen_template.c 
b/libavcodec/cbrt_tablegen_template.c
index a8c0495..9dd2cf5 100644
--- a/libavcodec/cbrt_tablegen_template.c
+++ b/libavcodec/cbrt_tablegen_template.c
@@ -27,7 +27,7 @@
 
 int main(void)
 {
-CBRT_RENAME(cbrt_tableinit)();
+AAC_RENAME(cbrt_tableinit)();
 
 write_fileheader();
 
diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index 5f0a74a..27c107c 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -23,6 +23,7 @@
 
 #include "config.h"
 #include "libavutil/mem.h"
+#include "libavcodec/aac_defines.h"
 
 #if CONFIG_HARDCODED_TABLES
 #   define SINETABLE_CONST const
@@ -34,28 +35,20 @@
 #define USE_FIXED 0
 #endif
 
-#if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
-#else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
-#endif
-
 #define SINETABLE(size) \
-SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, 
SINEWIN_SUFFIX(ff_sine_##size))[size]
+SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, 
AAC_RENAME(ff_sine_##size))[size]
 
 /**
  * Generate a sine window.
  * @param   window  pointer to half window
  * @param   n   size of half window
  */
-void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n);
+void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n);
 
 /**
  * initialize the specified entry of ff_sine_windows
  */
-void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index);
+void AAC_RENAME(ff_init_ff_sine_windows)(int index);
 
 extern SINETABLE(  32);
 extern SINETABLE(  64);
@@ -67,6 +60,6 @@ extern SINETABLE(2048);
 extern SINETABLE(4096);
 extern SINETABLE(8192);
 
-extern SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[14];
+extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[14];
 
 #endif /* AVCODEC_SINEWIN_H */
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index e1623b4..4432135 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -27,6 +27,7 @@
 // do not use libavutil/libm.h since this is compiled both
 // for the host and the target and config.h is only valid for the target
 #include 
+#include "libavcodec/aac_defines.h"
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 
@@ -49,33 +50,29 @@ SINETABLE(8192);
 #endif
 
 #if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
 #define SIN_FIX(a) (int)floor((a) * 0x8000 + 0.5)
 #else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
 #define SIN_FIX(a) a
 #endif
 
-SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[] = {
+SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
 NULL, NULL, NULL, NULL, NULL, // unused
-SINEWIN_SUFFIX(ff_sine_32) , SINEWIN_SUFFIX(ff_sine_64), 
SINEWIN_SUFFIX(ff_sine_128),
-SINEWIN_SUFFIX(ff_sine_256), SINEWIN_SUFFIX(ff_sine_512), 
SINEWIN_SUFFIX(ff_sine_1024),
-SINEWIN_SUFFIX(ff_sine_2048), SINEWIN_SUFFIX(ff_sine_4096), 
SINEWIN_SUFFIX(ff_sine_8192)
+AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128),
+AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024),
+AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), 
AAC_RENAME(ff_sine_8192)
 };
 
 // Generate a sine window.
-av_cold void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n) {
+av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) {
 int i;
 for(i = 0; i < n; i++)
 window[i] = SIN_FIX(sinf((i + 0.5) * (M_PI / (2.0 * n;
 }
 
-av_cold void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index) {
-assert(index >= 0 && index < 
FF_ARRAY_ELEMS(SINEWIN_SUFFIX(ff_sine_windows)));
+av_cold void AAC_RENAME(ff_init_ff_sine_windows)(int index) {
+assert(index >= 0 && index < FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
 #if !CONFIG_HARDCODED_TABLES
-
SIN

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

2015-06-30 Thread Nedeljko Babic
From: Jovan Zelincevic 

Move existing code to the new template files

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aacdec.c| 3132 +---
 libavcodec/{aacdec.c => aacdec_template.c} |  623 +---
 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, 97 insertions(+), 3699 deletions(-)
 copy libavcodec/{aacdec.c => aacdec_template.c} (85%)
 copy libavcodec/{cbrt_tablegen.c => cbrt_tablegen_template.c} (100%)
 copy libavcodec/{sinewin_tablegen.c => sinewin_tablegen_template.c} (100%)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 622cc5c..1d1abc9 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -32,55 +32,6 @@
  * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
  */
 
-/*
- * supported tools
- *
- * Support? Name
- * N (code in SoC repo) gain control
- * Yblock switching
- * Ywindow shapes - standard
- * Nwindow shapes - Low Delay
- * Yfilterbank - standard
- * N (code in SoC repo) filterbank - Scalable Sample Rate
- * YTemporal Noise Shaping
- * YLong Term Prediction
- * Yintensity stereo
- * Ychannel coupling
- * Yfrequency domain prediction
- * YPerceptual Noise Substitution
- * YMid/Side stereo
- * NScalable Inverse AAC Quantization
- * NFrequency Selective Switch
- * Nupsampling filter
- * Yquantization & coding - AAC
- * Nquantization & coding - TwinVQ
- * Nquantization & coding - BSAC
- * NAAC Error Resilience tools
- * NError Resilience payload syntax
- * NError Protection tool
- * NCELP
- * NSilence Compression
- * NHVXC
- * NHVXC 4kbits/s VR
- * NStructured Audio tools
- * NStructured Audio Sample Bank Format
- * NMIDI
- * NHarmonic and Individual Lines plus Noise
- * NText-To-Speech Interface
- * YSpectral Band Replication
- * Y (not in this code) Layer-1
- * Y (not in this code) Layer-2
- * Y (not in this code) Layer-3
- * NSinuSoidal Coding (Transient, Sinusoid, Noise)
- * YParametric Stereo
- * NDirect Stream Transfer
- * YEnhanced AAC Low Delay (ER AAC ELD)
- *
- * Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication.
- *   - HE AAC v2 comprises LC AAC with Spectral Band Replication and
-   Parametric Stereo.
- */
-
 #include "libavutil/float_dsp.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
@@ -108,1450 +59,19 @@
 #include 
 
 #if ARCH_ARM
-#   include "arm/aac.h"
-#elif ARCH_MIPS
-#   include "mips/aacdec_mips.h"
-#endif
-
-static VLC vlc_scalefactors;
-static VLC vlc_spectral[11];
-
-static int output_configure(AACContext *ac,
-uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
-enum OCStatus oc_type, int get_new_frame);
-
-#define overread_err "Input buffer exhausted before END element found\n"
-
-static int count_channels(uint8_t (*layout)[3], int tags)
-{
-int i, sum = 0;
-for (i = 0; i < tags; i++) {
-int syn_ele = layout[i][0];
-int pos = layout[i][2];
-sum += (1 + (syn_ele == TYPE_CPE)) *
-   (pos != AAC_CHANNEL_OFF && pos != AAC_CHANNEL_CC);
-}
-return sum;
-}
-
-/**
- * Check for the channel element in the current channel position configuration.
- * If it exists, make sure the appropriate element is allocated and map the
- * channel order to match the internal FFmpeg channel layout.
- *
- * @param   che_pos current channel position configuration
- * @param   type channel element type
- * @param   id channel element id
- * @param   channels count of the number of channels in the configuration
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static av_cold int che_configure(AACContext *ac,
- enum ChannelPosition che_pos,
- int type, int id, int *channels)
-{
-if (*channels >= MAX_CHANNELS)
-return AVERROR_INVALIDDATA;
-if (che_pos) {
-if (!ac->che[type][id]) {
-if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement
-return AVERROR(ENOMEM);
-ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
-}
-if (type != TYPE_CCE) {
- 

[FFmpeg-devel] [PATCH 07/12] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [3/3]

2015-06-30 Thread Nedeljko Babic
From: Djordje Pesut 

Add fixed poind code.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/Makefile  |   5 +-
 libavcodec/aac.h |  52 +---
 libavcodec/aac_defines.h |  78 ++
 libavcodec/aacdec_template.c |  14 +-
 libavcodec/aacsbr.c  |   1 +
 libavcodec/aacsbr.h  |  12 +-
 libavcodec/aacsbr_fixed.c| 586 +++
 libavcodec/aacsbr_template.c | 211 
 libavcodec/lpc.h |  15 +-
 libavcodec/sbr.h |  78 +++---
 libavcodec/sbrdsp.c  |   3 +
 libavcodec/sbrdsp.h  |  36 +--
 libavcodec/sbrdsp_fixed.c| 286 +
 libavcodec/sbrdsp_template.c |  42 ++--
 libavutil/softfloat.h|   8 +
 15 files changed, 1237 insertions(+), 190 deletions(-)
 create mode 100644 libavcodec/aac_defines.h
 create mode 100644 libavcodec/aacsbr_fixed.c
 create mode 100644 libavcodec/sbrdsp_fixed.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 642da3d..8bdf5a8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -119,8 +119,9 @@ OBJS-$(CONFIG_A64MULTI5_ENCODER)   += a64multienc.o 
elbg.o
 OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
   sbrdsp.o aacpsdsp.o
-OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o \
-  aacadtsdec.o mpeg4audio.o kbdwin.o
+OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o \
+  aacadtsdec.o mpeg4audio.o kbdwin.o \
+  sbrdsp_fixed.o
 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o\
   aacpsy.o aactab.o  \
   psymodel.o mpeg4audio.o kbdwin.o
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index f6fd446..d62455d 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -30,58 +30,8 @@
 #ifndef AVCODEC_AAC_H
 #define AVCODEC_AAC_H
 
-#ifndef USE_FIXED
-#define USE_FIXED 0
-#endif
-
-#if USE_FIXED
-
-#include "libavutil/softfloat.h"
-
-#define FFT_FLOAT0
-#define FFT_FIXED_32 1
-
-#define AAC_RENAME(x)   x ## _fixed
-#define AAC_RENAME_32(x)x ## _fixed_32
-#define AAC_FLOAT SoftFloat
-#define INTFLOAT int
-#define SHORTFLOAT int16_t
-#define AAC_SIGNE   int
-#define FIXR(a) ((int)((a) * 1 + 0.5))
-#define FIXR10(a)   ((int)((a) * 1024.0 + 0.5))
-#define Q23(a)  (int)((a) * 8388608.0 + 0.5)
-#define Q30(x)  (int)((x)*1073741824.0 + 0.5)
-#define Q31(x)  (int)((x)*2147483648.0 + 0.5)
-#define RANGE15(x)  x
-#define GET_GAIN(x, y)  (-(y) << (x)) + 1024
-#define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200) >> 26)
-#define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x2000) >> 30)
-#define AAC_MUL31(x, y) (int)(((int64_t)(x) * (y) + 0x4000) >> 31)
-
-#else
-
-#define FFT_FLOAT1
-#define FFT_FIXED_32 0
-
-#define AAC_RENAME(x)   x
-#define AAC_RENAME_32(x)x
-#define AAC_FLOAT float
-#define INTFLOAT float
-#define SHORTFLOAT float
-#define AAC_SIGNE   unsigned
-#define FIXR(x) ((float)(x))
-#define FIXR10(x)   ((float)(x))
-#define Q23(x)  x
-#define Q30(x)  x
-#define Q31(x)  x
-#define RANGE15(x)  (32768.0 * (x))
-#define GET_GAIN(x, y)  powf((x), -(y))
-#define AAC_MUL26(x, y) ((x) * (y))
-#define AAC_MUL30(x, y) ((x) * (y))
-#define AAC_MUL31(x, y) ((x) * (y))
-
-#endif /* USE_FIXED */
 
+#include "aac_defines.h"
 #include "libavutil/float_dsp.h"
 #include "libavutil/fixed_dsp.h"
 #include "avcodec.h"
diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
new file mode 100644
index 000..0f3905f
--- /dev/null
+++ b/libavcodec/aac_defines.h
@@ -0,0 +1,78 @@
+/*
+ * AAC defines
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_AAC_DEFINES_H
+#define AVCODEC_AAC_DEFINES_H
+
+#ifndef USE_FIXED
+#define USE_FIXED 0
+#endif
+
+#if USE_FIXED
+
+#include "libavutil/

[FFmpeg-devel] [PATCH 09/12] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [2/2]

2015-06-30 Thread Nedeljko Babic
From: Djordje Pesut 

Add fixed point implementation.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/Makefile   |  14 ++-
 libavcodec/aac_defines.h  |  36 ++
 libavcodec/aacps.c| 255 --
 libavcodec/aacps.h|  32 ++---
 libavcodec/aacps_fixed.c  |  24 
 libavcodec/aacps_fixed_tablegen.h |   2 +-
 libavcodec/aacps_float.c  |  24 
 libavcodec/aacpsdata.c|   6 +-
 libavcodec/aacpsdsp.c | 216 
 libavcodec/aacpsdsp.h |  30 ++---
 libavcodec/aacpsdsp_fixed.c   |  23 
 libavcodec/aacpsdsp_float.c   |  23 
 libavcodec/aacpsdsp_template.c| 228 ++
 libavcodec/aacsbr_template.c  |   8 +-
 14 files changed, 571 insertions(+), 350 deletions(-)
 create mode 100644 libavcodec/aacps_fixed.c
 create mode 100644 libavcodec/aacps_float.c
 delete mode 100644 libavcodec/aacpsdsp.c
 create mode 100644 libavcodec/aacpsdsp_fixed.c
 create mode 100644 libavcodec/aacpsdsp_float.c
 create mode 100644 libavcodec/aacpsdsp_template.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8bdf5a8..ddf47c5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -116,12 +116,12 @@ OBJS-$(CONFIG_WMA_FREQS)   += wma_freqs.o
 OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o
 OBJS-$(CONFIG_A64MULTI_ENCODER)+= a64multienc.o elbg.o
 OBJS-$(CONFIG_A64MULTI5_ENCODER)   += a64multienc.o elbg.o
-OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
+OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o 
aacps_float.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
-  sbrdsp.o aacpsdsp.o
-OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o \
+  sbrdsp.o aacpsdsp_float.o
+OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o aacps_fixed.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
-  sbrdsp_fixed.o
+  sbrdsp_fixed.o aacpsdsp_fixed.o
 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o\
   aacpsy.o aactab.o  \
   psymodel.o mpeg4audio.o kbdwin.o
@@ -922,6 +922,7 @@ TOOLS = fourcc2pixfmt
 
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
+aacps_fixed_tablegen\
 aacsbr_tablegen \
 aacsbr_fixed_tablegen   \
 cabac_tablegen  \
@@ -954,7 +955,7 @@ else
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
-GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h \
+GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacps_fixed_tables.h aacsbr_tables.h \
   aacsbr_fixed_tables.h aac_tables.h dsd_tables.h dv_tables.h \
   sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
motionpixels_tables.h \
   pcm_tables.h qdm2_tables.h
@@ -966,7 +967,8 @@ $(GEN_HEADERS): $(SUBDIR)%_tables.h: 
$(SUBDIR)%_tablegen$(HOSTEXESUF)
 ifdef CONFIG_HARDCODED_TABLES
 $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
 $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
-$(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
+$(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
+$(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
 $(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index 0f3905f..3c45742 100644
--- a/libavcodec/aac_defines.h
+++ b/libavcodec/aac_defines.h
@@ -35,6 +35,7 @@
 #define AAC_RENAME(x)   x ## _fixed
 #define AAC_RENAME_32(x)x ## _fixed_32
 #define INTFLOAT int
+#define INT64FLOAT  int64_t
 #define SHORTFLOAT int16_t
 #define AAC_FLOAT SoftFloat
 #define AAC_SIGNE   int
@@ -45,9 +46,33 @@
 #define Q31(x)  (int)((x)*2147483648.0 + 0.5)
 #define RANGE15(x)  x
 #define GET_GAIN(x, y)  (-(y) << (x)) + 1024
+#define AAC_MUL16(x, y) (int)(((int64_t)(x) * (y) + 0x8000) >> 16)
 #define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200) >> 26)
 #define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x2000) >> 30)
 #define AAC_MUL31(x, y) (int)(((int64_t)(x) * (y) + 0x4000) >> 31)
+#define AAC_MADD28(x, y, a, b) (int)int64_t)(x

Re: [FFmpeg-devel] [PATCH] vp9/update_prob: prevent out of bounds table read

2015-06-30 Thread Ronald S. Bultje
Hi,

On Tue, Jun 30, 2015 at 2:03 AM, James Zern  wrote:

> the max value of the lookup in expanded form is:
> (((1 << 7) - 1) << 1) - 65 + 1 + 64 = 254
>
> add one entry of padding to inv_map_table[] to prevent out of bounds
> access with non-conforming / fuzzed bitstreams
>
> Signed-off-by: James Zern 
> ---
>  libavcodec/vp9.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)


OK.

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


Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Nicolas Derouineau
>> @@ -475,6 +475,8 @@ per-block quantization parameter (QP)
>>  motion vector
>>  @item dct_coeff
>>
>> +@item green_metadata
>> +
>
>Shouldn't there be some explanation?

Corrected

>> @@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
>>  #define FF_DEBUG_ER  0x0400
>>  #define FF_DEBUG_MMCO0x0800
>>  #define FF_DEBUG_BUGS0x1000
>> +#define FF_DEBUG_GREEN_MD0x1200
>
>I believe this has to come at the end of the list with value 0x2.

Michael Niedermayer has sugested 0x0080. I'm however going to use the one 
you suggest (as it is the last comment). Corrected.

>> +if ( h->sei_green_metadata.green_metadata_type == 2){
>
>Please make this "if (h->sei.. == 2) {" to match the coding style around.

Corrected.

>
>Your av_logs could use a linebreak after the string.

I'm not sure I understand correctly this last comment. I have unified the 
number of space in the strings.






De : ffmpeg-devel-boun...@ffmpeg.org  de la 
part de Carl Eugen Hoyos 
Envoyé : mardi 30 juin 2015 11:52
À : FFmpeg development discussions and patches
Objet : Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

On Tuesday 30 June 2015 11:38:03 am Nicolas Derouineau wrote:

> From f7cff28a44adada6761233d59207b4a9c0373960 Mon Sep 17 00:00:00 2001
> From: Nicolas DEROUINEAU 
> Date: Tue, 30 Jun 2015 10:59:07 +0200
> Subject: [PATCH] Patch to parse SEI GreenMetadata
>
> ---
>  doc/codecs.texi|2 ++
>  libavcodec/avcodec.h   |1 +
>  libavcodec/h264.h  |   21 
>  libavcodec/h264_sei.c  |   59
>  libavcodec/options_table.h |
>  1 +
>  5 files changed, 84 insertions(+)
>
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index 3c035a5..5b3ec9b 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -475,6 +475,8 @@ per-block quantization parameter (QP)
>  motion vector
>  @item dct_coeff
>
> +@item green_metadata
> +

Shouldn't there be some explanation?

>  @item skip
>
>  @item startcode
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index ddbf0a3..65c9053 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
>  #define FF_DEBUG_ER  0x0400
>  #define FF_DEBUG_MMCO0x0800
>  #define FF_DEBUG_BUGS0x1000
> +#define FF_DEBUG_GREEN_MD0x1200

I believe this has to come at the end of the list with value 0x2.

[...]

> +if ( h->sei_green_metadata.green_metadata_type == 2){

Please make this "if (h->sei.. == 2) {" to match the coding style around.

Your av_logs could use a linebreak after the string.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From f7cff28a44adada6761233d59207b4a9c0373960 Mon Sep 17 00:00:00 2001
From: Nicolas DEROUINEAU 
Date: Tue, 30 Jun 2015 10:59:07 +0200
Subject: [PATCH 1/3] Patch to parse SEI GreenMetadata

---
 doc/codecs.texi|2 ++
 libavcodec/avcodec.h   |1 +
 libavcodec/h264.h  |   21 
 libavcodec/h264_sei.c  |   59 
 libavcodec/options_table.h |1 +
 5 files changed, 84 insertions(+)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 3c035a5..5b3ec9b 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -475,6 +475,8 @@ per-block quantization parameter (QP)
 motion vector
 @item dct_coeff
 
+@item green_metadata
+
 @item skip
 
 @item startcode
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ddbf0a3..65c9053 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
 #define FF_DEBUG_ER  0x0400
 #define FF_DEBUG_MMCO0x0800
 #define FF_DEBUG_BUGS0x1000
+#define FF_DEBUG_GREEN_MD0x1200
 #if FF_API_DEBUG_MV
 #define FF_DEBUG_VIS_QP  0x2000 ///< only access through AVOptions from outside libavcodec
 #define FF_DEBUG_VIS_MB_TYPE 0x4000 ///< only access through AVOptions from outside libavcodec
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 15b9a5d..c298008 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -137,6 +137,7 @@ typedef enum {
 SEI_TYPE_RECOVERY_POINT = 6,   ///< recovery point (frame # to decoder sync)
 SEI_TYPE_FRAME_PACKING  = 45,  ///< frame packing arrangement
 SEI_TYPE_DISPLAY_ORIENTATION= 47,  ///< display orientation
+SEI_TYPE_GREEN_METADATA = 56   ///< GreenMPEG information
 } SEI_Type;
 
 /**
@@ -268,6 +269,22 @@ typedef struct FPA {
 } FPA;
 
 /**
+ * Green MetaData Information Type
+ */
+typedef struct GreenMetaData {
+uint8_t  green_metadata_type;
+uint8_t  period_type;
+uint16_t  num_seconds;
+uint16_t  num_pictures;
+uint8_t percent_non_zero_macroblocks;
+uint8_t percent_intra_code

Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Carl Eugen Hoyos
On Tuesday 30 June 2015 12:30:50 pm Nicolas Derouineau wrote:
> >> @@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
> >>  #define FF_DEBUG_ER          0x0400
> >>  #define FF_DEBUG_MMCO        0x0800
> >>  #define FF_DEBUG_BUGS        0x1000
> >> +#define FF_DEBUG_GREEN_MD    0x1200
> >
> >I believe this has to come at the end of the list with value 0x2.
>
> Michael Niedermayer has sugested 0x0080. I'm however going to use the
> one you suggest (as it is the last comment). Corrected.

Please use what Michael suggested, sorry that I had missed it.

> >Your av_logs could use a linebreak after the string.
>
> I'm not sure I understand correctly this last comment. I have unified the
> number of space in the strings.

av_log(context, "a string with %d %d %d \n", some variables);
vs.
av_log(context, "string",
   variables);

(This of course only makes sense for long lines!)

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


Re: [FFmpeg-devel] [PATCH] vp9/update_prob: prevent out of bounds table read

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 05:59:53AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Tue, Jun 30, 2015 at 2:03 AM, James Zern  wrote:
> 
> > the max value of the lookup in expanded form is:
> > (((1 << 7) - 1) << 1) - 65 + 1 + 64 = 254
> >
> > add one entry of padding to inv_map_table[] to prevent out of bounds
> > access with non-conforming / fuzzed bitstreams
> >
> > Signed-off-by: James Zern 
> > ---
> >  libavcodec/vp9.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> 
> OK.

applied

thanks

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

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


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


[FFmpeg-devel] [PATCH]Make jp2 output Kakadu-compatible

2015-06-30 Thread Carl Eugen Hoyos
Hi!

Attached patch makes the output of ffmpeg -i lena.pnm -strict -2 out.jp2 
compatible with Kakadu, fixes ticket #4689.

Please comment, Carl Eugen
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index dcdf411..82a75aa 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -962,6 +962,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 bytestream_put_buffer(&s->buf, "ftyp", 4);
 bytestream_put_buffer(&s->buf, "jp2\040\040", 4);
 bytestream_put_be32(&s->buf, 0);
+bytestream_put_buffer(&s->buf, "jp2\040", 4);
 update_size(chunkstart, s->buf);
 
 jp2hstart = s->buf;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC]Add some docs for j2k encoding and remove experimental (instead of: Change the default j2k prediction to 5/3)

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 11:41:03AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> I just tested a patch to make the j2k encoder lossless by default 
> but I had not realized that the encoder does listen to -qscale which 
> might make more sense.
> 
> So instead I suggest the attached documentation update and the 
> removal of the experimental flag.

the docs change LGTM

the experimental removal, is more a question on what people prefer
than a technical question, ive no objections to it though

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


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


Re: [FFmpeg-devel] [PATCH]Make jp2 output Kakadu-compatible

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 02:05:37PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch makes the output of ffmpeg -i lena.pnm -strict -2 out.jp2 
> compatible with Kakadu, fixes ticket #4689.
> 
> Please comment, Carl Eugen

>  j2kenc.c |1 +
>  1 file changed, 1 insertion(+)
> 7fe04b2a6ae6fc046144cc6d4879b1f249e0ef7d  patchftyp.diff

needs fate update
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] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Nicolas Derouineau
Please find here enclosed the patch synthesizing all your comments.

Nicolas DEROUINEAU
Research Engineer
VITEC

T.  +33 1 46 73 06 06
E.  nicolas.derouin...@vitec.com
W. www.vitec.com


De : ffmpeg-devel-boun...@ffmpeg.org  de la 
part de Carl Eugen Hoyos 
Envoyé : mardi 30 juin 2015 12:47
À : FFmpeg development discussions and patches
Objet : Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

On Tuesday 30 June 2015 12:30:50 pm Nicolas Derouineau wrote:
> >> @@ -2610,6 +2610,7 @@ typedef struct AVCodecContext {
> >>  #define FF_DEBUG_ER  0x0400
> >>  #define FF_DEBUG_MMCO0x0800
> >>  #define FF_DEBUG_BUGS0x1000
> >> +#define FF_DEBUG_GREEN_MD0x1200
> >
> >I believe this has to come at the end of the list with value 0x2.
>
> Michael Niedermayer has sugested 0x0080. I'm however going to use the
> one you suggest (as it is the last comment). Corrected.

Please use what Michael suggested, sorry that I had missed it.

> >Your av_logs could use a linebreak after the string.
>
> I'm not sure I understand correctly this last comment. I have unified the
> number of space in the strings.

av_log(context, "a string with %d %d %d \n", some variables);
vs.
av_log(context, "string",
   variables);

(This of course only makes sense for long lines!)

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From 438a83b4cb86dd1045dca1d566f19148543e46ae Mon Sep 17 00:00:00 2001
From: Nicolas DEROUINEAU 
Date: Tue, 30 Jun 2015 15:17:59 +0200
Subject: [PATCH] Enabling Greenmetadata SEI parsing

---
 doc/codecs.texi|3 ++
 libavcodec/avcodec.h   |1 +
 libavcodec/h264.h  |   21 ++
 libavcodec/h264_sei.c  |   65 
 libavcodec/options_table.h |1 +
 5 files changed, 91 insertions(+)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 3c035a5..a2aa503 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -475,6 +475,9 @@ per-block quantization parameter (QP)
 motion vector
 @item dct_coeff
 
+@item green_metadata
+display complexity metadata for the upcoming frame, GoP or for a given duration.
+
 @item skip
 
 @item startcode
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ddbf0a3..6391cf3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2616,6 +2616,7 @@ typedef struct AVCodecContext {
 #endif
 #define FF_DEBUG_BUFFERS 0x8000
 #define FF_DEBUG_THREADS 0x0001
+#define FF_DEBUG_GREEN_MD0x0080
 #define FF_DEBUG_NOMC0x0100
 
 #if FF_API_DEBUG_MV
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 15b9a5d..c298008 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -137,6 +137,7 @@ typedef enum {
 SEI_TYPE_RECOVERY_POINT = 6,   ///< recovery point (frame # to decoder sync)
 SEI_TYPE_FRAME_PACKING  = 45,  ///< frame packing arrangement
 SEI_TYPE_DISPLAY_ORIENTATION= 47,  ///< display orientation
+SEI_TYPE_GREEN_METADATA = 56   ///< GreenMPEG information
 } SEI_Type;
 
 /**
@@ -268,6 +269,22 @@ typedef struct FPA {
 } FPA;
 
 /**
+ * Green MetaData Information Type
+ */
+typedef struct GreenMetaData {
+uint8_t  green_metadata_type;
+uint8_t  period_type;
+uint16_t  num_seconds;
+uint16_t  num_pictures;
+uint8_t percent_non_zero_macroblocks;
+uint8_t percent_intra_coded_macroblocks;
+uint8_t percent_six_tap_filtering;
+uint8_t percent_alpha_point_deblocking_instance;
+uint8_t xsd_metric_type;
+uint16_t xsd_metric_value;
+} GreenMetaData;
+
+/**
  * Memory management control operation opcode.
  */
 typedef enum MMCOOpcode {
@@ -814,6 +831,10 @@ typedef struct H264Context {
 /* Motion Estimation */
 qpel_mc_func (*qpel_put)[16];
 qpel_mc_func (*qpel_avg)[16];
+
+/*Green Metadata */
+GreenMetaData sei_green_metadata;
+
 } H264Context;
 
 extern const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM + 1]; ///< One chroma qp table for each possible bit depth (8-14).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index b6ec5c7..9ade524 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -285,6 +285,66 @@ static int decode_display_orientation(H264Context *h)
 return 0;
 }
 
+static int decode_GreenMetadata(H264Context *h)
+{
+if (h->avctx->debug & FF_DEBUG_GREEN_MD)
+av_log(h->avctx, AV_LOG_DEBUG,  "Green Metadata Info SEI message\n");
+
+h->sei_green_metadata.green_metadata_type=get_bits(&h->gb, 8);
+
+if (h->avctx->debug & FF_DEBUG_GREEN_MD)
+av_log(h->avctx, AV_LOG_DEBUG,  "green_metadata_type= %d\n",
+   h->sei_green_metadata.green_metadata_type);
+
+if (h->sei_green_metadata.green_metadata_type==0){
+h->sei_green_metadata.period_type=get_bits(&h->

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

2015-06-30 Thread Claudio Freire
LGTM, but it cannot be committed without the others, or a memset to
zero of is_mask somewhere at the beginning of each frame (or encoder
init).

On Fri, Jun 26, 2015 at 5:16 PM, Rostislav Pehlivanov
 wrote:
> 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 mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread Ivan Uskov
Hello All,

Unlike Windows, under linux a valid display handle should be specified
to open a QSV/MFX session.
The attached patch does find appropriate display handle and transfers
it to Intel's MFX library.


  

-- 
Best regards,
 Ivan  mailto:ivan.us...@nablet.com

0001-Adding-QSV-MFX-session-initialization-for-linux-plat.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 05:24:54PM +0300, Ivan Uskov wrote:
> Hello All,
> 
> Unlike Windows, under linux a valid display handle should be specified
> to open a QSV/MFX session.
> The attached patch does find appropriate display handle and transfers
> it to Intel's MFX library.
> 
> 
>   
> 
> -- 
> Best regards,
>  Ivan  mailto:ivan.us...@nablet.com

>  qsv.c  |   84 
> +
>  qsv_internal.h |   17 ++-
>  2 files changed, 100 insertions(+), 1 deletion(-)
> adde891c476ac9bc5cbc06caad70906c8072fd92  
> 0001-Adding-QSV-MFX-session-initialization-for-linux-plat.patch
> From aa319aac75ed30441ed53fac56ddfc347d2d454c Mon Sep 17 00:00:00 2001
> From: Ivan Uskov 
> Date: Tue, 30 Jun 2015 16:59:26 +0300
> Subject: [PATCH] Adding QSV/MFX session initialization for linux platform,
>  where a display handle is required. Now ff_qsv_init_internal_session() is
>  able to find appropriate display handle under linux using VAAPI.
> 
> ---
>  libavcodec/qsv.c  | 84 
> +++
>  libavcodec/qsv_internal.h | 17 +-
>  2 files changed, 100 insertions(+), 1 deletion(-)
>  mode change 100644 => 100755 libavcodec/qsv.c
>  mode change 100644 => 100755 libavcodec/qsv_internal.h
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c

> old mode 100644
> new mode 100755

this mode change looks unintended



> index 31be9d1..ba81815

> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -18,6 +18,11 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> +/**
> + * @file
> + * Intel QSV H.264 codec general functions.
> + */
> +
>  #include 
>  
>  #include "libavutil/error.h"
> @@ -25,6 +30,9 @@
>  #include "avcodec.h"
>  #include "qsv_internal.h"
>  
> +/**
> + * @brief translate ffmpeg codec IDs to MSDK
> + */
>  int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>  {
>  switch (codec_id) {
> @@ -42,6 +50,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>  return AVERROR(ENOSYS);
>  }
>  
> +
> +/**
> + * @brief translate MSDK error codes to ffmpeg error codes
> + */
>  int ff_qsv_error(int mfx_err)
>  {
>  switch (mfx_err) {
> @@ -77,6 +89,22 @@ int ff_qsv_error(int mfx_err)
>  }

The documentation addition should be in a seperate patch


>  }
>  
> +
> +/**
> + * @brief Initialize a MSDK session
> + *
> + * Media SDK is based on sessions, so this is the prerequisite 
> + * initialization for HW acceleration.  For Windows the session is
> + * complete and ready to use, for Linux a display handle is
> + * required.  For releases of Media Server Studio >= 2015 R4 the 
> + * render nodes interface is preferred (/dev/dri/renderD). 
> + * Using Media Server Studio 2015 R4 or newer is recommended
> + * but the older /dev/dri/card interface is also searched
> + * for broader compatibility.
> + * 
> + * @param avctxffmpeg metadata for this codec context
> + * @param session  the MSDK session used
> + */
>  int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session)
>  {
>  mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
> @@ -91,6 +119,62 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
> mfxSession *session)
>  return ff_qsv_error(ret);
>  }
>  
> +
> +// this code is only required for Linux.  It searches for a valid
> +// display handle.  First in /dev/dri/renderD then in /dev/dri/card
> +#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
> +// VAAPI display handle
> +VADisplay va_dpy=NULL;
> +VAStatus va_res = VA_STATUS_SUCCESS;
> +int major_version = 0, minor_version = 0;
> +int fd=-1;
> +  
> +//search for valid graphics device
> +char adapterpath[256];

> +for (int adapter_num=0;adapter_num<6;adapter_num++) {

the int should be declared above and outside the for(), some
compilers dont like this syntax



> +
> +if (adapter_num<3) {
> +snprintf(adapterpath,sizeof(adapterpath),
> +"/dev/dri/renderD%d", adapter_num+128);



> +} else {
> +snprintf(adapterpath,sizeof(adapterpath),
> +"/dev/dri/card%d", adapter_num-3);
> +}
> +
> +fd = open(adapterpath, O_RDWR);
> +if (fd < 0) {
> +av_log(avctx, AV_LOG_ERROR, 
> +"mfx init: %s fd open failed\n", adapterpath);
> +continue;
> +}
> +
> +va_dpy = vaGetDisplayDRM(fd);
> +if (!va_dpy) {
> +av_log(avctx, AV_LOG_ERROR, 
> +"mfx init: %s vaGetDisplayDRM failed\n", adapterpath);
> +close(fd);
> +continue;
> +}
> +
> +va_res = vaInitialize(va_dpy, &major_version, &minor_version);
> +if (VA_STATUS_SUCCESS != va_res) {
> +av_log(avctx, AV_LOG_ERROR, 
> +"mfx init: %s vaInitialize failed\n", adapterpath);
> +close(fd);
> +fd = -1;
> +  

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

2015-06-30 Thread Rostislav Pehlivanov
The problem was that ms_mask altered the phase during distortion
calculations but did not alter it again during codebook selection (e.g.
INTENSITY_BT or INTENSITY_BT2), so the phases got swapped around and the
artifacts appeared. M/S is off by default so the artifacts were only
present if -stereo_mode was set to something other than ms_off.
I've improved phase determination by using a separate variable and adding
up all the phases for every loop around w2. That way ms_mask will affect
the overall phase and distortion calculations will be more correct (using
the current overall phase instead of the local phase for a single w2 loop
will make some spectral coefficients have the wrong phase since they are a
minority and thus increase the error).

On 30 June 2015 at 05:42, Rostislav Pehlivanov  wrote:

> >cpe->ms_mask[w*16+g] = 0;
> This defeats the purpose of changing the phase of the spectral
> coefficients if ms_mask has been set by search_for_ms. If is_mask[idx] is 1
> then ms_mask is only used to alter the phase of the spectral coefficients,
> so probably the phase gets altered incorrectly. The reason why ms_mask is
> even considered is only because the decoder uses it in that way and because
> the specifications mention that IS and M/S are exclusive yet related. Maybe
> there might be something wrong with how the search_for_ms flags bands so it
> inverts the phase of IS incorrectly. Or maybe the code to determine the
> phase of the spectral coefficients might be wrong in search_for_is. I'll
> play around with how the phase is set and maybe in case nothing works out
> I'll unflag ms_mask[].
>
> On 30 June 2015 at 02:35, Claudio Freire  wrote:
>
>> On Fri, Jun 26, 2015 at 5:16 PM, Rostislav Pehlivanov
>>  wrote:
>> > +if (dist2 <= dist1) {
>> > +cpe->is_mask[w*16+g] = 1;
>> > +cpe->ch[0].is_ener[w*16+g] = ener1/ener01;
>> > +cpe->ch[1].is_ener[w*16+g] = ener0/ener1;
>> > +if (s_coef0*s_coef1 >= 0.0f)
>> > +cpe->ch[1].band_type[w*16+g] = INTENSITY_BT;
>> > +else
>> > +cpe->ch[1].band_type[w*16+g] = INTENSITY_BT2;
>> > +count++;
>> > +}
>>
>>
>> If you don't add an:
>>
>> cpe->ms_mask[w*16+g] = 0;
>>
>> In there, you get horrible artifacts. Tested it quite a bit already.
>>
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread Ivan Uskov
Hello Michael,

I'm sorry, what exactly documentation should be added regarding this
patch? As I can see there is no any standalone topic about QSV into
current /doc. Can modifications of Changelog be enough?

Tuesday, June 30, 2015, 5:42:56 PM, you wrote:

MN> On Tue, Jun 30, 2015 at 05:24:54PM +0300, Ivan Uskov wrote:
>> +
>> +/**
>> + * @brief translate MSDK error codes to ffmpeg error codes
>> + */
>>  int ff_qsv_error(int mfx_err)
>>  {
>>  switch (mfx_err) {
>> @@ -77,6 +89,22 @@ int ff_qsv_error(int mfx_err)
>>  }

MN> The documentation addition should be in a seperate patch


>>  }
>>  

-- 
Best regards,
 Ivanmailto:ivan.us...@nablet.com

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


[FFmpeg-devel] [PATCH] avfilter/af_astats: export metadata

2015-06-30 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi| 35 ++
 libavfilter/af_astats.c | 80 +++--
 2 files changed, 113 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 46df5b5..ed33621 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -941,6 +941,41 @@ It accepts the following option:
 @item length
 Short window length in seconds, used for peak and trough RMS measurement.
 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
+
+@item metadata
+
+Set metadata injection. All the metadata keys are prefixed with 
@code{lavfi.astats.X},
+where @code{X} is channel number starting from 1 or string @code{Overall}. 
Default is
+disabled.
+
+Available keys for each channel are:
+DC_offset
+Min_level
+Max_level
+Peak_level
+RMS_peak
+RMS_trough
+Crest_factor
+Flat_factor
+Peak_count
+
+and for Overall:
+DC_offset
+Min_level
+Max_level
+Peak_level
+RMS_level
+RMS_peak
+RMS_trough
+Flat_factor
+Peak_count
+Number_of_samples
+
+For example full key look like this @code{lavfi.astats.1.DC_offset} or
+this @code{lavfi.astats.Overall.Peak_count}.
+
+For description what each key means read bellow.
+
 @end table
 
 A description of each shown parameter follows:
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index 5780fb9..24cbadd 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -44,6 +44,7 @@ typedef struct {
 uint64_t tc_samples;
 double time_constant;
 double mult;
+int metadata;
 } AudioStatsContext;
 
 #define OFFSET(x) offsetof(AudioStatsContext, x)
@@ -51,6 +52,7 @@ typedef struct {
 
 static const AVOption astats_options[] = {
 { "length", "set the window length", OFFSET(time_constant), 
AV_OPT_TYPE_DOUBLE, {.dbl=.05}, .01, 10, FLAGS },
+{ "metadata", "inject metadata in the filtergraph", OFFSET(metadata), 
AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -146,9 +148,82 @@ static inline void update_stat(AudioStatsContext *s, 
ChannelStats *p, double d)
 p->nb_samples++;
 }
 
+static void set_meta(AVDictionary **metadata, int chan, const char *key,
+ const char *fmt, double val)
+{
+uint8_t value[128];
+uint8_t key2[128];
+
+snprintf(value, sizeof(value), fmt, val);
+if (chan)
+snprintf(key2, sizeof(key2), "lavfi.astats.%d.%s", chan, key);
+else
+snprintf(key2, sizeof(key2), "lavfi.astats.%s", key);
+av_dict_set(metadata, key2, value, 0);
+}
+
+#define LINEAR_TO_DB(x) (log10(x) * 20)
+
+static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
+{
+uint64_t min_count = 0, max_count = 0, nb_samples = 0;
+double min_runs = 0, max_runs = 0,
+   min = DBL_MAX, max = DBL_MIN,
+   max_sigma_x = 0,
+   sigma_x = 0,
+   sigma_x2 = 0,
+   min_sigma_x2 = DBL_MAX,
+   max_sigma_x2 = DBL_MIN;
+int c;
+
+for (c = 0; c < s->nb_channels; c++) {
+ChannelStats *p = &s->chstats[c];
+
+if (p->nb_samples < s->tc_samples)
+p->min_sigma_x2 = p->max_sigma_x2 = p->sigma_x2 / p->nb_samples;
+
+min = FFMIN(min, p->min);
+max = FFMAX(max, p->max);
+min_sigma_x2 = FFMIN(min_sigma_x2, p->min_sigma_x2);
+max_sigma_x2 = FFMAX(max_sigma_x2, p->max_sigma_x2);
+sigma_x += p->sigma_x;
+sigma_x2 += p->sigma_x2;
+min_count += p->min_count;
+max_count += p->max_count;
+min_runs += p->min_runs;
+max_runs += p->max_runs;
+nb_samples += p->nb_samples;
+if (fabs(p->sigma_x) > fabs(max_sigma_x))
+max_sigma_x = p->sigma_x;
+
+set_meta(metadata, c + 1, "DC_offset", "%f", p->sigma_x / 
p->nb_samples);
+set_meta(metadata, c + 1, "Min_level", "%f", p->min);
+set_meta(metadata, c + 1, "Max_level", "%f", p->max);
+set_meta(metadata, c + 1, "Peak_level", "%f", 
LINEAR_TO_DB(FFMAX(-p->min, p->max)));
+set_meta(metadata, c + 1, "RMS_level", "%f", 
LINEAR_TO_DB(sqrt(p->sigma_x2 / p->nb_samples)));
+set_meta(metadata, c + 1, "RMS_peak", "%f", 
LINEAR_TO_DB(sqrt(p->max_sigma_x2)));
+set_meta(metadata, c + 1, "RMS_trough", "%f", 
LINEAR_TO_DB(sqrt(p->min_sigma_x2)));
+set_meta(metadata, c + 1, "Crest_factor", "%f", p->sigma_x2 ? 
FFMAX(-p->min, p->max) / sqrt(p->sigma_x2 / p->nb_samples) : 1);
+set_meta(metadata, c + 1, "Flat_factor", "%f", 
LINEAR_TO_DB((p->min_runs + p->max_runs) / (p->min_count + p->max_count)));
+set_meta(metadata, c + 1, "Peak_count", "%f", (float)(p->min_count + 
p->max_count));
+}
+
+set_meta(metadata, 0, "Overall.DC_offset", "%f", max_sigma_x / (nb_samples 
/ s->nb_channels));
+set_meta(metadata, 0, "Overall.Min_level", "%f", min);
+set_meta(metadata, 0, "Overall.Max_level", "%f", max);
+set_meta(metadata, 0, "Overall.Peak_level", "%f", LINEAR_TO_DB(FFMAX(-min, 
max)));

Re: [FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 06:28:08PM +0300, Ivan Uskov wrote:
> Hello Michael,
> 
> I'm sorry, what exactly documentation should be added regarding this
> patch? As I can see there is no any standalone topic about QSV into
> current /doc. Can modifications of Changelog be enough?

your patch adds comments like "translate MSDK error codes to ffmpeg error codes"
these should be in a seperate patch as they are unrelated
to " enable QSV acceleration under linux platform"

sorry if i wasnt clear

> 
> Tuesday, June 30, 2015, 5:42:56 PM, you wrote:
> 
> MN> On Tue, Jun 30, 2015 at 05:24:54PM +0300, Ivan Uskov wrote:
> >> +
> >> +/**
> >> + * @brief translate MSDK error codes to ffmpeg error codes
> >> + */
> >>  int ff_qsv_error(int mfx_err)
> >>  {
> >>  switch (mfx_err) {
> >> @@ -77,6 +89,22 @@ int ff_qsv_error(int mfx_err)
> >>  }
> 
> MN> The documentation addition should be in a seperate patch
> 
> 
> >>  }
> >>  
> 
> -- 
> Best regards,
>  Ivanmailto:ivan.us...@nablet.com
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Michael Niedermayer
On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:
> On 6/25/15, Michael Niedermayer  wrote:
> > On Wed, Jun 24, 2015 at 11:48:10PM -0600, Roger Pack wrote:
> >> On 6/24/15, Michael Niedermayer  wrote:
> >> > On Wed, Jun 24, 2015 at 04:19:38AM -0600, Roger Pack wrote:
> >> >> On 7/5/12, Michael Niedermayer  wrote:
> >> >> > On Mon, Jun 25, 2012 at 02:21:21PM +0200, Michael Niedermayer wrote:
> >> >> >> On Tue, Jun 19, 2012 at 07:10:04PM +0200, Reimar Döffinger wrote:
> >> >> >> > On 19 Jun 2012, at 11:31, Joe Wreschnig 
> >> >> >> > wrote:
> >> >> >> > > On Windows, the Ctrl+Break key combination usually does what
> >> >> >> > > Ctrl+C
> >> >> >> > > does. It is more common for processes to send other processes
> >> >> >> > > Ctrl+Break rather than Ctrl+C, because sending Ctrl+C / SIGINT
> >> >> >> > > doesn't
> >> >> >> > > work if you started a child in a new process group.
> >> >> >> > >
> >> >> >> > > This patch makes ffmpeg.exe register what Windows calls a
> >> >> >> > > console
> >> >> >> > > control event handler, which allows it to intercept Ctrl+Break.
> >> >> >> > > It
> >> >> >> > > hands it off directly to the usual SIGINT/SIGTERM handler. The
> >> >> >> > > same
> >> >> >> > > function also processes closing the console window, mapping it
> >> >> >> > > to
> >> >> >> > > SIGTERM.
> >> >> >> > >
> >> >> >> > > Obviously, this is only enabled if compiling for a platform
> >> >> >> > > where
> >> >> >> > > SetConsoleCtrlHandler is available (i.e. modern Windows).
> >> >> >> >
> >> >> >> > What is "modern"? Also it is rather unusual to recompile for
> >> >> >> > different
> >> >> >> > Windows versions, couldn't you with about the same effort just
> >> >> >> > use
> >> >> >> > GetProcAddress (more complex code, but in exchange you'd save on
> >> >> >> > all
> >> >> >> > the
> >> >> >> > configure changes and #ifs).
> >> >> >>
> >> >> >> It seems versions that dont support this are no longer supported
> >> >> >> by microsoft. IMHO we shouldnt bother too much with such old
> >> >> >> windows
> >> >> >> versions unless someone wants to / volunteers to do it.
> >> >> >>
> >> >> >> thus, if there are no objections i will apply this patch once a few
> >> >> >> minor issues are fixed (ifdef breaking compile to be precisse)
> >> >> >
> >> >> > iam waiting for a working patch
> >> >> > i could try to fix it before applying myself but with patches for
> >> >> > non linux platforms i prefer to avoid changing as the changes would
> >> >> > be untested ,..
> >> >>
> >> >> Sorry I dropped the ball on this one.
> >> >> See attached.  The major gains we get out of this (in my head at
> >> >> least) is hopefully better shutdown if somebody logs out (which has
> >> >> bitten me before).  Or if someone closes a console window which also
> >> >> shuts down FFmpeg.
> >> >>
> >> >> I noticed that even with handling notifications of "logout" that
> >> >> ffmpeg can still easily leave behind corrupted mp4 files (it gets
> >> >> killed quickly after).
> >> >
> >> >> Makes me wonder if there's some way to make it shutdown more quickly,
> >> >> but I'm not sure if it's a problem yet or not.
> >> >
> >> > iam not sure i understand ?
> >> > does windows kill the process immedeatly after CtrlHandler() returns?
> >> > if so CtrlHandler() should wait for the main loop to exit and cleanup
> >> > finishing before it returns
> >>
> >> Thanks for the pointer, you were exactly right.  Appears I can
> >> basically "Sleep" in that method and thus allow FFmpeg to cleanup (in
> >> vista+ I believe it gives a max of 5 seconds which is enough).  If
> >> there's some other easy way to know the main loop has exited I could
> >> use that I suppose, but it should have the same effect.
> >
> > you could set a global volatile variable to 1 at the end of
> > exit_program() and wait on that to happen in the handler
> 
> Interesting.  I think it's probably "the same finally behavior" either
> way, since exit will be called, and the entire process basically
> terminated, but it does feel cleaner slightly.
> .
> Attached is one that waits on a variable set in ffmpeg_cleanup (since
> I guess that's run after exit() is called?) if you like it more.  Feel
> free to modify it to fit.
> 

> In my experiments typically the process is terminated before it even
> has a chance to get past the Sleep(0) loop, but sometimes it does :)

does ffmpeg really need >5sec to exit cleanly?
if so it would be interresting to know why it needs so much time

[...]

> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -79,6 +79,10 @@
>  #include 
>  #include 
>  #endif
> +#ifdef HAVE_SETCONSOLECTRLHANDLER

#if HAVE_SETCONSOLECTRLHANDLER
otherwise build breaks non non-windows

i also think ive seen a "\M" line ending in the patch somewhere
but my editor ate it so i dunno where it was

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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

Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Michael Niedermayer
On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:
[...]
> +Sleep(0);

the funky line ending is here


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


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

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 10:55:45AM -0300, Claudio Freire wrote:
> LGTM, but it cannot be committed without the others, or a memset to
> zero of is_mask somewhere at the beginning of each frame (or encoder
> init).

ok, ill wait till the next patchset

@Rostislav, maybe mark it as "Reviewed-by:..." or so, so i know it
has already been reviewed and approved

Thanks

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

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


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


Re: [FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread Ivan Uskov
Hello Michael,

Thank you very much, there is fixed patch attached, please look.

Tuesday, June 30, 2015, 7:21:53 PM, you wrote:

MN> On Tue, Jun 30, 2015 at 06:28:08PM +0300, Ivan Uskov wrote:
>> Hello Michael,
>> 
>> I'm sorry, what exactly documentation should be added regarding this
>> patch? As I can see there is no any standalone topic about QSV into
>> current /doc. Can modifications of Changelog be enough?

MN> your patch adds comments like "translate MSDK error codes to ffmpeg error 
codes"
MN> these should be in a seperate patch as they are unrelated
MN> to " enable QSV acceleration under linux platform"

MN> sorry if i wasnt clear




-- 
Best regards,
 Ivanmailto:ivan.us...@nablet.com

0001-Extending-QSV-MFX-session-initialization-for-linux-p.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Roger Pack
On 6/30/15, Michael Niedermayer  wrote:
> On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:

> [...]

>> +Sleep(0);

>

> the funky line ending is here

OK try this one.
thanks!


0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] pthread_frame: forward error codes when flushing

2015-06-30 Thread Andreas Cadhalpun
This is the first part of the fix for ticket #4370.

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

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a3fd1ff..d48ee33 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -454,6 +454,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
 *got_picture_ptr = p->got_frame;
 picture->pkt_dts = p->avpkt.dts;
 
+if (p->result < 0)
+err = p->result;
+
 /*
  * A later call with avkpt->size == 0 may loop over all threads,
  * including this one, searching for a frame to return before being
@@ -471,6 +474,14 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
 
 fctx->next_finished = finished;
 
+/*
+ * When no frame was found while flushing, but an error occured in
+ * any thread, return it instead of 0.
+ * Otherwise the error can get lost.
+ */
+if (!avpkt->size && !*got_picture_ptr)
+return err;
+
 /* return the size of the consumed packet if no error occurred */
 return (p->result >= 0) ? avpkt->size : p->result;
 }
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] ffmpeg: exit_on_error if decoding a packet failed

2015-06-30 Thread Andreas Cadhalpun
This is the second part of the fix for ticket #4370.

Signed-off-by: Andreas Cadhalpun 
---
 ffmpeg.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index aac03bb..e3d0cc4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1873,6 +1873,9 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
 if (*got_output || ret<0 || pkt->size)
 decode_error_stat[ret<0] ++;
 
+if (ret < 0 && exit_on_error)
+exit_program(1);
+
 if (!*got_output || ret < 0)
 return ret;
 
@@ -2009,6 +2012,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output)
 if (*got_output || ret<0 || pkt->size)
 decode_error_stat[ret<0] ++;
 
+if (ret < 0 && exit_on_error)
+exit_program(1);
+
 if (*got_output && ret >= 0) {
 if (ist->dec_ctx->width  != decoded_frame->width ||
 ist->dec_ctx->height != decoded_frame->height ||
@@ -2118,6 +2124,9 @@ static int transcode_subtitles(InputStream *ist, AVPacket 
*pkt, int *got_output)
 if (*got_output || ret<0 || pkt->size)
 decode_error_stat[ret<0] ++;
 
+if (ret < 0 && exit_on_error)
+exit_program(1);
+
 if (ret < 0 || !*got_output) {
 if (!pkt->size)
 sub2video_flush(ist);
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] ffmpeg: only count got_output/errors in decode_error_stat

2015-06-30 Thread Andreas Cadhalpun
If threading is used, the first (thread_count - 1) packets are read
before any frame/error is returned. Counting this as successful decoding
is wrong, because it also happens when no single frame could be decoded.

Signed-off-by: Andreas Cadhalpun 
---
 ffmpeg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index e3d0cc4..37f096c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1870,7 +1870,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
 ret = AVERROR_INVALIDDATA;
 }
 
-if (*got_output || ret<0 || pkt->size)
+if (*got_output || ret<0)
 decode_error_stat[ret<0] ++;
 
 if (ret < 0 && exit_on_error)
@@ -2009,7 +2009,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output)
 );
 }
 
-if (*got_output || ret<0 || pkt->size)
+if (*got_output || ret<0)
 decode_error_stat[ret<0] ++;
 
 if (ret < 0 && exit_on_error)
@@ -2121,7 +2121,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket 
*pkt, int *got_output)
 int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
   &subtitle, got_output, pkt);
 
-if (*got_output || ret<0 || pkt->size)
+if (*got_output || ret<0)
 decode_error_stat[ret<0] ++;
 
 if (ret < 0 && exit_on_error)
-- 
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_astats: export metadata

2015-06-30 Thread Dave Rice
Hi Paul,

> On Jun 29, 2015, at 7:40 PM, Paul B Mahol  wrote:
> 
> Signed-off-by: Paul B Mahol 
> ---
> doc/filters.texi| 35 ++
> libavfilter/af_astats.c | 80 +++--
> 2 files changed, 113 insertions(+), 2 deletions(-)

I tested the metadata astats filters with the latest drawgraph patch. I find 
this adds a lot of ability to visualize audio information. Here's a few 
comments from testing.

I suggest adding a reset_count/reset option similar to what is in cropdetect, 
so that audio information could either be graphed frame-by-frame or summarized 
as it accumulates.

With my samples the filter defaulted to an audio frame size of 1024. I realize 
that I could set asetnsamples before astats to change that, but could the audio 
frame size be set within the astats filter.

Thanks so much,
Dave Rice
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 01:00:22PM -0600, Roger Pack wrote:
> On 6/30/15, Michael Niedermayer  wrote:
> > On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:
> 
> > [...]
> 
> >> +Sleep(0);
> 
> >
> 
> > the funky line ending is here
> 
> OK try this one.
> thanks!

>  configure |2 ++
>  ffmpeg.c  |   41 +
>  2 files changed, 43 insertions(+)
> ff3f339e550dc83d300346ec648f778f85900679  
> 0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
> From 7ce401dbd16873928bd541d5d567208963b85889 Mon Sep 17 00:00:00 2001
> From: rogerdpack 
> Date: Tue, 30 Jun 2015 12:58:43 -0600
> Subject: [PATCH] windows: respond to logoff and ctrl+break messages as well
> 
> Signed-off-by: rogerdpack 
> ---
>  configure |  2 ++
>  ffmpeg.c  | 41 +
>  2 files changed, 43 insertions(+)
> 
> diff --git a/configure b/configure
> index 89b5668..cc23991 100755
> --- a/configure
> +++ b/configure
> @@ -1787,6 +1787,7 @@ SYSTEM_FUNCS="
>  pthread_cancel
>  sched_getaffinity
>  SetConsoleTextAttribute
> +SetConsoleCtrlHandler
>  setmode
>  setrlimit
>  Sleep
> @@ -4990,6 +4991,7 @@ check_func_headers windows.h GetSystemTimeAsFileTime
>  check_func_headers windows.h MapViewOfFile
>  check_func_headers windows.h PeekNamedPipe
>  check_func_headers windows.h SetConsoleTextAttribute
> +check_func_headers windows.h SetConsoleCtrlHandler
>  check_func_headers windows.h Sleep
>  check_func_headers windows.h VirtualAlloc
>  check_struct windows.h "CONDITION_VARIABLE" Ptr
> diff --git a/ffmpeg.c b/ffmpeg.c
> index aac03bb..b58d891 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -79,6 +79,10 @@
>  #include 
>  #include 
>  #endif
> +#ifdef HAVE_SETCONSOLECTRLHANDLER
[...]
> +#ifdef HAVE_SETCONSOLECTRLHANDLER

they are defined but to 0 on linux, this needs #if

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


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


[FFmpeg-devel] [PATCH] ffmpeg_opt: allow the user to ignore unused stream maps

2015-06-30 Thread Rodger Combs
---
 ffmpeg_opt.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index a746405..11511d3 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -114,6 +114,7 @@ static int override_ffserver  = 0;
 static int input_stream_potentially_available = 0;
 static int ignore_unknown_streams = 0;
 static int copy_unknown_streams = 0;
+static int allow_unused_maps = 0;
 
 static void uninit_options(OptionsContext *o)
 {
@@ -312,8 +313,13 @@ static int opt_map(void *optctx, const char *opt, const 
char *arg)
 }
 
 if (!m) {
-av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", 
arg);
-exit_program(1);
+if (allow_unused_maps) {
+av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; 
ignoring.\n", arg);
+} else {
+av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
+   "To ignore this, please use 
-allow_unused_maps.\n", arg);
+exit_program(1);
+}
 }
 
 av_freep(&map);
@@ -2904,6 +2910,8 @@ const OptionDef options[] = {
 "Ignore unknown stream types" },
 { "copy_unknown",   OPT_BOOL | OPT_EXPERT,   { 
 ©_unknown_streams },
 "Copy unknown stream types" },
+{ "allow_unused_maps", OPT_BOOL | OPT_EXPERT,{ 
 &allow_unused_maps },
+"Allow stream maps that don't match anything" },
 { "c",  HAS_ARG | OPT_STRING | OPT_SPEC |
 OPT_INPUT | OPT_OUTPUT,  { .off
   = OFFSET(codec_names) },
 "codec name", "codec" },
-- 
2.4.1

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


Re: [FFmpeg-devel] Patch to enable QSV acceleration under linux platform

2015-06-30 Thread wm4
On Tue, 30 Jun 2015 16:42:56 +0200
Michael Niedermayer  wrote:


> > +#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
> > +#include 
> > +#include 
> 
> > +#include 
> 
> needs HAVE_UNISTD_H check if its needed

There are Linux systems without unistd.h?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Patch to parse H264 SEI Green Metadata

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 01:23:57PM +, Nicolas Derouineau wrote:
> Please find here enclosed the patch synthesizing all your comments.

applied

thanks

[...]

-- 
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 to enable QSV acceleration under linux platform

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 10:51:00PM +0200, wm4 wrote:
> On Tue, 30 Jun 2015 16:42:56 +0200
> Michael Niedermayer  wrote:
> 
> 
> > > +#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
> > > +#include 
> > > +#include 
> > 
> > > +#include 
> > 
> > needs HAVE_UNISTD_H check if its needed
> 
> There are Linux systems without unistd.h?

probably but i suggested it more for consistency as we check
HAVE_UNISTD_H elsewheer before including the header

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

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


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


Re: [FFmpeg-devel] [PATCH 2/3] ffmpeg: exit_on_error if decoding a packet failed

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 09:31:49PM +0200, Andreas Cadhalpun wrote:
> This is the second part of the fix for ticket #4370.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  ffmpeg.c | 9 +
>  1 file changed, 9 insertions(+)

LGTM

thanks

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


Re: [FFmpeg-devel] [PATCH 3/3] ffmpeg: only count got_output/errors in decode_error_stat

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 09:31:57PM +0200, Andreas Cadhalpun wrote:
> If threading is used, the first (thread_count - 1) packets are read
> before any frame/error is returned. Counting this as successful decoding
> is wrong, because it also happens when no single frame could be decoded.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  ffmpeg.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

LGTM

thx

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

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"


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


Re: [FFmpeg-devel] [PATCH 1/3] pthread_frame: forward error codes when flushing

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 09:31:20PM +0200, Andreas Cadhalpun wrote:
> This is the first part of the fix for ticket #4370.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/pthread_frame.c | 11 +++
>  1 file changed, 11 insertions(+)

probably ok

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


[FFmpeg-devel] [PATCH] lavu: add an API function to return the FFmpeg version string

2015-06-30 Thread wm4
This returns something like "N-73264-gb54ac84". This is much more useful
than the individual library versions, of which there are too much and
which are very hard to map back to releases or git commits.
---
This actually just returns the contents of the already semi-public
av_util_ffversion variable. But this variable is undocumented, has no
public declaration, requires accessing variables over library
boundaries (which is apparently frowned upon and/or causes various
issues), and lacks av_export.
---
 doc/APIchanges | 3 +++
 libavutil/avutil.h | 7 +++
 libavutil/utils.c  | 5 +
 3 files changed, 15 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6e64a05..b1ecc3c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - xx - lavu  53.xx.100
+  Add avutil_version_info().
+
  8< - FFmpeg 2.7 was cut here  8< -
 
 2015-06-04 - cc17b43 - lswr  1.2.100
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index e6ebb6c..eec2d55 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -171,6 +171,13 @@
 unsigned avutil_version(void);
 
 /**
+ * Return an informative version string. This usually the actual release 
version
+ * number and a git hash. This string has no fixed format and can change any
+ * time. It should never be parsed by code.
+ */
+const char *avutil_version_info(void);
+
+/**
  * Return the libavutil build-time configuration.
  */
 const char *avutil_configuration(void);
diff --git a/libavutil/utils.c b/libavutil/utils.c
index 0b765ed..07bb380 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -30,6 +30,11 @@
 #include "libavutil/ffversion.h"
 const char av_util_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
 
+const char *avutil_version_info(void)
+{
+return FFMPEG_VERSION;
+}
+
 unsigned avutil_version(void)
 {
 static int checks_done;
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: allow the user to ignore unused stream maps

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 03:13:12PM -0500, Rodger Combs wrote:
> ---
>  ffmpeg_opt.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)

this seems usefull
maybe doing it per map parameter would be better though so the
user could specify which maps he intends to be optional
should not be hard to extend the syntax of maps to make this possible

also docs update is missing

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

It is what and why we do it that matters, not just one of them.


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


Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Roger Pack
On 6/30/15, Michael Niedermayer  wrote:
> On Tue, Jun 30, 2015 at 01:00:22PM -0600, Roger Pack wrote:
>> On 6/30/15, Michael Niedermayer  wrote:
>> > On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:
>>
>> > [...]
>>
>> >> +Sleep(0);
>>
>> >
>>
>> > the funky line ending is here
>>
>> OK try this one.
>> thanks!
>
>>  configure |2 ++
>>  ffmpeg.c  |   41 +
>>  2 files changed, 43 insertions(+)
>> ff3f339e550dc83d300346ec648f778f85900679
>> 0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
>> From 7ce401dbd16873928bd541d5d567208963b85889 Mon Sep 17 00:00:00 2001
>> From: rogerdpack 
>> Date: Tue, 30 Jun 2015 12:58:43 -0600
>> Subject: [PATCH] windows: respond to logoff and ctrl+break messages as
>> well
>>
>> Signed-off-by: rogerdpack 
>> ---
>>  configure |  2 ++
>>  ffmpeg.c  | 41 +
>>  2 files changed, 43 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 89b5668..cc23991 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1787,6 +1787,7 @@ SYSTEM_FUNCS="
>>  pthread_cancel
>>  sched_getaffinity
>>  SetConsoleTextAttribute
>> +SetConsoleCtrlHandler
>>  setmode
>>  setrlimit
>>  Sleep
>> @@ -4990,6 +4991,7 @@ check_func_headers windows.h
>> GetSystemTimeAsFileTime
>>  check_func_headers windows.h MapViewOfFile
>>  check_func_headers windows.h PeekNamedPipe
>>  check_func_headers windows.h SetConsoleTextAttribute
>> +check_func_headers windows.h SetConsoleCtrlHandler
>>  check_func_headers windows.h Sleep
>>  check_func_headers windows.h VirtualAlloc
>>  check_struct windows.h "CONDITION_VARIABLE" Ptr
>> diff --git a/ffmpeg.c b/ffmpeg.c
>> index aac03bb..b58d891 100644
>> --- a/ffmpeg.c
>> +++ b/ffmpeg.c
>> @@ -79,6 +79,10 @@
>>  #include 
>>  #include 
>>  #endif
>> +#ifdef HAVE_SETCONSOLECTRLHANDLER
> [...]
>> +#ifdef HAVE_SETCONSOLECTRLHANDLER
>
> they are defined but to 0 on linux, this needs #if

OK see attached, thanks.
-roger-


0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] pthread_frame: forward error codes when flushing

2015-06-30 Thread Andreas Cadhalpun
On 30.06.2015 23:56, Michael Niedermayer wrote:
> On Tue, Jun 30, 2015 at 09:31:20PM +0200, Andreas Cadhalpun wrote:
>> This is the first part of the fix for ticket #4370.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/pthread_frame.c | 11 +++
>>  1 file changed, 11 insertions(+)
> 
> probably ok

Set pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] Support Ctrl+Break in ffmpeg.exe on Windows as if it was Ctrl+C

2015-06-30 Thread Michael Niedermayer
On Tue, Jun 30, 2015 at 04:33:35PM -0600, Roger Pack wrote:
> On 6/30/15, Michael Niedermayer  wrote:
> > On Tue, Jun 30, 2015 at 01:00:22PM -0600, Roger Pack wrote:
> >> On 6/30/15, Michael Niedermayer  wrote:
> >> > On Mon, Jun 29, 2015 at 11:09:14PM -0600, Roger Pack wrote:
> >>
> >> > [...]
> >>
> >> >> +Sleep(0);
> >>
> >> >
> >>
> >> > the funky line ending is here
> >>
> >> OK try this one.
> >> thanks!
> >
> >>  configure |2 ++
> >>  ffmpeg.c  |   41 +
> >>  2 files changed, 43 insertions(+)
> >> ff3f339e550dc83d300346ec648f778f85900679
> >> 0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
> >> From 7ce401dbd16873928bd541d5d567208963b85889 Mon Sep 17 00:00:00 2001
> >> From: rogerdpack 
> >> Date: Tue, 30 Jun 2015 12:58:43 -0600
> >> Subject: [PATCH] windows: respond to logoff and ctrl+break messages as
> >> well
> >>
> >> Signed-off-by: rogerdpack 
> >> ---
> >>  configure |  2 ++
> >>  ffmpeg.c  | 41 +
> >>  2 files changed, 43 insertions(+)
> >>
> >> diff --git a/configure b/configure
> >> index 89b5668..cc23991 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -1787,6 +1787,7 @@ SYSTEM_FUNCS="
> >>  pthread_cancel
> >>  sched_getaffinity
> >>  SetConsoleTextAttribute
> >> +SetConsoleCtrlHandler
> >>  setmode
> >>  setrlimit
> >>  Sleep
> >> @@ -4990,6 +4991,7 @@ check_func_headers windows.h
> >> GetSystemTimeAsFileTime
> >>  check_func_headers windows.h MapViewOfFile
> >>  check_func_headers windows.h PeekNamedPipe
> >>  check_func_headers windows.h SetConsoleTextAttribute
> >> +check_func_headers windows.h SetConsoleCtrlHandler
> >>  check_func_headers windows.h Sleep
> >>  check_func_headers windows.h VirtualAlloc
> >>  check_struct windows.h "CONDITION_VARIABLE" Ptr
> >> diff --git a/ffmpeg.c b/ffmpeg.c
> >> index aac03bb..b58d891 100644
> >> --- a/ffmpeg.c
> >> +++ b/ffmpeg.c
> >> @@ -79,6 +79,10 @@
> >>  #include 
> >>  #include 
> >>  #endif
> >> +#ifdef HAVE_SETCONSOLECTRLHANDLER
> > [...]
> >> +#ifdef HAVE_SETCONSOLECTRLHANDLER
> >
> > they are defined but to 0 on linux, this needs #if
> 
> OK see attached, thanks.
> -roger-

>  configure |2 ++
>  ffmpeg.c  |   41 +
>  2 files changed, 43 insertions(+)
> 63faac68b3d286a6700cd3bba7b1e7a3bfeb8786  
> 0001-windows-respond-to-logoff-and-ctrl-break-messages-as.patch
> From 0def0b7c12bf43e384c57ce1c11a45a7fb520430 Mon Sep 17 00:00:00 2001
> From: rogerdpack 
> Date: Tue, 30 Jun 2015 16:31:19 -0600
> Subject: [PATCH] windows: respond to logoff and ctrl+break messages as well

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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 new Videotoolbox hwaccel.

2015-06-30 Thread Zhang Rui
> +static void videotoolbox_default_free(AVCodecContext *avctx)
> +{
> +AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;
> +
> +if (videotoolbox) {
> +if (videotoolbox->cm_fmt_desc)
> +CFRelease(videotoolbox->cm_fmt_desc);
> +
> +if (videotoolbox->session)

Better add VTDecompressionSessionWaitForAsynchronousFrames() here,
in case it is removed from videotoolbox_session_decode_frame() in
future by chance.

Callback could be called even after VTDecompressionSessionInvalidate()
when I try to work with flag kVTDecodeFrame_EnableAsynchronousDecompression
and without VTDecompressionSessionWaitForAsynchronousFrames() per sample
in my own player.

> +VTDecompressionSessionInvalidate(videotoolbox->session);
> +}
> +}
> +
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel