Merge "media: Deprecate support for NV12_512"
diff --git a/libc2dcolorconvert/C2DColorConverter.cpp b/libc2dcolorconvert/C2DColorConverter.cpp
index b7ca088..ca3674f 100644
--- a/libc2dcolorconvert/C2DColorConverter.cpp
+++ b/libc2dcolorconvert/C2DColorConverter.cpp
@@ -303,7 +303,6 @@
         case YCbCr420P:
         case YCrCb420P:
         case NV12_2K:
-        case NV12_512:
         case NV12_128m:
         case NV12_UBWC:
         case TP10_UBWC:
@@ -486,7 +485,6 @@
             return (C2D_COLOR_FORMAT_420_NV12 | C2D_FORMAT_MACROTILED);
         case YCbCr420SP:
         case NV12_2K:
-        case NV12_512:
         case NV12_128m:
             return C2D_COLOR_FORMAT_420_NV12;
         case YCbCr420P:
@@ -519,10 +517,8 @@
             return ALIGN(width, ALIGN16);
         case NV12_2K:
             return ALIGN(width, ALIGN16);
-        case NV12_512:
-            return ALIGN(width, ALIGN512);
         case NV12_128m:
-            return ALIGN(width, ALIGN128);
+            return ALIGN(width, ALIGN512);
         case YCbCr420P:
             return ALIGN(width, ALIGN16);
         case YCrCb420P:
@@ -553,10 +549,8 @@
             size_t lumaSize = ALIGN(alignedw * height, ALIGN2K);
             return lumaSize;
         }
-        case NV12_512:
-            return ALIGN(width, ALIGN512) * ALIGN(height, ALIGN512);
         case NV12_128m:
-            return ALIGN(width, ALIGN128) * ALIGN(height, ALIGN32);
+            return ALIGN(width, ALIGN512) * ALIGN(height, ALIGN512);
         case NV12_UBWC:
             return ALIGN( VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width) *
                     VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height), ALIGN4K) +
@@ -635,16 +629,11 @@
                                                    __FUNCTION__, width, height, size);
             }
             break;
-        case NV12_512:
+        case NV12_128m:
             alignedw = ALIGN(width, ALIGN512);
             alignedh = ALIGN(height, ALIGN512);
             size = ALIGN(alignedw * alignedh + (alignedw * ALIGN((height+1)/2, ALIGN256)), ALIGN4K);
             break;
-        case NV12_128m:
-            alignedw = ALIGN(width, ALIGN128);
-            alignedh = ALIGN(height, ALIGN32);
-            size = ALIGN(alignedw * alignedh + (alignedw * ALIGN((height+1)/2, ALIGN16)), ALIGN4K);
-            break;
         case NV12_UBWC:
             size = VENUS_BUFFER_SIZE(COLOR_FMT_NV12_UBWC, width, height);
             break;
