Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - d

#1
I've spent the last couple of days working on optimized 14-to-12-bit and 14-to-10-bit RAW conversion routines in native ARM assembly in hopes that 1) in spite of conventional wisdom the camera was in fact fast enough to do rudimentary "compression", and 2) the reduction in bitrate (15% and 29% respectively) would be a step towards making the 5D2 more viable for RAW recording at resolutions higher than 1280x720. There was only a limited amount of testing I could do with my very slow (40MB/s) cards but at 1280x720 on my 5D2 the conversion is fast enough for continuous "compressed" recording. I'd like to make the routines available to some people with faster cards and different cameras to see the extent to which this is viable at higher resolutions (10-bit 1880x1080 should theoretically be possible within the 5D2's apparent 60MB/s hardware limits).

Right now this should be treated as something highly experimental. Rather than posting a pre-built raw_rec.mo file I'm posting an assembled rawc.o file that can be linked with a compiled raw_rec.o into raw_rec.mo. The edits that need to be made to raw_rec.c (keep in mind that I'm working off the May 14th version so things have probably moved around) are:

New external functions:

extern void raw14_to_raw12(void *buffer, int size);
extern void raw14_to_raw10(void *buffer, int size);


New variable:

static int buffer_size_compressed = 0;

Inside the main recording loop after if (saving_buffer_index != capturing_buffer_index), add:

buffer_size_compressed = (buffer_size_used * 12) / 14;
raw14_to_raw12(buffers[saving_buffer_index], buffer_size_used);


for 12-bit, or:

buffer_size_compressed = (buffer_size_used * 10) / 14;
raw14_to_raw10(buffers[saving_buffer_index], buffer_size_used);


for 10-bit. Change every instance of buffer_size_used later in the function to buffer_size_compressed.

The native 14-bit RAW data is packed into halfwords, but it gets repacked into words in the conversion routines, so the C struct for getting at the 12-bit data in C looks like this:

struct raw12_pixblock
{
        unsigned int c_hi: 8;
        unsigned int b: 12;
        unsigned int a: 12;
        unsigned int f_hi: 4;
        unsigned int e: 12;
        unsigned int d: 12;
        unsigned int c_lo: 4;
        unsigned int h: 12;
        unsigned int g: 12;
        unsigned int f_lo: 8;
} __attribute__((packed));


Same deal with 10-bit data, but it's 32 bits shorter (and has 10-bit pixels obviously).

You can download the .o file at http://shoutingroomonly.com/rawc.zip