Re: [FFmpeg-devel] [PATCH v3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC

2015-04-14 Thread Claudio Freire
It's close...

On Tue, Apr 14, 2015 at 11:17 PM, Rostislav Pehlivanov
 wrote:
> @@ -711,9 +748,11 @@ static void search_for_quantizers_twoloop(AVCodecContext 
> *avctx,
>  {
>  int start = 0, i, w, w2, g;
>  int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / 
> avctx->channels * (lambda / 120.f);
> -float dists[128] = { 0 }, uplims[128];
> +const int freq_mul = avctx->sample_rate/(1024/sce->ics.num_windows)/2;

Storing it in a const can induce a huge rounding error.

Think sample_rate 7350, 1 window. That's freq_mult = 3.588, but
rounding it will put 3, which is a huge rounding error.

Just put the whole expression when needed, that will avoid the
rounding error. Like:

> +if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy 
> < uplim * 1.2f) {

start*avctx->sample_rate/(1024/sce->ics.num_windows)/2 =
start*7350/1024/2 = implicitly ((start*7350)/1024)/2, avoiding the
rounding error completely.

Always consider that when doing integer math, and the possibility of
intermediate results overflowing (not possible here given the maximum
start and sample_rate).

>  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) {
> +sce->sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], 
> minscaler_n, minscaler_n + SCALE_MAX_DIFF);
> +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]--;

Good, but you don't need to apply the clipping on each iteration. Do
it outside the do { ... } while (fflag && its < 10), which is just
once, at the very end.

With that fixed, I believe it will be committable.

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


[FFmpeg-devel] Question regarding inter-filter communication

2015-04-14 Thread Bahram Dahi
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?

Thanks,

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


