123 |
if (create->width%2 || create->height%2) |
if (create->width%2 || create->height%2) |
124 |
return XVID_ERR_FAIL; |
return XVID_ERR_FAIL; |
125 |
|
|
|
if (create->width<=0 || create->height<=0) |
|
|
return XVID_ERR_FAIL; |
|
|
|
|
126 |
/* allocate encoder struct */ |
/* allocate encoder struct */ |
127 |
|
|
128 |
pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE); |
pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE); |
1086 |
DPRINTF(XVID_DEBUG_DEBUG,"*** PFRAME bf: head=%i tail=%i queue: head=%i tail=%i size=%i\n", |
DPRINTF(XVID_DEBUG_DEBUG,"*** PFRAME bf: head=%i tail=%i queue: head=%i tail=%i size=%i\n", |
1087 |
pEnc->bframenum_head, pEnc->bframenum_tail, |
pEnc->bframenum_head, pEnc->bframenum_tail, |
1088 |
pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size); |
pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size); |
|
pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */ |
|
1089 |
|
|
1090 |
FrameCodeP(pEnc, &bs, 1, 0); |
FrameCodeP(pEnc, &bs, 1, 0); |
1091 |
|
|
1339 |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
1340 |
} |
} |
1341 |
|
|
1342 |
if ( FrameCodeP(pEnc, &bs, 1, 0) == 0 ) { |
FrameCodeP(pEnc, &bs, 1, 0); |
|
/* N-VOP, we mustn't code b-frames yet */ |
|
|
call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER, 0, 0, stats); |
|
|
goto done; |
|
|
} |
|
1343 |
} |
} |
1344 |
|
|
1345 |
|
|
1536 |
MBParam * const pParam = &pEnc->mbParam; |
MBParam * const pParam = &pEnc->mbParam; |
1537 |
int mb_width = pParam->mb_width; |
int mb_width = pParam->mb_width; |
1538 |
int mb_height = pParam->mb_height; |
int mb_height = pParam->mb_height; |
|
int coded = 1; |
|
1539 |
|
|
1540 |
|
|
1541 |
/* IMAGE *pCurrent = ¤t->image; */ |
/* IMAGE *pCurrent = ¤t->image; */ |
1863 |
#if 0 |
#if 0 |
1864 |
DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks); |
DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks); |
1865 |
#endif |
#endif |
1866 |
if (current->sStat.kblks + current->sStat.mblks <= |
if (current->sStat.kblks + current->sStat.mblks < |
1867 |
(pParam->frame_drop_ratio * mb_width * mb_height) / 100) |
(pParam->frame_drop_ratio * mb_width * mb_height) / 100) |
1868 |
{ |
{ |
1869 |
current->sStat.kblks = current->sStat.mblks = 0; |
current->sStat.kblks = current->sStat.mblks = 0; |
1880 |
current->rounding_type = reference->rounding_type; |
current->rounding_type = reference->rounding_type; |
1881 |
current->fcode = reference->fcode; |
current->fcode = reference->fcode; |
1882 |
current->bcode = reference->bcode; |
current->bcode = reference->bcode; |
|
current->stamp = reference->stamp; |
|
1883 |
image_copy(¤t->image, &reference->image, pParam->edged_width, pParam->height); |
image_copy(¤t->image, &reference->image, pParam->edged_width, pParam->height); |
1884 |
memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height); |
memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height); |
1885 |
coded = 0; |
} |
|
|
|
|
} else { |
|
1886 |
|
|
1887 |
pEnc->current->is_edged = 0; /* not edged */ |
pEnc->current->is_edged = 0; /* not edged */ |
1888 |
pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */ |
pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */ |
1893 |
image_swap(&pEnc->vInterH, &pEnc->f_refh); |
image_swap(&pEnc->vInterH, &pEnc->f_refh); |
1894 |
image_swap(&pEnc->vInterV, &pEnc->f_refv); |
image_swap(&pEnc->vInterV, &pEnc->f_refv); |
1895 |
image_swap(&pEnc->vInterHV, &pEnc->f_refhv); |
image_swap(&pEnc->vInterHV, &pEnc->f_refhv); |
1896 |
} |
|
1897 |
|
|
1898 |
/* XXX: debug |
/* XXX: debug |
1899 |
{ |
{ |
1914 |
|
|
1915 |
current->length = (BitstreamPos(bs) - bits) / 8; |
current->length = (BitstreamPos(bs) - bits) / 8; |
1916 |
|
|
1917 |
return coded; |
return 0; /* inter */ |
1918 |
} |
} |
1919 |
|
|
1920 |
|
|