linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 1/2] v4l2-ctrl: Add decoder conceal color control
Date: Mon, 15 Feb 2021 13:32:25 +0200	[thread overview]
Message-ID: <489f1417-085d-4057-f2e8-1cc8db0ed161@linaro.org> (raw)
In-Reply-To: <cccae00e-e30e-6691-d954-27379a104115@xs4all.nl>



On 2/9/21 1:05 PM, Hans Verkuil wrote:
> On 09/02/2021 10:45, Stanimir Varbanov wrote:
>> Add decoder v4l2 control to set conceal color.
>>
>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
>> ---
>>  .../media/v4l/ext-ctrls-codec.rst             | 20 +++++++++++++++++++
>>  drivers/media/v4l2-core/v4l2-ctrls.c          |  9 +++++++++
>>  include/uapi/linux/v4l2-controls.h            |  1 +
>>  3 files changed, 30 insertions(+)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> index 00944e97d638..994650052333 100644
>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
>> @@ -674,6 +674,26 @@ enum v4l2_mpeg_video_frame_skip_mode -
>>      is currently displayed (decoded). This value is reset to 0 whenever
>>      the decoder is started.
>>  
>> +``V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (integer64)``
>> +    This control sets conceal color in YUV color space. It describes the
>> +    client preference of error conceal color in case of error where
>> +    reference frame is missing. The decoder would paint the reference
>> +    buffer with preferred color and use it for future decoding.
>> +    Applicable to decoders.
> 
> You should mention explicitly that this is using 16-bit color components
> and expects Limited Range.

I don't want to limit the client to Limited range only. I'll mention in
the description that both ranges are valid.

> 
>> +
>> +.. flat-table::
>> +    :header-rows:  0
>> +    :stub-columns: 0
>> +
>> +    * - Bit 0:15
>> +      - Y luminance
>> +    * - Bit 16:31
>> +      - Cb chrominance
>> +    * - Bit 32:47
>> +      - Cr chrominance
>> +    * - Bit 48:63
>> +      - Must be zero
>> +
>>  ``V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (boolean)``
>>      If enabled the decoder expects to receive a single slice per buffer,
>>      otherwise the decoder expects a single frame in per buffer.
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
>> index 016cf6204cbb..a3b9d28a00b7 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
>> @@ -945,6 +945,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>>  	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:			return "VBV Buffer Size";
>>  	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
>>  	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
>> +	case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR:		return "Video Decoder Conceal Color";
>>  	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
>>  	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return "Horizontal MV Search Range";
>>  	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return "Vertical MV Search Range";
>> @@ -1430,6 +1431,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>>  		*max = 0x7fffffffffffffffLL;
>>  		*step = 1;
>>  		break;
>> +	case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR:
>> +		*type = V4L2_CTRL_TYPE_INTEGER64;
>> +		*min = 0;
>> +		/* default for 8bit black, luma is 16, chroma is 128 */
> 
> Since this is 16 bit the actual default luma value for black is 4096 and for chroma use
> 32768 (i.e. both values are times 256).

If we follow this for pixel format with 10bit per channel we have to
multiply by 64?

> 
>> +		*def = 0x8000800010LL;
>> +		*max = 0xffffffffffffLL;
>> +		*step = 1;
>> +		break;
>>  	case V4L2_CID_PIXEL_RATE:
>>  		*type = V4L2_CTRL_TYPE_INTEGER64;
>>  		*flags |= V4L2_CTRL_FLAG_READ_ONLY;
>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
>> index 039c0d7add1b..5e5a3068be2d 100644
>> --- a/include/uapi/linux/v4l2-controls.h
>> +++ b/include/uapi/linux/v4l2-controls.h
>> @@ -428,6 +428,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
>>  #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE		(V4L2_CID_CODEC_BASE+228)
>>  #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME		(V4L2_CID_CODEC_BASE+229)
>>  #define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID	(V4L2_CID_CODEC_BASE+230)
>> +#define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR		(V4L2_CID_CODEC_BASE+231)
>>  
>>  /* CIDs for the MPEG-2 Part 2 (H.262) codec */
>>  #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL			(V4L2_CID_CODEC_BASE+270)
>>
> 
> Regards,
> 
> 	Hans
> 

-- 
regards,
Stan

  reply	other threads:[~2021-02-15 11:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  9:45 [PATCH 0/2] Add decoder conceal color ctrl Stanimir Varbanov
2021-02-09  9:45 ` [PATCH 1/2] v4l2-ctrl: Add decoder conceal color control Stanimir Varbanov
2021-02-09 11:05   ` Hans Verkuil
2021-02-15 11:32     ` Stanimir Varbanov [this message]
2021-02-15 11:57       ` Hans Verkuil
2021-02-16  8:56         ` Stanimir Varbanov
2021-02-16  8:58           ` Hans Verkuil
2021-02-25 10:12             ` Stanimir Varbanov
2021-02-09  9:45 ` [PATCH 2/2] venus: vdec: Add support for conceal control Stanimir Varbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=489f1417-085d-4057-f2e8-1cc8db0ed161@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).