[v2,09/10] media: vicodec: add a flag FWHT_FL_P_FRAME to fwht header

Message ID 20190215130509.86290-10-dafna3@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Hans Verkuil
Headers

Commit Message

Dafna Hirschfeld Feb. 15, 2019, 1:05 p.m. UTC
  Add the flag 'FWHT_FL_P_FRAME' to indicate that
the frame is a p-frame so it needs the previous buffer
as a reference frame. This is needed for the stateless
codecs.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
---
 drivers/media/platform/vicodec/codec-fwht.h      | 1 +
 drivers/media/platform/vicodec/codec-v4l2-fwht.c | 2 ++
 2 files changed, 3 insertions(+)
  

Comments

Hans Verkuil Feb. 15, 2019, 1:42 p.m. UTC | #1
Hi Dafna,

On 2/15/19 2:05 PM, Dafna Hirschfeld wrote:
> Add the flag 'FWHT_FL_P_FRAME' to indicate that
> the frame is a p-frame so it needs the previous buffer
> as a reference frame. This is needed for the stateless
> codecs.
> 
> Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> ---
>  drivers/media/platform/vicodec/codec-fwht.h      | 1 +
>  drivers/media/platform/vicodec/codec-v4l2-fwht.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/media/platform/vicodec/codec-fwht.h b/drivers/media/platform/vicodec/codec-fwht.h
> index eab4a97aa132..c2b1f3cc9fed 100644
> --- a/drivers/media/platform/vicodec/codec-fwht.h
> +++ b/drivers/media/platform/vicodec/codec-fwht.h
> @@ -76,6 +76,7 @@
>  #define FWHT_FL_CHROMA_FULL_HEIGHT	BIT(7)
>  #define FWHT_FL_CHROMA_FULL_WIDTH	BIT(8)
>  #define FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
> +#define FWHT_FL_P_FRAME			BIT(10)

I thought about this some more and I think we need two changes here:

1) invert the flag, so rename it to FWHT_FL_I_FRAME. It makes more sense
   to signal an I frame than it is to signal a P frame (there are a lot
   more P frames than I frames)

2) this requires that the version of the codec will have to be updated.
   So a stateless decoder can only handle version 3 and up.

It also means for the stateless decoder that the version number should be
part of struct v4l2_ctrl_fwht_params so the driver can reject older versions.

If possible, can you make a patch for vicodec for the current master that
implements these two changes? It would be desirable to get this in for 5.1.

Regards,

	Hans

>  
>  /* A 4-values flag - the number of components - 1 */
>  #define FWHT_FL_COMPONENTS_NUM_MSK	GENMASK(18, 16)
> diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
> index 40b1f4901fd3..1c20b5685201 100644
> --- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c
> +++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
> @@ -257,6 +257,8 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
>  		flags |= FWHT_FL_CR_IS_UNCOMPRESSED;
>  	if (encoding & FWHT_ALPHA_UNENCODED)
>  		flags |= FWHT_FL_ALPHA_IS_UNCOMPRESSED;
> +	if (encoding & FWHT_FRAME_PCODED)
> +		flags |= FWHT_FL_P_FRAME;
>  	if (rf.height_div == 1)
>  		flags |= FWHT_FL_CHROMA_FULL_HEIGHT;
>  	if (rf.width_div == 1)
>
  

Patch

diff --git a/drivers/media/platform/vicodec/codec-fwht.h b/drivers/media/platform/vicodec/codec-fwht.h
index eab4a97aa132..c2b1f3cc9fed 100644
--- a/drivers/media/platform/vicodec/codec-fwht.h
+++ b/drivers/media/platform/vicodec/codec-fwht.h
@@ -76,6 +76,7 @@ 
 #define FWHT_FL_CHROMA_FULL_HEIGHT	BIT(7)
 #define FWHT_FL_CHROMA_FULL_WIDTH	BIT(8)
 #define FWHT_FL_ALPHA_IS_UNCOMPRESSED	BIT(9)
+#define FWHT_FL_P_FRAME			BIT(10)
 
 /* A 4-values flag - the number of components - 1 */
 #define FWHT_FL_COMPONENTS_NUM_MSK	GENMASK(18, 16)
diff --git a/drivers/media/platform/vicodec/codec-v4l2-fwht.c b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
index 40b1f4901fd3..1c20b5685201 100644
--- a/drivers/media/platform/vicodec/codec-v4l2-fwht.c
+++ b/drivers/media/platform/vicodec/codec-v4l2-fwht.c
@@ -257,6 +257,8 @@  int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 		flags |= FWHT_FL_CR_IS_UNCOMPRESSED;
 	if (encoding & FWHT_ALPHA_UNENCODED)
 		flags |= FWHT_FL_ALPHA_IS_UNCOMPRESSED;
+	if (encoding & FWHT_FRAME_PCODED)
+		flags |= FWHT_FL_P_FRAME;
 	if (rf.height_div == 1)
 		flags |= FWHT_FL_CHROMA_FULL_HEIGHT;
 	if (rf.width_div == 1)