Re: [FFmpeg-devel] [PATCH 2/5] libmp3lame + mp3enc: removes decoder delay compensation

2016-07-12 Thread Michael Niedermayer
On Tue, Jul 12, 2016 at 04:19:53PM -0700, Jon Toohill wrote:
> initial_padding specifies only encoder delay, decoder delay is
> handled by start_skip_samples.
> ---
>  doc/APIchanges  | 4 
>  libavcodec/libmp3lame.c | 2 +-
>  libavcodec/version.h| 2 +-
>  libavformat/mp3enc.c| 4 ++--
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index d777dc0..ae450e1 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,10 @@ libavutil: 2015-08-28
>  
>  API changes, most recent first:
>  
> +2016-07-12 - xxx - lavc 57.47.100 - libmp3lame.c
> +  Removed MP3 decoder delay from initial_padding in AVCodecContext.
> +  initial_padding only includes the encoder delay.
> +
>  2016-04-27 - xxx - lavu 55.23.100 - log.h
>Add a new function av_log_format_line2() which returns number of bytes
>written to the target buffer.
> diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
> index 5642264..198ac94 100644
> --- a/libavcodec/libmp3lame.c
> +++ b/libavcodec/libmp3lame.c
> @@ -137,7 +137,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext 
> *avctx)
>  }
>  
>  /* get encoder delay */
> -avctx->initial_padding = lame_get_encoder_delay(s->gfp) + 528 + 1;
> +avctx->initial_padding = lame_get_encoder_delay(s->gfp);
>  ff_af_queue_init(avctx, >afq);
>  
>  avctx->frame_size  = lame_get_framesize(s->gfp);
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 0852b43..37a6e17 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR  57
> -#define LIBAVCODEC_VERSION_MINOR  46
> +#define LIBAVCODEC_VERSION_MINOR  47

master is at 50
release/3.1 is at 48

the issue described in the last patchset a moment ago
./ffmpeg -i  ~/videos/matrixbench_mpeg2.mpg  -acodec mp3 -vn -t 1 file.mp4

applies to teh new patch 1+2 too

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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


[FFmpeg-devel] [PATCH 2/5] libmp3lame + mp3enc: removes decoder delay compensation

2016-07-12 Thread Jon Toohill
initial_padding specifies only encoder delay, decoder delay is
handled by start_skip_samples.
---
 doc/APIchanges  | 4 
 libavcodec/libmp3lame.c | 2 +-
 libavcodec/version.h| 2 +-
 libavformat/mp3enc.c| 4 ++--
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index d777dc0..ae450e1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-07-12 - xxx - lavc 57.47.100 - libmp3lame.c
+  Removed MP3 decoder delay from initial_padding in AVCodecContext.
+  initial_padding only includes the encoder delay.
+
 2016-04-27 - xxx - lavu 55.23.100 - log.h
   Add a new function av_log_format_line2() which returns number of bytes
   written to the target buffer.
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 5642264..198ac94 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -137,7 +137,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext 
*avctx)
 }
 
 /* get encoder delay */
-avctx->initial_padding = lame_get_encoder_delay(s->gfp) + 528 + 1;
+avctx->initial_padding = lame_get_encoder_delay(s->gfp);
 ff_af_queue_init(avctx, >afq);
 
 avctx->frame_size  = lame_get_framesize(s->gfp);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0852b43..37a6e17 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  46
+#define LIBAVCODEC_VERSION_MINOR  47
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index de63401..3b77d29 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -249,10 +249,10 @@ static int mp3_write_xing(AVFormatContext *s)
 avio_w8(dyn_ctx, 0);  // unknown abr/minimal bitrate
 
 // encoder delay
-if (par->initial_padding - 528 - 1 >= 1 << 12) {
+if (par->initial_padding >= 1 << 12) {
 av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
 }
-avio_wb24(dyn_ctx, FFMAX(par->initial_padding - 528 - 1, 0)<<12);
+avio_wb24(dyn_ctx, par->initial_padding << 12);
 
 avio_w8(dyn_ctx,   0); // misc
 avio_w8(dyn_ctx,   0); // mp3gain
-- 
2.8.0.rc3.226.g39d4020

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