1609 |
memcpy((void *)((ptr_t)bs->start + pos), |
memcpy((void *)((ptr_t)bs->start + pos), |
1610 |
(void *)((ptr_t)pEnc->smpData[k].bs->start), len); |
(void *)((ptr_t)pEnc->smpData[k].bs->start), len); |
1611 |
|
|
1612 |
current->length = pos += len; |
current->length += len; |
1613 |
|
pos += len; |
1614 |
|
|
1615 |
/* collect stats */ |
/* collect stats */ |
1616 |
current->sStat.iTextBits += pEnc->smpData[k].sStat->iTextBits; |
current->sStat.iTextBits += pEnc->smpData[k].sStat->iTextBits; |
1646 |
int bound = 0, num_slices = pEnc->num_slices; |
int bound = 0, num_slices = pEnc->num_slices; |
1647 |
int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices)); |
int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices)); |
1648 |
int slices_per_thread = (num_slices*1024 / num_threads); |
int slices_per_thread = (num_slices*1024 / num_threads); |
|
int mb_width = pEnc->mbParam.mb_width; |
|
1649 |
int mb_height = pEnc->mbParam.mb_height; |
int mb_height = pEnc->mbParam.mb_height; |
1650 |
void * status = NULL; |
void * status = NULL; |
1651 |
uint16_t k; |
uint16_t k; |
1755 |
FRAMEINFO *const current = pEnc->current; |
FRAMEINFO *const current = pEnc->current; |
1756 |
FRAMEINFO *const reference = pEnc->reference; |
FRAMEINFO *const reference = pEnc->reference; |
1757 |
MBParam * const pParam = &pEnc->mbParam; |
MBParam * const pParam = &pEnc->mbParam; |
|
IMAGE *pRef = &reference->image; |
|
1758 |
int mb_width = pParam->mb_width; |
int mb_width = pParam->mb_width; |
1759 |
int mb_height = pParam->mb_height; |
int mb_height = pParam->mb_height; |
1760 |
|
|
2130 |
|
|
2131 |
if (current->sStat.kblks + current->sStat.mblks < |
if (current->sStat.kblks + current->sStat.mblks < |
2132 |
(pParam->frame_drop_ratio * mb_width * mb_height) / 100 && |
(pParam->frame_drop_ratio * mb_width * mb_height) / 100 && |
2133 |
( (pEnc->bframenum_head >= pEnc->bframenum_tail) || !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) ) |
( (pEnc->bframenum_head >= pEnc->bframenum_tail) || !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) && |
2134 |
|
(current->coding_type == P_VOP) ) |
2135 |
{ |
{ |
2136 |
current->sStat.kblks = current->sStat.mblks = current->sStat.iTextBits = 0; |
current->sStat.kblks = current->sStat.mblks = current->sStat.iTextBits = 0; |
2137 |
current->sStat.ublks = mb_width * mb_height; |
current->sStat.ublks = mb_width * mb_height; |
2285 |
IMAGE *b_ref = &pEnc->current->image; |
IMAGE *b_ref = &pEnc->current->image; |
2286 |
|
|
2287 |
MBParam * const pParam = &pEnc->mbParam; |
MBParam * const pParam = &pEnc->mbParam; |
|
int mb_width = pParam->mb_width; |
|
2288 |
int mb_height = pParam->mb_height; |
int mb_height = pParam->mb_height; |
2289 |
|
|
2290 |
#ifdef BFRAMES_DEC_DEBUG |
#ifdef BFRAMES_DEC_DEBUG |
2304 |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
2305 |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
2306 |
pEnc->mbParam.height, 0); |
pEnc->mbParam.height, 0); |
2307 |
pEnc->current->is_edged = 1; |
pEnc->reference->is_edged = 1; |
2308 |
} |
} |
2309 |
|
|
2310 |
if (pEnc->reference->is_interpolated != 0) { |
if (pEnc->reference->is_interpolated != 0) { |
2335 |
|
|
2336 |
frame->coding_type = B_VOP; |
frame->coding_type = B_VOP; |
2337 |
|
|
2338 |
if (pEnc->current->vop_flags & XVID_VOP_RD_PSNRHVSM) { |
if ((frame->vop_flags & XVID_VOP_RD_PSNRHVSM) && (frame->vop_flags & XVID_VOP_RD_BVOP)) { |
2339 |
image_block_variance(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->current->mbs, |
image_block_variance(&frame->image, pEnc->mbParam.edged_width, frame->mbs, |
2340 |
pEnc->mbParam.mb_width, pEnc->mbParam.mb_height); |
pEnc->mbParam.mb_width, pEnc->mbParam.mb_height); |
2341 |
} |
} |
2342 |
|
|