[FFmpeg-devel] [PATCH v3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution for AAC

2015-04-14 Thread Rostislav Pehlivanov
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 third 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 unneeded variabes and 
comparisons. All of them were redundant and were going to be of little use for 
when the PNS implementation would be considered stable.

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 (updated to reflect the new revision and uploaded to 
a more pernament storage): 
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, feedback and criticism are welcome.
---
 libavcodec/aaccoder.c | 132 --
 libavcodec/aacenc.c   |   3 ++
 libavcodec/aacenc.h   |   1 +
 3 files changed, 99 insertions(+), 37 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 64eee32..0109655 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,  5,  5,  5,
@@ -57,6 +63,10 @@ static const uint8_t * const run_value_bits[2] = {
 run_value_bits_long, run_value_bits_short
 };
 
+/** Map to convert values from BandCodingPath index to a codebook index **/
+static const uint8_t aac_cb_out_map[CB_TOT]  = {0,1,2,3,4,5,6,7,8,9,10,11,13};
+/** Inverse map to convert from codebooks to BandCodingPath indices **/
+static const uint8_t aac_cb_in_map[CB_TOT+1] = 
{0,1,2,3,4,5,6,7,8,9,10,11,0,12};
 
 /**
  * Quantize one coefficient.
@@ -108,7 +118,7 @@ static av_always_inline float 
quantize_and_encode_band_cost_template(
   

Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Rostislav Pehlivanov
Nevermind, I failed to read your suggestion to just use a separate
minscaler for noise sf_idx.

On 15 April 2015 at 00:05, Rostislav Pehlivanov  wrote:

> You're right. Unfortunately letting the sf_idx be clipped to the minscale
> (+SCALE_MAX_DIFF) causes clipped noise values to be reported by the
> decoder. Seems like that magic number 4 you suggested might need to be
> adjusted after all. I also tried testing to see if advancing the minscaler
> based off of the noise sf_idx would work, but it didn't.
> Still, something weird happens at around 1.295 constant value for the
> threshold. The noise becomes clipped so increasing the value further yields
> no change in result. Any idea what could be causing this sudden increase in
> noise as the parameter is increased? Other than that the resolution of
> energy and threshold values is low enough.
>
> On 14 April 2015 at 22:06, Claudio Freire  wrote:
>
>> On Tue, Apr 14, 2015 at 4:52 PM, Rostislav Pehlivanov
>>  wrote:
>> > Uhh, can't replicate bug here (freshly built ffmpeg, just applied this
>> patch
>> > only), (md5 for file = 473edd68b91123c3a9c1825271012357). tried other
>> files
>> > and they encode and play fine. Spectrum also looks fine. I also tested
>> other
>> > random files out of the samples and they all seem file.
>> > Know of any other problematic files?
>>
>> I did a pull, replaced:
>>
>> if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
>> uplim * 1.2f) {
>>
>> with
>>
>> if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
>> uplim * 2.2f) {
>>
>> And ran
>>
>> /home/claudiofreire/src/ffmpeg/ffmpeg -i
>> /home/claudiofreire/tmp/audiosamples/ffsamples/aac/ct_faac-adts.aac
>> -strict -2 -c:a aac -b:a 48k -cutoff 22050 -f adts -aac_pns 1 -y
>> test.adts
>>
>> And got the assertion failure. You can try playing with that constant
>> or simply commenting out the "energy < uplim * X" term to force all
>> noise, and you will get it.
>>
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test

2015-04-14 Thread Ludmila Glinskih
Hi,

Thanks for you comments!

> +static int generate_raw_frame(uint16_t *frame_data, int i, int
> sample_rate,
> > +  int channels, int frame_size)
> > +{
> > +double t, tincr, tincr2;
> > +int j, k;
> > +
> > +t = 0.0;
> > +tincr = 2 * M_PI * 440.0 / sample_rate;
> > +tincr2 = tincr / sample_rate;
> > +for (j = 0; j < frame_size; j++)
> > +{
> > +frame_data[channels * j] = (int)(sin(t) * 1);
> > +for (k = 1; k < channels; k++)
> > +frame_data[channels * j + k] = frame_data[channels * j] * 2;
> > +t = i * tincr + (i * (i + 1) / 2.0 * tincr2);
> > +}
> > +return 0;
> > +}
>
> This was mentioned before: using floating point in tests causes
> problems which can be avoided by using integers only. This includes the
> sin() function. (Maybe generate some sort of square wave instead? Or
> just silence? I don't know.)
>
> Yeah, I didn't decide how to do it right yet. I like Michael's idea about
audiogen.


> > +result = avcodec_open2(ctx, enc, NULL);
> > +if (result < 0)
> > +{
> > +av_log(NULL, AV_LOG_ERROR, "Can't open encoder\n");
> > +return AVERROR_UNKNOWN;
>
> In this particular case, it would probably make sense to forward the
> error code. (Also affects some other lines in the patch.) I don't know
> how important this is for API tests, or what exactly we want, though.
>
I don't have any idea why I need it (right now). As soon as I find a reason
-- I'll change it.


> > +ctx->request_sample_fmt = AV_SAMPLE_FMT_S16;
> > +/* XXX: FLAC ignores it for some reason */
> > +ctx->request_channel_layout = ch_layout;
> > +ctx->channel_layout = ch_layout;
>
> Only some decoders can change the output, and then only in some cases.
> Normally, the API user is supposed to use libraries like libswresample
> to convert data to the required format. These fields (including
> request_sample_fmt) merely expose additional decoder features. They
> don't have to be present.
>
I test 4 different channel layouts, 2 of them have different values of
channel layout before and after encoding-decoding. Presetting
ctx->channel_layout fixes it.

> +out_frame = av_frame_alloc();
> > +if (!out_frame)
> > +{
> > +av_log(NULL, AV_LOG_ERROR, "Can't allocate output frame\n");
> > +return AVERROR(ENOMEM);
>
> This leaks in_frame on error. But it might be ok in such a test. We
> have to decide whether it is. (I'd say it's ok.)
>
In my opinion it's ok. If in some situations it leads to problems -- it's
easy to fix).


> > +if (got_output)
> > +{
> > +result = avcodec_decode_audio4(dec_ctx, out_frame,
> &got_output, &enc_pkt);
> > +if (result < 0)
> > +{
> > +av_log(NULL, AV_LOG_ERROR, "Error decoding audio
> packet\n");
> > +return AVERROR_UNKNOWN;
> > +}
> > +
> > +if (got_output)
> > +{
> > +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.

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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Rostislav Pehlivanov
You're right. Unfortunately letting the sf_idx be clipped to the minscale
(+SCALE_MAX_DIFF) causes clipped noise values to be reported by the
decoder. Seems like that magic number 4 you suggested might need to be
adjusted after all. I also tried testing to see if advancing the minscaler
based off of the noise sf_idx would work, but it didn't.
Still, something weird happens at around 1.295 constant value for the
threshold. The noise becomes clipped so increasing the value further yields
no change in result. Any idea what could be causing this sudden increase in
noise as the parameter is increased? Other than that the resolution of
energy and threshold values is low enough.

On 14 April 2015 at 22:06, Claudio Freire  wrote:

> On Tue, Apr 14, 2015 at 4:52 PM, Rostislav Pehlivanov
>  wrote:
> > Uhh, can't replicate bug here (freshly built ffmpeg, just applied this
> patch
> > only), (md5 for file = 473edd68b91123c3a9c1825271012357). tried other
> files
> > and they encode and play fine. Spectrum also looks fine. I also tested
> other
> > random files out of the samples and they all seem file.
> > Know of any other problematic files?
>
> I did a pull, replaced:
>
> if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
> uplim * 1.2f) {
>
> with
>
> if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
> uplim * 2.2f) {
>
> And ran
>
> /home/claudiofreire/src/ffmpeg/ffmpeg -i
> /home/claudiofreire/tmp/audiosamples/ffsamples/aac/ct_faac-adts.aac
> -strict -2 -c:a aac -b:a 48k -cutoff 22050 -f adts -aac_pns 1 -y
> test.adts
>
> And got the assertion failure. You can try playing with that constant
> or simply commenting out the "energy < uplim * X" term to force all
> noise, and you will get it.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/utils: Preserve packet duration when parsing is done only for headers

2015-04-14 Thread Michael Niedermayer
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(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a7440f5..6c7ca0a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1223,7 +1223,7 @@ static int parse_packet(AVFormatContext *s, AVPacket 
*pkt, int stream_index)
 }
 
 /* set the duration */
-out_pkt.duration = 0;
+out_pkt.duration = (st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) ? 
pkt->duration : 0;
 if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
 if (st->codec->sample_rate > 0) {
 out_pkt.duration =
diff --git a/tests/ref/fate/mkv b/tests/ref/fate/mkv
index 84608fd..aea378a 100644
--- a/tests/ref/fate/mkv
+++ b/tests/ref/fate/mkv
@@ -2,217 +2,217 @@
 #extradata 1:2, 0x00b200a1
 #tb 0: 1/1000
 #tb 1: 1/1000
-0,-42,  0,0,63501, 0x139d4c99
-0,  0, 84,0, 5368, 0xd964b678, F=0x0
+0,-42,  0,   41,63501, 0x139d4c99
+0,  0, 84,   41, 5368, 0xd964b678, F=0x0
 1,  8,  8,   21,  528, 0x3c990ddf
 1, 29, 29,   21,  510, 0xc16e0719
-0, 42, 42,0, 1840, 0x097b6726, F=0x0
+0, 42, 42,   41, 1840, 0x097b6726, F=0x0
 1, 50, 50,   21,  500, 0x6248f603
 1, 71, 71,   22,  491, 0xe767f705
-0, 84,167,0, 7168, 0xaa5913ed, F=0x0
+0, 84,167,   41, 7168, 0xaa5913ed, F=0x0
 1, 93, 93,   21,  506, 0x4340f3f3
 1,114,114,   21,  492, 0xf11c0210
-0,125,125,0, 2129, 0x6ab0db3e, F=0x0
+0,125,125,   41, 2129, 0x6ab0db3e, F=0x0
 1,135,135,   21,  502, 0x314b007e
 1,156,156,   22,  507, 0x76de0162
-0,167,250,0, 7230, 0x3fd63940, F=0x0
+0,167,250,   41, 7230, 0x3fd63940, F=0x0
 1,179,179,   21,  501, 0x0538fa45
 1,200,200,   21,  521, 0xc89f06d2
-0,209,209,0, 2114, 0xfceafb26, F=0x0
+0,209,209,   41, 2114, 0xfceafb26, F=0x0
 1,221,221,   21,  646, 0x8d8d3599
 1,242,242,   22,  661, 0x42de
-0,250,334,0,63420, 0x5ca6250f, F=0x0
+0,250,334,   41,63420, 0x5ca6250f, F=0x0
 1,264,264,   21,  609, 0xc0dc255c
 1,285,285,   21,  619, 0x9ac52dd1
-0,292,292,0,16751, 0xf293ab46, F=0x0
-0,292,417,0,22029, 0x3696462b, F=0x0
+0,292,292,   41,16751, 0xf293ab46, F=0x0
+0,292,417,   41,22029, 0x3696462b, F=0x0
 1,306,306,   21,  574, 0xf6410d4d
 1,327,327,   22,  565, 0xfd561191
 1,350,350,   21,  713, 0x48425147
 1,371,371,   21,  537, 0x09bbf515
-0,375,375,0, 5044, 0xa0344ae6, F=0x0
+0,375,375,   41, 5044, 0xa0344ae6, F=0x0
 1,392,392,   21,  486, 0x7946e28c
 1,413,413,   22,  499, 0xa770f22a
-0,417,500,0,25289, 0x46f9a219, F=0x0
+0,417,500,   41,25289, 0x46f9a219, F=0x0
 1,435,435,   21,  506, 0x355ef81d
 1,456,456,   21,  474, 0x6d24e2c5
-0,459,459,0,12871, 0x23e570c4, F=0x0
+0,459,459,   41,12871, 0x23e570c4, F=0x0
 1,477,477,   21,  494, 0x7d77e90f
 1,498,498,   22,  524, 0x6c82fdd2
-0,500,584,0,29580, 0xd051ad0c, F=0x0
+0,500,584,   41,29580, 0xd051ad0c, F=0x0
 1,520,520,   21,  482, 0xe625f255
 1,541,541,   21,  533, 0xed00fd16
-0,542,542,0, 9221, 0xfa1bdf6c, F=0x0
+0,542,542,   41, 9221, 0xfa1bdf6c, F=0x0
 1,562,562,   21,  524, 0x65cdf879
 1,583,583,   22,  533, 0xee26f570
-0,584,667,0,22238, 0x4e0daf3e, F=0x0
+0,584,667,   41,22238, 0x4e0daf3e, F=0x0
 1,605,605,   21,  621, 0xed9f23cc
-0,625,625,0, 7627, 0xc566337e, F=0x0
+0,625,625,   41, 7627, 0xc566337e, F=0x0
 1,   

Re: [FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present

2015-04-14 Thread Michael Niedermayer
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

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

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


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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Claudio Freire
On Tue, Apr 14, 2015 at 4:52 PM, Rostislav Pehlivanov
 wrote:
> Uhh, can't replicate bug here (freshly built ffmpeg, just applied this patch
> only), (md5 for file = 473edd68b91123c3a9c1825271012357). tried other files
> and they encode and play fine. Spectrum also looks fine. I also tested other
> random files out of the samples and they all seem file.
> Know of any other problematic files?

I did a pull, replaced:

if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
uplim * 1.2f) {

with

if (s->options.pns && start*freq_mul > NOISE_LOW_LIMIT && energy <
uplim * 2.2f) {

And ran

/home/claudiofreire/src/ffmpeg/ffmpeg -i
/home/claudiofreire/tmp/audiosamples/ffsamples/aac/ct_faac-adts.aac
-strict -2 -c:a aac -b:a 48k -cutoff 22050 -f adts -aac_pns 1 -y
test.adts

And got the assertion failure. You can try playing with that constant
or simply commenting out the "energy < uplim * X" term to force all
noise, and you will get 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)

2015-04-14 Thread Michael Niedermayer
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 ?

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test

2015-04-14 Thread wm4
On Tue, 14 Apr 2015 04:03:40 +0300
Ludmila Glinskih  wrote:

> This is a simple test for the FLAC codec.
> It generates an increasing tone, encodes it, decodes it back and
> compares with the original one byte-by-byte.
> ---
>  configure|   2 +
>  doc/Makefile |   1 +
>  doc/examples/Makefile|   1 +
>  doc/examples/flac_test.c | 295 
> +++
>  4 files changed, 299 insertions(+)
>  create mode 100644 doc/examples/flac_test.c
> 
> diff --git a/configure b/configure
> index bc59271..5650ef8 100755
> --- a/configure
> +++ b/configure
> @@ -1329,6 +1329,7 @@ EXAMPLE_LIST="
>  filter_audio_example
>  filtering_audio_example
>  filtering_video_example
> +flac_test_example
>  metadata_example
>  muxing_example
>  qsvdec_example
> @@ -2679,6 +2680,7 @@ extract_mvs_example_deps="avcodec avformat avutil"
>  filter_audio_example_deps="avfilter avutil"
>  filtering_audio_example_deps="avfilter avcodec avformat avutil"
>  filtering_video_example_deps="avfilter avcodec avformat avutil"
> +flac_test_example_deps="avcodec avutil"
>  metadata_example_deps="avformat avutil"
>  muxing_example_deps="avcodec avformat avutil swscale"
>  qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
> diff --git a/doc/Makefile b/doc/Makefile
> index 4573531..f462acc 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -45,6 +45,7 @@ DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE)   += 
> extract_mvs
>  DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)  += filter_audio
>  DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE)   += filtering_audio
>  DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE)   += filtering_video
> +DOC_EXAMPLES-$(CONFIG_FLAC_TEST_EXAMPLE) += flac_test
>  DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)  += metadata
>  DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing
>  DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec
> diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> index 9699f11..72a2fb6 100644
> --- a/doc/examples/Makefile
> +++ b/doc/examples/Makefile
> @@ -18,6 +18,7 @@ EXAMPLES=   avio_list_dir  \
>  extract_mvs\
>  filtering_video\
>  filtering_audio\
> +flac_test  \
>  metadata   \
>  muxing \
>  remuxing   \
> diff --git a/doc/examples/flac_test.c b/doc/examples/flac_test.c
> new file mode 100644
> index 000..392c50c
> --- /dev/null
> +++ b/doc/examples/flac_test.c
> @@ -0,0 +1,295 @@
> +/*
> + * Copyright (c) 2015 Ludmila Glinskih
> + * Copyright (c) 2001 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> + * of this software and associated documentation files (the "Software"), to 
> deal
> + * in the Software without restriction, including without limitation the 
> rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> + * THE SOFTWARE.
> + */
> +
> +/*
> + * FLAC codec test.
> + * Encodes raw data to FLAC format and decodes it back to raw. Compares 
> raw-data
> + * after that.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#define NUMBER_OF_FRAMES 200
> +#define NAME_BUFF_SIZE 100
> +
> +/* generate i-th frame of test audio */
> +static int generate_raw_frame(uint16_t *frame_data, int i, int sample_rate,
> +  int channels, int frame_size)
> +{
> +double t, tincr, tincr2;
> +int j, k;
> +
> +t = 0.0;
> +tincr = 2 * M_PI * 440.0 / sample_rate;
> +tincr2 = tincr / sample_rate;
> +for (j = 0; j < frame_size; j++)
> +{
> +frame_data[channels * j] = (int)(sin(t) * 1);
> +for (k = 1; k < channels; k++)
> +frame_data[channels * j + k] = frame_data[channels * j] * 2;
> +t = i * tincr + (i * (i + 1) / 2.0 * tincr2);
> +}
> +return 0;
> +}

This was mentioned before: using floating point in tests causes
probl

Re: [FFmpeg-devel] [PATCH 2/5] lavc: use correct type for printf() argument

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 09:24:34PM +0200, wm4 wrote:
> This was passing uint32_t for %d.
> ---
>  libavcodec/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Rostislav Pehlivanov
Uhh, can't replicate bug here (freshly built ffmpeg, just applied this
patch only), (md5 for file = 473edd68b91123c3a9c1825271012357). tried other
files and they encode and play fine. Spectrum also looks fine. I also
tested other random files out of the samples and they all seem file.
Know of any other problematic files?

On 14 April 2015 at 16:51, Claudio Freire  wrote:

> On Mon, Apr 13, 2015 at 8:33 PM, Rostislav Pehlivanov
>  wrote:
> > 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 second revision of this patch, made after some
> discussion via non-public email due to a mistake. Any changes made since
> the first revision 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. After a discussion, 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.
> >
> > 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://0x0.st/T7.png (original),
> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png
> (encoded with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png
> >
> > Comments, tips, feedback and criticism are welcome.
>
>
> This commandline:
>
> /home/claudiofreire/src/ffmpeg/ffmpeg -i
> /home/claudiofreire/tmp/audiosamples/ffsamples/aac/ct_faac-adts.aac
> -strict -2 -c:a aac -b:a 48k -cutoff 22050 -f adts -aac_pns 1 -y
> test.adts
>
> Produces:
>
> Assertion diff >= 0 && diff <= 120 failed at libavcodec/aacenc.c:398
> Aborted
>
> This will probably relate to the fact that noise scalefactors need to
> be clamped to a range of SCALE_MAX_DIFF (though independently of
> regular scalefactors).
>
> I would suggest that, at the end of twoloop, you measure the minimum
> noise scalefactor, and clamp in the range minscaler to
> minscaler+SCALE_MAX_DIFF.
>
> You can get the ffsamples folder by configuring with
> --samples=/home/claudiofreire/tmp/audiosamples/ffsamples (or whatever
> path works for you), and then make fate-rsync
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] avformat, avcodec: log discard padding

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 09:24:33PM +0200, wm4 wrote:
> Useful for debugging.
> ---
>  libavcodec/utils.c  | 4 ++--
>  libavformat/utils.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH v2] examples: add flac_test

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 04:03:40AM +0300, Ludmila Glinskih wrote:
> This is a simple test for the FLAC codec.
> It generates an increasing tone, encodes it, decodes it back and
> compares with the original one byte-by-byte.
> ---
>  configure|   2 +
>  doc/Makefile |   1 +
>  doc/examples/Makefile|   1 +
>  doc/examples/flac_test.c | 295 
> +++
>  4 files changed, 299 insertions(+)
>  create mode 100644 doc/examples/flac_test.c
> 
> diff --git a/configure b/configure
> index bc59271..5650ef8 100755
> --- a/configure
> +++ b/configure
> @@ -1329,6 +1329,7 @@ EXAMPLE_LIST="
>  filter_audio_example
>  filtering_audio_example
>  filtering_video_example
> +flac_test_example
>  metadata_example
>  muxing_example
>  qsvdec_example
> @@ -2679,6 +2680,7 @@ extract_mvs_example_deps="avcodec avformat avutil"
>  filter_audio_example_deps="avfilter avutil"
>  filtering_audio_example_deps="avfilter avcodec avformat avutil"
>  filtering_video_example_deps="avfilter avcodec avformat avutil"
> +flac_test_example_deps="avcodec avutil"
>  metadata_example_deps="avformat avutil"
>  muxing_example_deps="avcodec avformat avutil swscale"
>  qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
> diff --git a/doc/Makefile b/doc/Makefile
> index 4573531..f462acc 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -45,6 +45,7 @@ DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE)   += 
> extract_mvs
>  DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)  += filter_audio
>  DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE)   += filtering_audio
>  DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE)   += filtering_video
> +DOC_EXAMPLES-$(CONFIG_FLAC_TEST_EXAMPLE) += flac_test
>  DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)  += metadata
>  DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing
>  DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec
> diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> index 9699f11..72a2fb6 100644
> --- a/doc/examples/Makefile
> +++ b/doc/examples/Makefile
> @@ -18,6 +18,7 @@ EXAMPLES=   avio_list_dir  \
>  extract_mvs\
>  filtering_video\
>  filtering_audio\
> +flac_test  \
>  metadata   \
>  muxing \
>  remuxing   \
> diff --git a/doc/examples/flac_test.c b/doc/examples/flac_test.c
> new file mode 100644
> index 000..392c50c
> --- /dev/null
> +++ b/doc/examples/flac_test.c
> @@ -0,0 +1,295 @@
> +/*
> + * Copyright (c) 2015 Ludmila Glinskih
> + * Copyright (c) 2001 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> + * of this software and associated documentation files (the "Software"), to 
> deal
> + * in the Software without restriction, including without limitation the 
> rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> + * THE SOFTWARE.
> + */
> +
> +/*
> + * FLAC codec test.
> + * Encodes raw data to FLAC format and decodes it back to raw. Compares 
> raw-data
> + * after that.
> + */
> +
> +#include 
> +#include 
> +#include 
> +

