661 |
CheckCandidateBits16(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateBits16(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
662 |
{ |
{ |
663 |
|
|
664 |
static int16_t in[64], coeff[64]; |
int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64; |
665 |
int32_t bits = 0, sum; |
int32_t bits = 0, sum; |
666 |
VECTOR * current; |
VECTOR * current; |
667 |
const uint8_t * ptr; |
const uint8_t * ptr; |
723 |
} |
} |
724 |
} |
} |
725 |
|
|
726 |
bits += cbpy_tab[15-(cbp>>2)].len; |
bits += xvid_cbpy_tab[15-(cbp>>2)].len; |
727 |
bits += mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len; |
bits += mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len; |
728 |
|
|
729 |
if (bits < data->iMinSAD[0]) { |
if (bits < data->iMinSAD[0]) { |
746 |
CheckCandidateBits8(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateBits8(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
747 |
{ |
{ |
748 |
|
|
749 |
static int16_t in[64], coeff[64]; |
int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64; |
750 |
int32_t sum, bits; |
int32_t sum, bits; |
751 |
VECTOR * current; |
VECTOR * current; |
752 |
const uint8_t * ptr; |
const uint8_t * ptr; |
1012 |
VECTOR currentMV[5]; |
VECTOR currentMV[5]; |
1013 |
VECTOR currentQMV[5]; |
VECTOR currentQMV[5]; |
1014 |
int32_t iMinSAD[5]; |
int32_t iMinSAD[5]; |
1015 |
|
DECLARE_ALIGNED_MATRIX(dct_space, 2, 64, int16_t, CACHE_LINE); |
1016 |
SearchData Data; |
SearchData Data; |
1017 |
memset(&Data, 0, sizeof(SearchData)); |
memset(&Data, 0, sizeof(SearchData)); |
1018 |
Data.iEdgedWidth = iEdgedWidth; |
Data.iEdgedWidth = iEdgedWidth; |
1025 |
Data.qpel = current->vol_flags & XVID_VOL_QUARTERPEL; |
Data.qpel = current->vol_flags & XVID_VOL_QUARTERPEL; |
1026 |
Data.chroma = MotionFlags & XVID_ME_CHROMA16; |
Data.chroma = MotionFlags & XVID_ME_CHROMA16; |
1027 |
Data.rrv = current->vop_flags & XVID_VOP_REDUCED; |
Data.rrv = current->vop_flags & XVID_VOP_REDUCED; |
1028 |
|
Data.dctSpace = dct_space; |
1029 |
|
|
1030 |
if ((current->vop_flags & XVID_VOP_REDUCED)) { |
if ((current->vop_flags & XVID_VOP_REDUCED)) { |
1031 |
mb_width = (pParam->width + 31) / 32; |
mb_width = (pParam->width + 31) / 32; |
2550 |
int cbp = 0, bits = 0, t = 0, i, iDirection; |
int cbp = 0, bits = 0, t = 0, i, iDirection; |
2551 |
SearchData Data2, *Data8 = &Data2; |
SearchData Data2, *Data8 = &Data2; |
2552 |
int sumx = 0, sumy = 0; |
int sumx = 0, sumy = 0; |
2553 |
int16_t in[64], coeff[64]; |
int16_t *in = Data->dctSpace, *coeff = Data->dctSpace + 64; |
2554 |
|
|
2555 |
memcpy(Data8, Data, sizeof(SearchData)); |
memcpy(Data8, Data, sizeof(SearchData)); |
2556 |
CheckCandidate = CheckCandidateBits8; |
CheckCandidate = CheckCandidateBits8; |
2677 |
bits += CodeCoeffInter_CalcBits(coeff, scan_tables[0]); |
bits += CodeCoeffInter_CalcBits(coeff, scan_tables[0]); |
2678 |
cbp |= 1 << (5 - 5); |
cbp |= 1 << (5 - 5); |
2679 |
} |
} |
2680 |
bits += cbpy_tab[15-(cbp>>2)].len; |
bits += xvid_cbpy_tab[15-(cbp>>2)].len; |
2681 |
bits += mcbpc_inter_tab[(MODE_INTER4V & 7) | ((cbp & 3) << 3)].len; |
bits += mcbpc_inter_tab[(MODE_INTER4V & 7) | ((cbp & 3) << 3)].len; |
2682 |
} |
} |
2683 |
} |
} |
2692 |
int bits = 1; //this one is ac/dc prediction flag. always 1. |
int bits = 1; //this one is ac/dc prediction flag. always 1. |
2693 |
int cbp = 0, i, t, dc = 0, b_dc = 1024; |
int cbp = 0, i, t, dc = 0, b_dc = 1024; |
2694 |
const uint32_t iQuant = Data->lambda16; |
const uint32_t iQuant = Data->lambda16; |
2695 |
int16_t in[64], coeff[64]; |
int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64; |
2696 |
|
|
2697 |
for(i = 0; i < 4; i++) { |
for(i = 0; i < 4; i++) { |
2698 |
uint32_t iDcScaler = get_dc_scaler(iQuant, 1); |
uint32_t iDcScaler = get_dc_scaler(iQuant, 1); |
2740 |
bits += t = CodeCoeffIntra_CalcBits(coeff, scan_tables[0]) + dcc_tab[coeff[0] + 255].len; |
bits += t = CodeCoeffIntra_CalcBits(coeff, scan_tables[0]) + dcc_tab[coeff[0] + 255].len; |
2741 |
if (t != 0) cbp |= 1 << (5 - 5); |
if (t != 0) cbp |= 1 << (5 - 5); |
2742 |
|
|
2743 |
bits += cbpy_tab[cbp>>2].len; |
bits += xvid_cbpy_tab[cbp>>2].len; |
2744 |
bits += mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp & 3) << 3)].len; |
bits += mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp & 3) << 3)].len; |
2745 |
} |
} |
2746 |
} |
} |