small optimize mpeg12.c/get_qscale patch by (BERO <bero at geocities dot co dot jp>) and the return idea by arpi

Originally committed as revision 1870 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
BERO 2003-05-13 23:38:51 +00:00 committed by Michael Niedermayer
parent f7a8c179a7
commit 7062fad6e9
1 changed files with 3 additions and 6 deletions

View File

@ -852,16 +852,13 @@ static inline int get_dmv(MpegEncContext *s)
static inline int get_qscale(MpegEncContext *s)
{
int qscale;
int qscale = get_bits(&s->gb, 5);
if (s->mpeg2) {
if (s->q_scale_type) {
qscale = non_linear_qscale[get_bits(&s->gb, 5)];
return non_linear_qscale[qscale];
} else {
qscale = get_bits(&s->gb, 5) << 1;
return qscale << 1;
}
} else {
/* for mpeg1, we use the generic unquant code */
qscale = get_bits(&s->gb, 5);
}
return qscale;
}