Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
Le quintidi 25 germinal, an CCXXIII, Michael Niedermayer a écrit : > please avoid float/double > see tests/audiogen.c as an example or maybe better use tests/audiogen > so no code is duplicated Just for the record, there is also asrc_sine.c in lavfi that generates a bit-exact sine signal. I have the vague project of expanding it to generate semi-random sequences of "notes", but no time yet. But for this particular case, I wonder why there is so much code for a specific codec test while all other codecs are tested using the standard command-line tools. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Question regarding inter-filter communication
On Mon, 13 Apr 2015 08:28:18 -0700 Bahram Dahi wrote: > This is my first email to the list and I apologize in advance if I'm > breaking some sort of rule by doing a mass email. > > I am developing a couple of specialized filters for ffmpeg, where the first > filter would find some regions of interest (ROIs) on some frames and the > second filter (if present in the filter chain) would mark those ROIs. To be > able to achieve this, I need a way to pass the ROI information (let's say > an array of x,y points) in any reasonable format to the second optional > filter. Is there a way to do so? > Either side data (which would need a new type in libavutil - these things are not designed to be extensible), or the AVDictionary metadata field. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Tue, 14 Apr 2015 23:08:02 + Ludmila Glinskih wrote: > > > +{ > > > +if (result != enc_pkt.size) > > > +{ > > > +av_log(NULL, AV_LOG_INFO, "Decoder consumed only > > part of a packet, it is allowed to do so -- need to update this test\n"); > > > > The message probably lacks an "if" ("if it is allowed"). > > > As I understood from the documentation -- every decoder is allowed to do > so. Message is to inform that this test doesn't cover this case. Right, so the message is actually correct (though it looked weird to me and I only understand it now). ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Wed, 15 Apr 2015 09:23:04 +0200 Nicolas George wrote: > But for this particular case, I wonder why there is so much code for a > specific codec test while all other codecs are tested using the standard > command-line tools. Because we want to test the API, not the command line tools. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > Because we want to test the API, not the command line tools. And the command line tools, as everybody knows, operate by magic instead of using the API. If there is a point of the API that can not be accessed with the command-line tools, fix that first. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Tue, 14 Apr 2015 22:44:22 +0200 Michael Niedermayer wrote: > On Tue, Apr 14, 2015 at 09:24:32PM +0200, wm4 wrote: > > Seeking was slightly broken. The 4th patch seems to fix this (everything > > else is noise). > > > > > Note that ffmpeg can't correctly implement mp3 gapless audio if seeking > > is used. The xing toc is not precise enough. The only way to fix it is > > to do a full scan on the mp3 to index each frame (which in turn is not > > possible with the public API, because byte seeking is not supported and > > the parser would interfere anyway). But in this case, it even broke when > > seeking to the beginning. I'm still not sure if this patch is correct. > > do you have a file/sample/testcase for patch 4 ? https://0x0.st/AG.mp3 I'm assuming mpg123 is getting it right. One test case is seeking to the start of the file. (Seeking to anywhere else likely won't work, because libavformat tries to use the imperfect xing toc, instead of scanning the frames.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
On Tue, 14 Apr 2015 23:12:37 +0200 Michael Niedermayer wrote: > On Tue, Apr 14, 2015 at 09:24:37PM +0200, wm4 wrote: > > For consistency. This masked another bug before. > > --- > > libavformat/mp3dec.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > this breaks seeking in CBR files with a xing toc > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example The sample file is gone. Also at least the sample I have (linked in my other post, https://0x0.st/AG.mp3), the header claims CBR, but strictly speaking is VBR: the packet size is usually 418 bytes, but sometimes 417. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
wm4 googlemail.com> writes: > > this breaks seeking in CBR files with a xing toc > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example > > The sample file is gone. $ curl -O https://trac.ffmpeg.org/raw-attachment/ticket/2590/Underworld_sample_cut.mp3 % Total% Received % Xferd Average Speed TimeTime Time Current Dload Upload Total SpentLeft Speed 100 1500k 100 1500k0 0 1129k 0 0:00:01 0:00:01 --:--:-- 1200k ? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Wed, 15 Apr 2015 11:07:16 +0200 Nicolas George wrote: > Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > > Because we want to test the API, not the command line tools. > > And the command line tools, as everybody knows, operate by magic instead of > using the API. The command line tools are only 1 API user out of hundreds. > If there is a point of the API that can not be accessed with the > command-line tools, fix that first. Not possible. The command line tools behave in a very specific way. It can't test the API, it can only test the command line tools' way they use the APIs. They don't necessarily use the full API, and they can mask problems in the API. I'm not sure how your suggestion can even taken seriously, since the tools tend to mess with API internals, use some internal headers, and the libraries frequently tend to contain hacks to make up for deficits in the tools. (MPlayer is the only other API user which gets this special treatment.) There's just no point in testing a single API user. We need these API tests, if only for the fact that these "artificial" tests may be able to cover 100% of the API, something no real API user would do. Your attitude also shows an amazing chauvinism: who cares about the API users (and any downstream projects), as long as the command line tools are fine? Because your world view seems to be restricted to the ffmpeg git repo. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
On Wed, Apr 15, 2015 at 11:17:24AM +0200, wm4 wrote: > On Tue, 14 Apr 2015 23:12:37 +0200 > Michael Niedermayer wrote: > > > On Tue, Apr 14, 2015 at 09:24:37PM +0200, wm4 wrote: > > > For consistency. This masked another bug before. > > > --- > > > libavformat/mp3dec.c | 12 ++-- > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > this breaks seeking in CBR files with a xing toc > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example > > The sample file is gone. > > Also at least the sample I have (linked in my other post, > https://0x0.st/AG.mp3), the header claims CBR, but strictly > speaking is VBR: the packet size is usually 418 bytes, but > sometimes 417. some CBR modes allow +-1 in specific patterns in mp3 ill look at the file later [...] -- 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 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
On Wed, 15 Apr 2015 09:25:02 + (UTC) Carl Eugen Hoyos wrote: > wm4 googlemail.com> writes: > > > > this breaks seeking in CBR files with a xing toc > > > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example > > > > The sample file is gone. > > $ curl -O > https://trac.ffmpeg.org/raw-attachment/ticket/2590/Underworld_sample_cut.mp3 > % Total% Received % Xferd Average Speed TimeTime Time > Current > Dload Upload Total SpentLeft Speed > 100 1500k 100 1500k0 0 1129k 0 0:00:01 0:00:01 --:--:-- 1200k > > ? >From what I can tell, this can't be used to reproduce the problem. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
wm4 googlemail.com> writes: > > do you have a file/sample/testcase for patch 4 ? > > https://0x0.st/AG.mp3 What is wrong with seeking in this file? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : [ I skip over the usual jealousy rants. ] > Your attitude also shows an amazing chauvinism: who cares about the API > users (and any downstream projects), as long as the command line tools > are fine? And you fail to understand. Once again. The command-line tools should be able to test the API. All of it. If there is a point of the API that is not possible to test with the command-line tools, the command-line tools must be extended to be able to. Period. Inventing a specific test that nobody will maintain is a waste of time. > Because your world view seems to be restricted to the ffmpeg git repo. It seems to me this is the topic of this mailing-list. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
wm4 googlemail.com> writes: > > > > this breaks seeking in CBR files with a xing toc > > > > > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example > From what I can tell, this can't be used to reproduce the problem. I tested the following: $ ffmpeg -ss 50 -i Underworld_sample_cut.mp3 -t 10 out.wav ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers built on Feb 10 2013 11:28:07 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 51. 73.101 / 51. 73.101 libavcodec 54. 59.100 / 54. 59.100 libavformat54. 29.104 / 54. 29.104 libavdevice54. 2.101 / 54. 2.101 libavfilter 3. 17.100 / 3. 17.100 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc52. 0.100 / 52. 0.100 [mp3 @ 0x2b72280] max_analyze_duration 500 reached at 5015510 Input #0, mp3, from 'Underworld_sample_cut.mp3': Metadata: artist : Lilith album : Underworld genre : Gothic Metal date: 2007 Duration: 00:42:36.63, start: 0.00, bitrate: 4 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s Output #0, wav, to 'out.wav': Metadata: artist : Lilith album : Underworld genre : Gothic Metal date: 2007 encoder : Lavf54.29.104 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help size=5936kB time=00:00:10.02 bitrate=4851.8kbits/s video:0kB audio:5936kB subtitle:0 global headers:0kB muxing overhead 0.000757% The output file does not start at 0:50 and is too long. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, 15 Apr 2015 09:31:06 + (UTC) Carl Eugen Hoyos wrote: > wm4 googlemail.com> writes: > > > > do you have a file/sample/testcase for patch 4 ? > > > > https://0x0.st/AG.mp3 > > What is wrong with seeking in this file? It's not gapless. It destroys the discarding of samples from beginning/end. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present
On Wed, 15 Apr 2015 09:36:09 + (UTC) Carl Eugen Hoyos wrote: > wm4 googlemail.com> writes: > > > > > > this breaks seeking in CBR files with a xing toc > > > > > > > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example > > > From what I can tell, this can't be used to reproduce the problem. > > I tested the following: > $ ffmpeg -ss 50 -i Underworld_sample_cut.mp3 -t 10 out.wav > ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers > built on Feb 10 2013 11:28:07 with gcc 4.7 (SUSE Linux) > configuration: --enable-gpl > libavutil 51. 73.101 / 51. 73.101 > libavcodec 54. 59.100 / 54. 59.100 > libavformat54. 29.104 / 54. 29.104 > libavdevice54. 2.101 / 54. 2.101 > libavfilter 3. 17.100 / 3. 17.100 > libswscale 2. 1.101 / 2. 1.101 > libswresample 0. 15.100 / 0. 15.100 > libpostproc52. 0.100 / 52. 0.100 > [mp3 @ 0x2b72280] max_analyze_duration 500 reached at 5015510 > Input #0, mp3, from 'Underworld_sample_cut.mp3': > Metadata: > artist : Lilith > album : Underworld > genre : Gothic Metal > date: 2007 > Duration: 00:42:36.63, start: 0.00, bitrate: 4 kb/s > Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s > Output #0, wav, to 'out.wav': > Metadata: > artist : Lilith > album : Underworld > genre : Gothic Metal > date: 2007 > encoder : Lavf54.29.104 > Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, > s16, 1411 kb/s > Stream mapping: > Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) > Press [q] to stop, [?] for help > size=5936kB time=00:00:10.02 bitrate=4851.8kbits/s > video:0kB audio:5936kB subtitle:0 global headers:0kB muxing overhead 0.000757% > > The output file does not start at 0:50 and is too long. Alright, I can confirm that CBR seeking has better precision. The original file was 60MB, and the xing toc has only 100 entries, so it's not surprising seeking is a bit imprecise. However, if this file used VBR mode, seeking would be wrong anyway, so this is at best a special case to make CBR seeks work better. If you insist you can drop the 5th patch. But the problem remains: libavformat fundamentally can not seek correctly in mp3s. (And a lot of other audio formats.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Wed, 15 Apr 2015 11:34:28 +0200 Nicolas George wrote: > Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > > [ I skip over the usual jealousy rants. ] > > > Your attitude also shows an amazing chauvinism: who cares about the API > > users (and any downstream projects), as long as the command line tools > > are fine? > > And you fail to understand. Once again. Hurr durr. > The command-line tools should be able to test the API. All of it. If there > is a point of the API that is not possible to test with the command-line > tools, the command-line tools must be extended to be able to. Period. How hard is it to understand that a program built for a specific purpose can not be made to use an API in all possible ways? Unless you add dozens of redundant code paths to ffmpeg.c (do you want this?), you won't be able to get full API coverage, and more importantly, you won't be able to test all kinds of ways the API could be used in alternative ways. Artificial test programs can cover multiple ways of using the same API, and we can make automated tests. This is an improvement over downstreams breaking just because some implementation detail changed, and they didn't do the same as ffmpeg.c > Inventing a specific test that nobody will maintain is a waste of time. No it won't. And they will be maintained, because they will be part of FATE. (Unlike all our broken example programs, which -hilariously- some people actually try to use as a base for their code.) > > Because your world view seems to be restricted to the ffmpeg git repo. > > It seems to me this is the topic of this mailing-list. The concerns of API users have a place on this list too. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > How hard is it to understand that a program built for a specific > purpose can not be made to use an API in all possible ways? Unless you > add dozens of redundant code paths to ffmpeg.c (do you want this?), you > won't be able to get full API coverage, and more importantly, you won't > be able to test all kinds of ways the API could be used in alternative > ways. Unless you give some specific examples, I will consider this as simple FUD. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Wed, 15 Apr 2015 12:01:51 +0200 Nicolas George wrote: > Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > > How hard is it to understand that a program built for a specific > > purpose can not be made to use an API in all possible ways? Unless you > > add dozens of redundant code paths to ffmpeg.c (do you want this?), you > > won't be able to get full API coverage, and more importantly, you won't > > be able to test all kinds of ways the API could be used in alternative > > ways. > > Unless you give some specific examples, I will consider this as simple FUD. Both ffmpeg.c and the API are very complex, so it's obvious that ffmpeg.c can't possibly be using all possible ways the API can be used. If you really want a concrete example: av_seek_frame() is not used in any of the command line tools. Except ffserver.c, which is AFAIK not involved in any tests, and libavfilter/src_movie.c, which probably could be used in a FATE test, but passes a static set of flags and can't e.g. execute multiple seeks with multiple target destinations, and would make a very bad test. (Why do I even have to explain this.) > Regards, > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > Both ffmpeg.c and the API are very complex, so it's obvious that > ffmpeg.c can't possibly be using all possible ways the API can be used. FUD again. > If you really want a concrete example: av_seek_frame() is not used in > any of the command line tools. At last, ONE specific example. Now, the corresponding question: where is your patch to make ffmpeg.c use av_seek_frame()? Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test
On Wed, 15 Apr 2015 12:21:01 +0200 Nicolas George wrote: > Le sextidi 26 germinal, an CCXXIII, wm4 a écrit : > > Both ffmpeg.c and the API are very complex, so it's obvious that > > ffmpeg.c can't possibly be using all possible ways the API can be used. > > FUD again. > > > If you really want a concrete example: av_seek_frame() is not used in > > any of the command line tools. > > At last, ONE specific example. > > Now, the corresponding question: where is your patch to make ffmpeg.c use > av_seek_frame()? What if I want to call av_seek_frame() in pseudo-random intervals with different flags each? How do I make it to pass a specific stream argument? There are a number of other public API functions that are not used in any of the tools, probably because they don't need it. How would you test these? Would you really litter ffmpeg.c with extra code just for testing, all with the argument that it should be part of ffmpeg.c instead of separate tests? Here's another example that I actually hit: what if you set a channel layout on a SwrContext, open it, close it, set another channel layout, and open it again? (This used to crash, it actually happened to me in my code.) How would you mess this into ffmpeg.c? What the hell are you even thinking? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC][PATCH] avformat/flvdec: avoid reseting eof_reached to 0 silently
On Tue, 14 Apr 2015 11:24:23 +0800 Zhang Rui wrote: > 2015-04-14 1:09 GMT+08:00 wm4 : > > On Mon, 13 Apr 2015 12:02:29 +0800 > > Zhang Rui wrote: > > > >> 2015-04-12 22:45 GMT+08:00 Michael Niedermayer : > >> > On Sun, Apr 12, 2015 at 12:00:18PM +0800, Zhang Rui wrote: > >> >> 2015-04-10 22:04 GMT+08:00 wm4 : > >> >> > On Fri, 10 Apr 2015 21:17:42 +0800 > >> >> > Zhang Rui wrote: > >> >> >> > >> >> >> This kind of error handling need some more work in aviobuf.c, > >> >> >> and more advises from ffmpeg developers. > >> >> >> And i prefer this way than the patch I posted. > >> >> > > >> >> > stdio.h does it this way: FILE has an error flag that is set when > >> >> > something goes wrong. > >> >> > >> >> AVIOContext has an error field, too. But I don't think it's enough > >> >> for EAGAIN situation without some convention. > >> >> At least, ffplay doesn't show that. > >> >> > >> >> >> > Also, why doesn't avio_skip() return an error if the skip count is > >> >> >> > not > >> >> >> > 0 and the stream has reached EOF? > >> >> >> > >> >> >> The eof handling is quite confusing in ffplay for me. AVERROR_EOF is > >> >> >> clear enough. > >> >> > > >> >> > Well, I have no idea what avio_skip() even returns... it just calls > >> >> > avio_seek(), which is a goddamn fucked up mess thanks to years of > >> >> > people adding hacks. > >> >> > >> >> Is there any correct direction to fix it? > >> >> > >> >> > ffplay probably does it wrong. Wouldn't be surprising. It checks > >> >> > avio_feof() after a av_read_frame() call, which doesn't look correct. > >> >> > File EOF has absolutely nothing to do with whether a demuxer still has > >> >> > data. > >> >> > > >> >> > On a side note, I'm not sure whether av_read_frame() returning > >> >> > AVERROR_EOF is an error at all, or just signals that the end of the > >> >> > file was reached. The doxygen on this function isn't helpful either. > >> >> > >> >> Is there any ideas, or any helpful keywords or threads in mail list > >> >> archive? > >> > > >> > a simple error_count field could be added that way one could easily > >> > check if the count increased over any series of function call(s) > > > > Seems like a good idea. > > > >> Good enough for internal use of avio_r8(). > >> > >> > it also could be presented at verbose level by the user application, > >> > showing how many io errors where encountered which where not fatal > >> > >> Two problems for application: > >> > >> 1. Which error should be defined as fatal? > >> For avio_r8(), even an EAGAIN can be a fatal. > >> The error_count has no more information than error field for application. > > > > Well, EAGAIN is fatal isn't it? Virtually nothing checks the avio_r8() > > return value to retry (and expecting it that would be totally > > unreasonable), so this has to be handled on a deeper level, possibly > > before the error is even set. (Or in other words, EAGAIN is not an > > error in some contexts. Although it could be - if you setup a signal > > handler to interrupt system calls instead of retrying them > > transparently, you probably really want to unblock all blocking calls, > > instead of having code to block immediately again by retrying.) > > "verbose level by the user application" is the only concern here. > It has nothing to do with avio itself. What does "verbose level by the user application" mean? av_log messages? > I agree with you on "error_count is a good idea". > > >> 2. Nested format, e.g. hls, concatdec. > >> The error_count field is supposed to be added to AVIOContext. > >> But if the internal input failed, it's weired to set error to the > >> outer AVIOContext, > >> since it has nothing todo with the outer http/file/... protocol. > > > > What do nested protocols have to do anything with this? In cases when a > > protocol reads from another protocol, the error would obviously be > > naturally passed along. > > Concern only about "verbose level by the user application", too. > > Actually, It is a format (AVFormatContext), but not an avio (AVIOContext) > which reads from another format (AVFormatContext), for hls, concatdec > situation. > The error/error_count field of the internal AVIOContext > is simply ignored without being passed along. > > Whatever, it's not a serious problem, but only some opinion about > "verbose" idea. > > It does have nothing to do with avio. (Maybe kind of off topic). > > >> > >> In my opinion, we could stop returning avio error code directly from > >> av_read_frame(), > >> and limit the error code which could return from av_read_frame(), > >> explicitly. > >> e.g. > >> > >> // Map various error codes to limited error codes. > >> int av_read_frame2(AVFormatContext *s, AVPacket *pkt) { > >> int ret = av_read_frame(s, pkt); > >> switch (ret) { > >> case AVERROR_EOS: // end of stream. > >> case AVERROR_AGAIN: // error can be recovered. > >> case AVERROR_EXIT: // interrupted by user. > >> case AVERROR_FAIL: // generic error > >>
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > On Tue, 14 Apr 2015 22:44:22 +0200 > Michael Niedermayer wrote: > > > On Tue, Apr 14, 2015 at 09:24:32PM +0200, wm4 wrote: > > > Seeking was slightly broken. The 4th patch seems to fix this (everything > > > else is noise). > > > > > > > > Note that ffmpeg can't correctly implement mp3 gapless audio if seeking > > > is used. The xing toc is not precise enough. The only way to fix it is > > > to do a full scan on the mp3 to index each frame (which in turn is not > > > possible with the public API, because byte seeking is not supported and > > > the parser would interfere anyway). But in this case, it even broke when > > > seeking to the beginning. I'm still not sure if this patch is correct. > > > > do you have a file/sample/testcase for patch 4 ? > > https://0x0.st/AG.mp3 > > I'm assuming mpg123 is getting it right. One test case is seeking to > the start of the file. (Seeking to anywhere else likely won't work, > because libavformat tries to use the imperfect xing toc, instead of > scanning the frames.) how can this be tested ? ./ffmpeg -ss 0 -i AG.mp3 -flags +bitexact new.wav ./ffmpeg-ref -ss 0 -i AG.mp3 -flags +bitexact old.wav 52298dcb38185e665b1b6d184884dd3e new.wav 52298dcb38185e665b1b6d184884dd3e old.wav ./ffmpeg -ss 5 -i AG.mp3 -flags +bitexact new.wav ./ffmpeg-ref -ss 5 -i AG.mp3 -flags +bitexact old.wav b4b8f2a83924b48f3d25baa6b9b4f4a8 new.wav b4b8f2a83924b48f3d25baa6b9b4f4a8 old.wav [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: [...] > the start of the file. (Seeking to anywhere else likely won't work, > because libavformat tries to use the imperfect xing toc, instead of > scanning the frames.) btw, you can disable the imperfect xing toc for seeking with "-usetoc 0" [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, 15 Apr 2015 12:43:36 +0200 Michael Niedermayer wrote: > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > [...] > > the start of the file. (Seeking to anywhere else likely won't work, > > because libavformat tries to use the imperfect xing toc, instead of > > scanning the frames.) > > btw, you can disable the imperfect xing toc for seeking with > "-usetoc 0" But that breaks VBR even more, shouldn't it? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, Apr 15, 2015 at 01:12:27PM +0200, wm4 wrote: > On Wed, 15 Apr 2015 12:43:36 +0200 > Michael Niedermayer wrote: > > > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > [...] > > > the start of the file. (Seeking to anywhere else likely won't work, > > > because libavformat tries to use the imperfect xing toc, instead of > > > scanning the frames.) > > > > btw, you can disable the imperfect xing toc for seeking with > > "-usetoc 0" > > But that breaks VBR even more, shouldn't it? libavformat should build a index by linearly scanning the file up to the point where one seeks to, so it should work with vbr [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, 15 Apr 2015 12:42:04 +0200 Michael Niedermayer wrote: > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > On Tue, 14 Apr 2015 22:44:22 +0200 > > Michael Niedermayer wrote: > > > > > On Tue, Apr 14, 2015 at 09:24:32PM +0200, wm4 wrote: > > > > Seeking was slightly broken. The 4th patch seems to fix this (everything > > > > else is noise). > > > > > > > > > > > Note that ffmpeg can't correctly implement mp3 gapless audio if seeking > > > > is used. The xing toc is not precise enough. The only way to fix it is > > > > to do a full scan on the mp3 to index each frame (which in turn is not > > > > possible with the public API, because byte seeking is not supported and > > > > the parser would interfere anyway). But in this case, it even broke when > > > > seeking to the beginning. I'm still not sure if this patch is correct. > > > > > > do you have a file/sample/testcase for patch 4 ? > > > > https://0x0.st/AG.mp3 > > > > I'm assuming mpg123 is getting it right. One test case is seeking to > > the start of the file. (Seeking to anywhere else likely won't work, > > because libavformat tries to use the imperfect xing toc, instead of > > scanning the frames.) > > how can this be tested ? > ./ffmpeg -ss 0 -i AG.mp3 -flags +bitexact new.wav > ./ffmpeg-ref -ss 0 -i AG.mp3 -flags +bitexact old.wav > > 52298dcb38185e665b1b6d184884dd3e new.wav > 52298dcb38185e665b1b6d184884dd3e old.wav > > ./ffmpeg -ss 5 -i AG.mp3 -flags +bitexact new.wav > ./ffmpeg-ref -ss 5 -i AG.mp3 -flags +bitexact old.wav > > b4b8f2a83924b48f3d25baa6b9b4f4a8 new.wav > b4b8f2a83924b48f3d25baa6b9b4f4a8 old.wav The result is the same because in both cases the CBR seeking path is used, which didn't change. You need to apply patch 5/5. I don't have a good "real" VBR sample at hand for testing, unfortunately. With all patches applied, the output with "-ss 0" should be the same as without. (Make sure that ffmpeg.c doesn't drop or add audio samples due to the seek, because it could cause subtitle depending how seeking works - for one, skip_samples causes the decoder to change the audio timestamps for whatever reason, so the output doesn't actually start at timestamp 0.) As a "reliable" reference for testing I would use mpg123. But it doesn't have a bitexact mode (and even if it did, it'd probably not match ffmpeg's), so testing isn't that easy. (Also I'm not sure myself if I made some mistake, so it'd be nice if you could confirm this.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v4] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC
This commit implements the perceptual noise substitution AAC extension. This is a proof of concept implementation, and as such, is not enabled by default. This is the fourth revision of this patch, made after some problems were noted out. Any changes made since the previous revisions have been indicated. In order to extend the encoder to use an additional codebook, the array holding each codebook has been modified with two additional entries - 13 for the NOISE_BT codebook and 12 which has a placeholder function. The cost system was modified to skip the 12th entry using an array to map the input and outputs it has. It also does not accept using the 13th codebook for any band which is not marked as containing noise, thereby restricting its ability to arbitrarily choose it for bands. The use of arrays allows the system to be easily extended to allow for intensity stereo encoding, which uses additional codebooks. The 12th entry in the codebook function array points to a function which stops the execution of the program by calling an assert with an always 'false' argument. It was pointed out in an email discussion with Claudio Freire that having a 'NULL' entry can result in unexpected behaviour and could be used as a security hole. There is no danger of this function being called during encoding due to the codebook maps introduced. Another change from version 1 of the patch is the addition of an argument to the encoder, '-aac_pns' to enable and disable the PNS. This currently defaults to disable the PNS, as it is experimental. The switch will be removed in the future, when the algorithm to select noise bands has been improved. The current algorithm simply compares the energy to the threshold (multiplied by a constant) to determine noise, however the FFPsyBand structure contains other useful figures to determine which bands carry noise more accurately. Some of the sample files provided triggered an assertion when the parameter to tune the threshold was set to a value of '2.2'. Claudio Freire reported the problem's source could be in the range of the scalefactor indices for noise and advised to measure the minimal index and clip anything above the maximum allowed value. This has been implemented and all the files which used to trigger the asserion now encode without error. The third revision of the problem also removes unneded variabes and comparisons. All of them were redundant and were of little use for when the PNS implementation would be extended. The fourth revision moved the clipping of the noise scalefactors outside the second loop of the two-loop algorithm in order to prevent their redundant calculations. Also, freq_mult has been changed to a float variable due to the fact that rounding errors can prove to be a problem at low frequencies. Considerations were taken whether the entire expression could be evaluated inside the expression, but in the end it was decided that it would be for the best if just the type of the variable were to change. Claudio Freire reported the two problems. There is no change of functionality (except for low sampling frequencies) so the spectral demonstrations at the end of this commit's message were not updated. Finally, the way energy values are converted to scalefactor indices has changed since the first commit, as per the suggestion of Claudio Freire. This may still have some drawbacks, but unlike the first commit it works without having redundant offsets and outputs what the decoder expects to have, in terms of the ranges of the scalefactor indices. Some spectral comparisons: https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/Original.png (original), https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS_NO.png (encoded without PNS), https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS1.2.png (encoded with PNS, const = 1.2), https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/Difference1.png (spectral difference). The constant is the value which multiplies the threshold when it gets compared to the energy, larger values means more noise will be substituded by PNS values. Example when const = 2.2: https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS_2.2.png Comments and feedback are welcome. --- libavcodec/aaccoder.c | 136 -- libavcodec/aacenc.c | 3 ++ libavcodec/aacenc.h | 1 + 3 files changed, 103 insertions(+), 37 deletions(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 64eee32..f07e523 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -40,6 +40,12 @@ #include "aacenc.h" #include "aactab.h" +/** Frequency in Hz for lower limit of noise substitution **/ +#define NOISE_LOW_LIMIT 4000 + +/** Total number of usable codebooks **/ +#define CB_TOT 13 + /** bits needed to code codebook run value for long windows */ static const uint8_t run_value_bits_long[64] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, 15 Apr 2015 13:16:20 +0200 Michael Niedermayer wrote: > On Wed, Apr 15, 2015 at 01:12:27PM +0200, wm4 wrote: > > On Wed, 15 Apr 2015 12:43:36 +0200 > > Michael Niedermayer wrote: > > > > > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > > [...] > > > > the start of the file. (Seeking to anywhere else likely won't work, > > > > because libavformat tries to use the imperfect xing toc, instead of > > > > scanning the frames.) > > > > > > btw, you can disable the imperfect xing toc for seeking with > > > "-usetoc 0" > > > > But that breaks VBR even more, shouldn't it? > > libavformat should build a index by linearly scanning the file > up to the point where one seeks to, so it should work with vbr And how could this be achieved? I'm also not very fond of utils.c messing with what the demuxer does. It really made developing and debugging this harder. It should be the other way around, with the demuxer directly being called by the user, and the demuxer invoking generic helpers if it needs to. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, Apr 15, 2015 at 01:16:45PM +0200, wm4 wrote: > On Wed, 15 Apr 2015 12:42:04 +0200 > Michael Niedermayer wrote: > > > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > > On Tue, 14 Apr 2015 22:44:22 +0200 > > > Michael Niedermayer wrote: > > > > > > > On Tue, Apr 14, 2015 at 09:24:32PM +0200, wm4 wrote: > > > > > Seeking was slightly broken. The 4th patch seems to fix this > > > > > (everything > > > > > else is noise). > > > > > > > > > > > > > > Note that ffmpeg can't correctly implement mp3 gapless audio if > > > > > seeking > > > > > is used. The xing toc is not precise enough. The only way to fix it is > > > > > to do a full scan on the mp3 to index each frame (which in turn is not > > > > > possible with the public API, because byte seeking is not supported > > > > > and > > > > > the parser would interfere anyway). But in this case, it even broke > > > > > when > > > > > seeking to the beginning. I'm still not sure if this patch is correct. > > > > > > > > do you have a file/sample/testcase for patch 4 ? > > > > > > https://0x0.st/AG.mp3 > > > > > > I'm assuming mpg123 is getting it right. One test case is seeking to > > > the start of the file. (Seeking to anywhere else likely won't work, > > > because libavformat tries to use the imperfect xing toc, instead of > > > scanning the frames.) > > > > how can this be tested ? > > ./ffmpeg -ss 0 -i AG.mp3 -flags +bitexact new.wav > > ./ffmpeg-ref -ss 0 -i AG.mp3 -flags +bitexact old.wav > > > > 52298dcb38185e665b1b6d184884dd3e new.wav > > 52298dcb38185e665b1b6d184884dd3e old.wav > > > > ./ffmpeg -ss 5 -i AG.mp3 -flags +bitexact new.wav > > ./ffmpeg-ref -ss 5 -i AG.mp3 -flags +bitexact old.wav > > > > b4b8f2a83924b48f3d25baa6b9b4f4a8 new.wav > > b4b8f2a83924b48f3d25baa6b9b4f4a8 old.wav > > The result is the same because in both cases the CBR seeking path is > used, which didn't change. You need to apply patch 5/5. I don't have a > good "real" VBR sample at hand for testing, unfortunately. ok, i can confirm that seek to 0 works better with the patches 3&4 with xing TOC so applied them [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, Apr 15, 2015 at 01:32:11PM +0200, wm4 wrote: > On Wed, 15 Apr 2015 13:16:20 +0200 > Michael Niedermayer wrote: > > > On Wed, Apr 15, 2015 at 01:12:27PM +0200, wm4 wrote: > > > On Wed, 15 Apr 2015 12:43:36 +0200 > > > Michael Niedermayer wrote: > > > > > > > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > > > [...] > > > > > the start of the file. (Seeking to anywhere else likely won't work, > > > > > because libavformat tries to use the imperfect xing toc, instead of > > > > > scanning the frames.) > > > > > > > > btw, you can disable the imperfect xing toc for seeking with > > > > "-usetoc 0" > > > > > > But that breaks VBR even more, shouldn't it? > > > > libavformat should build a index by linearly scanning the file > > up to the point where one seeks to, so it should work with vbr > > And how could this be achieved? it should just work not require anything from the user, if i just commit the cbr and toc code out i still can seek so the fallback seems working > > I'm also not very fond of utils.c messing with what the demuxer does. > It really made developing and debugging this harder. It should be the > other way around, with the demuxer directly being called by the user, > and the demuxer invoking generic helpers if it needs to. i understand, iam not sure though if it was the other way around if that wouldnt lead to other annoyances like if the fallback case needs to be changed then all demuxers for which it applies would need to be changed The part that IMO we are really missing is clear documentation about the seeking function interactions [...] -- 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 2/2] libavutil: Make changes in softfloat needed for fixed point aac decoder.
From: Djordje Pesut Functions for sqrt and sincos are added. Div function is improved. Some changes are made in order for code in softfloat to be usable in fixed aac decoder code. This doesn't create any impact on current ffmpeg code since softfloat is currently not in use and this way we don't need to make much changes in implementation of aac fixed point decoder that uses this code. Softfloat tests are adjusted. Signed-off-by: Nedeljko Babic --- libavutil/softfloat.c| 6 +- libavutil/softfloat.h| 167 +--- libavutil/softfloat_tables.h | 294 +++ 3 files changed, 447 insertions(+), 20 deletions(-) create mode 100644 libavutil/softfloat_tables.h diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c index bf9cfda..23de93d 100644 --- a/libavutil/softfloat.c +++ b/libavutil/softfloat.c @@ -27,7 +27,7 @@ #undef printf int main(void){ -SoftFloat one= av_int2sf(1, 0); +SoftFloat one= av_int2sf(1, 30); SoftFloat sf1, sf2; double d1, d2; int i, j; @@ -59,8 +59,8 @@ int main(void){ for(i= 0; i<100; i++){ START_TIMER -sf1= av_int2sf(i, 0); -sf2= av_div_sf(av_int2sf(i, 2), av_int2sf(200, 3)); +sf1= av_int2sf(i, 30); +sf2= av_div_sf(av_int2sf(i, 28), av_int2sf(200, 27)); for(j= 0; j<1000; j++){ sf1= av_mul_sf(av_add_sf(sf1, one),sf2); } diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 654a31f..c3ab316 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -25,6 +25,7 @@ #include "common.h" #include "avassert.h" +#include "softfloat_tables.h" #define MIN_EXP -126 #define MAX_EXP 126 @@ -35,6 +36,14 @@ typedef struct SoftFloat{ int32_t exp; }SoftFloat; +static const SoftFloat FLOAT_0 = { 0, 0}; +static const SoftFloat FLOAT_05 = { 0x2000, 0}; +static const SoftFloat FLOAT_1 = { 0x2000, 1}; +static const SoftFloat FLOAT_EPSILON= { 0x29F16B12, -16}; +static const SoftFloat FLOAT_1584893192 = { 0x32B771ED, 1}; +static const SoftFloat FLOAT_10 = { 0x30D4, 17}; +static const SoftFloat FLOAT_099= { 0x3BCE, 0}; + static av_const SoftFloat av_normalize_sf(SoftFloat a){ if(a.mant){ #if 1 @@ -83,17 +92,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){ a.exp += b.exp; av_assert2((int32_t)((a.mant * (int64_t)b.mant) >> ONE_BITS) == (a.mant * (int64_t)b.mant) >> ONE_BITS); a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS; -return av_normalize1_sf(a); -} - -/** - * b has to be normalized and not zero. - * @return Will not be more denormalized than a. - */ -static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){ -a.exp -= b.exp+1; -a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant; -return av_normalize1_sf(a); +return av_normalize1_sf((SoftFloat){a.mant, --a.exp}); } static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ @@ -102,11 +101,18 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ elsereturn a.mant - (b.mant >> t); } +static inline av_const int av_gt_sf(SoftFloat a, SoftFloat b) +{ +int t= a.exp - b.exp; +if(t<0) return (a.mant >> (-t)) > b.mant ; +elsereturn a.mant > (b.mant >> t); +} + static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ int t= a.exp - b.exp; -if (t <-31) return b; -else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> (-t)), b.exp}); -else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> t ), a.exp}); +if (t <=-31) return b; +else if (t < 0) return av_normalize_sf(av_normalize1_sf((SoftFloat){ b.mant + (a.mant >> (-t)), b.exp})); +else if (t < 32) return av_normalize_sf(av_normalize1_sf((SoftFloat){ a.mant + (b.mant >> t ), a.exp})); else return a; } @@ -114,19 +120,146 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){ return av_add_sf(a, (SoftFloat){ -b.mant, b.exp}); } -//FIXME sqrt, log, exp, pow, sin, cos +static inline av_const SoftFloat av_recip_sf(SoftFloat a) +{ +int s = a.mant >> 31; + +a.exp = 1 - a.exp; +a.mant = (a.mant ^ s) - s; +a.mant = av_divtbl_sf[(a.mant - 0x2000) >> 22]; +a.mant = (a.mant ^ s) - s; + +return a; +} + +static av_always_inline SoftFloat av_div_sf(SoftFloat a, SoftFloat b){ +#if 0 +a.exp -= b.exp + 1; +a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant; +return av_normalize1_sf(a); +#else +SoftFloat res; +SoftFloat iB, tmp; + +if (b.mant != 0) +{ +iB = av_recip_sf(b); +/* Newton iteration to double precision */ +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB)); +iB = av_add_sf(iB, av_mul_sf(iB, tmp)); +tmp = av_sub_sf(FLOAT_1, av_mul_sf(b, iB)); +iB =
Re: [FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)
On Wed, 15 Apr 2015 13:47:48 +0200 Michael Niedermayer wrote: > On Wed, Apr 15, 2015 at 01:32:11PM +0200, wm4 wrote: > > On Wed, 15 Apr 2015 13:16:20 +0200 > > Michael Niedermayer wrote: > > > > > On Wed, Apr 15, 2015 at 01:12:27PM +0200, wm4 wrote: > > > > On Wed, 15 Apr 2015 12:43:36 +0200 > > > > Michael Niedermayer wrote: > > > > > > > > > On Wed, Apr 15, 2015 at 11:08:02AM +0200, wm4 wrote: > > > > > [...] > > > > > > the start of the file. (Seeking to anywhere else likely won't work, > > > > > > because libavformat tries to use the imperfect xing toc, instead of > > > > > > scanning the frames.) > > > > > > > > > > btw, you can disable the imperfect xing toc for seeking with > > > > > "-usetoc 0" > > > > > > > > But that breaks VBR even more, shouldn't it? > > > > > > libavformat should build a index by linearly scanning the file > > > up to the point where one seeks to, so it should work with vbr > > > > And how could this be achieved? > > it should just work not require anything from the user, > if i just commit the cbr and toc code out i still can seek so the > fallback seems working There's also the thing that this would be incompatible with the ffmpeg philosophy of "streaming". So what happens if the user seeks in a 1GB VBR mp3? (I seriously had such a case. It caused problems with the xing toc, since with 100 entries in a 1GB file it can be off by a _lot_.) Anyway, the main problem is how this would be implemented. The mp3 data first must go through the parser, which utils.c handles. The parser essentially tells us the frame duration, from which the PTS of a packet can be derived. It also tells us at which file position the packet starts. So if a seek happens, then utils.c (?) must read packets until the target position is reached, and adds them to the index. And then we must be sure that the seek function in the format (i.e. mp3_seek()) actually uses this function. AND we must be sure that it doesn't use the broken xing toc seek entries. This sounds like a pretty messy extra interaction between utils.c and mp3dec.c. This would possibly be useful for other formats, like other raw audio formats (TTA?), OGG, or unseekable formats like mpeg-ts. But then it becomes even more complicated. Also, are there codecs involved in this whose parser doesn't simply determine at which position packets are split, but also rewrites them by adding or dropping bytes? (Maybe I'm overthinking it.) > > > > I'm also not very fond of utils.c messing with what the demuxer does. > > It really made developing and debugging this harder. It should be the > > other way around, with the demuxer directly being called by the user, > > and the demuxer invoking generic helpers if it needs to. > > i understand, iam not sure though if it was the other way around > if that wouldnt lead to other annoyances like if the fallback case > needs to be changed then all demuxers for which it applies would need > to be changed > > The part that IMO we are really missing is clear documentation about > the seeking function interactions These interactions are just terrible. I seriously can't tell what happens if libavformat is told to seek. There are too many things that could happen which depend on too many flags and fallback cases. Documenting these interactions will probably not help much - what is needed it reducing this complexity. Yes, it's probably too late for this; my point is just that we should try not to make it even more complex. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Changes to libavutil/softfloat
The next two patches are making some changes in softfloat. These changes don't have any impact on current ffmpeg code since softfloat is currently not in use. They are needed as preparation for submitting implementation of fixed point aac decoder that will follow soon. -Nedeljko ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] libavutil/softfloat: Change order of fields in SoftFloat structure.
Softfloat will be used in implementation of AAC fixed point decoder. This change is needed in order to more easily integrate ffmpegs softfloat in already developed algorithm for AAC. Signed-off-by: Nedeljko Babic --- libavutil/softfloat.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index 8647e6a..654a31f 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -31,8 +31,8 @@ #define ONE_BITS 29 typedef struct SoftFloat{ -int32_t exp; int32_t mant; +int32_t exp; }SoftFloat; static av_const SoftFloat av_normalize_sf(SoftFloat a){ @@ -67,10 +67,10 @@ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ return a; #elif 1 int t= a.mant + 0x4000 < 0; -return (SoftFloat){a.exp+t, a.mant>>t}; +return (SoftFloat){ a.mant>>t, a.exp+t}; #else int t= (a.mant + 0x4000U)>>31; -return (SoftFloat){a.exp+t, a.mant>>t}; +return (SoftFloat){a.mant>>t, a.exp+t}; #endif } @@ -105,19 +105,19 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ int t= a.exp - b.exp; if (t <-31) return b; -else if (t < 0) return av_normalize1_sf((SoftFloat){b.exp, b.mant + (a.mant >> (-t))}); -else if (t < 32) return av_normalize1_sf((SoftFloat){a.exp, a.mant + (b.mant >> t )}); +else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> (-t)), b.exp}); +else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> t ), a.exp}); else return a; } static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){ -return av_add_sf(a, (SoftFloat){b.exp, -b.mant}); +return av_add_sf(a, (SoftFloat){ -b.mant, b.exp}); } //FIXME sqrt, log, exp, pow, sin, cos static inline av_const SoftFloat av_int2sf(int v, int frac_bits){ -return av_normalize_sf((SoftFloat){ONE_BITS-frac_bits, v}); +return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits}); } /** -- 1.8.2.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec
Signed-off-by: Simon Thelen --- Implemented like the check for libx264 without the warn on fallback. Tested on my system with pkg-config. configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 389de92..1d98828 100755 --- a/configure +++ b/configure @@ -5012,7 +5012,8 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } enabled libcaca && require_pkg_config caca caca.h caca_create_canvas -enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec +enabled libdcadec && { use_pkg_config dcadec libdcadec/dca_context.h dcadec_context_create || + { require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec; }; } enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" -- 2.3.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/14] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [4/4]
From: Jovan Zelincevic Build system modified. Signed-off-by: Nedeljko Babic --- libavcodec/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 07b1899..6d2a4b9 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -114,8 +114,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 -- 1.8.2.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 04/14] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [4/4]
From: Jovan Zelincevic Build system modified 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 389de92..e3fd2af 100755 --- a/configure +++ b/configure @@ -2093,6 +2093,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 b01ecd6..f0f3977 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -100,7 +100,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_STARTCODE) += startcode.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_VIDEODSP)+= videodsp.o @@ -114,6 +114,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 @@ -902,6 +904,7 @@ HOSTPROGS = aac_tablegen \ aacsbr_tablegen \ cabac_tablegen \ cbrt_tablegen \ +cbrt_fixed_tablegen \ cos_tablegen\ dsd_tablegen\ dv_tablegen \ @@ -910,6 +913,7 @@ HOSTPROGS = aac_tablegen \ pcm_tablegen\ qdm2_tablegen \ sinewin_tablegen\ +sinewin_fixed_tablegen \ CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) @@ -928,8 +932,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)) @@ -938,13 +942,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)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h $(SUBDIR)mpegaudiodec_fixed.o: $(SUBDIR)mpegaudio_tables.h $(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h $(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 5a9c57c..d4fdf32 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -35,7 +35,6 @@ #define FFT_FLOAT 1 #define FFT_FIXED_32 0 #define USE_FIXED 0 -#define CONFIG_FIXED 0 #include "libavutil/float_dsp.h" #include "libavutil/opt.h" diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index 97
[FFmpeg-devel] AAC Decoder - fixed point implementation
Hello, I am again resending patch set with the implementation of fixed point AAC decoder. Patch set is rebased to the newest code as requested. Patches for softfloat moved to separate patch set as proposed in last review. Other changes requested in last review are done. Small changes done to float AAC decoder since last post are integrated in fixed point implementation. The only thing that is not added is support for ER AAC ELD 480. This patch set is dependent on patch set that makes changes in softfloat. Please have a look. Thanks, Nedeljko ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 09/14] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [1/3]
From: Djordje Pesut Move existing code to a new file. Signed-off-by: Nedeljko Babic --- libavcodec/aacps.c | 157 - libavcodec/aacps_float.c | 177 +++ 2 files changed, 177 insertions(+), 157 deletions(-) create mode 100644 libavcodec/aacps_float.c diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c index ea5a5d2..822d6c6 100644 --- a/libavcodec/aacps.c +++ b/libavcodec/aacps.c @@ -749,163 +749,6 @@ static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC], } } -static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34) -{ -int e, b, k; - -float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11; -float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12; -float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21; -float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22; -int8_t *opd_hist = ps->opd_hist; -int8_t *ipd_hist = ps->ipd_hist; -int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; -int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; -int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; -int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; -int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf; -int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf; -int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf; -int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf; -const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20; -TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB; - -//Remapping -if (ps->num_env_old) { -memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0])); -memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0])); -memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0])); -memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0])); -memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0])); -memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0])); -memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0])); -memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0])); -} - -if (is34) { -remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1); -remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1); -if (ps->enable_ipdopd) { -remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0); -remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0); -} -if (!ps->is34bands_old) { -map_val_20_to_34(H11[0][0]); -map_val_20_to_34(H11[1][0]); -map_val_20_to_34(H12[0][0]); -map_val_20_to_34(H12[1][0]); -map_val_20_to_34(H21[0][0]); -map_val_20_to_34(H21[1][0]); -map_val_20_to_34(H22[0][0]); -map_val_20_to_34(H22[1][0]); -ipdopd_reset(ipd_hist, opd_hist); -} -} else { -remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1); -remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1); -if (ps->enable_ipdopd) { -remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0); -remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0); -} -if (ps->is34bands_old) { -map_val_34_to_20(H11[0][0]); -map_val_34_to_20(H11[1][0]); -map_val_34_to_20(H12[0][0]); -map_val_34_to_20(H12[1][0]); -map_val_34_to_20(H21[0][0]); -map_val_34_to_20(H21[1][0]); -map_val_34_to_20(H22[0][0]); -map_val_34_to_20(H22[1][0]); -ipdopd_reset(ipd_hist, opd_hist); -} -} - -//Mixing -for (e = 0; e < ps->num_env; e++) { -for (b = 0; b < NR_PAR_BANDS[is34]; b++) { -float h11, h12, h21, h22; -h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0]; -h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1]; -h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2]; -h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3]; - -if (!PS_BASELINE && ps->enable_ipdopd && b < NR_IPDOPD_BANDS[is34]) { -//The spec say says to only run this smoother when enable_ipdopd -//is set but the reference decoder appears to run it constantly -float h11i, h12i, h21i, h22i; -float ipd_adj_re, ipd_adj_im; -int opd_idx = opd_hist[b] * 8
[FFmpeg-devel] [PATCH 02/14] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [2/4]
From: Jovan Zelincevic Add fixed point implementation of functions for generating tables Signed-off-by: Nedeljko Babic --- libavcodec/aacdectab.h | 34 +-- libavcodec/aactab.c| 486 + libavcodec/aactab.h| 4 + libavcodec/cbrt_fixed_tablegen.c | 24 ++ 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_fixed.c | 21 ++ libavcodec/sinewin_fixed_tablegen.c| 24 ++ libavcodec/sinewin_tablegen.c | 3 + libavcodec/sinewin_tablegen.h | 31 ++- libavcodec/sinewin_tablegen_template.c | 20 +- libavcodec/tableprint.h| 2 + 15 files changed, 657 insertions(+), 35 deletions(-) create mode 100644 libavcodec/cbrt_fixed_tablegen.c create mode 100644 libavcodec/sinewin_fixed.c create mode 100644 libavcodec/sinewin_fixed_tablegen.c diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index 4a12b4f..16dd89f 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,6 +1769,490 @@ const DECLARE_ALIGNED(32, float, ff_aac_eld_window_512)[1920] = { -0.0044, -0.00109764, -0.00108377, -0.00106989, }; +/* Q30 representation of ff_aac_eld_window_512 table */ +const DECLARE_ALIGNED(32, int, ff_aac_eld_window_512_fixed)[1920] = { +0x003783ba, 0x005d04f4, 0x008ae226, 0x00c02021, +0x00fb1804, 0x013a30a8, 0x017be9e6, 0x01bf296c, +0x02033204, 0x0247502c, 0x028adab0, 0x02cd9568, +0x030fa980, 0x03513dc0, 0x03927274, 0x03d363e0, +0x04142e40, 0x0454edc0, 0x0495bd48, 0x04d6a060, +0x051786d8, 0x05586548, 0x059935e8, 0x05d9feb0, +0x061acea0, 0x065bb680, 0x069cc800, 0x06de13f0, +0x071fa748, 0x07618b80, 0x07a3c7a8, 0x07e66da0, +0x082999d0, 0x086d6590, 0x08b1e640, 0x08f72850, +0x093d3120, 0x09840550, 0x09cba880, 0x0a1415f0, +0x0a5d41b0, 0x0aa720d0, 0x0af1a9a0, 0x0b3cce70, +0x0b887ec0, 0x0bd4ac10, 0x0c214a70, 0x0c6e5130, +0x0cbbba50, 0x0d098130, 0x0d57a240,
[FFmpeg-devel] [PATCH 14/14] Edit documentation and versioning
From: Jovan Zelincevic Signed-off-by: Nedeljko Babic --- Changelog | 1 + doc/general.texi| 2 +- doc/mips.txt| 5 + libavutil/version.h | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 2e30b24..d634853 100644 --- a/Changelog +++ b/Changelog @@ -17,6 +17,7 @@ version : - WebM Live Chunk Muxer - nvenc level and tier options - chorus filter +- AAC fixed-point decoding version 2.6: diff --git a/doc/general.texi b/doc/general.texi index a826a1d..fc6315a 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -834,7 +834,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..49ac872 100644 --- a/doc/mips.txt +++ b/doc/mips.txt @@ -47,12 +47,17 @@ 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/ + aac_float_emu.h + aacdec_fixed.c + aacsbr_fixed.c + aacsbr_template.c aaccoder_mips.c aacpsy_mips.h ac3dsp_mips.c diff --git a/libavutil/version.h b/libavutil/version.h index a3d95d8..a26245e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -57,7 +57,7 @@ #define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MINOR 22 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MICRO 102 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ -- 1.8.2.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 13/14] tests: Add aac_fixed decoder test
From: Nedeljko Babic Signed-off-by: Nedeljko Babic --- tests/fate/aac.mak | 63 ++ 1 file changed, 63 insertions(+) diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index 34823be..d90b143 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -70,6 +70,69 @@ 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 += 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 += 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 += 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 += 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 += 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 += 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 += fate-aac-fixed-am00_88 +fate-aac-fixed-am00_88: CMD = pcm -i $(TARGET_SAMPLES)/aac/am00_88.mp4 +fate-aac-fixed-am00_88: REF = $(SAMPLES)/aac/am00_88.s16 + +FATE_AAC += fate-aac-fixed-am05_44 +fate-aac-fixed-am05_44: CMD = pcm -i $(TARGET_SAMPLES)/aac/am05_44.mp4 +fate-aac-fixed-am05_44: REF = $(SAMPLES)/aac/am05_44_reorder.s16 + +FATE_AAC += 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 += 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 += 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 += fate-aac-fixed-al_sbr_ps_06_ur +fate-aac-fixed-al_sbr_ps_06_ur: CMD = pcm -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 += 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 += 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 += 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 += 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 -- 1.8.2.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 06/14] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [2/4]
From: Jovan Zelincevic Create tables for fixed point code. Signed-off-by: Nedeljko Babic --- libavcodec/Makefile | 5 +- libavcodec/aacsbr_fixed_tablegen.c | 40 +++ libavcodec/aacsbr_fixed_tablegen.h | 32 +++ libavcodec/aacsbr_tablegen.c| 1 + libavcodec/aacsbr_tablegen.h| 101 +-- libavcodec/aacsbr_tablegen_common.h | 129 + libavcodec/aacsbrdata.h | 522 ++-- 7 files changed, 469 insertions(+), 361 deletions(-) create mode 100644 libavcodec/aacsbr_fixed_tablegen.c create mode 100644 libavcodec/aacsbr_fixed_tablegen.h create mode 100644 libavcodec/aacsbr_tablegen_common.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f0f3977..07b1899 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -902,6 +902,7 @@ TOOLS = fourcc2pixfmt HOSTPROGS = aac_tablegen\ aacps_tablegen \ aacsbr_tablegen \ +aacsbr_fixed_tablegen \ cabac_tablegen \ cbrt_tablegen \ cbrt_fixed_tablegen \ @@ -932,7 +933,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)) @@ -945,6 +947,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_fixed_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.c new file mode 100644 index 000..7117dbd --- /dev/null +++ b/libavcodec/aacsbr_fixed_tablegen.c @@ -0,0 +1,40 @@ +/* + * Header file for hardcoded AAC SBR windows + * + * Copyright (c) 2014 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#define CONFIG_HARDCODED_TABLES 0 +#define USE_FIXED 1 +#include "libavutil/common.h" +#include "aacsbr_fixed_tablegen.h" +#include "tableprint.h" + +int main(void) +{ +aacsbr_tableinit(); + +write_fileheader(); + +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_fixed_tablegen.h b/libavcodec/aacsbr_fixed_tablegen.h new file mode 100644 index 000..1439ebe --- /dev/null +++ b/libavcodec/aacsbr_fixed_tablegen.h @@ -0,0 +1,32 @@ +/* + * Header file for hardcoded AAC SBR windows + * + * Copyright (c) 2014 Reimar Döffinger + * + * 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_AACSBR_FIXED_
[FFmpeg-devel] [PATCH 03/14] libavcodec/libavutil: Implementation of AAC_fixed_decoder (LC-module) [3/4]
From: Djordje Pesut Add fixed point implementation Signed-off-by: Nedeljko Babic --- libavcodec/aac.h | 101 -- libavcodec/aacdec.c | 5 + libavcodec/aacdec_fixed.c| 448 +++ libavcodec/aacdec_template.c | 433 - libavcodec/lpc.h | 15 +- libavcodec/mdct_template.c | 5 + libavutil/fixed_dsp.c| 70 ++- libavutil/fixed_dsp.h| 53 + 8 files changed, 967 insertions(+), 163 deletions(-) create mode 100644 libavcodec/aacdec_fixed.c diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 23ec085..571f8b9 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -30,9 +30,62 @@ #ifndef AVCODEC_AAC_H #define AVCODEC_AAC_H +#ifndef USE_FIXED +#define USE_FIXED 0 +#endif + +#if USE_FIXED + +#define FFT_FLOAT0 +#define FFT_FIXED_32 1 + +#define AAC_RENAME(x) x ## _fixed +#define AAC_RENAME_32(x)x ## _fixed_32 +#define INTFLOAT int +#define SHORTFLOAT int16_t +#define AAC_FLOAT aac_float_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 INTFLOAT float +#define SHORTFLOAT float +#define AAC_FLOAT 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" @@ -125,12 +178,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 @@ -151,7 +204,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; @@ -185,7 +238,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; /** @@ -222,7 +275,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; /** @@ -234,16 +287,16 @@ 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) -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]; ///< ove
[FFmpeg-devel] [PATCH 12/14] libavcodec: Minor macro polishing
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 07/14] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [3/4]
From: Djordje Pesut Add fixed poind code. Signed-off-by: Nedeljko Babic --- libavcodec/aac.h | 51 +--- libavcodec/aac_defines.h | 76 ++ libavcodec/aacsbr.c | 3 + libavcodec/aacsbr.h | 12 +- libavcodec/aacsbr_fixed.c| 586 +++ libavcodec/aacsbr_template.c | 219 libavcodec/sbr.h | 78 +++--- libavcodec/sbrdsp.c | 4 + libavcodec/sbrdsp.h | 36 +-- libavcodec/sbrdsp_fixed.c| 286 + libavcodec/sbrdsp_template.c | 42 ++-- 11 files changed, 1214 insertions(+), 179 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/aac.h b/libavcodec/aac.h index 571f8b9..2be7e84 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -30,56 +30,7 @@ #ifndef AVCODEC_AAC_H #define AVCODEC_AAC_H -#ifndef USE_FIXED -#define USE_FIXED 0 -#endif - -#if USE_FIXED - -#define FFT_FLOAT0 -#define FFT_FIXED_32 1 - -#define AAC_RENAME(x) x ## _fixed -#define AAC_RENAME_32(x)x ## _fixed_32 -#define INTFLOAT int -#define SHORTFLOAT int16_t -#define AAC_FLOAT aac_float_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 INTFLOAT float -#define SHORTFLOAT float -#define AAC_FLOAT 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..3ba9957 --- /dev/null +++ b/libavcodec/aac_defines.h @@ -0,0 +1,76 @@ +/* + * 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 + +#define FFT_FLOAT0 +#define FFT_FIXED_32 1 + +#define AAC_RENAME(x) x ## _fixed +#define AAC_RENAME_32(x)x ## _fixed_32 +#define INTFLOAT int +#define SHORTFLOAT int16_t +#define AAC_FLOAT SoftFloat +#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) +#define AAC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y)) + +#else + +#define FFT_FLOAT1 +#define FFT_FIXED_32 0 + +#define AAC_RENAME(x) x +#define AAC_RENAME_32(x)x +#define INTFLOAT float +#define SHORTFLOAT float +#define AAC_FLOAT float +#define AAC_SIGNE unsigned +#define FIXR(x) ((float)(x)) +#define FIXR10(x) ((float)(x)) +#define
[FFmpeg-devel] [PATCH 10/14] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [2/3]
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/14] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [3/3]
From: Djordje Pesut Add fixed point implementation. Signed-off-by: Nedeljko Babic --- libavcodec/Makefile| 14 +- libavcodec/aac_defines.h | 36 + libavcodec/aacps.c | 344 ++--- libavcodec/aacps.h | 32 ++-- libavcodec/aacps_fixed.c | 24 +++ libavcodec/aacps_float.c | 157 +-- 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 +++ 12 files changed, 667 insertions(+), 466 deletions(-) create mode 100644 libavcodec/aacps_fixed.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 6d2a4b9..bca5d23 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -111,12 +111,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 @@ -902,6 +902,7 @@ TOOLS = fourcc2pixfmt HOSTPROGS = aac_tablegen\ aacps_tablegen \ +aacps_fixed_tablegen\ aacsbr_tablegen \ aacsbr_fixed_tablegen \ cabac_tablegen \ @@ -934,7 +935,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 @@ -946,7 +947,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 3ba9957..5c2b181 100644 --- a/libavcodec/aac_defines.h +++ b/libavcodec/aac_defines.h @@ -33,6 +33,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 @@ -43,9 +44,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) * (y)) + \ + ((int64_t)(a) * (b)) + \ +0x800) >> 28) +#define AAC_MADD30(x, y, a, b) (in
[FFmpeg-devel] [PATCH 05/14] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [1/4]
From: Djordje Pesut Move the existing code to a new template file. Signed-off-by: Nedeljko Babic --- libavcodec/aacsbr.c | 1413 -- libavcodec/aacsbr.h | 45 ++ libavcodec/aacsbr_template.c | 1395 + libavcodec/sbrdsp.c | 74 --- libavcodec/sbrdsp_template.c | 95 +++ 5 files changed, 1535 insertions(+), 1487 deletions(-) create mode 100644 libavcodec/aacsbr_template.c create mode 100644 libavcodec/sbrdsp_template.c diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index b582d3f..9cc4f5b 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 > 0) { -static con
Re: [FFmpeg-devel] [PATCH v4] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC
On Wed, Apr 15, 2015 at 8:18 AM, Rostislav Pehlivanov wrote: > @@ -828,9 +882,17 @@ static void search_for_quantizers_twoloop(AVCodecContext > *avctx, > > fflag = 0; > minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF); > + > +for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) > +for (g = 0; g < sce->ics.num_swb; g++) > +if (sce->band_type[w*16+g] == NOISE_BT) > +sce->sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], > minscaler_n, minscaler_n + SCALE_MAX_DIFF); > + > for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { > for (g = 0; g < sce->ics.num_swb; g++) { > int prevsc = sce->sf_idx[w*16+g]; > +if (sce->band_type[w*16+g] == NOISE_BT) > +continue; > if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > > 60) { > if (find_min_book(maxvals[w*16+g], > sce->sf_idx[w*16+g]-1)) > sce->sf_idx[w*16+g]--; This is still done at each iteration rather than at the end. Still, it will be a correct result nonetheless (it's idempotent now), so I believe it can be committed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] AAC Decoder - fixed point implementation
On Wed, Apr 15, 2015 at 1:29 PM, Nedeljko Babic wrote: > Hello, > > I am again resending patch set with the implementation of fixed point AAC > decoder. > > Patch set is rebased to the newest code as requested. Cool, I'll test them when I get some free time, hopefully during this week. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec
On Wed, 15 Apr 2015 17:18:58 +0200 Simon Thelen wrote: > Signed-off-by: Simon Thelen > --- > Implemented like the check for libx264 without the warn on fallback. Tested > on my system with pkg-config. > configure | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 389de92..1d98828 100755 > --- a/configure > +++ b/configure > @@ -5012,7 +5012,8 @@ enabled libcelt && require libcelt > celt/celt.h celt_decode -lcelt0 && > { check_lib celt/celt.h > celt_decoder_create_custom -lcelt0 || > die "ERROR: libcelt must be installed and > version must be >= 0.11.0."; } > enabled libcaca && require_pkg_config caca caca.h > caca_create_canvas > -enabled libdcadec && require libdcadec libdcadec/dca_context.h > dcadec_context_create -ldcadec > +enabled libdcadec && { use_pkg_config dcadec libdcadec/dca_context.h > dcadec_context_create || > + { require libdcadec libdcadec/dca_context.h > dcadec_context_create -ldcadec; }; } > enabled libfaac && require2 libfaac "stdint.h faac.h" > faacEncGetVersion -lfaac > enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h > aacEncOpen -lfdk-aac > flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal > -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish > -lflite_cmulex -lflite" Isn't the fallback not needed anymore? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec
On 15/04/15 2:00 PM, wm4 wrote: > On Wed, 15 Apr 2015 17:18:58 +0200 > Simon Thelen wrote: > >> Signed-off-by: Simon Thelen >> --- >> Implemented like the check for libx264 without the warn on fallback. Tested >> on my system with pkg-config. >> configure | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 389de92..1d98828 100755 >> --- a/configure >> +++ b/configure >> @@ -5012,7 +5012,8 @@ enabled libcelt && require libcelt >> celt/celt.h celt_decode -lcelt0 && >> { check_lib celt/celt.h >> celt_decoder_create_custom -lcelt0 || >> die "ERROR: libcelt must be installed and >> version must be >= 0.11.0."; } >> enabled libcaca && require_pkg_config caca caca.h >> caca_create_canvas >> -enabled libdcadec && require libdcadec libdcadec/dca_context.h >> dcadec_context_create -ldcadec >> +enabled libdcadec && { use_pkg_config dcadec >> libdcadec/dca_context.h dcadec_context_create || >> + { require libdcadec libdcadec/dca_context.h >> dcadec_context_create -ldcadec; }; } >> enabled libfaac && require2 libfaac "stdint.h faac.h" >> faacEncGetVersion -lfaac >> enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h >> aacEncOpen -lfdk-aac >> flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal >> -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish >> -lflite_cmulex -lflite" > > Isn't the fallback not needed anymore? Yeah, the pkg-config check alone is enough. There's currently no release out using this wrapper, or any distro whatsoever shipping the library in question for that matter, so it can be safely removed without being considered a change of behavior. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec
On 15-04-15 at 14:03, James Almer wrote: > On 15/04/15 2:00 PM, wm4 wrote: > > On Wed, 15 Apr 2015 17:18:58 +0200 > > Simon Thelen wrote: > >> Signed-off-by: Simon Thelen [..] > > Isn't the fallback not needed anymore? > Yeah, the pkg-config check alone is enough. > There's currently no release out using this wrapper, or any distro whatsoever > shipping > the library in question for that matter, so it can be safely removed without > being > considered a change of behavior. I don't particularly mind either way. I can resend a version without fallback. -- Simon Thelen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: use pkg-config to find libdcadec
Signed-off-by: Simon Thelen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 389de92..93aebcb 100755 --- a/configure +++ b/configure @@ -5012,7 +5012,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } enabled libcaca && require_pkg_config caca caca.h caca_create_canvas -enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec +enabled libdcadec && require_pkg_config dcadec libdcadec/dca_context.h dcadec_context_create enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" -- 2.3.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Warning when compiling ffmpeg using msvc toolchain with --enable-pthreads
Hi, When using an ffmpeg.exe built using msys and the msvc toolchain, at run time a warning is displayed [udp @ 00395860] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required) So, I wanted to enable pthread I downloaded pthread-win32 Added the include and lib paths to the INCLUDE and PATH environment variables started visual studio 2013 desktop express vsvars.bat and started msys.bat and did ../configure --toolchain=msvc --enable-pthreads --extra-libs=pthreadVC2.lib output of configure now showed "threading support pthreads" instead of "threading support win32threads" and the runtime warning went away :-) but while "make"ing it shows few warnings CC libavdevice/alldevices.o cl : Command line warning D9002 : ignoring unknown option '-pthread' and LD libavutil/avutil-54.dll LINK : warning LNK4044: unrecognized option '/pthread'; ignored As I understand "-pthread" is gcc specific, and I think it should not be used with msvc's cl.exe. But do I need to worry about the macros _REENTRANT or __USE_REENTRANT as mentioned here http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling and http://stackoverflow.com/questions/23250863/difference-between-pthread-and-lpthread-while-compiling ? Thanks Ramprasad ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] libavutil/softfloat: Change order of fields in SoftFloat structure.
On Wed, Apr 15, 2015 at 03:14:06PM +0200, Nedeljko Babic wrote: > Softfloat will be used in implementation of AAC fixed point decoder. > This change is needed in order to more easily integrate ffmpegs softfloat in > already developed algorithm for AAC. > > Signed-off-by: Nedeljko Babic > --- > libavutil/softfloat.h | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC
I did consider putting the whole thing outside however I noticed that the outer loop modifies sf->idx[0] (by having w and g start from 0) which is also the initial value for both the noise and the normal minscaler vars. I'm pretty sure it wouldn't have caused a problem to just put it outside and only use the last value for the minscaler_n but I decided it's best to play it safe. On 15 April 2015 at 17:55, Claudio Freire wrote: > On Wed, Apr 15, 2015 at 8:18 AM, Rostislav Pehlivanov > wrote: > > @@ -828,9 +882,17 @@ static void > search_for_quantizers_twoloop(AVCodecContext *avctx, > > > > fflag = 0; > > minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF); > > + > > +for (w = 0; w < sce->ics.num_windows; w += > sce->ics.group_len[w]) > > +for (g = 0; g < sce->ics.num_swb; g++) > > +if (sce->band_type[w*16+g] == NOISE_BT) > > +sce->sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], > minscaler_n, minscaler_n + SCALE_MAX_DIFF); > > + > > for (w = 0; w < sce->ics.num_windows; w += > sce->ics.group_len[w]) { > > for (g = 0; g < sce->ics.num_swb; g++) { > > int prevsc = sce->sf_idx[w*16+g]; > > +if (sce->band_type[w*16+g] == NOISE_BT) > > +continue; > > if (dists[w*16+g] > uplims[w*16+g] && > sce->sf_idx[w*16+g] > 60) { > > if (find_min_book(maxvals[w*16+g], > sce->sf_idx[w*16+g]-1)) > > sce->sf_idx[w*16+g]--; > > > This is still done at each iteration rather than at the end. > > Still, it will be a correct result nonetheless (it's idempotent now), > so I believe it can be committed. > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC
On Wed, Apr 15, 2015 at 01:55:28PM -0300, Claudio Freire wrote: > On Wed, Apr 15, 2015 at 8:18 AM, Rostislav Pehlivanov > wrote: > > @@ -828,9 +882,17 @@ static void > > search_for_quantizers_twoloop(AVCodecContext *avctx, > > > > fflag = 0; > > minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF); > > + > > +for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) > > +for (g = 0; g < sce->ics.num_swb; g++) > > +if (sce->band_type[w*16+g] == NOISE_BT) > > +sce->sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], > > minscaler_n, minscaler_n + SCALE_MAX_DIFF); > > + > > for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { > > for (g = 0; g < sce->ics.num_swb; g++) { > > int prevsc = sce->sf_idx[w*16+g]; > > +if (sce->band_type[w*16+g] == NOISE_BT) > > +continue; > > if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > > > 60) { > > if (find_min_book(maxvals[w*16+g], > > sce->sf_idx[w*16+g]-1)) > > sce->sf_idx[w*16+g]--; > > > This is still done at each iteration rather than at the end. > > Still, it will be a correct result nonetheless (it's idempotent now), > so I believe it can be committed. commited thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fate: add mp3 gapless test
--- gapless.mp3: https://0x0.st/AG.mp3 Possibly a bit over-complicated, but it doesn't even test everything I wanted to test. At least the lavc skip_manual flag is not tested, because there's apparently no way yet to test AVFrame side data? --- tests/Makefile | 1 + tests/fate-run.sh | 22 ++ tests/fate/gapless.mak | 7 +++ tests/ref/fate/gapless-mp3 | 4 4 files changed, 34 insertions(+) create mode 100644 tests/fate/gapless.mak create mode 100644 tests/ref/fate/gapless-mp3 diff --git a/tests/Makefile b/tests/Makefile index 8505211..cffa541 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -117,6 +117,7 @@ include $(SRC_PATH)/tests/fate/filter-audio.mak include $(SRC_PATH)/tests/fate/filter-video.mak include $(SRC_PATH)/tests/fate/flac.mak include $(SRC_PATH)/tests/fate/fft.mak +include $(SRC_PATH)/tests/fate/gapless.mak include $(SRC_PATH)/tests/fate/gif.mak include $(SRC_PATH)/tests/fate/h264.mak include $(SRC_PATH)/tests/fate/hevc.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 74f2645..c68c389 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -220,6 +220,28 @@ pixfmts(){ test=$outertest } +gapless(){ +sample=$(target_path $1) +extra_args=$2 + +decfile1="${outdir}/${test}.out-1" +decfile2="${outdir}/${test}.out-2" +cleanfiles="$cleanfiles $decfile1 $decfile2" + +# large enough to make ffmpeg.c seek to the start of the file +start_offset=-1 + +# test packet data +ffmpeg -i "$sample" $extra_args -flags +bitexact -c:a copy -f framecrc -y $decfile1 +do_md5sum $decfile1 +# test decoded (and cut) data +ffmpeg -i "$sample" $extra_args -flags +bitexact -f wav md5: +# the same as aboce again, with seeking to the start +ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -c:a copy -f framecrc -y $decfile2 +do_md5sum $decfile2 +ffmpeg -ss $start_offset -i "$sample" $extra_args -flags +bitexact -f wav md5: +} + mkdir -p "$outdir" # Disable globbing: command arguments may contain globbing characters and diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak new file mode 100644 index 000..7f0848d --- /dev/null +++ b/tests/fate/gapless.mak @@ -0,0 +1,7 @@ +FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 +fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 1" + +FATE_GAPLESS = $(FATE_GAPLESS-yes) + +FATE_SAMPLES_AVCONV += $(FATE_GAPLESS) +fate-gapless: $(FATE_GAPLESS) diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3 new file mode 100644 index 000..9add70f --- /dev/null +++ b/tests/ref/fate/gapless-mp3 @@ -0,0 +1,4 @@ +d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3.out-1 +3e41cbd4dcd511d3155234684252beab +68f040b12d79c71e3b2e8ba90a9cbd96 *tests/data/fate/gapless-mp3.out-2 +3e41cbd4dcd511d3155234684252beab \ No newline at end of file -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] libavutil: Make changes in softfloat needed for fixed point aac decoder.
On Wed, Apr 15, 2015 at 03:14:07PM +0200, Nedeljko Babic wrote: > From: Djordje Pesut > > Functions for sqrt and sincos are added. > > Div function is improved. > > Some changes are made in order for code in softfloat to be usable in fixed aac > decoder code. > > This doesn't create any impact on current ffmpeg code since softfloat is > currently not in use and this way we don't need to make much changes in > implementation of aac fixed point decoder that uses this code. > > Softfloat tests are adjusted. > > Signed-off-by: Nedeljko Babic > --- > libavutil/softfloat.c| 6 +- > libavutil/softfloat.h| 167 +--- > libavutil/softfloat_tables.h | 294 > +++ > 3 files changed, 447 insertions(+), 20 deletions(-) > create mode 100644 libavutil/softfloat_tables.h > > diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c > index bf9cfda..23de93d 100644 > --- a/libavutil/softfloat.c > +++ b/libavutil/softfloat.c > @@ -27,7 +27,7 @@ > #undef printf > > int main(void){ > -SoftFloat one= av_int2sf(1, 0); > +SoftFloat one= av_int2sf(1, 30); > SoftFloat sf1, sf2; > double d1, d2; > int i, j; > @@ -59,8 +59,8 @@ int main(void){ > > for(i= 0; i<100; i++){ > START_TIMER > -sf1= av_int2sf(i, 0); > -sf2= av_div_sf(av_int2sf(i, 2), av_int2sf(200, 3)); > +sf1= av_int2sf(i, 30); > +sf2= av_div_sf(av_int2sf(i, 28), av_int2sf(200, 27)); > for(j= 0; j<1000; j++){ > sf1= av_mul_sf(av_add_sf(sf1, one),sf2); > } > diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h > index 654a31f..c3ab316 100644 > --- a/libavutil/softfloat.h > +++ b/libavutil/softfloat.h > @@ -25,6 +25,7 @@ > #include "common.h" > > #include "avassert.h" > +#include "softfloat_tables.h" > > #define MIN_EXP -126 > #define MAX_EXP 126 > @@ -35,6 +36,14 @@ typedef struct SoftFloat{ > int32_t exp; > }SoftFloat; > > +static const SoftFloat FLOAT_0 = { 0, 0}; > +static const SoftFloat FLOAT_05 = { 0x2000, 0}; > +static const SoftFloat FLOAT_1 = { 0x2000, 1}; > +static const SoftFloat FLOAT_EPSILON= { 0x29F16B12, -16}; > +static const SoftFloat FLOAT_1584893192 = { 0x32B771ED, 1}; > +static const SoftFloat FLOAT_10 = { 0x30D4, 17}; > +static const SoftFloat FLOAT_099= { 0x3BCE, 0}; > + > static av_const SoftFloat av_normalize_sf(SoftFloat a){ > if(a.mant){ > #if 1 > @@ -83,17 +92,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, > SoftFloat b){ > a.exp += b.exp; > av_assert2((int32_t)((a.mant * (int64_t)b.mant) >> ONE_BITS) == (a.mant > * (int64_t)b.mant) >> ONE_BITS); > a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS; > -return av_normalize1_sf(a); > -} > - > -/** > - * b has to be normalized and not zero. > - * @return Will not be more denormalized than a. > - */ > -static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){ > -a.exp -= b.exp+1; > -a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant; > -return av_normalize1_sf(a); > +return av_normalize1_sf((SoftFloat){a.mant, --a.exp}); ^^ a.exp - 1 > } > > static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){ > @@ -102,11 +101,18 @@ static inline av_const int av_cmp_sf(SoftFloat a, > SoftFloat b){ > elsereturn a.mant - (b.mant >> t); > } > > +static inline av_const int av_gt_sf(SoftFloat a, SoftFloat b) > +{ > +int t= a.exp - b.exp; > +if(t<0) return (a.mant >> (-t)) > b.mant ; > +elsereturn a.mant > (b.mant >> t); > +} > + > static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ > int t= a.exp - b.exp; > -if (t <-31) return b; > -else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> > (-t)), b.exp}); > -else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> > t ), a.exp}); > +if (t <=-31) return b; > +else if (t < 0) return av_normalize_sf(av_normalize1_sf((SoftFloat){ > b.mant + (a.mant >> (-t)), b.exp})); > +else if (t < 32) return av_normalize_sf(av_normalize1_sf((SoftFloat){ > a.mant + (b.mant >> t ), a.exp})); > else return a; > } > > @@ -114,19 +120,146 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat > a, SoftFloat b){ > return av_add_sf(a, (SoftFloat){ -b.mant, b.exp}); > } > > -//FIXME sqrt, log, exp, pow, sin, cos > +static inline av_const SoftFloat av_recip_sf(SoftFloat a) > +{ > +int s = a.mant >> 31; > + > +a.exp = 1 - a.exp; > +a.mant = (a.mant ^ s) - s; > +a.mant = av_divtbl_sf[(a.mant - 0x2000) >> 22]; > +a.mant = (a.mant ^ s) - s; > + > +return a; > +} > + > +static av_always_inline SoftFloat av_div_sf(SoftFloa
Re: [FFmpeg-devel] [PATCH] fate: add mp3 gapless test
On Wed, Apr 15, 2015 at 09:10:49PM +0200, wm4 wrote: > --- > gapless.mp3: https://0x0.st/AG.mp3 uploaded [...] -- 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] configure: add pkg-config support for libdcadec
Simon Thelen c-14.de> writes: > I don't particularly mind either way. I can resend > a version without fallback. Please keep the fallback, not all OS have pkg-config. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add pkg-config support for libdcadec
On 15/04/15 8:14 PM, Carl Eugen Hoyos wrote: > Simon Thelen c-14.de> writes: > >> I don't particularly mind either way. I can resend >> a version without fallback. > > Please keep the fallback, not all OS have pkg-config. > > Carl Eugen There's no OS without pkg-config. Only broken or badly made environments. Lets not start another pkg-config debate. Half the libraries use pkg-config only and you don't see people complaining about it. pkg-config is the standard with all these libraries. People using broken or incomplete environments are not a reason to bloat our scripts. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/utils: Preserve packet duration when parsing is done only for headers
On Wed, Apr 15, 2015 at 12:32:14AM +0200, Michael Niedermayer wrote: > Signed-off-by: Michael Niedermayer > --- > libavformat/utils.c |2 +- > tests/ref/fate/mkv | 144 ++-- > tests/ref/fate/vp8-alpha | 240 > +++--- > 3 files changed, 193 insertions(+), 193 deletions(-) applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ivfenc: incorrect fourcc for VP9 video
VP80 fourcc are writed for all contexts (without ctx->codec_tag) how to reproduce the issue: 1) Get any vp9 video (for example http://base-n.de/webm/out9.webm) 2) ffmpeg -i out9.webm -vcodec copy out9.ivf 3) out9.ivf have VP80 fourcc at ivf header The proposed fix solves this issue --- libavformat/ivfenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 5700f01..1d76c5c 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -38,7 +38,7 @@ static int ivf_write_header(AVFormatContext *s) avio_write(pb, "DKIF", 4); avio_wl16(pb, 0); // version avio_wl16(pb, 32); // header length -avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80")); +avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : ctx->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") : AV_RL32("VP80")); avio_wl16(pb, ctx->width); avio_wl16(pb, ctx->height); avio_wl32(pb, s->streams[0]->time_base.den); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: add missing dependencies for MIPS and PPC features
Signed-off-by: James Almer --- configure | 4 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 389de92..c5bae3f 100755 --- a/configure +++ b/configure @@ -2012,14 +2012,18 @@ setend_deps="arm" map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM +loongson_deps="mips" mipsfpu_deps="mips" mipsdspr1_deps="mips" mipsdspr2_deps="mips" +mips32r2_deps="mips" mips32r5_deps="mips" mips64r6_deps="mips" msa_deps="mips" altivec_deps="ppc" +dcbzl_deps="ppc" +ldbrx_deps="ppc" ppc4xx_deps="ppc" vsx_deps="ppc" -- 2.3.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel