[vlc-commits] avcodec: cleanup chroma helper prototypes

Rémi Denis-Courmont git at videolan.org
Fri Jan 4 18:25:57 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jan  4 18:53:20 2013 +0200| [9aee7d49962135ed2e3cf1651a4968a565c0619e] | committer: Rémi Denis-Courmont

avcodec: cleanup chroma helper prototypes

Avoid passing a structure on the stack.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9aee7d49962135ed2e3cf1651a4968a565c0619e
---

 modules/codec/avcodec/chroma.c      |   14 +++++++-------
 modules/codec/avcodec/chroma.h      |    6 +++---
 modules/codec/avcodec/deinterlace.c |    2 +-
 modules/codec/avcodec/encoder.c     |    4 ++--
 modules/video_filter/swscale.c      |    4 ++--
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
index 4ae407b..0c86867 100644
--- a/modules/codec/avcodec/chroma.c
+++ b/modules/codec/avcodec/chroma.c
@@ -122,7 +122,7 @@ static const struct
     { 0, 0, 0, 0, 0 }
 };
 
-int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
+int TestFfmpegChroma( int i_ffmpeg_id, vlc_fourcc_t i_vlc_fourcc )
 {
     for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
     {
@@ -133,18 +133,18 @@ int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
 }
 
 /* FIXME special case the RGB formats */
-int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
+int GetFfmpegChroma( int *restrict i_ffmpeg_chroma, const video_format_t *fmt )
 {
     for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
     {
-        if( chroma_table[i].i_chroma == fmt.i_chroma )
+        if( chroma_table[i].i_chroma == fmt->i_chroma )
         {
             if( ( chroma_table[i].i_rmask == 0 &&
                   chroma_table[i].i_gmask == 0 &&
                   chroma_table[i].i_bmask == 0 ) ||
-                ( chroma_table[i].i_rmask == fmt.i_rmask &&
-                  chroma_table[i].i_gmask == fmt.i_gmask &&
-                  chroma_table[i].i_bmask == fmt.i_bmask ) )
+                ( chroma_table[i].i_rmask == fmt->i_rmask &&
+                  chroma_table[i].i_gmask == fmt->i_gmask &&
+                  chroma_table[i].i_bmask == fmt->i_bmask ) )
             {
                 *i_ffmpeg_chroma = chroma_table[i].i_chroma_id;
                 return VLC_SUCCESS;
@@ -154,7 +154,7 @@ int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
     return VLC_EGENERIC;
 }
 
-int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma )
+int GetVlcChroma( video_format_t *fmt, int i_ffmpeg_chroma )
 {
     /* TODO FIXME for rgb format we HAVE to set rgb mask/shift */
     for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
diff --git a/modules/codec/avcodec/chroma.h b/modules/codec/avcodec/chroma.h
index eae86b6..37b1588 100644
--- a/modules/codec/avcodec/chroma.h
+++ b/modules/codec/avcodec/chroma.h
@@ -26,8 +26,8 @@
 #ifndef _VLC_AVUTIL_CHROMA_H
 #define _VLC_AVUTIL_CHROMA_H 1
 
-int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
-int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
-int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
+int TestFfmpegChroma( int i_ffmpeg_id, vlc_fourcc_t i_vlc_fourcc );
+int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t *fmt );
+int GetVlcChroma( video_format_t *fmt, int i_ffmpeg_chroma );
 
 #endif
diff --git a/modules/codec/avcodec/deinterlace.c b/modules/codec/avcodec/deinterlace.c
index 343141b..99777a4 100644
--- a/modules/codec/avcodec/deinterlace.c
+++ b/modules/codec/avcodec/deinterlace.c
@@ -85,7 +85,7 @@ int OpenDeinterlace( vlc_object_t *p_this )
 
     /* Misc init */
     p_filter->fmt_in.video.i_chroma = p_filter->fmt_in.i_codec;
-    if( GetFfmpegChroma( &p_sys->i_src_ffmpeg_chroma, p_filter->fmt_in.video ) != VLC_SUCCESS )
+    if( GetFfmpegChroma( &p_sys->i_src_ffmpeg_chroma, &p_filter->fmt_in.video ) != VLC_SUCCESS )
     {
         msg_Err( p_filter, "Failed to match chroma type" );
         return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index c3e81b2..bb45a61 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -464,7 +464,7 @@ int OpenEncoder( vlc_object_t *p_this )
 
         p_enc->fmt_in.i_codec = VLC_CODEC_I420;
         p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec;
-        GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
+        GetFfmpegChroma( &p_context->pix_fmt, &p_enc->fmt_in.video );
 
         if( p_codec->pix_fmts )
         {
@@ -682,7 +682,7 @@ int OpenEncoder( vlc_object_t *p_this )
     {
         /* XXX: hack: Force same codec (will be handled by transcode) */
         p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
-        GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
+        GetFfmpegChroma( &p_context->pix_fmt, &p_enc->fmt_in.video );
     }
 
     /* Make sure we get extradata filled by the encoder */
diff --git a/modules/video_filter/swscale.c b/modules/video_filter/swscale.c
index d7ef3ba..91562ce 100644
--- a/modules/video_filter/swscale.c
+++ b/modules/video_filter/swscale.c
@@ -293,8 +293,8 @@ static int GetParameters( ScalerConfiguration *p_cfg,
     bool b_swap_uvi = false;
     bool b_swap_uvo = false;
 
-    GetFfmpegChroma( &i_fmti, *p_fmti );
-    GetFfmpegChroma( &i_fmto, *p_fmto );
+    GetFfmpegChroma( &i_fmti, p_fmti );
+    GetFfmpegChroma( &i_fmto, p_fmto );
 
     if( p_fmti->i_chroma == p_fmto->i_chroma )
     {



More information about the vlc-commits mailing list