> +#define NUMBER_OF_FRAMES 200
> +#define NAME_BUFF_SIZE 100
> +
> +/* generate i-th frame of test audio */
> +static int generate_raw_frame(uint16_t *frame_data, int i, int sample_rate,
> +  int channels, int frame_size)
> +{
> +double t, tincr, tincr2;
> +int j, k;
> +
> +t = 0.0;
> +tincr = 2 * M_PI * 440.0 / sample_rate;
> +tincr2 = tincr / sample_rate;
> +for (j = 0; j < frame_size; j++)
> +{
> +frame_data[channels * j] = (int)(sin(t) * 1);
> +for (k = 1; k < channels; k++)
> +frame_data[channels * j + k] = frame_data[channels * j] * 2;
> +t = i * tincr + (i * (i + 1) / 2.0 * tincr2);
> +}
> +return 0;
> +}

please avoid float/double
see tests/audiogen.c as an example or

[FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present

2015-04-14 Thread wm4
For consistency. This masked another bug before.
---
 libavformat/mp3dec.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c48f1f1..e157a1a 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -432,7 +432,12 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 int64_t best_pos;
 int best_score;
 
-if (   mp3->is_cbr
+if (mp3->xing_toc) {
+if (ret < 0)
+return ret;
+
+ie = &st->index_entries[ret];
+} else if (mp3->is_cbr
 && st->duration > 0
 && mp3->header_filesize > s->internal->data_offset
 && mp3->frames) {
@@ -446,11 +451,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 timestamp = av_clip64(timestamp, 0, duration);
 ie->timestamp = timestamp;
 ie->pos   = av_rescale(timestamp, filesize, duration) + 
s->internal->data_offset;
-} else if (mp3->xing_toc) {
-if (ret < 0)
-return ret;
-
-ie = &st->index_entries[ret];
 } else {
 st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 3/5] Revert "avformat/mp3dec: offset seek index to end of id3v2 tag"

2015-04-14 Thread wm4
This reverts commit 8b76c0eb561b0313e2a27950fe9d2bc5e4780dd8.

It was slightly incorrect; the next commit fixes it.
---
 libavformat/mp3dec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 161f27d..d2498a0 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -106,7 +106,7 @@ static int mp3_read_probe(AVProbeData *p)
 //mpegps_mp3_unrecognized_format.mpg has max_frames=3
 }
 
-static void read_xing_toc(AVFormatContext *s, int64_t base, int64_t filesize, 
int64_t duration)
+static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t 
duration)
 {
 int i;
 MP3DecContext *mp3 = s->priv_data;
@@ -122,7 +122,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t base, 
int64_t filesize, in
 uint8_t b = avio_r8(s->pb);
 if (fill_index)
 av_add_index_entry(s->streams[0],
-   av_rescale(b, filesize, 256) + base,
+   av_rescale(b, filesize, 256),
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);
 }
@@ -130,7 +130,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t base, 
int64_t filesize, in
 mp3->xing_toc = 1;
 }
 
-static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, int64_t base,
+static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
MPADecodeHeader *c, uint32_t spf)
 {
 #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
@@ -172,7 +172,7 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream 
*st, int64_t base,
 }
 }
 if (v & XING_FLAG_TOC)
-read_xing_toc(s, base, mp3->header_filesize, av_rescale_q(mp3->frames,
+read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames,
(AVRational){spf, c->sample_rate},
st->time_base));
 /* VBR quality */
@@ -310,7 +310,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream 
*st, int64_t base)
 mp3->frames = 0;
 mp3->header_filesize   = 0;
 
-mp3_parse_info_tag(s, st, base, &c, spf);
+mp3_parse_info_tag(s, st, &c, spf);
 mp3_parse_vbri_tag(s, st, base);
 
 if (!mp3->frames && !mp3->header_filesize)
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/5] lavc: use correct type for printf() argument

2015-04-14 Thread wm4
This was passing uint32_t for %d.
---
 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d2b8631..fe435fd 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2600,7 +2600,7 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_WARNING, "Could not update timestamps 
for discarded samples.\n");
 }
 av_log(avctx, AV_LOG_DEBUG, "discard %d/%d samples\n",
-   discard_padding, frame->nb_samples);
+   (int)discard_padding, frame->nb_samples);
 frame->nb_samples -= discard_padding;
 }
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 4/5] avformat/mp3dec: offset seek index to end of vbr headers

2015-04-14 Thread wm4
---
 libavformat/mp3dec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index d2498a0..c48f1f1 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -334,6 +334,7 @@ static int mp3_read_header(AVFormatContext *s)
 AVStream *st;
 int64_t off;
 int ret;
+int i;
 
 st = avformat_new_stream(s, NULL);
 if (!st)
@@ -363,6 +364,10 @@ static int mp3_read_header(AVFormatContext *s)
 if (ret < 0)
 return ret;
 
+// the seek index is relative to the end of the xing vbr headers
+for (i = 0; i < st->nb_index_entries; i++)
+st->index_entries[i].pos += avio_tell(s->pb);
+
 /* the parameters will be extracted from the compressed bitstream */
 return 0;
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 0/5] Fix mp3 gapless support (second try)

2015-04-14 Thread wm4
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.

