From 1429cf3cead2bffdc7e797267cb2fae4319a17f0 Mon Sep 17 00:00:00 2001 From: Stricted Date: Mon, 24 Sep 2018 19:59:41 +0200 Subject: [PATCH] ifdef undefined stuff Change-Id: Ib74b27c2c80e91bcfc09bb72539618a11255af3e --- libexynosutils/exynos_format_v4l2.c | 30 +++++++++++++--------- libscaler/libscalerblend-v4l2.cpp | 2 ++ libvideocodec/enc/ExynosVideoEncoder.c | 35 +++++++++++++++++--------- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/libexynosutils/exynos_format_v4l2.c b/libexynosutils/exynos_format_v4l2.c index 0590b42..680f070 100644 --- a/libexynosutils/exynos_format_v4l2.c +++ b/libexynosutils/exynos_format_v4l2.c @@ -80,11 +80,11 @@ int HAL_PIXEL_FORMAT_2_V4L2_PIX( case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P: v4l2_pixel_format = V4L2_PIX_FMT_YUV420; break; - +#ifdef V4L2_PIX_FMT_YUV420N case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_PN: v4l2_pixel_format = V4L2_PIX_FMT_YUV420N; break; - +#endif case HAL_PIXEL_FORMAT_YCbCr_422_SP: v4l2_pixel_format = V4L2_PIX_FMT_NV16; break; @@ -92,11 +92,11 @@ int HAL_PIXEL_FORMAT_2_V4L2_PIX( case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP: v4l2_pixel_format = V4L2_PIX_FMT_NV12; break; - +#ifdef V4L2_PIX_FMT_NV12N case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN: v4l2_pixel_format = V4L2_PIX_FMT_NV12N; break; - +#endif case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M: case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV: case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B: @@ -137,11 +137,11 @@ int HAL_PIXEL_FORMAT_2_V4L2_PIX( v4l2_pixel_format = V4L2_PIX_FMT_NV12MT_16X16; #endif break; - +#ifdef V4L2_PIX_FMT_NV12NT case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED: v4l2_pixel_format = V4L2_PIX_FMT_NV12NT; break; - +#endif case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_I: v4l2_pixel_format = V4L2_PIX_FMT_YVYU; break; @@ -184,11 +184,11 @@ int V4L2_PIX_2_HAL_PIXEL_FORMAT( case V4L2_PIX_FMT_YUV420: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P; break; - +#ifdef V4L2_PIX_FMT_YUV420N case V4L2_PIX_FMT_YUV420N: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_PN; break; - +#endif case V4L2_PIX_FMT_YUV420M: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M; break; @@ -208,11 +208,11 @@ int V4L2_PIX_2_HAL_PIXEL_FORMAT( case V4L2_PIX_FMT_NV12: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP; break; - +#ifdef V4L2_PIX_FMT_NV12N case V4L2_PIX_FMT_NV12N: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN; break; - +#endif case V4L2_PIX_FMT_NV12M: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M; break; @@ -237,11 +237,11 @@ int V4L2_PIX_2_HAL_PIXEL_FORMAT( case V4L2_PIX_FMT_NV12MT_16X16: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED; break; - +#ifdef V4L2_PIX_FMT_NV12NT case V4L2_PIX_FMT_NV12NT: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED; break; - +#endif case V4L2_PIX_FMT_NV61: hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_SP; break; @@ -377,11 +377,17 @@ int V4L2_PIX_2_YUV_INFO(unsigned int v4l2_pixel_format, unsigned int * bpp, unsi switch (v4l2_pixel_format) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV21: +#ifdef V4L2_PIX_FMT_NV12N case V4L2_PIX_FMT_NV12N: +#endif +#ifdef V4L2_PIX_FMT_NV12NT case V4L2_PIX_FMT_NV12NT: +#endif case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YVU420: +#ifdef V4L2_PIX_FMT_YUV420N case V4L2_PIX_FMT_YUV420N: +#endif *bpp = 12; *planes = 1; break; diff --git a/libscaler/libscalerblend-v4l2.cpp b/libscaler/libscalerblend-v4l2.cpp index 4747e72..6e3a403 100644 --- a/libscaler/libscalerblend-v4l2.cpp +++ b/libscaler/libscalerblend-v4l2.cpp @@ -116,9 +116,11 @@ void CScalerBlendV4L2::GetCustomAlphaBlendFmt(int32_t &src_color_space, } else if (src_color_space == V4L2_PIX_FMT_NV12) { if ((srcblendfmt == V4L2_PIX_FMT_RGB32)) src_color_space = V4L2_PIX_FMT_NV12_RGB32; +#ifdef V4L2_PIX_FMT_NV12N } else if (src_color_space == V4L2_PIX_FMT_NV12N) { if ((srcblendfmt == V4L2_PIX_FMT_RGB32)) src_color_space = V4L2_PIX_FMT_NV12N_RGB32; +#endif } else if (src_color_space == V4L2_PIX_FMT_NV12MT_16X16) { if ((srcblendfmt == V4L2_PIX_FMT_RGB32)) src_color_space = V4L2_PIX_FMT_NV12MT_16X16_RGB32; diff --git a/libvideocodec/enc/ExynosVideoEncoder.c b/libvideocodec/enc/ExynosVideoEncoder.c index 0bd0b67..7623029 100644 --- a/libvideocodec/enc/ExynosVideoEncoder.c +++ b/libvideocodec/enc/ExynosVideoEncoder.c @@ -861,6 +861,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 1; } #endif +#ifdef V4L2_CID_MPEG_VIDEO_H264_MIN_QP_P /* optional : if these are not set, set value are same as I frame */ if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { i = ext_ctrls.count; @@ -875,6 +876,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 4; } +#endif break; } @@ -961,7 +963,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( break; } ext_ctrls.count = MPEG4_CTRL_NUM; - +#ifdef V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP_P /* optional : if these are not set, set value are same as I frame */ if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { i = ext_ctrls.count; @@ -976,6 +978,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 4; } +#endif break; } @@ -1022,7 +1025,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( break; } ext_ctrls.count = H263_CTRL_NUM; - +#ifdef V4L2_CID_MPEG_VIDEO_H263_MIN_QP_P /* optional : if these are not set, set value are same as I frame */ if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { i = ext_ctrls.count; @@ -1033,6 +1036,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 2; } +#endif break; } @@ -1127,7 +1131,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 3; } - +#ifdef V4L2_CID_MPEG_VIDEO_VP8_MIN_QP_P /* optional : if these are not set, set value are same as I frame */ if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { i = ext_ctrls.count; @@ -1138,6 +1142,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 2; } +#endif break; } #ifdef USE_HEVCENC_SUPPORT @@ -1277,7 +1282,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrl[52].value = (2 << 16 | 29); ext_ctrls.count = HEVC_CTRL_NUM; -#ifdef CID_SUPPORT +#if defined(CID_SUPPORT) && defined(V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT0) if (pCtx->videoInstInfo.specificInfo.enc.bTemporalSvcSupport == VIDEO_TRUE) { i = ext_ctrls.count; ext_ctrl[i].id = V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT0; @@ -1306,7 +1311,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 1; } #endif - +#ifdef V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP_P /* optional : if these are not set, set value are same as I frame */ if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { i = ext_ctrls.count; @@ -1321,6 +1326,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_EncParam ( ext_ctrls.count += 4; } +#endif break; } #endif @@ -1630,7 +1636,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[0][0] = GET_H264_QP_VALUE(qpRange.QpMin_I); values[0][1] = GET_H264_QP_VALUE(qpRange.QpMax_I); - +#ifdef V4L2_CID_MPEG_VIDEO_H264_MIN_QP_P if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { cids[1][0] = V4L2_CID_MPEG_VIDEO_H264_MIN_QP_P; cids[1][1] = V4L2_CID_MPEG_VIDEO_H264_MAX_QP_P; @@ -1642,6 +1648,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[2][0] = GET_H264_QP_VALUE(qpRange.QpMin_B); values[2][1] = GET_H264_QP_VALUE(qpRange.QpMax_B); } +#endif break; } case VIDEO_CODING_MPEG4: @@ -1657,7 +1664,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[0][0] = GET_MPEG4_QP_VALUE(qpRange.QpMin_I); values[0][1] = GET_MPEG4_QP_VALUE(qpRange.QpMax_I); - +#ifdef V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP_P if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { cids[1][0] = V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP_P; cids[1][1] = V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP_P; @@ -1669,6 +1676,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[2][0] = GET_MPEG4_QP_VALUE(qpRange.QpMin_B); values[2][1] = GET_MPEG4_QP_VALUE(qpRange.QpMax_B); } +#endif break; } case VIDEO_CODING_H263: @@ -1678,7 +1686,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[0][0] = GET_H263_QP_VALUE(qpRange.QpMin_I); values[0][1] = GET_H263_QP_VALUE(qpRange.QpMax_I); - +#ifdef V4L2_CID_MPEG_VIDEO_H263_MIN_QP_P if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { cids[1][0] = V4L2_CID_MPEG_VIDEO_H263_MIN_QP_P; cids[1][1] = V4L2_CID_MPEG_VIDEO_H263_MAX_QP_P; @@ -1686,6 +1694,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[1][0] = GET_H263_QP_VALUE(qpRange.QpMin_P); values[1][1] = GET_H263_QP_VALUE(qpRange.QpMax_P); } +#endif break; } case VIDEO_CODING_VP8: @@ -1695,7 +1704,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[0][0] = GET_VP8_QP_VALUE(qpRange.QpMin_I); values[0][1] = GET_VP8_QP_VALUE(qpRange.QpMax_I); - +#ifdef V4L2_CID_MPEG_VIDEO_VP8_MIN_QP_P if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { cids[1][0] = V4L2_CID_MPEG_VIDEO_VP8_MIN_QP_P; cids[1][1] = V4L2_CID_MPEG_VIDEO_VP8_MAX_QP_P; @@ -1703,6 +1712,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[1][0] = GET_VP8_QP_VALUE(qpRange.QpMin_P); values[1][1] = GET_VP8_QP_VALUE(qpRange.QpMax_P); } +#endif break; } #ifdef USE_HEVCENC_SUPPORT @@ -1719,7 +1729,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[0][0] = GET_HEVC_QP_VALUE(qpRange.QpMin_I); values[0][1] = GET_HEVC_QP_VALUE(qpRange.QpMax_I); - +#ifdef V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP_P if (pCtx->videoInstInfo.specificInfo.enc.bQpRangePBSupport == VIDEO_TRUE) { cids[1][0] = V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP_P; cids[1][1] = V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP_P; @@ -1731,6 +1741,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_QuantizationRange( values[2][0] = GET_HEVC_QP_VALUE(qpRange.QpMin_B); values[2][1] = GET_HEVC_QP_VALUE(qpRange.QpMax_B); } +#endif break; } #endif @@ -1860,7 +1871,7 @@ static ExynosVideoErrorType MFC_Encoder_Enable_PrependSpsPpsToIdr(void *pHandle) goto EXIT; } break; -#if defined(USE_HEVCENC_SUPPORT) && defined(CID_SUPPORT) +#if defined(USE_HEVCENC_SUPPORT) && defined(CID_SUPPORT) && defined(V4L2_CID_MPEG_VIDEO_HEVC_PREPEND_SPSPPS_TO_IDR) case VIDEO_CODING_HEVC: if (exynos_v4l2_s_ctrl(pCtx->hEnc, V4L2_CID_MPEG_VIDEO_HEVC_PREPEND_SPSPPS_TO_IDR, 1) != 0) { ALOGE("%s: Failed to s_ctrl", __func__); @@ -1934,7 +1945,7 @@ static ExynosVideoErrorType MFC_Encoder_Set_LayerChange( case VIDEO_CODING_AVC: CID = V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_CH; break; -#if defined(USE_HEVCENC_SUPPORT) && defined(CID_SUPPORT) +#if defined(USE_HEVCENC_SUPPORT) && defined(CID_SUPPORT) && defined(V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_CH) case VIDEO_CODING_HEVC: CID = V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_CH; break; -- 2.20.1