[Theora-dev] FPGA implementation

Andrey Filippov theora at elphel.com
Tue Jan 25 13:17:13 PST 2005


> Andrey Filippov wrote:
>> Two more bugs fixed - one (in DC prediction) was that the last operation
>> -
>> comparing with 3 neighbours and replacing predicted value with one of
>> them
>> was terminated after 2, not 3 cycles. The other one - shifting color
>> components by 128 before forward DCT and after inverse DCT. Still there
>> are some (at least 3 what I can see):
>>
>> 1 - DCT prediction on the right border;
>> 2 - Y starts from >128 , not from nearly zero
>> 3 - color artifacts near the where there is sharp intensity change.
>> http://www.elphel.com/downloads/twelfth.ogg
>> http://www.elphel.com/downloads/twelfth.png

>
> Getting closer! As for 2, Y is also shifted by 128 (as per Section
> 7.9.1, "The Intra Predictor"). Make sure you're subtracting that before
> encoding.
>

Fixed that, but still had a bug - I should try use neighbour as a
predictor if there (P[0], P[1], P[2]) were non-zeros, didn't need to look
at P[3] as below:
 http://www.elphel.com/downloads/thirteenth.ogg
 http://www.elphel.com/downloads/thirteenth.ogg.png
 - that was easy to find and fix, even as such procedures are more
difficult to implement in FPGA than in a program - instead of fragment.c
-
http://cvs.sourceforge.net/viewcvs.py/elphel/fpga/theora/dc_predict_calc.v?rev=1.1&view=markup

But now these colored blocks:
 http://www.elphel.com/downloads/fourteenth_q29.ogg
 http://www.elphel.com/downloads/fourteenth_q29.png

Error in filling quantization/dequantization tables in FPGA (room is up to
8 that can be used without additional data transfger to FPGA), so color
components used the same as for luma. Fixed that - but got something new
(it was not there before):
 http://www.elphel.com/downloads/sixteenth_29.ogg
 http://www.elphel.com/downloads/sixteenth_29.png

This was really stupid - the last byte (or probably even 1 bit - as it was
0x80) was lost while converting output file to ogg and it took me a while
to find the problem - from my previous experience with the accidentally
truncated  frame I thought Theora could handle it on it's own :-)

 http://www.elphel.com/downloads/seventeenth_29.ogg
 http://www.elphel.com/downloads/seventeenth_29.png

and with maximal quality

 http://www.elphel.com/downloads/seventeenth_63.ogg
 http://www.elphel.com/downloads/seventeenth_63.png

Still something wrong with colors. On the edge it's OK - I feed the
pattern as if from the sensor (Bayer coded RG/GB pixels) and there are
color artifacts on the edges. I now use 3x3 pixel interpolation as in the
older 313 camera, but memory is already setup to process 5x5 (internal
FPGA buffers receive 20x20 Bayer data macroblocks to calculate 16x16 YCbCr
4:2:0 macroblock for compression).



More information about the Theora-dev mailing list