Page 13 of 31

Posted: Sun Nov 16, 2008 5:30 am
by KreAture
Here's what I found on the subject:

"MJPEG in AVIs having the MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* -- Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, and it must use basic Huffman encoding, not arithmetic or progressive. "

This means it should be quite easy to get the cam to output right format as long as you can force the huffman table to standard and then omit it in the stream.

Posted: Sun Nov 16, 2008 10:58 am
by buffercam
rgbphil wrote:a FIFO RAM might be of more use than a SRAM
You're absolutely right. Thanks for pointing me to this chip.

Posted: Sun Nov 16, 2008 12:58 pm
by buffercam
I edited my previous message about HCOUNT and VCOUNT calculations.

Here is what I added (although it still may not be correct):
buffercam wrote:It seems that the HCOUNT calculation is based on counting the clocks in a single row of image data at 1/2 the DSP clock frequency.
So for the Full Mega size, note that the data output is output at 1 x DSP frequency. This means you divide the number of clocks by two when calculating HCOUNT.
Smaller images are output at 1/4 the DSP clock rate, so you need to *multiply* the number of clocks by 2.
The result is that for every picture size, HCOUNT comes out to be approximately the default value of 713 (after you subtract the offset of 677). (I actually calculate 715.)

Posted: Sun Nov 16, 2008 3:45 pm
by KreAture
I also wish there were better docs. All we know are whats in the appnote together with the list of names and addresses in the datasheet.
what HCOUNT actually does appears to be a bit vague.

I have issues with my cams not delivering the entire frame and suspect this to be a small setting-error simply due to poor docs.
Best I can do is adjust so I get about half a image. Still, the image is then completely wrong colorwise. It's like it's YUV or something even though RGB is active.

Posted: Sun Nov 16, 2008 5:34 pm
by buffercam
Kreature,

Are you sure your camera is outputting at 15 fps (the maximum output rate specified in the datasheet)?

My camera tries to output at 30 fps when the frame rate is set to the max.

We have three settings for FRMSPD (specified in the Application Note):
Max frame rate
Half frame rate
Quarter frame rate

The datasheet only specified two frame rates: 15fps and 7.5fps.

Based on what I've measured, I think this is the relationship between the two:

Max frame rate = 30 fps, doesn't work properly?
Half frame rate = 15 fps
Quarter frame rate = 7.5 fps

Perhaps they initially designed the camera to do 30 fps, but couldn't get it to work in hardware, so they changed the datasheet to say 15 fps (instead of 30 fps)?

At any rate, try setting frame speed to "Half frame rate."

-David

Posted: Mon Nov 17, 2008 12:16 am
by KreAture
I have been using lowest framerate as I am focusing on still capture to start with. What settings are you guys using for the rest of the parameters? Like RGB/YUV and audo-contrast/exposure...

Victory!!!

Posted: Tue Nov 18, 2008 6:15 am
by ma4826
After a lot of attempts:

Address Data Comments
0x0B 0x00 White Line OFF
0x58 0x20 Exposure Time
0x05 0x00 Frame Rate Quarter
0x1A 0xFF
0x1B 0xB3
0x11 0x4A
0x14 0x33
0x04 0x0D RGB, 352x288, OUT ON
0x1F 0x0B
0x1E 0xC3
0x0E 0x1E

Image

Best regards,

ma4826

Posted: Tue Nov 18, 2008 10:53 am
by buffercam
Thank you and congratulations.

Where did you find info on this secret register?
0x0B 0x00 White Line OFF

EDIT: I'm starting to get the feeling you captured this image with the TCM8230MD. Is that the case? EDIT: Nevermind.

Posted: Tue Nov 18, 2008 11:00 am
by KreAture
Agreed, that is brilliant!
I will be testing this soon.

I've been writing structs for this cam and will incorporate all the details I find.

Anyone know how to define structs endian?

Posted: Tue Nov 18, 2008 11:28 am
by ma4826
Thank you and congratulations.

Where did you find info on this secret register?
0x0B 0x00 White Line OFF

EDIT: I'm starting to get the feeling you captured this image with the TCM8230MD. Is that the case?
Testing the registers one for one until 0x19.
With the TCM8240MD.

With 0x0B default value:

Image

Posted: Tue Nov 18, 2008 11:49 am
by KreAture
OMG! That is the problem I have been having!
Basically, the pink stuff on the left side is over-exposed and with wrong colors. If you take into account me not setting the exposure that leaves the right side black on my shot and the left hidiously pink!

I think I'll have to play around a bit to get this right but wohooo!
Finally the missing piece!

Posted: Tue Nov 18, 2008 11:54 am
by buffercam
Thanks for clarifying.

How did you calculate SPCOUNT?
The AppNote says SPCOUNT = 2 x (H_COUNT + 191) for that PICSIZ. That's different than what you used.

Also, what is Register 0x0E?
Code: Select all
 0x02 0x00  //Set Camera Active (I assume you did this?)

 0x0B 0x00  // White Line OFF
 0x58 0x20  // Exposure Time
 0x05 0x00  // Frame Rate Quarter
 0x1A 0xFF  // HCOUNT = 0x3FF = 1023
 0x1B 0xB3  // VCOUNT = 0x21B = 539 // Assuming Register 0x1C is left at the default (0xA1)
 0x11 0x4A  // Changed b/c of PICSIZE
 0x14 0x33  // Changed b/c of PICSIZE
 0x04 0x0D  // RGB  352x288  OUT ON
 0x1F 0x0B  // SPCOUNT = 0xBC3 = 3011 // Doesn't match formula?
 0x1E 0xC3  // SPCOUNT[7:0]
 0x0E 0x1E  // According to the AppNote it should be 0xAC for this PICSIZ?

Posted: Tue Nov 18, 2008 12:33 pm
by ma4826
With the values of appnote I got the same results as Kreature.

I got the correct values with these automatic tests.
Code: Select all
for (reg1f = 0; reg1f < 16; reg1f ++)
{
for (reg1e = 0; reg1e <= (255-15); reg1e = reg1e + 15)
{
for (reg0e = 0; reg0e <= (255-15); reg0e = reg0e + 15)
{

...
...
...

}
}
}
By changing these values the image moves within the "picture" and changes the color.

For example:

with 0x0E = 0x3C

Image

Best regards,

ma4826

Posted: Tue Nov 18, 2008 12:41 pm
by buffercam
Very helpful, thanks.

Posted: Tue Nov 18, 2008 12:44 pm
by KreAture
Haha. To do that rigorous testing would kill a year for me.
I have been reading my images out with a ATmega88!
It takes time and then I have to view them manually.