Skip to content

M-Film: film simulation for Canon EOS cameras with Magic Lantern. 72 film stocks (Portra, Velvia, Tri-X, CineStill…), a film-camera interface and an in-camera darkroom that develops your RAWs. 5D Mark III, 6D, 600D, 650D, 700D, EOS M and more.

Darkroom: portrait frames came out with lines across them (#6)

Claude4bdb70e16011
diff --git a/ml-dev/filmos/fos_dev.c b/ml-dev/filmos/fos_dev.c
index 83672d7..6f7023c 100644
--- a/ml-dev/filmos/fos_dev.c
+++ b/ml-dev/filmos/fos_dev.c
@@ -771,12 +771,18 @@ static int setup_maps(struct fos_dev *d)
{
d->seg_piece[k] = n;
int s0 = d->seg_x0[k], len = d->seg_x0[k + 1] - s0, odd = s0 & 1, pairs = (len - odd) >> 1;
+ /* the even column after the pairs: worked out before odd is
+ * cleared below, or a segment that starts on an odd column and
+ * takes more than one piece (portrait) gets a column too many,
+ * and the row's later pieces read one column off (on the camera,
+ * words not on a word boundary: lines across the picture) */
+ int tail = (len - odd) & 1;
/* four pairs at most a piece; a longer segment (portrait) in more */
do
{
int p = pairs < 4 ? pairs : 4;
pairs -= p;
- d->seg_desc[n] = (uint8_t) (p | (!pairs && ((len - odd) & 1)) << 6 | odd << 7);
+ d->seg_desc[n] = (uint8_t) (p | (!pairs && tail) << 6 | odd << 7);
d->desc_off[n++] = d->seg_off[k];
odd = 0;
}
diff --git a/ml-dev/fork/film-mode.patch b/ml-dev/fork/film-mode.patch
index 0fb357e..4b49ed0 100644
--- a/ml-dev/fork/film-mode.patch
+++ b/ml-dev/fork/film-mode.patch
@@ -3551,7 +3551,7 @@ new file mode 100644
index 000000000..83672d714
--- /dev/null
+++ b/src/fos_dev.c
-@@ -0,0 +1,2145 @@
+@@ -0,0 +1,2151 @@
+/* fos_dev: developing film in the camera, a frame at a time.
+ *
+ * The frame's CR2 is read a chunk at a time and its lossless JPEG decoded;
@@ -4325,12 +4325,18 @@ index 000000000..83672d714
+ {
+ d->seg_piece[k] = n;
+ int s0 = d->seg_x0[k], len = d->seg_x0[k + 1] - s0, odd = s0 & 1, pairs = (len - odd) >> 1;
++ /* the even column after the pairs: worked out before odd is
++ * cleared below, or a segment that starts on an odd column and
++ * takes more than one piece (portrait) gets a column too many,
++ * and the row's later pieces read one column off (on the camera,
++ * words not on a word boundary: lines across the picture) */
++ int tail = (len - odd) & 1;
+ /* four pairs at most a piece; a longer segment (portrait) in more */
+ do
+ {
+ int p = pairs < 4 ? pairs : 4;
+ pairs -= p;
-+ d->seg_desc[n] = (uint8_t) (p | (!pairs && ((len - odd) & 1)) << 6 | odd << 7);
++ d->seg_desc[n] = (uint8_t) (p | (!pairs && tail) << 6 | odd << 7);
+ d->desc_off[n++] = d->seg_off[k];
+ odd = 0;
+ }