[FFmpeg-devel] [PATCH 6/8] tests/tiny_ssim: replace #define by typedef

Hendrik Leppkes h.leppkes at gmail.com
Thu Nov 19 15:19:05 CET 2015


On Thu, Nov 19, 2015 at 2:50 PM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> On Thu, Nov 19, 2015 at 8:36 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
>> Hi,
>>
>> On Thu, Nov 19, 2015 at 8:14 AM, Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> wrote:
>>>
>>> See e.g
>>> https://stackoverflow.com/questions/1666353/are-typedef-and-define-the-same-in-c
>>> for rationale.
>>>
>>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>> ---
>>>  tests/tiny_ssim.c | 5 ++---
>>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/tiny_ssim.c b/tests/tiny_ssim.c
>>> index 9f355a3..ebd0216 100644
>>> --- a/tests/tiny_ssim.c
>>> +++ b/tests/tiny_ssim.c
>>> @@ -79,11 +79,11 @@ static float ssim_end1( int s1, int s2, int ss, int
>>> s12 )
>>>   * s1*s1, s2*s2, and s1*s2 also obtain this value for edge cases:
>>> ((2^10-1)*16*4)^2 = 4286582784.
>>>   * Maximum value for 9-bit is: ss*64 = (2^9-1)^2*16*4*64 = 1069551616,
>>> which will not overflow. */
>>>  #if BIT_DEPTH > 9
>>> -#define type float
>>> +typedef float type;
>>>      static const float ssim_c1 = .01*.01*PIXEL_MAX*PIXEL_MAX*64;
>>>      static const float ssim_c2 = .03*.03*PIXEL_MAX*PIXEL_MAX*64*63;
>>>  #else
>>> -#define type int
>>> +typedef int type;
>>>      static const int ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64 +
>>> .5);
>>>      static const int ssim_c2 = (int)(.03*.03*PIXEL_MAX*PIXEL_MAX*64*63 +
>>> .5);
>>>  #endif
>>
>>
>> Bad indentation?
>
> I noticed it, suspect it was due to the macro earlier. I followed
> general philosophy of avoiding reindents in code changes, keeping them
> for a separate commit.

Please just indent here, doing a separate commit for one-line changes
is not needed. The only reason is for readability, which is not really
affected here.

- Hendrik


More information about the ffmpeg-devel mailing list