Wednesday 30 July 2014

Lot of pushing done

- Debug Infrastructure Pushed
- Pipelined Memory Pushed
- Will do heart beat tomorrow

Friday 25 July 2014

Daily Snippey

Debugger program with cdc in done
H2u firmware with cdc debug done with timing errors. But it works. Worked really hard on it but did not meet timing.
Memory pipelining done for all encoding quality.
Today (Saturday) we have a Church outing so I will fix everything and commit them on Sunday.
Cheers!

EDIT: The title was a typo because I was using my tab. But it sounds cool.

Tuesday 22 July 2014

Daily snippet

Oops missed yesterday's blog.
- Heart beat feature completed
- Sent debug data out of cdc
- working on debugger program
- major changes to debug module

Friday 18 July 2014

HDMI2USB Serial Controller Port

When we connect HDMI2USB to host, two CDC are enumerated. One is for UVC(ACM0) and the other is for controller port(ACM1).
The controller port can be used to control certain features of HDMI2USB and also display status of USB, jpeg encoder etc.
To access this use any serial terminal program like gtkterm. The commands send to the control port is in ASCII. The ascii commands are two byte, first is the address(like U or u for USB TOP) and the second is the command you want to send to that address (like S or s for status). So if you send US, it will return the status of the USB Top module. Since the terminal I am using allows only hexadecimal commands, so I have to convert the ASCII commands to their hex equivalent (which is irritating).

While creating the debug infrastructure, I completely neglected that there is already a lot of infrastructure already built in due to the control port. Some feature that I have added like frame rate etc can be exposed via the control port. Then we can have a debugger using the control port. Plus it can be used to control features of firmware which is even more awesome. What say mithro/shenki?

Controller Port

I fixed up Heart Beat module as Karl required it. Mithro asked me to add functionality to turn it off/on using controller port. To do that I dug through the code of how data is send through the second ACM port that is enumerated via HDMI2USB. I was finally able to do it.

Thursday 17 July 2014

Daily Snippet

Instead of two encoder, I tried changing the state machine to drop frames as low as possible but it didn't work. Will try to work on it tomorrow.
Also I changed the code of the heart beat feature I had implemented long ago. I did not have atlys board when I implemented it so came to know about a bug in the code when I ran it on the board. Eventually was able to fix it and improved the code to use lesser number of flops.
Also mithro added me to the TimVideos Hardware hacker team. It felt nice, actually very nice. It actually felt like this:

So can I now update my linkedin profile? But before that let me learn Git coz when shenki talks about stuff like bisecting, rebase I am like this





Wednesday 16 July 2014

Debug Program almost done!

The bare bone debug program is ready.
Here is how the program looks like. Things will improve as other developers add stuff to the debug infrastructure like packet count, expansion boards ID etc.
There are two bugs which I couldn't fix even after hours of attempt: 
  • UART is suddenly send incorrect data causing wrong output for a moment.
  • HDMI 1 is shown connected even though only one is connected.
I will spend some more time on it in the weekend.

Tomorrow I am planning to go back to the real stuff I am working on. Tomorrow I will try to add another encoder. Let's see if it is possible. If not, atleast we will know that this solution is not possible for available fpga resource.

Till then I am going to sleep.

Tuesday 15 July 2014

Oops Forgot again

I usually write my blog before going to bed. Yesterday I went to bed and then I realised I forgot to write my snippet. Now I had a very tough choice to make-"Sleep,blopost,sleep,blogpost" Finally I chose sleep. So now I wake up and write my blog.
Daily Snippet:
1) Removed some bugs from the debugger. (Behold the irony)
2) Added non blocking keyboard IO.

Hopefully I complete it today.

Phew, now I can sleep in peace.

Monday 14 July 2014

GSOC ain't your College Assignment

