comparison h264.c @ 7347:612a78c3b128 libavcodec

qscale has a range of 0..51 we thus do not need a 256 entry table and neither need to and it with 0xFF.
author michael
date Tue, 22 Jul 2008 13:01:10 +0000
parents def19f6f7ce9
children 39e5cadcebab
comparison
equal deleted inserted replaced
7346:def19f6f7ce9 7347:612a78c3b128
1582 1582
1583 /** 1583 /**
1584 * gets the chroma qp. 1584 * gets the chroma qp.
1585 */ 1585 */
1586 static inline int get_chroma_qp(H264Context *h, int t, int qscale){ 1586 static inline int get_chroma_qp(H264Context *h, int t, int qscale){
1587 return h->pps.chroma_qp_table[t][qscale & 0xff]; 1587 return h->pps.chroma_qp_table[t][qscale];
1588 } 1588 }
1589 1589
1590 //FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close 1590 //FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close
1591 //FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away) 1591 //FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away)
1592 static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, int intra, int separate_dc){ 1592 static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, int intra, int separate_dc){
7335 7335
7336 static void 7336 static void
7337 build_qp_table(PPS *pps, int t, int index) 7337 build_qp_table(PPS *pps, int t, int index)
7338 { 7338 {
7339 int i; 7339 int i;
7340 for(i = 0; i < 255; i++) 7340 for(i = 0; i < 52; i++)
7341 pps->chroma_qp_table[t][i & 0xff] = chroma_qp[av_clip(i + index, 0, 51)]; 7341 pps->chroma_qp_table[t][i] = chroma_qp[av_clip(i + index, 0, 51)];
7342 } 7342 }
7343 7343
7344 static inline int decode_picture_parameter_set(H264Context *h, int bit_length){ 7344 static inline int decode_picture_parameter_set(H264Context *h, int bit_length){
7345 MpegEncContext * const s = &h->s; 7345 MpegEncContext * const s = &h->s;
7346 unsigned int tmp, pps_id= get_ue_golomb(&s->gb); 7346 unsigned int tmp, pps_id= get_ue_golomb(&s->gb);