]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: vicodec: Add a flag for I-frames in fwht header
authorDafna Hirschfeld <dafna3@gmail.com>
Fri, 15 Feb 2019 20:58:53 +0000 (15:58 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 18 Feb 2019 20:36:23 +0000 (15:36 -0500)
Add a flag 'FWHT_FL_I_FRAME' that indicates that
this is an I-frame. This requires incrementing
to version 3

This flag is needed for the upcoming stateless FWHT
decoder since it has to know if an encoded frame is
an I or a P frame.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
[hverkuil-cisco@xs4all.nl: added the last paragraph of the commit msg]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vicodec/codec-fwht.h
drivers/media/platform/vicodec/codec-v4l2-fwht.c
drivers/media/platform/vicodec/vicodec-core.c

index 60d71d9dacb39c9928668bd96e2d05f0086ebc12..c410512d47c5966c5104d0cf30955aac4aa9a313 100644 (file)
@@ -56,7 +56,7 @@
 #define FWHT_MAGIC1 0x4f4f4f4f
 #define FWHT_MAGIC2 0xffffffff
 
-#define FWHT_VERSION 2
+#define FWHT_VERSION 3
 
 /* Set if this is an interlaced format */
 #define FWHT_FL_IS_INTERLACED          BIT(0)
@@ -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_I_FRAME                        BIT(10)
 
 /* A 4-values flag - the number of components - 1 */
 #define FWHT_FL_COMPONENTS_NUM_MSK     GENMASK(18, 16)
index c150348491339bb305fa95ef4f0225602e9dbba5..6573a471c5ca94f0ce0668216ffc663236bf56f7 100644 (file)
@@ -218,6 +218,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_I_FRAME;
        if (rf.height_div == 1)
                flags |= FWHT_FL_CHROMA_FULL_HEIGHT;
        if (rf.width_div == 1)
@@ -265,7 +267,7 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
 
        flags = ntohl(state->header.flags);
 
-       if (version == FWHT_VERSION) {
+       if (version >= 2) {
                if ((flags & FWHT_FL_PIXENC_MSK) != info->pixenc)
                        return -EINVAL;
                components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
index 9d739ea5542d5310133c7caed1977c0360014139..d7636fe9e1749641077fe350632df0a2a1780cfe 100644 (file)
@@ -339,7 +339,7 @@ info_from_header(const struct fwht_cframe_hdr *p_hdr)
        unsigned int pixenc = 0;
        unsigned int version = ntohl(p_hdr->version);
 
-       if (version == FWHT_VERSION) {
+       if (version >= 2) {
                components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
                                FWHT_FL_COMPONENTS_NUM_OFFSET);
                pixenc = (flags & FWHT_FL_PIXENC_MSK);
@@ -362,7 +362,7 @@ static bool is_header_valid(const struct fwht_cframe_hdr *p_hdr)
        if (w < MIN_WIDTH || w > MAX_WIDTH || h < MIN_HEIGHT || h > MAX_HEIGHT)
                return false;
 
-       if (version == FWHT_VERSION) {
+       if (version >= 2) {
                unsigned int components_num = 1 +
                        ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
                        FWHT_FL_COMPONENTS_NUM_OFFSET);