@@ -750,10 +739,8 @@
     switch (format) {
         case NV12_2K:
           return ALIGN2K;
-        case NV12_512:
-          return ALIGN512;
         case NV12_128m:
-          return 1;
+          return ALIGN512;
         case NV12_UBWC:
         case TP10_UBWC:
           return ALIGN4K;
@@ -771,7 +758,6 @@
         case YCbCr420SP: //OR NV12
         case YCbCr420P:
         case NV12_2K:
-        case NV12_512:
         case NV12_128m:
         case NV12_UBWC:
         case TP10_UBWC:
@@ -801,7 +787,6 @@
         case YCrCb420P:
         case YCbCr420Tile:
         case NV12_2K:
-        case NV12_512:
         case NV12_128m:
         case NV12_UBWC:
         case TP10_UBWC:
diff --git a/libc2dcolorconvert/C2DColorConverter.h b/libc2dcolorconvert/C2DColorConverter.h
index f677deb..d23c780 100644
--- a/libc2dcolorconvert/C2DColorConverter.h
+++ b/libc2dcolorconvert/C2DColorConverter.h
@@ -108,7 +108,6 @@
     RGBA8888,
     RGBA8888_UBWC,
     NV12_2K,
-    NV12_512,
     NV12_128m,
     NV12_UBWC,
     TP10_UBWC,
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index a45edbc..40ed324 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -291,7 +291,6 @@
     mMapPixelFormat2Converter.insert({
             {HAL_PIXEL_FORMAT_RGBA_8888, RGBA8888},
             {HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC, NV12_UBWC},
-            {HAL_PIXEL_FORMAT_NV12_HEIF, NV12_512},
                 });
 
     pthread_mutex_init(&m_lock, NULL);
@@ -5127,7 +5126,7 @@
                                private_handle_t::PRIV_FLAGS_ITU_R_601_FR : 0;
 
         if (m_sOutPortDef.format.video.eCompressionFormat == OMX_VIDEO_CodingImageHEIC)
-            c2dDestFmt = NV12_512;
+            c2dDestFmt = NV12_128m;
 
         if (c2dcc.getConversionNeeded() &&
             c2dcc.isPropChanged(m_sInPortDef.format.video.nFrameWidth,
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 2b6521d..ab2f301 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -935,7 +935,6 @@
 
         switch (color_format) {
         case NV12_128m:
-        case NV12_512:
             return venc_set_color_format((OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m);
         case NV12_UBWC:
             return venc_set_color_format((OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed);
@@ -1369,23 +1368,6 @@
                 fwrite(ptemp, m_sVenc_cfg.input_width, 1, m_debug.infile);
                 ptemp += stride;
             }
-        } else if (color_format == COLOR_FMT_NV12_512) {
-            stride = VENUS_Y_STRIDE(color_format, m_sVenc_cfg.input_width);
-            scanlines = VENUS_Y_SCANLINES(color_format, m_sVenc_cfg.input_height);
-
-            for (i = 0; i < scanlines; i++) {
-                fwrite(ptemp, stride, 1, m_debug.infile);
-                ptemp += stride;
-            }
-            if (metadatamode == 1) {
-                ptemp = pvirt + (stride * scanlines);
-            } else {
-                ptemp = (unsigned char *)pbuffer->pBuffer + (stride * scanlines);
-            }
-            for (i = 0; i < scanlines/2; i++) {
-                fwrite(ptemp, stride, 1, m_debug.infile);
-                ptemp += stride;
-            }
         } else if (color_format == COLOR_FMT_RGBA8888) {
             stride = VENUS_RGB_STRIDE(color_format, m_sVenc_cfg.input_width);
             scanlines = VENUS_RGB_SCANLINES(color_format, m_sVenc_cfg.input_height);
@@ -2686,8 +2668,8 @@
                             m_sVenc_cfg.inputformat = isUBWC ? V4L2_PIX_FMT_NV12_UBWC : V4L2_PIX_FMT_NV12;
                             DEBUG_PRINT_INFO("ENC_CONFIG: Input Color = NV12 %s", isUBWC ? "UBWC" : "Linear");
                         } else if (handle->format == HAL_PIXEL_FORMAT_NV12_HEIF) {
-                            m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12_512;
-                            DEBUG_PRINT_INFO("ENC_CONFIG: Input Color = NV12_512");
+                            m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12;
+                            DEBUG_PRINT_INFO("ENC_CONFIG: Input Color = NV12");
                         } else if (handle->format == HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC) {
                             m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12_UBWC;
                             DEBUG_PRINT_INFO("ENC_CONFIG: Input Color = NV12_UBWC");
@@ -3018,9 +3000,6 @@
         case V4L2_PIX_FMT_NV12:
             color_format = COLOR_FMT_NV12;
             break;
-        case V4L2_PIX_FMT_NV12_512:
-            color_format = COLOR_FMT_NV12_512;
-            break;
         case V4L2_PIX_FMT_NV12_UBWC:
             color_format = COLOR_FMT_NV12_UBWC;
             break;
@@ -3595,10 +3574,7 @@
     }
 
     if (m_codec == OMX_VIDEO_CodingImageHEIC)
-        format = V4L2_PIX_FMT_NV12_512;
-
-    if (m_codec == OMX_VIDEO_CodingImageHEIC)
-        format = V4L2_PIX_FMT_NV12_512;
+        format = V4L2_PIX_FMT_NV12;
 
     return format;
 }
@@ -3644,10 +3620,7 @@
     }
 
     if (m_codec == OMX_VIDEO_CodingImageHEIC)
-        m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12_512;
-
-    if (m_codec == OMX_VIDEO_CodingImageHEIC)
-        m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12_512;
+        m_sVenc_cfg.inputformat = V4L2_PIX_FMT_NV12;
 
     memset(&fmt, 0, sizeof(fmt));
     fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
index 8824c4c..561cf05 100755
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
@@ -55,17 +55,12 @@
             *usage &= ~GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
             DEBUG_PRINT_INFO("Clear UBWC consumer usage bits as 10-bit linear color requested");
         }
-    } else if (mUseLinearColorFormat & REQUEST_LINEAR_COLOR_8_BIT) {
+    } else if (mUseLinearColorFormat & REQUEST_LINEAR_COLOR_8_BIT ||
+            m_codec == OMX_VIDEO_CodingImageHEIC) {
         *usage &= ~GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
         DEBUG_PRINT_INFO("Clear UBWC consumer usage bits as 8-bit linear color requested");
     }
 
-    if (m_codec == OMX_VIDEO_CodingImageHEIC) {
-        DEBUG_PRINT_INFO("Clear UBWC and set HEIF consumer usage bit");
-        *usage &= ~GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
-        *usage |= GRALLOC_USAGE_PRIVATE_HEIF_VIDEO;
-    }
-
     DEBUG_PRINT_INFO("venc_get_consumer_usage 0x%x", *usage);
 }