wm4 (5):
  avformat, avcodec: log discard padding
  lavc: use correct type for printf() argument
  Revert "avformat/mp3dec: offset seek index to end of id3v2 tag"
  avformat/mp3dec: offset seek index to end of vbr headers
  avformat/mp3dec: alwas prefer xing toc for seeking if present

 libavcodec/utils.c   |  6 +++---
 libavformat/mp3dec.c | 27 ---
 libavformat/utils.c  |  2 +-
 3 files changed, 20 insertions(+), 15 deletions(-)

-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/5] avformat, avcodec: log discard padding

2015-04-14 Thread wm4
Useful for debugging.
---
 libavcodec/utils.c  | 4 ++--
 libavformat/utils.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 99f254b..d2b8631 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2549,9 +2549,9 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 side= av_packet_get_side_data(avctx->internal->pkt, 
AV_PKT_DATA_SKIP_SAMPLES, &side_size);
 if(side && side_size>=10) {
 avctx->internal->skip_samples = AV_RL32(side);
-av_log(avctx, AV_LOG_DEBUG, "skip %d samples due to side data\n",
-   avctx->internal->skip_samples);
 discard_padding = AV_RL32(side + 4);
+av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to 
side data\n",
+   avctx->internal->skip_samples, (int)discard_padding);
 skip_reason = AV_RL8(side + 8);
 discard_reason = AV_RL8(side + 9);
 }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c6e4627..a7440f5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1415,7 +1415,7 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 if (p) {
 AV_WL32(p, st->skip_samples);
 AV_WL32(p + 4, discard_padding);
-av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", 
st->skip_samples);
+av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d / discard 
%d\n", st->skip_samples, discard_padding);
 }
 st->skip_samples = 0;
 }
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 1/2] webdashenc: replace unchecked av_malloc with stack allocation

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 10:54:23AM -0700, Vignesh Venkatasubramanian wrote:
> Replace an unchecked av_malloc call with stack allocation as the size
> is always a constant.
> 
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/webmdashenc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH 1/2] webdashenc: Add failure check for av_malloc.

2015-04-14 Thread wm4
On Tue, 14 Apr 2015 10:29:33 -0700
Vignesh Venkatasubramanian  wrote:

> Add a missing failure check for av_malloc call.
> 
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/webmdashenc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index c5347a9..c5d7158 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -109,7 +109,7 @@ static void write_header(AVFormatContext *s)
>  time_t local_time = time(NULL);
>  struct tm gmt_buffer;
>  struct tm *gmt = gmtime_r(&local_time, &gmt_buffer);
> -char *gmt_iso = av_malloc(21);
> +char gmt_iso[21];
>  strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt);
>  if (w->debug_mode) {
>  av_strlcpy(gmt_iso, "", 1);
> @@ -122,7 +122,6 @@ static void write_header(AVFormatContext *s)
>  w->utc_timing_url ? "urn:mpeg:dash:utc:http-iso:2014" : 
> "urn:mpeg:dash:utc:direct:2012");
>  avio_printf(s->pb, "  value=\"%s\"/>\n",
>  w->utc_timing_url ? w->utc_timing_url : gmt_iso);
> -av_free(gmt_iso);
>  }
>  }
>  

Looks nice. Though now the title of the patch is wrong. I suggest:
"webdashenc: replace unchecked av_malloc with stack allocation"
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] NVENC HEVC Profile Settings Errors

2015-04-14 Thread Scott Leno
On Tue, Apr 14, 2015 at 8:49 AM, Ali KIZIL  wrote:

> Timo Rothenpieler  rothenpieler.org> writes:
>
> >
> > > When setting level of HEVC in NVENC, FFmpeg gives error:
> > >
> > > root  encoder:~# /opt/ffmpeghw/bin/ffmpeg -i /root/bunny.mp4 -
> aspect 16:9
> > > -s 3840x2160 -vcodec nvenc_h265 -preset hp -fflags +genpts -vb
> 25000k -
> > > minrate 25000k -maxrate 25000k -bufsize 75000k -muxrate 25000k -r 50
> -an
> > > -flush_packets 0 -packetsize 188 -level 5.1 -y -f mpegts /dev/null
> > ...
> > > [nvenc_h2650xee0080] InitializeEncoder failed: 0x8
> >
> > That simply means that the requested encoding options are
> > unsupported/invalid.
> > The requested level is just passed to nvenc, it doesn't support every
> > single one of them in every mode.
> >
> >
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel  ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
>
> Yes, agree. Maybe a fix to give info massage that NVENC does not support
> levels 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6 in HEVC ?
>
>
>
The problem you have is that the 4k video isn't supported in levels below 5
and the 25mb/s minimum rate you specify isn't supported below 6.1
Your problem is a conflict between the level and the parameters you have
chosen.
There are probably other limitations, but those two limit you to 6.1 and
above.
Even if the NVENC does support these levels, your test command line would
fail.

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


Re: [FFmpeg-devel] NVENC HEVC Profile Settings Errors

2015-04-14 Thread Timo Rothenpieler

Yes, agree. Maybe a fix to give info massage that NVENC does not support
levels 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6 in HEVC ?



There is no documented information about what levels it supports, it 
also likely depends on other settings.

So ffmpeg just offers all of them.


>
> I think this section needs to be as below:
>
> static const NvencValuePair nvenc_h265_level_pairs[] = {
>  { "auto", NV_ENC_LEVEL_AUTOSELECT },
>  { "6"   , NV_ENC_LEVEL_HEVC_6 },
>  { "6.0" , NV_ENC_LEVEL_HEVC_6 },
>  { "6.1" , NV_ENC_LEVEL_HEVC_61},
>  { "6.2" , NV_ENC_LEVEL_HEVC_62},
>  { NULL }
> };
>

Not it doesn't. As i said, there is no certain information about what is 
or will be supported in combination with other settings.





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


Re: [FFmpeg-devel] [PATCH v2 3/3] [GSoC] [AAC] aacdec: Use macros for constants

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 12:36:48PM -0300, Claudio Freire wrote:
> LGTM

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Claudio Freire
On Mon, Apr 13, 2015 at 8:33 PM, Rostislav Pehlivanov
 wrote:
