diff mbox series

[FFmpeg-devel,2/8] libavfilter/vf_ssim.c: fix build warning

Message ID 20210220072218.31629-2-yejun.guo@intel.com
State New
Headers show
Series [FFmpeg-devel,1/8] libavdevice/v4l2.c: fix build warning
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Guo, Yejun Feb. 20, 2021, 7:22 a.m. UTC
The build warning message:
src/libavfilter/vf_ssim.c: In function ‘ssim_plane_16bit’:
src/libavfilter/vf_ssim.c:246:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~
src/libavfilter/vf_ssim.c: In function ‘ssim_plane’:
src/libavfilter/vf_ssim.c:289:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~
---
 libavfilter/vf_ssim.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Andreas Rheinhardt Feb. 20, 2021, 10:20 p.m. UTC | #1
Guo, Yejun:
> The build warning message:
> src/libavfilter/vf_ssim.c: In function ‘ssim_plane_16bit’:
> src/libavfilter/vf_ssim.c:246:24: warning: ‘main’ is usually a function [-Wmain]
>          const uint8_t *main = td->main_data[c];
>                         ^~~~
> src/libavfilter/vf_ssim.c: In function ‘ssim_plane’:
> src/libavfilter/vf_ssim.c:289:24: warning: ‘main’ is usually a function [-Wmain]
>          const uint8_t *main = td->main_data[c];
>                         ^~~~
> ---
>  libavfilter/vf_ssim.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
> index 9682c093b2..ebb314c69f 100644
> --- a/libavfilter/vf_ssim.c
> +++ b/libavfilter/vf_ssim.c
> @@ -243,8 +243,8 @@ static int ssim_plane_16bit(AVFilterContext *ctx, void *arg,
>      const int max = td->max;
>  
>      for (int c = 0; c < td->nb_components; c++) {
> -        const uint8_t *main = td->main_data[c];
> -        const uint8_t *ref = td->ref_data[c];
> +        const uint8_t *main_data = td->main_data[c];
> +        const uint8_t *ref_data = td->ref_data[c];
>          const int main_stride = td->main_linesize[c];
>          const int ref_stride = td->ref_linesize[c];
>          int width = td->planewidth[c];
> @@ -263,8 +263,8 @@ static int ssim_plane_16bit(AVFilterContext *ctx, void *arg,
>          for (int y = ystart; y < slice_end; y++) {
>              for (; z <= y; z++) {
>                  FFSWAP(void*, sum0, sum1);
> -                ssim_4x4xn_16bit(&main[4 * z * main_stride], main_stride,
> -                                 &ref[4 * z * ref_stride], ref_stride,
> +                ssim_4x4xn_16bit(&main_data[4 * z * main_stride], main_stride,
> +                                 &ref_data[4 * z * ref_stride], ref_stride,
>                                   sum0, width);

I don't see an advantage here; it just makes the code less compact.

>              }
>  
> @@ -286,8 +286,8 @@ static int ssim_plane(AVFilterContext *ctx, void *arg,
>      SSIMDSPContext *dsp = td->dsp;
>  
>      for (int c = 0; c < td->nb_components; c++) {
> -        const uint8_t *main = td->main_data[c];
> -        const uint8_t *ref = td->ref_data[c];
> +        const uint8_t *main_data = td->main_data[c];
> +        const uint8_t *ref_data = td->ref_data[c];
>          const int main_stride = td->main_linesize[c];
>          const int ref_stride = td->ref_linesize[c];
>          int width = td->planewidth[c];
> @@ -306,8 +306,8 @@ static int ssim_plane(AVFilterContext *ctx, void *arg,
>          for (int y = ystart; y < slice_end; y++) {
>              for (; z <= y; z++) {
>                  FFSWAP(void*, sum0, sum1);
> -                dsp->ssim_4x4_line(&main[4 * z * main_stride], main_stride,
> -                                   &ref[4 * z * ref_stride], ref_stride,
> +                dsp->ssim_4x4_line(&main_data[4 * z * main_stride], main_stride,
> +                                   &ref_data[4 * z * ref_stride], ref_stride,
>                                     sum0, width);
>              }
>  
>
Guo, Yejun Feb. 21, 2021, 3:30 a.m. UTC | #2
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Andreas Rheinhardt
> Sent: Sunday, February 21, 2021 6:21 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 2/8] libavfilter/vf_ssim.c: fix build
> warning
> 
> Guo, Yejun:
> > The build warning message:
> > src/libavfilter/vf_ssim.c: In function ‘ssim_plane_16bit’:
> > src/libavfilter/vf_ssim.c:246:24: warning: ‘main’ is usually a function [-
> Wmain]
> >          const uint8_t *main = td->main_data[c];
> >                         ^~~~
> > src/libavfilter/vf_ssim.c: In function ‘ssim_plane’:
> > src/libavfilter/vf_ssim.c:289:24: warning: ‘main’ is usually a function [-
> Wmain]
> >          const uint8_t *main = td->main_data[c];
> >                         ^~~~
> > ---
> >  libavfilter/vf_ssim.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index
> > 9682c093b2..ebb314c69f 100644
> > --- a/libavfilter/vf_ssim.c
> > +++ b/libavfilter/vf_ssim.c
> > @@ -243,8 +243,8 @@ static int ssim_plane_16bit(AVFilterContext *ctx,
> void *arg,
> >      const int max = td->max;
> >
> >      for (int c = 0; c < td->nb_components; c++) {
> > -        const uint8_t *main = td->main_data[c];
> > -        const uint8_t *ref = td->ref_data[c];
> > +        const uint8_t *main_data = td->main_data[c];
> > +        const uint8_t *ref_data = td->ref_data[c];
> >          const int main_stride = td->main_linesize[c];
> >          const int ref_stride = td->ref_linesize[c];
> >          int width = td->planewidth[c]; @@ -263,8 +263,8 @@ static int
> > ssim_plane_16bit(AVFilterContext *ctx, void *arg,
> >          for (int y = ystart; y < slice_end; y++) {
> >              for (; z <= y; z++) {
> >                  FFSWAP(void*, sum0, sum1);
> > -                ssim_4x4xn_16bit(&main[4 * z * main_stride], main_stride,
> > -                                 &ref[4 * z * ref_stride], ref_stride,
> > +                ssim_4x4xn_16bit(&main_data[4 * z * main_stride], main_stride,
> > +                                 &ref_data[4 * z * ref_stride],
> > + ref_stride,
> >                                   sum0, width);
> 
> I don't see an advantage here; it just makes the code less compact.

It's to fix the build warning. The waning says we'd change the variable name
from 'main' to other. So I change it to 'main_data', and just for a better 'style',
I also change 'ref' to 'ref_data'.

> 
> >              }
> >
> > @@ -286,8 +286,8 @@ static int ssim_plane(AVFilterContext *ctx, void *arg,
> >      SSIMDSPContext *dsp = td->dsp;
> >
> >      for (int c = 0; c < td->nb_components; c++) {
> > -        const uint8_t *main = td->main_data[c];
> > -        const uint8_t *ref = td->ref_data[c];
> > +        const uint8_t *main_data = td->main_data[c];
> > +        const uint8_t *ref_data = td->ref_data[c];
> >          const int main_stride = td->main_linesize[c];
> >          const int ref_stride = td->ref_linesize[c];
> >          int width = td->planewidth[c]; @@ -306,8 +306,8 @@ static int
> > ssim_plane(AVFilterContext *ctx, void *arg,
> >          for (int y = ystart; y < slice_end; y++) {
> >              for (; z <= y; z++) {
> >                  FFSWAP(void*, sum0, sum1);
> > -                dsp->ssim_4x4_line(&main[4 * z * main_stride], main_stride,
> > -                                   &ref[4 * z * ref_stride], ref_stride,
> > +                dsp->ssim_4x4_line(&main_data[4 * z * main_stride],
> main_stride,
> > +                                   &ref_data[4 * z * ref_stride],
> > + ref_stride,
> >                                     sum0, width);
> >              }
> >
> >
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 9682c093b2..ebb314c69f 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -243,8 +243,8 @@  static int ssim_plane_16bit(AVFilterContext *ctx, void *arg,
     const int max = td->max;
 
     for (int c = 0; c < td->nb_components; c++) {
-        const uint8_t *main = td->main_data[c];
-        const uint8_t *ref = td->ref_data[c];
+        const uint8_t *main_data = td->main_data[c];
+        const uint8_t *ref_data = td->ref_data[c];
         const int main_stride = td->main_linesize[c];
         const int ref_stride = td->ref_linesize[c];
         int width = td->planewidth[c];
@@ -263,8 +263,8 @@  static int ssim_plane_16bit(AVFilterContext *ctx, void *arg,
         for (int y = ystart; y < slice_end; y++) {
             for (; z <= y; z++) {
                 FFSWAP(void*, sum0, sum1);
-                ssim_4x4xn_16bit(&main[4 * z * main_stride], main_stride,
-                                 &ref[4 * z * ref_stride], ref_stride,
+                ssim_4x4xn_16bit(&main_data[4 * z * main_stride], main_stride,
+                                 &ref_data[4 * z * ref_stride], ref_stride,
                                  sum0, width);
             }
 
@@ -286,8 +286,8 @@  static int ssim_plane(AVFilterContext *ctx, void *arg,
     SSIMDSPContext *dsp = td->dsp;
 
     for (int c = 0; c < td->nb_components; c++) {
-        const uint8_t *main = td->main_data[c];
-        const uint8_t *ref = td->ref_data[c];
+        const uint8_t *main_data = td->main_data[c];
+        const uint8_t *ref_data = td->ref_data[c];
         const int main_stride = td->main_linesize[c];
         const int ref_stride = td->ref_linesize[c];
         int width = td->planewidth[c];
@@ -306,8 +306,8 @@  static int ssim_plane(AVFilterContext *ctx, void *arg,
         for (int y = ystart; y < slice_end; y++) {
             for (; z <= y; z++) {
                 FFSWAP(void*, sum0, sum1);
-                dsp->ssim_4x4_line(&main[4 * z * main_stride], main_stride,
-                                   &ref[4 * z * ref_stride], ref_stride,
+                dsp->ssim_4x4_line(&main_data[4 * z * main_stride], main_stride,
+                                   &ref_data[4 * z * ref_stride], ref_stride,
                                    sum0, width);
             }