diff mbox

[FFmpeg-devel,4/4] avformat/mov: Break out of inner loop early in mov_estimate_video_delay()

Message ID 20180711001758.27132-4-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer July 11, 2018, 12:17 a.m. UTC
0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things)

Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i /dev/zero -t 24:00:00.00 out.mp4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Sasi Inguva July 11, 2018, 11:36 p.m. UTC | #1
LGTM. thanks
On Tue, Jul 10, 2018 at 5:18 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> 0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things)
>
> Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i
> /dev/zero -t 24:00:00.00 out.mp4
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 951a337cca..b0b9fd99cc 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3331,7 +3331,8 @@ static void mov_estimate_video_delay(MOVContext *c,
> AVStream* st) {
>                  if (pts_buf[j] < pts_buf[r]) {
>                      FFSWAP(int64_t, pts_buf[j], pts_buf[r]);
>                      ++num_swaps;
> -                }
> +                } else
> +                    break;
>
Prefer keeping paranthesis around break especially since there are
paranthesis around the if block.


>                  j = r;
>              }
>              st->codecpar->video_delay = FFMAX(st->codecpar->video_delay,
> num_swaps);
> --
> 2.18.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Michael Niedermayer July 12, 2018, 12:04 p.m. UTC | #2
On Wed, Jul 11, 2018 at 04:36:53PM -0700, Sasi Inguva wrote:
> LGTM. thanks
> On Tue, Jul 10, 2018 at 5:18 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > 0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things)
> >
> > Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i
> > /dev/zero -t 24:00:00.00 out.mp4
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/mov.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 951a337cca..b0b9fd99cc 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -3331,7 +3331,8 @@ static void mov_estimate_video_delay(MOVContext *c,
> > AVStream* st) {
> >                  if (pts_buf[j] < pts_buf[r]) {
> >                      FFSWAP(int64_t, pts_buf[j], pts_buf[r]);
> >                      ++num_swaps;
> > -                }
> > +                } else
> > +                    break;
> >

> Prefer keeping paranthesis around break especially since there are
> paranthesis around the if block.

will apply with this changhe

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 951a337cca..b0b9fd99cc 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3331,7 +3331,8 @@  static void mov_estimate_video_delay(MOVContext *c, AVStream* st) {
                 if (pts_buf[j] < pts_buf[r]) {
                     FFSWAP(int64_t, pts_buf[j], pts_buf[r]);
                     ++num_swaps;
-                }
+                } else
+                    break;
                 j = r;
             }
             st->codecpar->video_delay = FFMAX(st->codecpar->video_delay, num_swaps);