Today I submitted my first c code and it was a such a disaster that I am looking back and laughing at it. Contributing to open source comes with it's own baggage like license, coding style and git, all of which I never cared about. But these are very important in an collaborative environment and hence important to learn. I got the bare bone version of my debug program working (with errors) and committed it. But before committing I remembered, "Where is the license?" So I copied the license from a VHDL file ( I know I am a smartass) and then happily committed it, feeling proud of my achievement. Only later I realised that it won't compile because to comment in VHDL we use "--" which will throw a compile error in C. Shenki must have been ROFLing on seeing it.

Also I would like to propose daily tweeting instead of daily blogging. I haven't been blogging lately not because I was not working but blog, don't know why, sounds to  me hard work, like the daily cursive writing my Mom used to make me write when I was a kid.

Okay now I am rambling. Daily Snippet:
-[code]Debug program
-Studied Git
-Studied Linux Coding Stlye Guide
-Sat and wondered why mithro and shenki work so hard?

Tomorrow:
-[code]Debug program
-work on comments and *try* to rebase 


Sunday 6 July 2014

Plans

I would like to make hdmi2usb usable for 720p atleast.  Since we have already achieved 30 fps, things are looking good. Now the next thing to work on is finding an optimum encoding quality so that the encoded frame fit the fx2 bandwidth and are viewable.

Tariq observed that we are clocking pixels which do not have useful data. I would like to check that too. It most probably will not affect the frame rate but it might effect things at higher resolution.

How did fps improve to 30 fps?
In the original read/write state machine of DDR, read and writes did not happen simultaneously. I modified the read and write state machine to start encoding as soon as 8 lines are read into the DDR. This allows encoding of every alternate frame and hence fps of 30. In case Shenki you want to test it on your system, then here is the xsvf file.

How things can be improved further?
  • Double/triple buffering: Can improve the frame rate to the maximum frame rate of the encoder(currently it is 40 fps).
  • Using two encoder instead of one: Now as every alternate frame is being dropped, another encoder can be used to process these frames. This way we can get fully 60Hz frame rate. But there are issuses:
    •  Already the encoder is taking up almost half of the BRAMs available. So there might not be enough space for adding another encoder or if it is possible to add another encoder, there might not be enough space for other features which are going to be added.
    • As two encoded frames will be produced simultaneously, an way to send these to host via fx2 has to be designed which in turn will cost more memory.
  • (Suggested by shenki)Removing DDR image buffer and storing frames directly into the line buffer: I am not sure if it is possible. Wil have to check.
  • Subsampling: Currently the encoder takes in RGB888 and converts into YCrCb and then subsamples it at 4:2:2. This can be changed into 4:2:0. This can reduce encoding time and might help us with the bandwidth issues. 

Wednesday 2 July 2014

Daily Snippet


  • Completed mid term report
  • Studied about DDR2
  • Studied about double and triple buffering. Here is an excellent link to the same. http://www.anandtech.com/show/2794/2
  • Tomorrow I will try to change the image buffer SM such that encoding starts as soon as 8 lines are written into DDR. If this works frame rate should increase.

Tuesday 1 July 2014

Daily Snippet

  • Finally got the frame size of compressed image from the UART port.
The results confirm that the slower frame rate for higher encoding quality is because of bandwidth issue.

For 50% encoding quality, size of encoded frame is .436MB. So if the maximum bandwidth of fx2 is 40MBps then maximum number of frames possible is 91 which more than what we require.

In case of 100% encoding quality, the frame size of encoded frame is 3.6 MB which is greater than the input frame size. This is possible because in RLE, if there is no repetition of data, the size of encoded image can be double(wiki page). So for this size and a bandwidth of 40MBps maximum frame rate is 11 which is also observed.

So there is also a need to find an optimum encoding quality which has reasonable image quality and size.

  • Started working on mid term report. Hopefully I will finish tomorrow.
  • I am facing an issue with mu laptop. It turns off because of excessive heating when I build the firmware. This was not the case earlier. This wasted a lot of my time yesterday and today. I am using ubuntu 13.10. If anybody has any idea about the problem please help. Right now I go to windows build the firmware and then use ubuntu for rest of my stuff.