Continuing on the quest to find what's going on with FRSP lossless compression on the 700D/EOSM. Knowing that the problem is with the save_lossless_dng function in modules/silent/silent.c, there's what I did:
# Made a copy of my repository using the Mac Finder
# Yeah--I know, bad form. Got a space in the path name but hey.
# Why did I make a copy? You'll see in a minute.
cd magic-lantern\ copy/
hg bisect --reset
hg diff -r b98026c9978f -r 5b6936ed7aab > 700d-compress.patch
hg up b98026c9978f -C
217 files updated, 0 files merged, 381 files removed, 0 files unresolved
# Apply patch
patch -p1 < 700d-compress.patch
patching file modules/silent/lossless.c
patching file src/boot-hack.c
patching file src/debug.c
patching file src/raw.c
patching file src/tasks.c
# Looks like Erwin didn't touch modules/silent/silent.c so I'll be copying
# silent.c to my "real" repository -- now it should be clear Why
# I made a copy. I wanted to isolate just the changes in silent.c
# This also allowed me to stay on 700D.115 for these tests.
hg bisect --good
hg up ebf206a3a2d1 -C
130 files updated, 0 files merged, 7 files removed, 0 files unresolved
hg bisect --bad
Testing changeset 16504:8040bdc22e2f (24 changesets remaining, ~4 tests)
89 files updated, 0 files merged, 12 files removed, 0 files unresolved
# At first I was applying the patch and reverting but then I realized that
# since there were no changes to silent.c in the patch this had no effect
# so I stopped doing that. Cutting to the chase:
...
The first bad revision is:
changeset: 16504:8040bdc22e2f
branch: crop_rec_4k
user: alex@thinkpad
date: Sat Aug 19 01:18:35 2017 +0300
summary: exmem: do not keep track of full shoot memory allocations
Looking up that commit, it didn't touch silent.c. However, what I did discover is:
This works--lossless compressed DNG on FRSP:
static int save_lossless_dng(char * filename, struct raw_info * raw_info)
{
struct raw_info out_raw_info = *raw_info;
ASSERT(out_raw_info.bits_per_pixel == 14);
/* compress the image in-place */
/* skip the top bar (that way, we'll be able to avoid race conditions) */
int dy = out_raw_info.active_area.y1;
int dm = dy * out_raw_info.pitch;
void * output_buffer = out_raw_info.buffer; /* output buffer = real buffer */
out_raw_info.buffer += dm; /* input buffer = real buffer + top bar size */
out_raw_info.frame_size -= dm;
out_raw_info.height -= dy;
out_raw_info.active_area.y1 -= dy;
out_raw_info.active_area.y2 -= dy;
struct memSuite * out_suite = CreateMemorySuite(output_buffer, raw_info->frame_size & ~0xFFF, 0);
out_raw_info.frame_size = lossless_compress_raw(&out_raw_info, out_suite);
ASSERT(out_raw_info.frame_size < raw_info->frame_size);
out_raw_info.buffer = output_buffer;
DeleteMemorySuite(out_suite);
int ok = save_dng(filename, &out_raw_info);
if (!ok) bmp_printf( FONT_MED, 0, 83, "DNG save error (card full?)");
return ok;
}
But what is in the latest version of silent.c doesn't work:
static int save_lossless_dng(char * filename, struct raw_info * raw_info)
{
struct raw_info out_raw_info = *raw_info;
ASSERT(out_raw_info.bits_per_pixel == 14);
/* fixme: not all models are able to allocate such a large contiguous chunk */
int max_compressed_size = ((uint64_t) raw_info->frame_size * 80 / 100) & ~0xFFF;
struct memSuite * out_suite = shoot_malloc_suite_contig(max_compressed_size);
if (!out_suite)
{
bmp_printf( FONT_MED, 0, 83, "Out of memory");
return 0;
}
ASSERT(out_suite->size == max_compressed_size);
out_raw_info.frame_size = lossless_compress_raw(&out_raw_info, out_suite);
if (out_raw_info.frame_size > out_suite->size)
{
bmp_printf( FONT_MED, 0, 83, "Warning: output truncated (%s)", format_memory_size(out_suite->size));
out_raw_info.frame_size = out_suite->size;
}
out_raw_info.buffer = GetMemoryAddressOfMemoryChunk(GetFirstChunkFromSuite(out_suite));
int ok = save_dng(filename, &out_raw_info);
if (!ok) bmp_printf( FONT_MED, 0, 83, "DNG save error (card full?)");
shoot_free_suite(out_suite);
return ok;
}
Still trying to narrow this down even further.