> 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 second revision of this patch, made after some discussion via 
> non-public email due to a mistake. Any changes made since the first revision 
> 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. After a discussion, 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.
>
> 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://0x0.st/T7.png (original), 
> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png (encoded 
> with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png
>
> Comments, tips, feedback and criticism are welcome.


This commandline:

/home/claudiofreire/src/ffmpeg/ffmpeg -i
/home/claudiofreire/tmp/audiosamples/ffsamples/aac/ct_faac-adts.aac
-strict -2 -c:a aac -b:a 48k -cutoff 22050 -f adts -aac_pns 1 -y
test.adts

Produces:

Assertion diff >= 0 && diff <= 120 failed at libavcodec/aacenc.c:398
Aborted

This will probably relate to the fact that noise scalefactors need to
be clamped to a range of SCALE_MAX_DIFF (though independently of
regular scalefactors).

I would suggest that, at the end of twoloop, you measure the minimum
noise scalefactor, and clamp in the range minscaler to
minscaler+SCALE_MAX_DIFF.

You can get the ffsamples folder by configuring with
--samples=/home/claudiofreire/tmp/audiosamples/ffsamples (or whatever
path works for you), and then make fate-rsync
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 12:42:21PM -0300, Claudio Freire wrote:
> On Tue, Apr 14, 2015 at 6:10 AM, Michael Niedermayer  wrote:
> > On Tue, Apr 14, 2015 at 12:33:50AM +0100, Rostislav Pehlivanov wrote:
> >> 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 second revision of this patch, made after some 
> >> discussion via non-public email due to a mistake. Any changes made since 
> >> the first revision 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. After a discussion, 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.
> >>
> >> 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://0x0.st/T7.png (original), 
> >> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png 
> >> (encoded with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png
> >
> > its probably better to upload and link to places that are more permanent
> > than 0x0.st as someone in the future might see this discussion or
> > commit and could want to see the pictures too
> 
> 
> ffmpeg's wiki?

yes, possible

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 03:01:00PM +0200, Wiebe Cazemier wrote:
> - Original Message -
> > From: "Wiebe Cazemier" 
> > To: "Michael Niedermayer" 
> > Cc: "FFmpeg development discussions and patches" , 
> > "madshi" 
> > Sent: Monday, 6 April, 2015 7:25:16 AM
> > Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
> > (drc_scale) is now 0 by default
> > 
> > > 
> > > has someone contacted justin ?
> > > 
> > > 
> > 
> > I did now.
> > 
> > Sorry, I was still kind of spacing out on what to do next...
> 
> As of yet no response. Do we take the other decision making route?

If you belive that a listed maintainer in the MAINTAINERs file no
longer wants to / no longer is maintaining the code he is listed for
in FFmpeg. Then yes please post a patch that corrects the MAINTAINERs
file with a CC to anyone whos status is changed and explanation in
the commit message

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Claudio Freire
On Tue, Apr 14, 2015 at 6:10 AM, Michael Niedermayer  wrote:
> On Tue, Apr 14, 2015 at 12:33:50AM +0100, Rostislav Pehlivanov wrote:
>> 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 second revision of this patch, made after some 
>> discussion via non-public email due to a mistake. Any changes made since the 
>> first revision 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. After a discussion, 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.
>>
>> 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://0x0.st/T7.png (original), 
>> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png (encoded 
>> with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png
>
> its probably better to upload and link to places that are more permanent
> than 0x0.st as someone in the future might see this discussion or
> commit and could want to see the pictures too


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


Re: [FFmpeg-devel] [PATCH v2 3/3] [GSoC] [AAC] aacdec: Use macros for constants

2015-04-14 Thread Claudio Freire
LGTM

On Mon, Apr 13, 2015 at 8:33 PM, Rostislav Pehlivanov
 wrote:
> This commit replaces the previous hardcoded constants with both new and 
> previously defined macros from aac.h. This change makes it easy for anyone 
> reading the code to know how encoding and decoding scalefactors works. It's 
> also possibly a step in unifying some of the code across both the encoder and 
> decoder.
> ---
>  libavcodec/aacdec.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
> index 5a0c05a..1a2ddc2 100644
> --- a/libavcodec/aacdec.c
> +++ b/libavcodec/aacdec.c
> @@ -1394,7 +1394,7 @@ static int decode_scalefactors(AACContext *ac, float 
> sf[120], GetBitContext *gb,
> int band_type_run_end[120])
>  {
>  int g, i, idx = 0;
> -int offset[3] = { global_gain, global_gain - 90, 0 };
> +int offset[3] = { global_gain, global_gain - NOISE_OFFSET, 0 };
>  int clipped_offset;
>  int noise_flag = 1;
>  for (g = 0; g < ics->num_window_groups; g++) {
> @@ -1406,7 +1406,7 @@ static int decode_scalefactors(AACContext *ac, float 
> sf[120], GetBitContext *gb,
>  } else if ((band_type[idx] == INTENSITY_BT) ||
> (band_type[idx] == INTENSITY_BT2)) {
>  for (; i < run_end; i++, idx++) {
> -offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) 
> - 60;
> +offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) 
> - SCALE_DIFF_ZERO;
>  clipped_offset = av_clip(offset[2], -155, 100);
>  if (offset[2] != clipped_offset) {
>  avpriv_request_sample(ac->avctx,
> @@ -1419,9 +1419,9 @@ static int decode_scalefactors(AACContext *ac, float 
> sf[120], GetBitContext *gb,
>  } else if (band_type[idx] == NOISE_BT) {
>  for (; i < run_end; i++, idx++) {
>  if (noise_flag-- > 0)
> -offset[1] += get_bits(gb, 9) - 256;
> +offset[1] += get_bits(gb, NOISE_PRE_BITS) - 
> NOISE_PRE;
>  else
> -offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 
> 3) - 60;
> +offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 
> 3) - SCALE_DIFF_ZERO;
>  clipped_offset = av_clip(offset[1], -100, 155);
>  if (offset[1] != clipped_offset) {
>  avpriv_request_sample(ac->avctx,
> @@ -1433,7 +1433,7 @@ static int decode_scalefactors(AACContext *ac, float 
> sf[120], GetBitContext *gb,
>  }
>  } else {
>  for (; i < run_end; i++, idx++) {
> -offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) 
> - 60;
> +offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) 
> - SCALE_DIFF_ZERO;
>  if (offset[0] > 255U) {
>  av_log(ac->avctx, AV_LOG_ERROR,
> "Scalefactor (%d) out of range.\n", 
> offset[0]);
> --
> 2.1.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-04-14 Thread Kieran Kunhya
On 14 April 2015 at 14:01, Wiebe Cazemier  wrote:
> - Original Message -
>> From: "Wiebe Cazemier" 
>> To: "Michael Niedermayer" 
>> Cc: "FFmpeg development discussions and patches" , 
>> "madshi" 
>> Sent: Monday, 6 April, 2015 7:25:16 AM
>> Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
>> (drc_scale) is now 0 by default
>>
>> >
>> > has someone contacted justin ?
>> >
>> >
>>
>> I did now.
>>
>> Sorry, I was still kind of spacing out on what to do next...
>
> As of yet no response. Do we take the other decision making route?

No because votes in FFmpeg are historically a bad idea.

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


Re: [FFmpeg-devel] ffmpeg latest git - rewrapping (codec copy) breaks container fps/tbr values

2015-04-14 Thread David Favor

Michael Niedermayer wrote:

On Mon, Apr 13, 2015 at 04:36:18PM -0500, David Favor wrote:

David Favor wrote:

David Favor wrote:

The following command:

   ffmpeg -i clip.mts -c:v copy -c:a copy clip.mp4 (or clip.mov)

seems to incorrectly write container values for fps + tbr which
causes .mp4/.mov files to play with very odd jerky movements.

https://trac.ffmpeg.org/ticket/974 seems to be a ticket already
opened for this.

More jittery artifacts.

This produces no jitter:

 ffmpeg -fflags +genpts -i clip.mts -c:v copy -c:a copy clip.mp4




This produces jitter:

 ffmpeg -fflags +genpts -i clip.mts -c:v copy -c:a libfaac clip.mp4

Anytime the audio stream is transcoded (libfaac or fdk), jitter returns.

This behavior isn't mentioned in the above ticket.


if you found a bug which isnt reported yet (i dont know if that applies
here) please open a new seperate ticket


https://trac.ffmpeg.org/ticket/4485 opened to cover audio transcode
having any effect on video stream.

https://trac.ffmpeg.org/ticket/974 updated with additional info about
-fflags +genpts having unexpected effect on container fps + tbr values.
Specifically, -fflags +genpts seems to imply the target footage will
have same fps + tbr values as source footage.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-14 Thread Paul B Mahol
On 4/14/15, Thilo Borgmann  wrote:
> Am 13.04.15 um 21:44 schrieb Michael Niedermayer:
>> On Mon, Apr 13, 2015 at 06:49:04PM +, Paul B Mahol wrote:
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavcodec/alsdec.c | 61
>>> ++---
>>>  1 file changed, 30 insertions(+), 31 deletions(-)
>>
>> LGTM
>
> OK

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


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-04-14 Thread Wiebe Cazemier
- Original Message -
> From: "Wiebe Cazemier" 
> To: "Michael Niedermayer" 
> Cc: "FFmpeg development discussions and patches" , 
> "madshi" 
> Sent: Monday, 6 April, 2015 7:25:16 AM
> Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
> (drc_scale) is now 0 by default
> 
> > 
> > has someone contacted justin ?
> > 
> > 
> 
> I did now.
> 
> Sorry, I was still kind of spacing out on what to do next...

As of yet no response. Do we take the other decision making route?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] NVENC HEVC Profile Settings Errors

2015-04-14 Thread Ali KIZIL
Timo Rothenpieler  rothenpieler.org> writes:

> 
> > When setting level of HEVC in NVENC, FFmpeg gives error:
> >
> > root  encoder:~# /opt/ffmpeghw/bin/ffmpeg -i /root/bunny.mp4 -
aspect 16:9
> > -s 3840x2160 -vcodec nvenc_h265 -preset hp -fflags +genpts -vb 
25000k -
> > minrate 25000k -maxrate 25000k -bufsize 75000k -muxrate 25000k -r 50 
-an
> > -flush_packets 0 -packetsize 188 -level 5.1 -y -f mpegts /dev/null
> ...
> > [nvenc_h2650xee0080] InitializeEncoder failed: 0x8
> 
> That simply means that the requested encoding options are 
> unsupported/invalid.
> The requested level is just passed to nvenc, it doesn't support every 
> single one of them in every mode.
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel  ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

I think this section needs to be as below:

static const NvencValuePair nvenc_h265_level_pairs[] = {
{ "auto", NV_ENC_LEVEL_AUTOSELECT },
{ "6"   , NV_ENC_LEVEL_HEVC_6 },
{ "6.0" , NV_ENC_LEVEL_HEVC_6 },
{ "6.1" , NV_ENC_LEVEL_HEVC_61},
{ "6.2" , NV_ENC_LEVEL_HEVC_62},
{ NULL }
};


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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Paul B Mahol
On 4/14/15, Rostislav Pehlivanov  wrote:
> The images will be retained for 356 days according to the formula left on
> the website. As long as it's guaranteed its better than anything else I've
> used, and it doesn't touch the images so you can replicate the results.
>
> Nevertheless, here's a backup of them just in case:
> Original: http://postimg.org/image/mzoix4goz/full/
> Encoded(without PNS): http://postimg.org/image/mvupgvb7n/full/
> Encoded(with PNS, const = 1.2(default)):
> http://postimg.org/image/kd90g6phf/full/
> Encoded(with PNS, const = 2.2): http://postimg.org/image/pshqh5h1f/full/
> Difference(no PNS -> PNS const 1.2):
> http://postimg.org/image/6v243wdc3/full/
> Difference(no PNS -> PNS const 2.2):
> http://postimg.org/image/g6o60upvn/full/
>
> To process the difference, the following command was used(from the
> imagemagick utils):
> '$ composite file1.png file2.png -compose difference diff1.png'
>

Same can be done with blend filter.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] NVENC HEVC Profile Settings Errors

2015-04-14 Thread Ali KIZIL
Timo Rothenpieler  rothenpieler.org> writes:

> 
> > When setting level of HEVC in NVENC, FFmpeg gives error:
> >
> > root  encoder:~# /opt/ffmpeghw/bin/ffmpeg -i /root/bunny.mp4 -
aspect 16:9
> > -s 3840x2160 -vcodec nvenc_h265 -preset hp -fflags +genpts -vb 
25000k -
> > minrate 25000k -maxrate 25000k -bufsize 75000k -muxrate 25000k -r 50 
-an
> > -flush_packets 0 -packetsize 188 -level 5.1 -y -f mpegts /dev/null
> ...
> > [nvenc_h2650xee0080] InitializeEncoder failed: 0x8
> 
> That simply means that the requested encoding options are 
> unsupported/invalid.
> The requested level is just passed to nvenc, it doesn't support every 
> single one of them in every mode.
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel  ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

Yes, agree. Maybe a fix to give info massage that NVENC does not support 
levels 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6 in HEVC ?


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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Rostislav Pehlivanov
The images will be retained for 356 days according to the formula left on
the website. As long as it's guaranteed its better than anything else I've
used, and it doesn't touch the images so you can replicate the results.

Nevertheless, here's a backup of them just in case:
Original: http://postimg.org/image/mzoix4goz/full/
Encoded(without PNS): http://postimg.org/image/mvupgvb7n/full/
Encoded(with PNS, const = 1.2(default)):
http://postimg.org/image/kd90g6phf/full/
Encoded(with PNS, const = 2.2): http://postimg.org/image/pshqh5h1f/full/
Difference(no PNS -> PNS const 1.2):
http://postimg.org/image/6v243wdc3/full/
Difference(no PNS -> PNS const 2.2):
http://postimg.org/image/g6o60upvn/full/

To process the difference, the following command was used(from the
imagemagick utils):
'$ composite file1.png file2.png -compose difference diff1.png'

On 14 April 2015 at 10:10, Michael Niedermayer  wrote:

> On Tue, Apr 14, 2015 at 12:33:50AM +0100, Rostislav Pehlivanov wrote:
> > 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 second revision of this patch, made after some
> discussion via non-public email due to a mistake. Any changes made since
> the first revision 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. After a discussion, 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.
> >
> > 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://0x0.st/T7.png (original),
> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png
> (encoded with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png
>
> its probably better to upload and link to places that are more permanent
> than 0x0.st as someone in the future might see this discussion or
> commit and could want to see the pictures too
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Everything should be made as simple as possible, but not simpler.
> -- Albert Einstein
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Check for not synchronized packets (very small feed file, very slow client connection)

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 12:36:37PM +0200, Milan Matejec wrote:
> Hi,
> 
> sorry but that doesn't make sense. FFM is internal exchange format and
> temporary feed file in this format is created every time ffserver is
> started so why keep backward compatibility? Also adding checks for it would
> create needless amount of code in it.

ffm is used to comunicate between ffmpeg and ffserver, the 2 can run
on different computers and certainly can be different versions,
we have also tried to maintain compatibility previously
also why does your bugfix need any change to the format in the
first place ?

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Fix potential leak in realloc

2015-04-14 Thread Michael Niedermayer
On Mon, Apr 13, 2015 at 01:58:30PM -0700, Vignesh Venkatasubramanian wrote:
> On Mon, Apr 13, 2015 at 12:48 PM, Michael Niedermayer  
> wrote:
> > On Mon, Apr 13, 2015 at 12:16:44PM -0700, Vignesh Venkatasubramanian wrote:
> >> Fix potential leak in av_realloc call where the output was being
> >> overwritten by using a temporary variable.
> >>
> >> Signed-off-by: Vignesh Venkatasubramanian 
> >> ---
> >>  libavformat/webmdashenc.c | 5 +++--
> >>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> >> index 80266f7..0f915fd 100644
> >> --- a/libavformat/webmdashenc.c
> >> +++ b/libavformat/webmdashenc.c
> >> @@ -419,9 +419,10 @@ static int parse_adaptation_sets(AVFormatContext *s)
> >>  if (*p == ' ')
> >>  continue;
> >>  else if (state == new_set && !strncmp(p, "id=", 3)) {
> >> -w->as = av_realloc(w->as, sizeof(*w->as) * ++w->nb_as);
> >> -if (w->as == NULL)
> >> +void *mem = av_realloc(w->as, sizeof(*w->as) * ++w->nb_as);
> >> +if (mem == NULL)
> >>  return AVERROR(ENOMEM);
> >
> > nb_as will be 1 larger than the array in the return case
> > is that intended / safe ?
> >
> 
> yes, that value shouldn't be used anywhere else. anyway, i'm reworking
> a lot of error handling in this file. so this is fine for now.

nb_as is used in webm_dash_manifest_write_trailer() too 

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

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


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


Re: [FFmpeg-devel] [PATCH] Check for not synchronized packets (very small feed file, very slow client connection)

2015-04-14 Thread Milan Matejec
Hi,

sorry but that doesn't make sense. FFM is internal exchange format and
temporary feed file in this format is created every time ffserver is
started so why keep backward compatibility? Also adding checks for it would
create needless amount of code in it.

Thanks.

M.

2015-04-14 1:10 GMT+02:00 Michael Niedermayer :

> On Sun, Apr 12, 2015 at 11:30:32PM +0200, Milan Matejec wrote:
> > Hi,
> >
> > attached is patch for encoding/decoding .ffm format. When you set a
> maximum
> > size of feed file to too small number (I tried 20k) and try to connect to
> > ffserver from very slow connection (simulated by reading 8k chunks and
> then
> > wait 3 seconds) .ffm decoder will after a few seconds (10 maybe more ...)
> > stuck in endless "READ_HEADER" state because it got unreal size of .ffm
> > data packet (it's 24bits so take some random number - usually something
> > about 10MB) leading to immediately return after *ffm_is_avail_data()*.
> This
> > patch adds a packet header with signature so after loading header it
> tries
> > to check if signature is there. If not then it logs an error and tries to
> > reset a packet and read header again. It's not a best solution but better
> > than end up in an endless loop ...
>
> please split the patch in 2, one for the demuxer and one for the muxer
> make sure the code works with only one patch applied and interoperation
> between versions that have and do not have the patch is fully fine
> it appears its not with this patchset
>
> also please attach patches normally and dont double encode them
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> It is what and why we do it that matters, not just one of them.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/drawtext: fix frame mem leak

2015-04-14 Thread Michael Niedermayer
On Fri, Apr 10, 2015 at 05:28:45PM +0300, Ivan Efimov wrote:
> Signed-off-by: Ivan Efimov 
> ---
> This fixes memory leak in drawtext in case of textfile load error
> 
>  libavfilter/vf_drawtext.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

applied

thanks

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: use av_malloc(z)_array()

2015-04-14 Thread Thilo Borgmann
Am 13.04.15 um 21:44 schrieb Michael Niedermayer:
> On Mon, Apr 13, 2015 at 06:49:04PM +, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavcodec/alsdec.c | 61 
>> ++---
>>  1 file changed, 30 insertions(+), 31 deletions(-)
> 
> LGTM

OK

-Thilo

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


Re: [FFmpeg-devel] [PATCH v2 1/3] [GSoC] [AAC] aaccoder: Implement Perceptual Noise Substitution

2015-04-14 Thread Michael Niedermayer
On Tue, Apr 14, 2015 at 12:33:50AM +0100, Rostislav Pehlivanov wrote:
> 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 second revision of this patch, made after some discussion via 
> non-public email due to a mistake. Any changes made since the first revision 
> 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. After a discussion, 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.
> 
> 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://0x0.st/T7.png (original), 
> https://0x0.st/Th.png (encoded without PNS), https://0x0.st/A1.png (encoded 
> with PNS, const = 1.2), https://0x0.st/Aj.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://0x0.st/Ae.png

its probably better to upload and link to places that are more permanent
than 0x0.st as someone in the future might see this discussion or
commit and could want to see the pictures too

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] NVENC HEVC Profile Settings Errors

2015-04-14 Thread Timo Rothenpieler

When setting level of HEVC in NVENC, FFmpeg gives error:

root@encoder:~# /opt/ffmpeghw/bin/ffmpeg -i /root/bunny.mp4 -aspect 16:9
-s 3840x2160 -vcodec nvenc_h265 -preset hp -fflags +genpts -vb 25000k -
minrate 25000k -maxrate 25000k -bufsize 75000k -muxrate 25000k -r 50 -an
-flush_packets 0 -packetsize 188 -level 5.1 -y -f mpegts /dev/null

...

[nvenc_h265 @ 0xee0080] InitializeEncoder failed: 0x8


That simply means that the requested encoding options are 
unsupported/invalid.
The requested level is just passed to nvenc, it doesn't support every 
single one of them in every mode.




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


Re: [FFmpeg-devel] [PATCH 1/2] webdashenc: Add failure check for av_malloc.

2015-04-14 Thread wm4
On Mon, 13 Apr 2015 12:16:31 -0700
Vignesh Venkatasubramanian  wrote:

> Add a missing failure check for av_malloc call.
> 
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/webmdashenc.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index c5347a9..80266f7 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -87,7 +87,7 @@ static double get_duration(AVFormatContext *s)
>  return max / 1000;
>  }
>  
> -static void write_header(AVFormatContext *s)
> +static int write_header(AVFormatContext *s)
>  {
>  WebMDashMuxContext *w = s->priv_data;
>  double min_buffer_time = 1.0;
> @@ -110,6 +110,7 @@ static void write_header(AVFormatContext *s)
>  struct tm gmt_buffer;
>  struct tm *gmt = gmtime_r(&local_time, &gmt_buffer);
>  char *gmt_iso = av_malloc(21);
> +if (!gmt_iso) return AVERROR(ENOMEM);

There is absolutely no reason why it should use malloc for 21 bytes.
I'm really wondering why you're adding a failure path instead of just
turning it into a stack allocation??

>  strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt);
>  if (w->debug_mode) {
>  av_strlcpy(gmt_iso, "", 1);
> @@ -124,6 +125,7 @@ static void write_header(AVFormatContext *s)
>  w->utc_timing_url ? w->utc_timing_url : gmt_iso);
>  av_free(gmt_iso);
>  }
> +return 0;
>  }
>  
>  static void write_footer(AVFormatContext *s)
> @@ -456,7 +458,7 @@ static int 
> webm_dash_manifest_write_header(AVFormatContext *s)
>  double start = 0.0;
>  WebMDashMuxContext *w = s->priv_data;
>  parse_adaptation_sets(s);
> -write_header(s);
> +if (write_header(s) < 0) return -1;
>  avio_printf(s->pb, "  avio_printf(s->pb, " start=\"PT%gS\"", start);
>  if (!w->is_live) {

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


Re: [FFmpeg-devel] [PATCH] avfilter/drawtext: fix frame mem leak

2015-04-14 Thread Ivan Efimov
2015-04-10 17:28 GMT+03:00 Ivan Efimov :
> Signed-off-by: Ivan Efimov 
> ---
> This fixes memory leak in drawtext in case of textfile load error
>
>  libavfilter/vf_drawtext.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index 37eb231..cf17a55 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -1275,12 +1275,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  int ret;
>
>  if (s->reload) {
> -if ((ret = load_textfile(ctx)) < 0)
> +if ((ret = load_textfile(ctx)) < 0) {
> +av_frame_free(&frame);
>  return ret;
> +}
>  #if CONFIG_LIBFRIBIDI
>  if (s->text_shaping)
> -if ((ret = shape_text(ctx)) < 0)
> +if ((ret = shape_text(ctx)) < 0) {
> +av_frame_free(&frame);
>  return ret;
> +}
>  #endif
>  }
>
> --
> 2.1.4
>

Hi all,

Could you please take a look at my patch for drawtext.
It is fairly small, so it should not take a lot of time.

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