changeset 11742:a37818ac3817 libavcodec

Factorize some code into the new function ff_toupper4(). Patch by Francesco Lavra, francescolavra interfree it
author cehoyos
date Tue, 18 May 2010 19:16:40 +0000
parents 872971445121
children 55294f889a01
files internal.h mpegvideo.c utils.c
diffstat 3 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/internal.h	Mon May 17 22:49:34 2010 +0000
+++ b/internal.h	Tue May 18 19:16:40 2010 +0000
@@ -48,4 +48,6 @@
  */
 int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
 
+unsigned int ff_toupper4(unsigned int x);
+
 #endif /* AVCODEC_INTERNAL_H */
--- a/mpegvideo.c	Mon May 17 22:49:34 2010 +0000
+++ b/mpegvideo.c	Tue May 18 19:16:40 2010 +0000
@@ -30,6 +30,7 @@
 #include "libavutil/intmath.h"
 #include "avcodec.h"
 #include "dsputil.h"
+#include "internal.h"
 #include "mpegvideo.h"
 #include "mpegvideo_common.h"
 #include "mjpegenc.h"
@@ -530,15 +531,9 @@
     yc_size = y_size + 2 * c_size;
 
     /* convert fourcc to upper case */
-    s->codec_tag=          toupper( s->avctx->codec_tag     &0xFF)
-                        + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
-                        + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)
-                        + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
+    s->codec_tag = ff_toupper4(s->avctx->codec_tag);
 
-    s->stream_codec_tag=          toupper( s->avctx->stream_codec_tag     &0xFF)
-                               + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )
-                               + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
-                               + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
+    s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag);
 
     s->avctx->coded_frame= (AVFrame*)&s->current_picture;
 
--- a/utils.c	Mon May 17 22:49:34 2010 +0000
+++ b/utils.c	Tue May 18 19:16:40 2010 +0000
@@ -1294,3 +1294,11 @@
     }
     return 0;
 }
+
+unsigned int ff_toupper4(unsigned int x)
+{
+    return     toupper( x     &0xFF)
+            + (toupper((x>>8 )&0xFF)<<8 )
+            + (toupper((x>>16)&0xFF)<<16)
+            + (toupper((x>>24)&0xFF)<<24);
+}