[Ffmpeg-devel] [PATCH] CYUV encoder resurrected
Baptiste Coudurier
baptiste.coudurier
Sat Mar 3 01:47:45 CET 2007
Baptiste Coudurier wrote:
> Hi
>
> Michael Niedermayer wrote:
>> Hi
>>
>> On Thu, Mar 01, 2007 at 01:45:26AM +0100, Baptiste Coudurier wrote:
>>> Hi
>>>
>>> Here is old cyuv encoder resurrected from
>>>
>>> [Ffmpeg-devel] Trellis Quantization Applied To (A)DPCM
>>> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-June/011688.html
>>>
>>> by Loren.
>>>
>>> I added some #ifdef DEBUG around printf code, renamed some macros. Can
>>> it be applied ?
>> [...]
>>> + u = nodes;
>>> + nodes = nodes_next;
>>> + nodes_next = u;
>> FFSWAP
>
> Done
>
>> [...]
>>> + for(i=0; i<16; i++){
>>> + int score = abs(d - table[i]);
>> FFABS
>>
>
> Done
>
>> [...]
>>> +static int tables_tried = 0;
>> non constant static
>>
>
> Removed
>
>> [...]
>>
>>> + {
>>> + static int fn = 0;
>>> + dprintf("fn %d tables_tried %d \n", fn, tables_tried);
>>> + fn++;
>>> + }
>
> Removed.
>
>> [...]
>>> + uint8_t y_buf[s->avctx->width];
>>> + uint8_t u_buf[s->avctx->width>>2];
>>> + uint8_t v_buf[s->avctx->width>>2];
>>> + pict->error[0] += quantize_row_trellis(avctx, y_ptr, y_buf, y_table, y_itable, s->avctx->width);
>>> + pict->error[1] += quantize_row_trellis(avctx, u_ptr, u_buf, u_table, u_itable, s->avctx->width>>2);
>>> + pict->error[2] += quantize_row_trellis(avctx, v_ptr, v_buf, v_table, v_itable, s->avctx->width>>2);
>> could be put into a loop maybe, the same applies to other similar YUV cases
>> of course only if the resulting code is simpler
>>
>
> I'll let Loren do it if he feels like it. Updated patch attached.
>
> [...]
> +
> +static int quantize_sample(int sample, int *pred, const int8_t *table, const uint8_t *itable)
> +{
> + int p = *pred;
> + int bi = itable[(sample - p) & 0xff];
> + *pred = p + table[bi];
> + if(*pred & ~0xff){
> + int i, bscore=INT_MAX;
> + for(i=0; i<16; i++){
> + int score = abs(sample - ((p + table[i]) & 0xff));
Rah, that is changed to FFABS in my tree.
[...]
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
More information about the ffmpeg-devel
mailing list