[FFmpeg-devel] [PATCH 05/41] avcodec/videodsp: Make ff_emulated_edge_mc_16 static
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Jun 10 19:07:43 EEST 2022
Ronald S. Bultje:
> Hi,
>
> On Thu, Jun 9, 2022 at 7:56 PM Andreas Rheinhardt <
> andreas.rheinhardt at outlook.com> wrote:
>
>> Only ff_emulated_edge_mc_8() is used outside of lavc/videodsp.c.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>> libavcodec/videodsp.c | 4 ++++
>> libavcodec/videodsp.h | 1 -
>> libavcodec/videodsp_template.c | 1 +
>> 3 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
>> index 2198d46c15..02af046b81 100644
>> --- a/libavcodec/videodsp.c
>> +++ b/libavcodec/videodsp.c
>> @@ -25,11 +25,15 @@
>> #include "videodsp.h"
>>
>> #define BIT_DEPTH 8
>> +#define STATIC
>> #include "videodsp_template.c"
>> +#undef STATIC
>> #undef BIT_DEPTH
>>
>> #define BIT_DEPTH 16
>> +#define STATIC static
>> #include "videodsp_template.c"
>> +#undef STATIC
>> #undef BIT_DEPTH
>>
>> static void just_return(uint8_t *buf, ptrdiff_t stride, int h)
>>
> [..]
>
>> diff --git a/libavcodec/videodsp_template.c
>> b/libavcodec/videodsp_template.c
>> index 55123a5844..8bc3290248 100644
>> --- a/libavcodec/videodsp_template.c
>> +++ b/libavcodec/videodsp_template.c
>> @@ -20,6 +20,7 @@
>> */
>>
>> #include "bit_depth_template.c"
>> +STATIC
>> void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
>> ptrdiff_t buf_linesize,
>> ptrdiff_t src_linesize,
>> --
>> 2.34.1
>>
>
> This splits the "staticness" over two places (i.e. to understand what
> STATIC means and/or why it exists, you have to look at two places), and
> also doesn't explain why we need "variable staticness" (i.e. one being
> static, but not the other one).
>
> Maybe you could use the following:
>
> #if BIT_DEPTH != 8 // we make a call to the 8-bit version in
> $fill_me_in_here$
> static
> #endif
> void FUNC(ff_..
>
> That way the meaning of STATIC is not obfuscated (I know, STATIC should be
> obvious, but it's still an indirection) and the reasoning is included also.
>
> Ronald
>
I'll change it if you prefer it that way.
- Andreas
More information about the ffmpeg-devel
mailing list