diff mbox series

[FFmpeg-devel,1/2] lavc/mpegvideo_enc: mark default_mv_penalty as const

Message ID 20210208095321.6332-1-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/2] lavc/mpegvideo_enc: mark default_mv_penalty as const
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

Anton Khirnov Feb. 8, 2021, 9:53 a.m. UTC
Nothing is ever written into it.
---
 libavcodec/mpegvideo_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt Feb. 8, 2021, 10:01 a.m. UTC | #1
Anton Khirnov:
> Nothing is ever written into it.
> ---
>  libavcodec/mpegvideo_enc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 34dcf8c313..a27c80ca37 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -82,7 +82,7 @@ static int sse_mb(MpegEncContext *s);
>  static void denoise_dct_c(MpegEncContext *s, int16_t *block);
>  static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
>  
> -static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
> +static const uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
>  static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
>  
>  const AVOption ff_mpv_generic_options[] = {
> 
If you do this, the array will be present in the binary and will
actually occupy memory if it is used; currently, all the pages can be
mapped to the zero page.

- Andreas
Michael Niedermayer Feb. 8, 2021, 10:35 p.m. UTC | #2
On Mon, Feb 08, 2021 at 10:53:20AM +0100, Anton Khirnov wrote:
> Nothing is ever written into it.
> ---
>  libavcodec/mpegvideo_enc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 34dcf8c313..a27c80ca37 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -82,7 +82,7 @@ static int sse_mb(MpegEncContext *s);
>  static void denoise_dct_c(MpegEncContext *s, int16_t *block);
>  static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
>  
> -static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
> +static const uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
>  static uint8_t default_fcode_tab[MAX_MV * 2 + 1];

if its optimal to have this the zero table instead of some non zero content
then i suggest to rename it to zero_mv_penalty

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 34dcf8c313..a27c80ca37 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -82,7 +82,7 @@  static int sse_mb(MpegEncContext *s);
 static void denoise_dct_c(MpegEncContext *s, int16_t *block);
 static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
 
-static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
+static const uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
 static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
 
 const AVOption ff_mpv_generic_options[] = {