vc1: simplify code use INIT_LUT()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
2e789d165b
commit
62d9445396
@ -576,6 +576,25 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fill lookup tables for intensity compensation */
|
||||||
|
#define INIT_LUT(lumscale, lumshift, luty, lutuv) \
|
||||||
|
if (!lumscale) { \
|
||||||
|
scale = -64; \
|
||||||
|
shift = (255 - lumshift * 2) << 6; \
|
||||||
|
if (lumshift > 31) \
|
||||||
|
shift += 128 << 6; \
|
||||||
|
} else { \
|
||||||
|
scale = lumscale + 32; \
|
||||||
|
if (lumshift > 31) \
|
||||||
|
shift = (lumshift - 64) << 6; \
|
||||||
|
else \
|
||||||
|
shift = lumshift << 6; \
|
||||||
|
} \
|
||||||
|
for (i = 0; i < 256; i++) { \
|
||||||
|
luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6); \
|
||||||
|
lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); \
|
||||||
|
}
|
||||||
|
|
||||||
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
||||||
{
|
{
|
||||||
int pqindex, lowquant, status;
|
int pqindex, lowquant, status;
|
||||||
@ -682,22 +701,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
|||||||
v->lumshift = get_bits(gb, 6);
|
v->lumshift = get_bits(gb, 6);
|
||||||
v->use_ic = 1;
|
v->use_ic = 1;
|
||||||
/* fill lookup tables for intensity compensation */
|
/* fill lookup tables for intensity compensation */
|
||||||
if (!v->lumscale) {
|
INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv);
|
||||||
scale = -64;
|
|
||||||
shift = (255 - v->lumshift * 2) << 6;
|
|
||||||
if (v->lumshift > 31)
|
|
||||||
shift += 128 << 6;
|
|
||||||
} else {
|
|
||||||
scale = v->lumscale + 32;
|
|
||||||
if (v->lumshift > 31)
|
|
||||||
shift = (v->lumshift - 64) << 6;
|
|
||||||
else
|
|
||||||
shift = v->lumshift << 6;
|
|
||||||
}
|
|
||||||
for (i = 0; i < 256; i++) {
|
|
||||||
v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6);
|
|
||||||
v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
v->qs_last = v->s.quarter_sample;
|
v->qs_last = v->s.quarter_sample;
|
||||||
if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
|
if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
|
||||||
@ -808,25 +812,6 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill lookup tables for intensity compensation */
|
|
||||||
#define INIT_LUT(lumscale, lumshift, luty, lutuv) \
|
|
||||||
if (!lumscale) { \
|
|
||||||
scale = -64; \
|
|
||||||
shift = (255 - lumshift * 2) << 6; \
|
|
||||||
if (lumshift > 31) \
|
|
||||||
shift += 128 << 6; \
|
|
||||||
} else { \
|
|
||||||
scale = lumscale + 32; \
|
|
||||||
if (lumshift > 31) \
|
|
||||||
shift = (lumshift - 64) << 6; \
|
|
||||||
else \
|
|
||||||
shift = lumshift << 6; \
|
|
||||||
} \
|
|
||||||
for (i = 0; i < 256; i++) { \
|
|
||||||
luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6); \
|
|
||||||
lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); \
|
|
||||||
}
|
|
||||||
|
|
||||||
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
|
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
|
||||||
{
|
{
|
||||||
int pqindex, lowquant;
|
int pqindex, lowquant;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user