/* 10-bit LiveView RAW */ /* Tested on 60D, likely to work on other models too. */ /* Before running, enable raw recording with grayscale preview. */ /* Then, place this under "don't click me" and have fun! */ static void run_test() { msleep(2000); /* set PACK32_MODE to 10-bit */ /* valid values at https://bitbucket.org/hudson/magic-lantern/commits/21f337ae919ed82e9aa1ebaf994e15ce1cb86f38?at=unified#Lmodules/silent/silent.cT1230 */ /* or at http://magiclantern.wikia.com/wiki/Register_Map -> PACK16_MODE */ EngDrvOut(0xC0F08094, 0); wait_lv_frames(1); struct raw_info local_raw_info = raw_info; local_raw_info.bits_per_pixel = 10; local_raw_info.pitch = local_raw_info.width * local_raw_info.bits_per_pixel / 8; local_raw_info.frame_size = local_raw_info.height * local_raw_info.pitch; local_raw_info.black_level /= 16; local_raw_info.white_level /= 16; /* we need to swap the byte order, so we'll grab a copy of the current raw buffer */ /* (which is overwritten at each LiveView frame) */ void* buf10 = malloc(local_raw_info.frame_size); if (!buf10) return; /* we may get data from a few LiveView frames, but at least we'll get a valid DNG */ memcpy(buf10, raw_info.buffer, local_raw_info.frame_size); /* raw stream is back to the default buffer, and nobody else touches our 10-bit data */ local_raw_info.buffer = buf10; save_dng("10bit.dng", &local_raw_info); free(buf10); }