Re: [PATCH 40/40] media: imx: set and propagate empty field, colorimetry params

From: Philipp Zabel
Date: Tue Apr 18 2017 - 05:30:41 EST


On Thu, 2017-04-13 at 09:40 -0700, Steve Longerbeam wrote:
[...]
> >> @@ -804,12 +804,29 @@ static void prp_try_fmt(struct prp_priv *priv,
> >> &sdformat->format.height,
> >> infmt->height / 4, MAX_H_SRC,
> >> H_ALIGN_SRC, S_ALIGN);
> >> +
> >> + /*
> >> + * The Image Converter produces fixed quantization
> >> + * (full range for RGB, limited range for YUV), and
> >> + * uses a fixed Y`CbCr encoding (V4L2_YCBCR_ENC_601).
> >> + * For colorspace and transfer func, just propagate
> >> + * from the sink.
> >> + */
> >> + sdformat->format.quantization =
> >> + ((*cc)->cs != IPUV3_COLORSPACE_YUV) ?
> >> + V4L2_QUANTIZATION_FULL_RANGE :
> >> + V4L2_QUANTIZATION_LIM_RANGE;
> >> + sdformat->format.ycbcr_enc = V4L2_YCBCR_ENC_601;
> >
> > Support for V4L2_YCBCR_ENC_709 and quantization options could be added
> > to the IPUv3 core code, so this limitation could be relaxed later.
>
> Yes, I was going to mention that too. We can add coefficient tables
> to ipu-ic for all the encodings enumerated in enum v4l2_ycbcr_encoding.

Exactly.

> I know that quantization is programmable in the DP, but is it in the
> IC? AFAICT there is none.

We have a freely programmable 4x3 matrix multiplication both before and
after processing in each task, and there is a saturation mode switch
that can limit the first component to (16...235) and the other two to
(16...240). That should be enough for at least full/limited range YCbCr
quantizations. So we apparently can't saturate to limited range RGB, but
for example full-range -> limited-range RGB conversions should be
perfectly possible.

regards
Philipp