diff mbox

[FFmpeg-devel] avfilter/motion_estimation: Fix pre processor formating

Message ID 20160826181929.26502-1-michael@niedermayer.cc
State Accepted
Commit 0c7979b43d5b71949c75bdb92488b152d1be74ed
Headers show

Commit Message

Michael Niedermayer Aug. 26, 2016, 6:19 p.m. UTC
IIRC, The spaces are not standard before the #

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/motion_estimation.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

James Almer Aug. 26, 2016, 7 p.m. UTC | #1
On 8/26/2016 3:19 PM, Michael Niedermayer wrote:
> IIRC, The spaces are not standard before the #

We use them sometimes when nesting several preprocessor checks,
but in this case yes, it should have no spaces.

> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/motion_estimation.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/motion_estimation.c b/libavfilter/motion_estimation.c
> index fa6f49d..0f9ba21 100644
> --- a/libavfilter/motion_estimation.c
> +++ b/libavfilter/motion_estimation.c
> @@ -262,10 +262,10 @@ uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
>          x = mv[0];
>          y = mv[1];
>  
> -    #if 1
> +#if 1
>          for (i = 0; i < 8; i++)
>              COST_P_MV(x + dia2[i][0], y + dia2[i][1]);
> -    #else
> +#else
>          /* this version skips previously examined 3 or 5 locations based on prev origin */
>          if (dir_x <= 0)
>              COST_P_MV(x - 2, y);
> @@ -286,7 +286,7 @@ uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
>  
>          dir_x = mv[0] - x;
>          dir_y = mv[1] - y;
> -    #endif
> +#endif
>  
>      } while (x != mv[0] || y != mv[1]);
>  
> 

LGTM, assuming the disabled code has a reason to be there.
Michael Niedermayer Aug. 26, 2016, 8:56 p.m. UTC | #2
On Fri, Aug 26, 2016 at 04:00:09PM -0300, James Almer wrote:
> On 8/26/2016 3:19 PM, Michael Niedermayer wrote:
> > IIRC, The spaces are not standard before the #
> 
> We use them sometimes when nesting several preprocessor checks,

spaces after the # are standard IIRC, before they are not but maybe
i misremember


> but in this case yes, it should have no spaces.
> 
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavfilter/motion_estimation.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavfilter/motion_estimation.c b/libavfilter/motion_estimation.c
> > index fa6f49d..0f9ba21 100644
> > --- a/libavfilter/motion_estimation.c
> > +++ b/libavfilter/motion_estimation.c
> > @@ -262,10 +262,10 @@ uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
> >          x = mv[0];
> >          y = mv[1];
> >  
> > -    #if 1
> > +#if 1
> >          for (i = 0; i < 8; i++)
> >              COST_P_MV(x + dia2[i][0], y + dia2[i][1]);
> > -    #else
> > +#else
> >          /* this version skips previously examined 3 or 5 locations based on prev origin */
> >          if (dir_x <= 0)
> >              COST_P_MV(x - 2, y);
> > @@ -286,7 +286,7 @@ uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
> >  
> >          dir_x = mv[0] - x;
> >          dir_y = mv[1] - y;
> > -    #endif
> > +#endif
> >  
> >      } while (x != mv[0] || y != mv[1]);
> >  
> > 
> 
> LGTM, assuming the disabled code has a reason to be there.

yes its probably faster

applied

thx

[...]
Davinder Singh Aug. 26, 2016, 10:28 p.m. UTC | #3
On Sat, Aug 27, 2016 at 2:26 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Fri, Aug 26, 2016 at 04:00:09PM -0300, James Almer wrote:
> > On 8/26/2016 3:19 PM, Michael Niedermayer wrote:
> > > IIRC, The spaces are not standard before the #
> >
> > We use them sometimes when nesting several preprocessor checks,
>
> spaces after the # are standard IIRC, before they are not but maybe
> i misremember
>
>
> > but in this case yes, it should have no spaces.
> >
> > >
> > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > ---
> > >  libavfilter/motion_estimation.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/libavfilter/motion_estimation.c
> b/libavfilter/motion_estimation.c
> > > index fa6f49d..0f9ba21 100644
> > > --- a/libavfilter/motion_estimation.c
> > > +++ b/libavfilter/motion_estimation.c
> > > @@ -262,10 +262,10 @@ uint64_t ff_me_search_ds(AVMotionEstContext
> *me_ctx, int x_mb, int y_mb, int *mv
> > >          x = mv[0];
> > >          y = mv[1];
> > >
> > > -    #if 1
> > > +#if 1
> > >          for (i = 0; i < 8; i++)
> > >              COST_P_MV(x + dia2[i][0], y + dia2[i][1]);
> > > -    #else
> > > +#else
> > >          /* this version skips previously examined 3 or 5 locations
> based on prev origin */
> > >          if (dir_x <= 0)
> > >              COST_P_MV(x - 2, y);
> > > @@ -286,7 +286,7 @@ uint64_t ff_me_search_ds(AVMotionEstContext
> *me_ctx, int x_mb, int y_mb, int *mv
> > >
> > >          dir_x = mv[0] - x;
> > >          dir_y = mv[1] - y;
> > > -    #endif
> > > +#endif
> > >
> > >      } while (x != mv[0] || y != mv[1]);
> > >
> > >
> >
> > LGTM, assuming the disabled code has a reason to be there.
>
> yes its probably faster
>

yes, it is.

enabled code:
frame= 4689 fps= 51 q=-0.0 Lsize=N/A time=00:03:07.65 bitrate=N/A
speed=2.06x
real 1m31.239s
user 1m34.895s
sys 0m0.617s

disabled code:
frame= 4689 fps= 69 q=-0.0 Lsize=N/A time=00:03:07.65 bitrate=N/A
speed=2.75x
real 1m8.279s
user 1m12.039s
sys 0m0.553s

used this command for testing:
time ./ffmpeg -i ../matrixbench_mpeg2.mpg -vf mestimate=method=ds -f null -

i'll send patch along with optimizations for others, same can be done for
ntss or maybe hex also.


> applied
>
> thx
>
> [...]
>
diff mbox

Patch

diff --git a/libavfilter/motion_estimation.c b/libavfilter/motion_estimation.c
index fa6f49d..0f9ba21 100644
--- a/libavfilter/motion_estimation.c
+++ b/libavfilter/motion_estimation.c
@@ -262,10 +262,10 @@  uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
         x = mv[0];
         y = mv[1];
 
-    #if 1
+#if 1
         for (i = 0; i < 8; i++)
             COST_P_MV(x + dia2[i][0], y + dia2[i][1]);
-    #else
+#else
         /* this version skips previously examined 3 or 5 locations based on prev origin */
         if (dir_x <= 0)
             COST_P_MV(x - 2, y);
@@ -286,7 +286,7 @@  uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv
 
         dir_x = mv[0] - x;
         dir_y = mv[1] - y;
-    #endif
+#endif
 
     } while (x != mv[0] || y != mv[1]);