1855 |
iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x, |
iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x, |
1856 |
pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x, |
pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x, |
1857 |
pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant); |
pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant); |
1858 |
if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant) { |
if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant || ((bound > 1) && |
1859 |
|
((y*mb_width+x == bound) || (y*mb_width+x == bound+1)))) { /* Some third-party decoders have problems with coloc skip MB before or after |
1860 |
|
resync marker in BVOP. We avoid any ambiguity and force no skip at slice boundary */ |
1861 |
bSkip = 0; /* could not SKIP */ |
bSkip = 0; /* could not SKIP */ |
1862 |
if (pParam->vol_flags & XVID_VOL_QUARTERPEL) { |
if (pParam->vol_flags & XVID_VOL_QUARTERPEL) { |
1863 |
VECTOR predMV = get_qpmv2(current->mbs, pParam->mb_width, bound, x, y, 0); |
VECTOR predMV = get_qpmv2(current->mbs, pParam->mb_width, bound, x, y, 0); |
2208 |
int num_slices = pEnc->num_slices; |
int num_slices = pEnc->num_slices; |
2209 |
|
|
2210 |
if (data->start_y > 0) { /* write resync marker */ |
if (data->start_y > 0) { /* write resync marker */ |
2211 |
write_video_packet_header(bs, pParam, frame, bound); |
write_video_packet_header(bs, pParam, frame, bound+1); |
2212 |
} |
} |
2213 |
|
|
2214 |
for (y = data->start_y; y < data->stop_y; y++) { |
for (y = data->start_y; y < MIN(data->stop_y+1, mb_height); y++) { |
2215 |
int new_bound = mb_width * ((((y*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices); |
int new_bound = mb_width * ((((y*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices); |
2216 |
|
int stop_x = (y == data->stop_y) ? 1 : mb_width; |
2217 |
|
int start_x = (y == data->start_y && y > 0) ? 1 : 0; |
2218 |
|
|
2219 |
if (new_bound > bound) { |
for (x = start_x; x < stop_x; x++) { |
|
bound = new_bound; |
|
|
BitstreamPadAlways(bs); |
|
|
write_video_packet_header(bs, pParam, frame, bound); |
|
|
} |
|
|
|
|
|
for (x = 0; x < mb_width; x++) { |
|
2220 |
MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width]; |
MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width]; |
2221 |
|
|
2222 |
/* decoder ignores mb when refence block is INTER(0,0), CBP=0 */ |
/* decoder ignores mb when refence block is INTER(0,0), CBP=0 */ |
2228 |
continue; |
continue; |
2229 |
} |
} |
2230 |
|
|
2231 |
|
if (new_bound > bound && x > 0) { |
2232 |
|
bound = new_bound; |
2233 |
|
BitstreamPadAlways(bs); |
2234 |
|
write_video_packet_header(bs, pParam, frame, y*mb_width+x); |
2235 |
|
} |
2236 |
|
|
2237 |
mb->quant = frame->quant; |
mb->quant = frame->quant; |
2238 |
|
|
2239 |
if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) { |
if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) { |
2410 |
pEnc->reference->mbs, f_ref, |
pEnc->reference->mbs, f_ref, |
2411 |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
2412 |
pEnc->current, b_ref, &pEnc->vInterH, |
pEnc->current, b_ref, &pEnc->vInterH, |
2413 |
&pEnc->vInterV, &pEnc->vInterHV); |
&pEnc->vInterV, &pEnc->vInterHV, |
2414 |
|
pEnc->num_slices); |
2415 |
} |
} |
2416 |
stop_motion_timer(); |
stop_motion_timer(); |
2417 |
|
|