[vlc-devel] commit: Factorize avcodec chroma table - another 2kb ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Oct 19 22:01:48 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Oct 19 23:01:29 2008 +0300| [deeb99dcdebd0a37dfe4975c5cf4326a32703684] | committer: Rémi Denis-Courmont 

Factorize avcodec chroma table - another 2kb

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

 modules/codec/avcodec/Modules.am             |    2 +-
 modules/codec/avcodec/avcodec.h              |    5 +++++
 modules/codec/avcodec/{chroma.h => chroma.c} |   24 ++++++++++++++++++++----
 modules/codec/avcodec/deinterlace.c          |    1 -
 modules/codec/avcodec/encoder.c              |    1 -
 modules/codec/avcodec/video.c                |    1 -
 6 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/modules/codec/avcodec/Modules.am b/modules/codec/avcodec/Modules.am
index f680229..af45ff8 100644
--- a/modules/codec/avcodec/Modules.am
+++ b/modules/codec/avcodec/Modules.am
@@ -6,7 +6,7 @@ SOURCES_avcodec = \
 	deinterlace.c \
 	avutil.h \
 	fourcc.c \
-	chroma.h \
+	chroma.c \
 	$(NULL)
 
 if ENABLE_SOUT
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 6d8e082..0532499 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -21,10 +21,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+/* VLC <-> avcodec tables */
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
                     int *pi_ffmpeg_codec, const char **ppsz_name );
 int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
+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 );
+
 
 picture_t * DecodeVideo    ( decoder_t *, block_t ** );
 aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
diff --git a/modules/codec/avcodec/chroma.h b/modules/codec/avcodec/chroma.c
similarity index 90%
rename from modules/codec/avcodec/chroma.h
rename to modules/codec/avcodec/chroma.c
index 542bcf9..6913a42 100644
--- a/modules/codec/avcodec/chroma.h
+++ b/modules/codec/avcodec/chroma.c
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * chroma.h: libavutil <-> libvlc conversion routines
+ * chroma.c: libavutil <-> libvlc conversion routines
  *****************************************************************************
  * Copyright (C) 1999-2008 the VideoLAN team
  * $Id$
@@ -22,6 +22,22 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 021100301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+#include <vlc_codec.h>
+
+#ifdef HAVE_LIBAVCODEC_AVCODEC_H
+#   include <libavcodec/avcodec.h>
+#elif defined(HAVE_FFMPEG_AVCODEC_H)
+#   include <ffmpeg/avcodec.h>
+#else
+#   include <avcodec.h>
+#endif
+#include "avcodec.h"
+
 /*****************************************************************************
  * Chroma fourcc -> ffmpeg_id mapping
  *****************************************************************************/
@@ -101,7 +117,7 @@ static const struct
     { 0, 0, 0, 0, 0 }
 };
 
-static inline int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
+int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
 {
     for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
     {
@@ -112,7 +128,7 @@ static inline int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_
 }
 
 /* FIXME special case the RGB formats */
-static inline int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
+int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
 {
     for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
     {
@@ -130,7 +146,7 @@ static inline int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fm
     return VLC_EGENERIC;
 }
 
-static inline int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma )
+int GetVlcChroma( video_format_t *fmt, const 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/deinterlace.c b/modules/codec/avcodec/deinterlace.c
index fbc553d..4b97455 100644
--- a/modules/codec/avcodec/deinterlace.c
+++ b/modules/codec/avcodec/deinterlace.c
@@ -44,7 +44,6 @@
 #endif
 
 #include "avcodec.h"
-#include "chroma.h"
 
 static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic );
 
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 675c811..0dc7dc0 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -50,7 +50,6 @@
 #endif
 
 #include "avcodec.h"
-#include "chroma.h"
 
 #define HURRY_UP_GUARD1 (450000)
 #define HURRY_UP_GUARD2 (300000)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 0d6d01f..bd018e7 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -44,7 +44,6 @@
 #endif
 
 #include "avcodec.h"
-#include "chroma.h"
 
 /*****************************************************************************
  * decoder_sys_t : decoder descriptor




More information about the vlc-devel mailing list