diff mbox

[FFmpeg-devel] avfilter/af_atempo: fix drift calculation, ticket #6157

Message ID 1487458002-6569-1-git-send-email-pkoshevoy@gmail.com
State Accepted
Commit 947fdad92de8ce6912ed8f3095c218c35d0b9fa7
Headers show

Commit Message

Pavel Koshevoy Feb. 18, 2017, 10:46 p.m. UTC
From: Pavel Koshevoy <pkoshevoy@gmail.com>

---
 libavfilter/af_atempo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Steven Liu Feb. 19, 2017, 2:04 a.m. UTC | #1
2017-02-19 6:46 GMT+08:00 <pkoshevoy@gmail.com>:

> From: Pavel Koshevoy <pkoshevoy@gmail.com>
>
> ---
>  libavfilter/af_atempo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
> index a487882..eb62656 100644
> --- a/libavfilter/af_atempo.c
> +++ b/libavfilter/af_atempo.c
> @@ -697,11 +697,11 @@ static int yae_adjust_position(ATempoContext
> *atempo)
>      AudioFragment       *frag = yae_curr_frag(atempo);
>
>      const double prev_output_position =
> -        (double)(prev->position[1] - atempo->origin[1] + atempo->window /
> 2);
> +        (double)(prev->position[1] - atempo->origin[1] + atempo->window /
> 2) *
> +        atempo->tempo;
>
>      const double ideal_output_position =
> -        (double)(prev->position[0] - atempo->origin[0] + atempo->window /
> 2) /
> -        atempo->tempo;
> +        (double)(prev->position[0] - atempo->origin[0] + atempo->window /
> 2);
>
>      const int drift = (int)(prev_output_position - ideal_output_position);
>
> --
> 2.6.6
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


LGTM


Thanks
Pavel Koshevoy Feb. 19, 2017, 2:22 a.m. UTC | #2
On 02/18/2017 07:04 PM, Steven Liu wrote:
>
>
> 2017-02-19 6:46 GMT+08:00 <pkoshevoy@gmail.com <mailto:pkoshevoy@gmail.com>>:
>
>     From: Pavel Koshevoy <pkoshevoy@gmail.com <mailto:pkoshevoy@gmail.com>>
>
>     ---
>      libavfilter/af_atempo.c | 6 +++---
>      1 file changed, 3 insertions(+), 3 deletions(-)
>
>     diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
>     index a487882..eb62656 100644
>     --- a/libavfilter/af_atempo.c
>     +++ b/libavfilter/af_atempo.c
>     @@ -697,11 +697,11 @@ static int yae_adjust_position(ATempoContext *atempo)
>          AudioFragment       *frag = yae_curr_frag(atempo);
>
>          const double prev_output_position =
>     -        (double)(prev->position[1] - atempo->origin[1] + atempo->window / 2);
>     +        (double)(prev->position[1] - atempo->origin[1] + atempo->window /
>     2) *
>     +        atempo->tempo;
>
>          const double ideal_output_position =
>     -        (double)(prev->position[0] - atempo->origin[0] + atempo->window /
>     2) /
>     -        atempo->tempo;
>     +        (double)(prev->position[0] - atempo->origin[0] + atempo->window / 2);
>
>          const int drift = (int)(prev_output_position - ideal_output_position);
>
>     --
>     2.6.6
>
>     _______________________________________________
>     ffmpeg-devel mailing list
>     ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>     http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>     <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
>
>
>
> LGTM
>
>
> Thanks


Then would someone apply this, please?


Thank you,

     Pavel
Steven Liu Feb. 19, 2017, 2:42 a.m. UTC | #3
2017-02-19 10:22 GMT+08:00 Pavel Koshevoy <pkoshevoy@gmail.com>:

> On 02/18/2017 07:04 PM, Steven Liu wrote:
>
>>
>>
>> 2017-02-19 6:46 GMT+08:00 <pkoshevoy@gmail.com <mailto:
>> pkoshevoy@gmail.com>>:
>>
>>     From: Pavel Koshevoy <pkoshevoy@gmail.com <mailto:pkoshevoy@gmail.com
>> >>
>>
>>     ---
>>      libavfilter/af_atempo.c | 6 +++---
>>      1 file changed, 3 insertions(+), 3 deletions(-)
>>
>>     diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
>>     index a487882..eb62656 100644
>>     --- a/libavfilter/af_atempo.c
>>     +++ b/libavfilter/af_atempo.c
>>     @@ -697,11 +697,11 @@ static int yae_adjust_position(ATempoContext
>> *atempo)
>>          AudioFragment       *frag = yae_curr_frag(atempo);
>>
>>          const double prev_output_position =
>>     -        (double)(prev->position[1] - atempo->origin[1] +
>> atempo->window / 2);
>>     +        (double)(prev->position[1] - atempo->origin[1] +
>> atempo->window /
>>     2) *
>>     +        atempo->tempo;
>>
>>          const double ideal_output_position =
>>     -        (double)(prev->position[0] - atempo->origin[0] +
>> atempo->window /
>>     2) /
>>     -        atempo->tempo;
>>     +        (double)(prev->position[0] - atempo->origin[0] +
>> atempo->window / 2);
>>
>>          const int drift = (int)(prev_output_position -
>> ideal_output_position);
>>
>>     --
>>     2.6.6
>>
>>     _______________________________________________
>>     ffmpeg-devel mailing list
>>     ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>>     http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>     <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
>>
>>
>>
>> LGTM
>>
>>
>> Thanks
>>
>
>
> Then would someone apply this, please?
>

Will apply after 24 hours!

>
>
> Thank you,
>
>     Pavel
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Steven Liu Feb. 20, 2017, 2:52 a.m. UTC | #4
2017-02-19 10:42 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:

>
>
> 2017-02-19 10:22 GMT+08:00 Pavel Koshevoy <pkoshevoy@gmail.com>:
>
>> On 02/18/2017 07:04 PM, Steven Liu wrote:
>>
>>>
>>>
>>> 2017-02-19 6:46 GMT+08:00 <pkoshevoy@gmail.com <mailto:
>>> pkoshevoy@gmail.com>>:
>>>
>>>     From: Pavel Koshevoy <pkoshevoy@gmail.com <mailto:
>>> pkoshevoy@gmail.com>>
>>>
>>>     ---
>>>      libavfilter/af_atempo.c | 6 +++---
>>>      1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>>     diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
>>>     index a487882..eb62656 100644
>>>     --- a/libavfilter/af_atempo.c
>>>     +++ b/libavfilter/af_atempo.c
>>>     @@ -697,11 +697,11 @@ static int yae_adjust_position(ATempoContext
>>> *atempo)
>>>          AudioFragment       *frag = yae_curr_frag(atempo);
>>>
>>>          const double prev_output_position =
>>>     -        (double)(prev->position[1] - atempo->origin[1] +
>>> atempo->window / 2);
>>>     +        (double)(prev->position[1] - atempo->origin[1] +
>>> atempo->window /
>>>     2) *
>>>     +        atempo->tempo;
>>>
>>>          const double ideal_output_position =
>>>     -        (double)(prev->position[0] - atempo->origin[0] +
>>> atempo->window /
>>>     2) /
>>>     -        atempo->tempo;
>>>     +        (double)(prev->position[0] - atempo->origin[0] +
>>> atempo->window / 2);
>>>
>>>          const int drift = (int)(prev_output_position -
>>> ideal_output_position);
>>>
>>>     --
>>>     2.6.6
>>>
>>>     _______________________________________________
>>>     ffmpeg-devel mailing list
>>>     ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>>>     http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>     <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
>>>
>>>
>>>
>>> LGTM
>>>
>>>
>>> Thanks
>>>
>>
>>
>> Then would someone apply this, please?
>>
>
> Will apply after 24 hours!
>
>>
>>
>> Thank you,
>>
>>     Pavel
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
pushed


Thanks!
diff mbox

Patch

diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index a487882..eb62656 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -697,11 +697,11 @@  static int yae_adjust_position(ATempoContext *atempo)
     AudioFragment       *frag = yae_curr_frag(atempo);
 
     const double prev_output_position =
-        (double)(prev->position[1] - atempo->origin[1] + atempo->window / 2);
+        (double)(prev->position[1] - atempo->origin[1] + atempo->window / 2) *
+        atempo->tempo;
 
     const double ideal_output_position =
-        (double)(prev->position[0] - atempo->origin[0] + atempo->window / 2) /
-        atempo->tempo;
+        (double)(prev->position[0] - atempo->origin[0] + atempo->window / 2);
 
     const int drift = (int)(prev_output_position - ideal_output_position);