The problem was introduced
when trying to autodetect resolution from registers, rather than hardcoding it for each video mode. The method did not give exact results; they were sometimes off by one. Previously, we took the resolution from EDMAC configurations, but these were harder to autodetect with EDMAC_RAW_SLURP - because in this case we had to set up the EDMAC at the right resolution, rather than taking it for granted.
Back then, having exact resolution didn't seem important; at least nobody noticed it when reviewing
this PR.
Later, shortly after crop_rec_4k was announced for 5D3,
this adjustment was required for 8...12-bit lossless modes - otherwise, only every other frame was correct. You'll see the issue right away if you comment out the height adjustment. However, if you reduce the autodetected value by 2 pixels or a bit more, all frames will still be correct. So, it's critical to have the EDMAC resolution
not higher than what the sensor is set up to deliver (but apparently it can be a little lower).
Now, why did I not adjust all the other models in the same way?
Resolution autodetection is inconsistent - sometimes this method gives the EDMAC resolution + 1, other times - 1 and other times the exact value. Here's a script that scans the ROMs for possible resolutions (pattern matching):
scan_raw_res.py and results:
raw_res.txt.
Interpretation:
- some models give exact values (with exceptions - some hidden video modes are configured differently):
6D, 100D, EOSM2
- most models have EDMAC resolutions configured at the one from capture registers + 1 (vertically)
1100D, 1200D, 1300D, 600D, 60D, 650D, 700D, EOSM
- one model has EDMAC resolutions configured at the one from capture registers - 1 (vertically)
5D3
- not analyzed: old DIGIC 4 models with LVState.
So... rather than hardcoding resolutions in each video mode (as we did some time ago), looks like we still have to hardcode a resolution adjustment (besides column_factor, which probably shows how many columns are read out in parallel).
Notice the EDMAC (used for transferring 14-bit Bayer data into RAM) is configured sometimes at even resolutions and sometimes at odd resolutions - in Canon code.