<div dir="ltr"><div dir="ltr">Hi Laurent, </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 7, 2021 at 9:01 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Hiro,<br>
<br>
Thank you for the patch.<br>
<br>
On Fri, May 28, 2021 at 12:05:26PM +0900, Hirokazu Honda wrote:<br>
> The control is used to report available sensor test pattern modes<br>
> and also specify the mode to sensor.<br>
> <br>
> Signed-off-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org" target="_blank">hiroh@chromium.org</a>><br>
> Reviewed-by: Jacopo Mondi <<a href="mailto:jacopo@jmondi.org" target="_blank">jacopo@jmondi.org</a>><br>
> ---<br>
>  src/libcamera/control_ids.yaml | 58 ++++++++++++++++++++++++++++++++++<br>
>  1 file changed, 58 insertions(+)<br>
> <br>
> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml<br>
> index 88d81ac4..b1fe1dc6 100644<br>
> --- a/src/libcamera/control_ids.yaml<br>
> +++ b/src/libcamera/control_ids.yaml<br>
> @@ -615,4 +615,62 @@ controls:<br>
>          detection, additional format conversions etc) count as an additional<br>
>          pipeline stage.<br>
>  <br>
> +  - TestPatternMode:<br>
> +      type: int32_t<br>
> +      draft: true<br>
> +      description: |<br>
> +        Control to select the test pattern mode. Currently identical to<br>
> +        ANDROID_SENSOR_TEST_PATTERN_MODE.<br>
<br>
I'd add that the test pattern modes are identical to the ones defined by<br>
the CCS specification. Maybe something along the lines of:<br>
<br>
        The modes are described in a pixel-perfect way in the MIPI<br>
        Camera Command Set (<a href="https://www.mipi.org/specifications/camera-command-set" rel="noreferrer" target="_blank">https://www.mipi.org/specifications/camera-command-set</a>)<br>
        specification.<br>
<br>
I've wondered for a long time how we could standardize test pattern<br>
modes when there's no standard at the hardware level, and I've been<br>
pointed out recently to the fact that CCS defines pixel-perfect test<br>
patterns (they are parametrized by a set of read-only parameters<br>
reported by the sensor though, the specification is worth a read). This<br>
comes from the SMIA++ specification that also standardized test pattern<br>
modes, but from what I've been told, not in a pixel-perfect way.<br>
<br></blockquote><div><br></div><div>Thanks Laurent for the info. The test pattern modes defined in CCS is almost one-to-one correspondence to Android test pattern modes though 100% color tile is not defined in Android.</div><div>To test the test pattern modes in a pixel-perfect way, we have to tell a client the parameters.</div><div>I am fine to re-declare the test pattern mode control based on CCS definition, but testing them in a pixel-perfect way seems to require much more work.</div><div><br></div><div>Regards,</div><div>-Hiro</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Apart from that, this looks good to me for now as it's a draft control.<br>
We'll have to decide how to handle custom patterns once we destage this<br>
control.<br>
<br>
> +      enum:<br>
> +        - name: TestPatternModeOff<br>
> +          value: 0<br>
> +          description: |<br>
> +            No test pattern mode is used. The camera device returns frames from<br>
> +            the image sensor.<br>
> +        - name: TestPatternModeSolidColor<br>
> +          value: 1<br>
> +          description: |<br>
> +            Each pixel in [R, G_even, G_odd, B] is replaced by its respective<br>
> +            color channel provided in test pattern data.<br>
> +            \todo Add control for test pattern data.<br>
> +        - name: TestPatternModeColorBars<br>
> +          value: 2<br>
> +          description: |<br>
> +            All pixel data is replaced with an 8-bar color pattern. The vertical<br>
> +            bars (left-to-right) are as follows; white, yellow, cyan, green,<br>
> +            magenta, red, blue and black. Each bar should take up 1/8 of the<br>
> +            sensor pixel array width. When this is not possible, the bar size<br>
> +            should be rounded down to the nearest integer and the pattern can<br>
> +            repeat on the right side. Each bar's height must always take up the<br>
> +            full sensor pixel array height.<br>
> +        - name: TestPatternModeColorBarsFadeToGray<br>
> +          value: 3<br>
> +          description: |<br>
> +            The test pattern is similar to TestPatternModeColorBars,<br>
> +            except that each bar should start at its specified color at the top<br>
> +            and fade to gray at the bottom. Furthermore each bar is further<br>
> +            subdevided into a left and right half. The left half should have a<br>
> +            smooth gradient, and the right half should have a quantized<br>
> +            gradient. In particular, the right half's should consist of blocks<br>
> +            of the same color for 1/16th active sensor pixel array width. The<br>
> +            least significant bits in the quantized gradient should be copied<br>
> +            from the most significant bits of the smooth gradient. The height of<br>
> +            each bar should always be a multiple of 128. When this is not the<br>
> +            case, the pattern should repeat at the bottom of the image.<br>
> +        - name: TestPatternModePn9<br>
> +          value: 4<br>
> +          description: |<br>
> +            All pixel data is replaced by a pseudo-random sequence generated<br>
> +            from a PN9 512-bit sequence (typically implemented in hardware with<br>
> +            a linear feedback shift register). The generator should be reset at<br>
> +            the beginning of each frame, and thus each subsequent raw frame with<br>
> +            this test pattern should be exactly the same as the last.<br>
> +        - name: TestPatternModeCustom1<br>
> +          value: 5<br>
<br>
This starts at 256 in the Android camera HAL API, I'd do the same as the<br>
control is documented as being identical to<br>
ANDROID_SENSOR_TEST_PATTERN_MODE.<br>
<br>
Reviewed-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
<br>
> +          description: |<br>
> +            The first custom test pattern. All custom patterns that are<br>
> +            available only on this camera device are at least this numeric<br>
> +            value. All of the custom test patterns will be static (that is the<br>
> +            raw image must not vary from frame to frame).<br>
> +<br>
>  ...<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div></div>