Commit 4cd2401c authored by cehoyos's avatar cehoyos

Factorize some code into the new function ff_toupper4().

Patch by Francesco Lavra, francescolavra interfree it 


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23158 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7f5cd579
...@@ -48,4 +48,6 @@ AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt); ...@@ -48,4 +48,6 @@ AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
*/ */
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); 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 */ #endif /* AVCODEC_INTERNAL_H */
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "libavutil/intmath.h" #include "libavutil/intmath.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "internal.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpegvideo_common.h" #include "mpegvideo_common.h"
#include "mjpegenc.h" #include "mjpegenc.h"
...@@ -530,15 +531,9 @@ av_cold int MPV_common_init(MpegEncContext *s) ...@@ -530,15 +531,9 @@ av_cold int MPV_common_init(MpegEncContext *s)
yc_size = y_size + 2 * c_size; yc_size = y_size + 2 * c_size;
/* convert fourcc to upper case */ /* convert fourcc to upper case */
s->codec_tag= toupper( s->avctx->codec_tag &0xFF) s->codec_tag = ff_toupper4(s->avctx->codec_tag);
+ (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
+ (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag);
+ (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
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->avctx->coded_frame= (AVFrame*)&s->current_picture; s->avctx->coded_frame= (AVFrame*)&s->current_picture;
......
...@@ -1294,3 +1294,11 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) ...@@ -1294,3 +1294,11 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
} }
return 0; 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);
}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "libavcodec/internal.h"
#include "libavcodec/opt.h" #include "libavcodec/opt.h"
#include "metadata.h" #include "metadata.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
...@@ -2041,10 +2042,7 @@ enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) ...@@ -2041,10 +2042,7 @@ enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
return tags[i].id; return tags[i].id;
} }
for(i=0; tags[i].id != CODEC_ID_NONE; i++) { for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
if( toupper((tag >> 0)&0xFF) == toupper((tags[i].tag >> 0)&0xFF) if (ff_toupper4(tag) == ff_toupper4(tags[i].tag))
&& toupper((tag >> 8)&0xFF) == toupper((tags[i].tag >> 8)&0xFF)
&& toupper((tag >>16)&0xFF) == toupper((tags[i].tag >>16)&0xFF)
&& toupper((tag >>24)&0xFF) == toupper((tags[i].tag >>24)&0xFF))
return tags[i].id; return tags[i].id;
} }
return CODEC_ID_NONE; return CODEC_ID_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment