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.
C analog-photographycamera-firmwarecanoncanon-5d-mark-ivcanon-5dmark2canon-6dcanon-eoscr2darkroomeos-mfilm-emulationfilm-lookfilm-photographyfilm-simulationfujifilm-recipeskodak-portralutmagic-lanternphotographyraw
Darkroom: pink and magenta prints on the 5D Mark II, 60D and 50D
Claudedc4c897b8edc
diff --git a/README.md b/README.mdindex dda4b6a..e50bc98 100644--- a/README.md+++ b/README.md@@ -160,7 +160,7 @@ still wrong. If you have one marked *needs a tester*, you can help: [TESTING.md]| Canon EOS 5D Mark III (firmware 1.2.3) | 1.2.3 | ⚠️ Tried, known problem | Starts and shoots; the in-camera darkroom can't find the RAWs ([#16](../../issues/16), [#37](../../issues/37)). Fixed in the next update. | `M-Film-camera-5D3.123.zip` || Canon EOS 550D / Rebel T2i / Kiss X4 | 1.0.9 | 🔧 Too big for its boot memory: being fixed | | || Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | 🔧 Too big for its boot memory: being fixed | | |-| Canon EOS 60D | 1.1.1 | ⚠️ Tried, known problem | Starts, shoots and develops; the prints come out magenta ([#25](../../issues/25)). Being fixed. | `M-Film-camera-60D.111.zip` |+| Canon EOS 60D | 1.1.1 | ⚠️ Tried, known problem | Starts, shoots and develops; the prints come out magenta ([#25](../../issues/25)). Fixed in the next update. | `M-Film-camera-60D.111.zip` || Canon EOS 1100D / Rebel T3 / Kiss X50 | 1.0.5 | 🔧 Too big for its boot memory: being fixed | | || Canon EOS 500D / Rebel T1i / Kiss X3 | 1.1.1 | 🧪 Builds, needs a tester | | `M-Film-camera-500D.111.zip` || Canon EOS 50D | 1.0.9 | 🧪 Builds, needs a tester | | `M-Film-camera-50D.109.zip` |diff --git a/README.th.md b/README.th.mdindex 7c4ad57..ca3ed36 100644--- a/README.th.md+++ b/README.th.md@@ -160,7 +160,7 @@ M-Film ทำบน EOS M และใช้ได้จริงบนรุ่| Canon EOS 5D Mark III (firmware 1.2.3) | 1.2.3 | ⚠️ ลองแล้ว ยังมีปัญหา | เปิดและถ่ายได้ แต่ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ ([#16](../../issues/16), [#37](../../issues/37)) แก้แล้วในอัปเดตหน้า | `M-Film-camera-5D3.123.zip` || Canon EOS 550D / Rebel T2i / Kiss X4 | 1.0.9 | 🔧 ใหญ่เกินหน่วยความจำตอนบูต: กำลังแก้ | | || Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | 🔧 ใหญ่เกินหน่วยความจำตอนบูต: กำลังแก้ | | |-| Canon EOS 60D | 1.1.1 | ⚠️ ลองแล้ว ยังมีปัญหา | เปิด ถ่าย และล้างได้ แต่รูปออกสีม่วงอมชมพู ([#25](../../issues/25)) กำลังแก้ | `M-Film-camera-60D.111.zip` |+| Canon EOS 60D | 1.1.1 | ⚠️ ลองแล้ว ยังมีปัญหา | เปิด ถ่าย และล้างได้ แต่รูปออกสีม่วงอมชมพู ([#25](../../issues/25)) แก้แล้วในอัปเดตหน้า | `M-Film-camera-60D.111.zip` || Canon EOS 1100D / Rebel T3 / Kiss X50 | 1.0.5 | 🔧 ใหญ่เกินหน่วยความจำตอนบูต: กำลังแก้ | | || Canon EOS 500D / Rebel T1i / Kiss X3 | 1.1.1 | 🧪 build ได้แล้ว รอคนทดสอบ | | `M-Film-camera-500D.111.zip` || Canon EOS 50D | 1.0.9 | 🧪 build ได้แล้ว รอคนทดสอบ | | `M-Film-camera-50D.109.zip` |diff --git a/ml-dev/cameras.txt b/ml-dev/cameras.txtindex 19ed473..69b02c5 100644--- a/ml-dev/cameras.txt+++ b/ml-dev/cameras.txt@@ -24,7 +24,7 @@ EOSM.202 working 727072 Canon EOS M5D3.123 issues - Canon EOS 5D Mark III (firmware 1.2.3) | Starts and shoots; the in-camera darkroom can't find the RAWs (#16, #37). Fixed in the next update. | เปิดและถ่ายได้ แต่ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ (#16, #37) แก้แล้วในอัปเดตหน้า550D.109 memory 589568 Canon EOS 550D / Rebel T2i / Kiss X4600D.102 memory 589824 Canon EOS 600D / Rebel T3i / Kiss X5-60D.111 issues - Canon EOS 60D | Starts, shoots and develops; the prints come out magenta (#25). Being fixed. | เปิด ถ่าย และล้างได้ แต่รูปออกสีม่วงอมชมพู (#25) กำลังแก้+60D.111 issues - Canon EOS 60D | Starts, shoots and develops; the prints come out magenta (#25). Fixed in the next update. | เปิด ถ่าย และล้างได้ แต่รูปออกสีม่วงอมชมพู (#25) แก้แล้วในอัปเดตหน้า1100D.105 memory 524032 Canon EOS 1100D / Rebel T3 / Kiss X50500D.111 testing - Canon EOS 500D / Rebel T1i / Kiss X350D.109 testing - Canon EOS 50Ddiff --git a/ml-dev/filmos/fos_dev.c b/ml-dev/filmos/fos_dev.cindex 3d03421..fd6efba 100644--- a/ml-dev/filmos/fos_dev.c+++ b/ml-dev/filmos/fos_dev.c@@ -354,6 +354,7 @@ struct fos_dev/* the raw */int raw_w, raw_h, orient;+ int rphase; /* 1: the mosaic's red rows are the odd ones, see row_phase() */int crop_l, crop_t, crop_w, crop_h, ob_l, ob_r;int slices[3];int clrs, wide, high, bits, psv;@@ -404,6 +405,27 @@ struct fos_devuint8_t *idx;};+/* Which raw rows are red-green: LibRaw has every Canon here RGGB from the+ * top left of the picture, and on these sensors the picture starts on raw+ * row 51 (LibRaw's identify.cpp, the canon[] table), so their red rows are+ * the odd ones; the others start on an even row (EOS M, 650D, 700D, 100D 52;+ * 6D, 70D 38; 5D Mark III 80; 500D 26; 1100D 18). Every left edge is even.+ * Read as even ones, a picture's colours came out pink or magenta (5D Mark II+ * #18, 60D #25). By the sensor's size, so a CR2 from any camera develops+ * right on any build. */+static int row_phase(int raw_w, int raw_h)+{+ static const uint16_t odd[][2] = {+ { 5792, 3804 }, /* 5D Mark II */+ { 5344, 3516 }, /* 550D, 600D, 60D */+ { 5360, 3516 }, /* 7D */+ { 4832, 3228 }, /* 50D */+ };+ for (unsigned i = 0; i < sizeof(odd) / sizeof(odd[0]); i++)+ if (raw_w == odd[i][0] && raw_h == odd[i][1]) return 1;+ return 0;+}+/* The sensor's colours, XYZ -> camera, and its white level: LibRaw's* colordata.cpp (the Adobe matrices), per camera the fork is built for.* The EOS M's is the default (and the 650D's, 700D's and 100D's: one sensor). */@@ -707,6 +729,7 @@ static int setup_maps(struct fos_dev *d)d->ob_l = 0; d->ob_r = d->crop_l - 1;}if (d->ob_r > d->crop_l - 20) d->ob_r = d->crop_l - 20;+ d->rphase = row_phase(d->raw_w, d->raw_h);int portrait = d->orient == 6 || d->orient == 8;d->rows_axis_x = portrait;d->oh = FOS_PRINT_H;@@ -739,7 +762,7 @@ static int setup_maps(struct fos_dev *d)if (a < 0 || a >= d->crop_h) { d->rowoff[y] = OUT; continue; }int o = (int) ((long) a * rlen / d->crop_h);if (rflip) o = rlen - 1 - o;- if (y & 1) d->no_r[o]++; else d->ne_r[o]++;+ if ((y ^ d->rphase) & 1) d->no_r[o]++; else d->ne_r[o]++;d->rowoff[y] = 3 * (portrait ? d->ox0 + o : o * FOS_PRINT_W);}/* raw columns: segment k of them (in raw order) makes print line o */@@ -1103,6 +1126,7 @@ static __attribute__((noinline)) void scatter(struct fos_dev *d, const uint16_tconst int pic0 = d->crop_l, pic1 = d->crop_l + d->crop_w;const uint8_t *desc = d->seg_desc;int sx = d->sx, sy = d->sy, sw = d->sw, sx0 = d->sx0;+ const int rphase = d->rphase;int64_t black_sum = d->black_sum;long black_n = d->black_n;while (n > 0)@@ -1121,10 +1145,10 @@ static __attribute__((noinline)) void scatter(struct fos_dev *d, const uint16_tif (colob[x]) { black_sum += src[x - x0]; black_n++; }if (pa < pb){- /* sample of raw column x at at[x]; RGGB at the sensor's top- * left: the even columns' colour, then the odd ones' */+ /* sample of raw column x at at[x]; RG rows then GB rows+ * (row_phase), the even columns' colour then the odd ones' */const uint16_t *at = src - x0;- uint32_t *row = sums + ro + (sy & 1);+ uint32_t *row = sums + ro + ((sy ^ rphase) & 1);/* the segments it touches, and those it has whole (a row* of the picture is in two of Canon's slices) */int k0 = seg_of[pa], k1 = seg_of[pb - 1] + 1;diff --git a/ml-dev/filmos/sim/tools/mkcr2.c b/ml-dev/filmos/sim/tools/mkcr2.cindex 9f8c3a2..2741b8f 100644--- a/ml-dev/filmos/sim/tools/mkcr2.c+++ b/ml-dev/filmos/sim/tools/mkcr2.c@@ -224,7 +224,10 @@ static void expose(int portrait, double ev)for (int j = 0; j < 3; j++) cam[i] += cam_rgb[i][j] * lin[j];cam[i] /= pre_mul[i];}- int c = (y & 1) * 2 + (x & 1); /* RGGB */+ /* RGGB from the picture's top left, as LibRaw has every+ * Canon here: on a sensor whose picture starts on an odd+ * row (5D Mark II, 60D, 50D: 51) the red rows are the odd ones */+ int c = ((y - CROP_T) & 1) * 2 + ((x - CROP_L) & 1);double e = (c == 0 ? cam[0] : c == 3 ? cam[2] : cam[1]) / 0.18 * gain;if (e < 0) e = 0;val = e + sqrt(e + 1) * 0.6 * gauss();diff --git a/ml-dev/fork/film-mode.patch b/ml-dev/fork/film-mode.patchindex 9fa15a6..b2d6e56 100644--- a/ml-dev/fork/film-mode.patch+++ b/ml-dev/fork/film-mode.patch@@ -3645,7 +3645,7 @@ new file mode 100644index 000000000..3d034217c--- /dev/null+++ b/src/fos_dev.c-@@ -0,0 +1,2097 @@+@@ -0,0 +1,2121 @@+/* 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;@@ -4002,6 +4002,7 @@ index 000000000..3d034217c++ /* the raw */+ int raw_w, raw_h, orient;++ int rphase; /* 1: the mosaic's red rows are the odd ones, see row_phase() */+ int crop_l, crop_t, crop_w, crop_h, ob_l, ob_r;+ int slices[3];+ int clrs, wide, high, bits, psv;@@ -4052,6 +4053,27 @@ index 000000000..3d034217c+ uint8_t *idx;+};+++/* Which raw rows are red-green: LibRaw has every Canon here RGGB from the++ * top left of the picture, and on these sensors the picture starts on raw++ * row 51 (LibRaw's identify.cpp, the canon[] table), so their red rows are++ * the odd ones; the others start on an even row (EOS M, 650D, 700D, 100D 52;++ * 6D, 70D 38; 5D Mark III 80; 500D 26; 1100D 18). Every left edge is even.++ * Read as even ones, a picture's colours came out pink or magenta (5D Mark II++ * #18, 60D #25). By the sensor's size, so a CR2 from any camera develops++ * right on any build. */++static int row_phase(int raw_w, int raw_h)++{++ static const uint16_t odd[][2] = {++ { 5792, 3804 }, /* 5D Mark II */++ { 5344, 3516 }, /* 550D, 600D, 60D */++ { 5360, 3516 }, /* 7D */++ { 4832, 3228 }, /* 50D */++ };++ for (unsigned i = 0; i < sizeof(odd) / sizeof(odd[0]); i++)++ if (raw_w == odd[i][0] && raw_h == odd[i][1]) return 1;++ return 0;++}+++/* The sensor's colours, XYZ -> camera, and its white level: LibRaw's+ * colordata.cpp (the Adobe matrices), per camera the fork is built for.+ * The EOS M's is the default (and the 650D's, 700D's and 100D's: one sensor). */@@ -4355,6 +4377,7 @@ index 000000000..3d034217c+ d->ob_l = 0; d->ob_r = d->crop_l - 1;+ }+ if (d->ob_r > d->crop_l - 20) d->ob_r = d->crop_l - 20;++ d->rphase = row_phase(d->raw_w, d->raw_h);+ int portrait = d->orient == 6 || d->orient == 8;+ d->rows_axis_x = portrait;+ d->oh = FOS_PRINT_H;@@ -4387,7 +4410,7 @@ index 000000000..3d034217c+ if (a < 0 || a >= d->crop_h) { d->rowoff[y] = OUT; continue; }+ int o = (int) ((long) a * rlen / d->crop_h);+ if (rflip) o = rlen - 1 - o;-+ if (y & 1) d->no_r[o]++; else d->ne_r[o]++;++ if ((y ^ d->rphase) & 1) d->no_r[o]++; else d->ne_r[o]++;+ d->rowoff[y] = 3 * (portrait ? d->ox0 + o : o * FOS_PRINT_W);+ }+ /* raw columns: segment k of them (in raw order) makes print line o */@@ -4751,6 +4774,7 @@ index 000000000..3d034217c+ const int pic0 = d->crop_l, pic1 = d->crop_l + d->crop_w;+ const uint8_t *desc = d->seg_desc;+ int sx = d->sx, sy = d->sy, sw = d->sw, sx0 = d->sx0;++ const int rphase = d->rphase;+ int64_t black_sum = d->black_sum;+ long black_n = d->black_n;+ while (n > 0)@@ -4769,10 +4793,10 @@ index 000000000..3d034217c+ if (colob[x]) { black_sum += src[x - x0]; black_n++; }+ if (pa < pb)+ {-+ /* sample of raw column x at at[x]; RGGB at the sensor's top-+ * left: the even columns' colour, then the odd ones' */++ /* sample of raw column x at at[x]; RG rows then GB rows++ * (row_phase), the even columns' colour then the odd ones' */+ const uint16_t *at = src - x0;-+ uint32_t *row = sums + ro + (sy & 1);++ uint32_t *row = sums + ro + ((sy ^ rphase) & 1);+ /* the segments it touches, and those it has whole (a row+ * of the picture is in two of Canon's slices) */+ int k0 = seg_of[pa], k1 = seg_of[pb - 1] + 1;