Browse Source

sf-omx-il: Add yuv422/yuv444 output pixel formats support for codaj12

Formats supported:
yuv422-- I422 NV16 NV61 YUYV YVYU UYVY VYUY
yuv444-- I444 YUV444PACKED

Signed-off-by: Som Qin <som.qin@starfivetech.com>
Som Qin 2 years ago
parent
commit
5b278b79cf

+ 95 - 6
soft_3rdpart/omx-il/component/image/dec/SF_OMX_Mjpeg_decoder.c

@@ -438,22 +438,73 @@ static OMX_ERRORTYPE SF_OMX_SetParameter(
                     case OMX_COLOR_FormatYUV420Planar:
                         decConfig->cbcrInterleave = CBCR_SEPARATED;
                         decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_420;
                         pOutputPort->nBufferSize = (width * height * 3) / 2;
                         break;
                     case OMX_COLOR_FormatYUV420SemiPlanar: //NV12
                         decConfig->cbcrInterleave = CBCR_INTERLEAVE;
                         decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_420;
                         pOutputPort->nBufferSize = (width * height * 3) / 2;
                         break;
                     case OMX_COLOR_FormatYVU420SemiPlanar: //NV21
                         decConfig->cbcrInterleave = CRCB_INTERLEAVE;
                         decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_420;
                         pOutputPort->nBufferSize = (width * height * 3) / 2;
                         break;
                     case OMX_COLOR_FormatYUV422Planar:
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatYUV422SemiPlanar: //NV16
+                        decConfig->cbcrInterleave = CBCR_INTERLEAVE;
+                        decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
                         pOutputPort->nBufferSize = width * height * 2;
                         break;
-                    case OMX_COLOR_FormatYUV444Interleaved:
+                    case OMX_COLOR_FormatYVU422SemiPlanar: //NV61
+                        decConfig->cbcrInterleave = CRCB_INTERLEAVE;
+                        decConfig->packedFormat = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatYCbYCr: //YUYV
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_422_YUYV;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatYCrYCb: //YVYU
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_422_YVYU;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatCbYCrY: //UYVY
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_422_UYVY;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatCrYCbY: //VYUY
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_422_VYUY;
+                        pSfMjpegImplement->frameFormat = FORMAT_422;
+                        pOutputPort->nBufferSize = width * height * 2;
+                        break;
+                    case OMX_COLOR_FormatYUV444Planar: //I444
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_NONE;
+                        pSfMjpegImplement->frameFormat = FORMAT_444;
+                        pOutputPort->nBufferSize = width * height * 3;
+                        break;
+                    case OMX_COLOR_FormatYUV444Interleaved: //YUV444PACKED
+                        decConfig->cbcrInterleave = CBCR_SEPARATED;
+                        decConfig->packedFormat   = PACKED_FORMAT_444;
+                        pSfMjpegImplement->frameFormat = FORMAT_444;
                         pOutputPort->nBufferSize = width * height * 3;
                         break;
                     default:
@@ -481,25 +532,60 @@ static OMX_ERRORTYPE SF_OMX_SetParameter(
             decConfig->cbcrInterleave = CBCR_SEPARATED;
             decConfig->packedFormat = PACKED_FORMAT_NONE;
             pSfMjpegImplement->frameFormat = FORMAT_420;
-            pPort->format.video.eColorFormat = portFormat->eColorFormat;
             break;
         case OMX_COLOR_FormatYUV420SemiPlanar: //NV12
             decConfig->cbcrInterleave = CBCR_INTERLEAVE;
             decConfig->packedFormat = PACKED_FORMAT_NONE;
             pSfMjpegImplement->frameFormat = FORMAT_420;
-            pPort->format.video.eColorFormat = portFormat->eColorFormat;
             break;
         case OMX_COLOR_FormatYVU420SemiPlanar: //NV21
             decConfig->cbcrInterleave = CRCB_INTERLEAVE;
             decConfig->packedFormat = PACKED_FORMAT_NONE;
             pSfMjpegImplement->frameFormat = FORMAT_420;
-            pPort->format.video.eColorFormat = portFormat->eColorFormat;
             break;
         case OMX_COLOR_FormatYUV422Planar:
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat = PACKED_FORMAT_NONE;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatYUV422SemiPlanar: //NV16
+            decConfig->cbcrInterleave = CBCR_INTERLEAVE;
+            decConfig->packedFormat = PACKED_FORMAT_NONE;
             pSfMjpegImplement->frameFormat = FORMAT_422;
-            pPort->format.video.eColorFormat = portFormat->eColorFormat;
             break;
-        case OMX_COLOR_FormatYUV444Interleaved:
+        case OMX_COLOR_FormatYVU422SemiPlanar: //NV61
+            decConfig->cbcrInterleave = CRCB_INTERLEAVE;
+            decConfig->packedFormat = PACKED_FORMAT_NONE;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatYCbYCr: //YUYV
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_422_YUYV;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatYCrYCb: //YVYU
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_422_YVYU;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatCbYCrY: //UYVY
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_422_UYVY;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatCrYCbY: //VYUY
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_422_VYUY;
+            pSfMjpegImplement->frameFormat = FORMAT_422;
+            break;
+        case OMX_COLOR_FormatYUV444Planar: //I444
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_NONE;
+            pSfMjpegImplement->frameFormat = FORMAT_444;
+            break;
+        case OMX_COLOR_FormatYUV444Interleaved: //YUV444PACKED
+            decConfig->cbcrInterleave = CBCR_SEPARATED;
+            decConfig->packedFormat   = PACKED_FORMAT_444;
             pSfMjpegImplement->frameFormat = FORMAT_444;
             pPort->format.video.eColorFormat = portFormat->eColorFormat;
             break;
@@ -507,6 +593,9 @@ static OMX_ERRORTYPE SF_OMX_SetParameter(
             ret = OMX_ErrorNotImplemented;
             break;
         }
+        if(!ret)
+            pPort->format.video.eColorFormat = portFormat->eColorFormat;
+        break;
     }
     case OMX_IndexParamVideoInit:
     {

+ 36 - 0
soft_3rdpart/omx-il/tests/mjpeg_dec_test.c

@@ -400,6 +400,42 @@ int main(int argc, char **argv)
     {
         pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
     }
+    else if (strstr(decodeTestContext->sOutputFormat, "i422") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV422Planar;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "nv16") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV422SemiPlanar;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "nv61") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYVU422SemiPlanar;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "yuyv") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "yvyu") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYCrYCb;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "uyvy") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatCbYCrY;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "vyuy") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatCrYCbY;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "i444") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV444Planar;
+    }
+    else if (strstr(decodeTestContext->sOutputFormat, "yuv444packed") != NULL)
+    {
+        pOutputPortDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV444Interleaved;
+    }
     else
     {
         printf("Unsupported color format!\r\n");