Opencv 3.1 project on GR-PEACH board

Fork of gr-peach-opencv-project by the do

Committer:
thedo
Date:
Tue Jul 04 06:23:13 2017 +0000
Revision:
170:54ff26da7eb6
Parent:
166:3a9487d57a5c
project opencv 3.1 on GR PEACH board, no use SD card.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thedo 166:3a9487d57a5c 1 /*******************************************************************************
thedo 166:3a9487d57a5c 2 * DISCLAIMER
thedo 166:3a9487d57a5c 3 * This software is supplied by Renesas Electronics Corporation and is only
thedo 166:3a9487d57a5c 4 * intended for use with Renesas products. No other uses are authorized. This
thedo 166:3a9487d57a5c 5 * software is owned by Renesas Electronics Corporation and is protected under
thedo 166:3a9487d57a5c 6 * all applicable laws, including copyright laws.
thedo 166:3a9487d57a5c 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
thedo 166:3a9487d57a5c 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
thedo 166:3a9487d57a5c 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
thedo 166:3a9487d57a5c 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
thedo 166:3a9487d57a5c 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
thedo 166:3a9487d57a5c 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
thedo 166:3a9487d57a5c 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
thedo 166:3a9487d57a5c 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
thedo 166:3a9487d57a5c 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
thedo 166:3a9487d57a5c 16 * Renesas reserves the right, without notice, to make changes to this software
thedo 166:3a9487d57a5c 17 * and to discontinue the availability of this software. By using this software,
thedo 166:3a9487d57a5c 18 * you agree to the additional terms and conditions found by accessing the
thedo 166:3a9487d57a5c 19 * following link:
thedo 166:3a9487d57a5c 20 * http://www.renesas.com/disclaimer
thedo 166:3a9487d57a5c 21 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
thedo 166:3a9487d57a5c 22 *******************************************************************************/
thedo 166:3a9487d57a5c 23 /**************************************************************************//**
thedo 166:3a9487d57a5c 24 * @file r_vdec_check_parameter.c
thedo 166:3a9487d57a5c 25 * @version 1.00
thedo 166:3a9487d57a5c 26 * $Rev: 199 $
thedo 166:3a9487d57a5c 27 * $Date:: 2014-05-23 16:33:52 +0900#$
thedo 166:3a9487d57a5c 28 * @brief VDEC driver parameter check processing
thedo 166:3a9487d57a5c 29 ******************************************************************************/
thedo 166:3a9487d57a5c 30
thedo 166:3a9487d57a5c 31 /******************************************************************************
thedo 166:3a9487d57a5c 32 Includes <System Includes> , "Project Includes"
thedo 166:3a9487d57a5c 33 ******************************************************************************/
thedo 166:3a9487d57a5c 34 #include "r_vdec.h"
thedo 166:3a9487d57a5c 35 #include "r_vdec_user.h"
thedo 166:3a9487d57a5c 36 #include "r_vdec_check_parameter.h"
thedo 166:3a9487d57a5c 37
thedo 166:3a9487d57a5c 38
thedo 166:3a9487d57a5c 39 #ifdef R_VDEC_CHECK_PARAMETERS
thedo 166:3a9487d57a5c 40 /******************************************************************************
thedo 166:3a9487d57a5c 41 Macro definitions
thedo 166:3a9487d57a5c 42 ******************************************************************************/
thedo 166:3a9487d57a5c 43 /* Valid bit range */
thedo 166:3a9487d57a5c 44 #define VDEC_CPARA_RANGE_0X00000001 (0x00000001u)
thedo 166:3a9487d57a5c 45 #define VDEC_CPARA_RANGE_0X00000003 (0x00000003u)
thedo 166:3a9487d57a5c 46 #define VDEC_CPARA_RANGE_0X00000007 (0x00000007u)
thedo 166:3a9487d57a5c 47 #define VDEC_CPARA_RANGE_0X0000000F (0x0000000Fu)
thedo 166:3a9487d57a5c 48 #define VDEC_CPARA_RANGE_0X0000001F (0x0000001Fu)
thedo 166:3a9487d57a5c 49 #define VDEC_CPARA_RANGE_0X0000003F (0x0000003Fu)
thedo 166:3a9487d57a5c 50 #define VDEC_CPARA_RANGE_0X0000007F (0x0000007Fu)
thedo 166:3a9487d57a5c 51 #define VDEC_CPARA_RANGE_0X000000FF (0x000000FFu)
thedo 166:3a9487d57a5c 52 #define VDEC_CPARA_RANGE_0X000001FF (0x000001FFu)
thedo 166:3a9487d57a5c 53 #define VDEC_CPARA_RANGE_0X000003FF (0x000003FFu)
thedo 166:3a9487d57a5c 54 #define VDEC_CPARA_RANGE_0X000007FF (0x000007FFu)
thedo 166:3a9487d57a5c 55 #define VDEC_CPARA_RANGE_0X00001FFF (0x00001FFFu)
thedo 166:3a9487d57a5c 56
thedo 166:3a9487d57a5c 57 /******************************************************************************
thedo 166:3a9487d57a5c 58 Typedef definitions
thedo 166:3a9487d57a5c 59 ******************************************************************************/
thedo 166:3a9487d57a5c 60
thedo 166:3a9487d57a5c 61 /******************************************************************************
thedo 166:3a9487d57a5c 62 Private global variables and functions
thedo 166:3a9487d57a5c 63 ******************************************************************************/
thedo 166:3a9487d57a5c 64 static vdec_error_t NoiseReductionLPFCheckParam(const vdec_noise_rd_lpf_t * const p_noise_rd_lpf);
thedo 166:3a9487d57a5c 65 static vdec_error_t SyncSlicerCheckParam(const vdec_sync_slicer_t * const p_sync_slicer);
thedo 166:3a9487d57a5c 66 static vdec_error_t HorizontalAFCCheckParam(const vdec_horizontal_afc_t * const p_horizontal_afc);
thedo 166:3a9487d57a5c 67 static vdec_error_t VerticalCountdownCheckParam(const vdec_vcount_down_t * const p_vcount_down);
thedo 166:3a9487d57a5c 68 static vdec_error_t AgcPgaCheckParam(const vdec_agc_t * const p_agc);
thedo 166:3a9487d57a5c 69 static vdec_error_t PeakLimiterControlCheckParam(const vdec_peak_limiter_t * const p_peak_limiter);
thedo 166:3a9487d57a5c 70 static vdec_error_t OverRangeControlCheckParam(const vdec_over_range_t * const p_over_range);
thedo 166:3a9487d57a5c 71 static vdec_error_t YcSeparationControlCheckParam(const vdec_yc_sep_ctrl_t * const p_yc_sep_ctrl);
thedo 166:3a9487d57a5c 72 static vdec_error_t FilterTAPsCoefficientCheckParam(const vdec_chrfil_tap_t * const fil2_2d);
thedo 166:3a9487d57a5c 73 static vdec_error_t ChromaDecodingControlCheckParam(const vdec_chrmdec_ctrl_t * const p_chrmdec_ctrl);
thedo 166:3a9487d57a5c 74 static vdec_error_t BurstLockCheckParam(const vdec_burst_lock_t * const p_burst_lock);
thedo 166:3a9487d57a5c 75 static vdec_error_t AccColorKillerCheckParam(const vdec_acc_t * const p_acc);
thedo 166:3a9487d57a5c 76
thedo 166:3a9487d57a5c 77
thedo 166:3a9487d57a5c 78 /**************************************************************************//**
thedo 166:3a9487d57a5c 79 * @brief Checks on input pin control
thedo 166:3a9487d57a5c 80 * @param[in] vinsel : Input pin control
thedo 166:3a9487d57a5c 81 * @retval Error code
thedo 166:3a9487d57a5c 82 *****************************************************************************/
thedo 166:3a9487d57a5c 83 vdec_error_t VDEC_InitializeCheckParam (const vdec_adc_vinsel_t vinsel)
thedo 166:3a9487d57a5c 84 {
thedo 166:3a9487d57a5c 85 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 86
thedo 166:3a9487d57a5c 87 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 88
thedo 166:3a9487d57a5c 89 if ((vinsel != VDEC_ADC_VINSEL_VIN1) && (vinsel != VDEC_ADC_VINSEL_VIN2)) {
thedo 166:3a9487d57a5c 90 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 91 goto END;
thedo 166:3a9487d57a5c 92 }
thedo 166:3a9487d57a5c 93 END:
thedo 166:3a9487d57a5c 94 return vdec_error;
thedo 166:3a9487d57a5c 95 } /* End of function VDEC_InitializeCheckParam() */
thedo 166:3a9487d57a5c 96
thedo 166:3a9487d57a5c 97 /**************************************************************************//**
thedo 166:3a9487d57a5c 98 * @brief Checks on active image period parameter
thedo 166:3a9487d57a5c 99 * @param[in] param : Active image period parameter
thedo 166:3a9487d57a5c 100 * @retval Error code
thedo 166:3a9487d57a5c 101 *****************************************************************************/
thedo 166:3a9487d57a5c 102 vdec_error_t VDEC_ActivePeriodCheckParam (const vdec_active_period_t * const param)
thedo 166:3a9487d57a5c 103 {
thedo 166:3a9487d57a5c 104 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 105
thedo 166:3a9487d57a5c 106 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 107
thedo 166:3a9487d57a5c 108 if (param == NULL) {
thedo 166:3a9487d57a5c 109 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 110 goto END;
thedo 166:3a9487d57a5c 111 }
thedo 166:3a9487d57a5c 112 /* Left end of input video signal capturing area */
thedo 166:3a9487d57a5c 113 if (((uint32_t)param->srcleft & (uint32_t)(~VDEC_CPARA_RANGE_0X000001FF)) != 0u) {
thedo 166:3a9487d57a5c 114 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 115 goto END;
thedo 166:3a9487d57a5c 116 }
thedo 166:3a9487d57a5c 117 /* Top end of input video signal capturing area */
thedo 166:3a9487d57a5c 118 if (((uint32_t)param->srctop & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 119 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 120 goto END;
thedo 166:3a9487d57a5c 121 }
thedo 166:3a9487d57a5c 122 /* Height of input video signal capturing area */
thedo 166:3a9487d57a5c 123 if (((uint32_t)param->srcheight & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 124 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 125 goto END;
thedo 166:3a9487d57a5c 126 }
thedo 166:3a9487d57a5c 127 /* Width of input video signal capturing area */
thedo 166:3a9487d57a5c 128 if (((uint32_t)param->srcwidth & (uint32_t)(~VDEC_CPARA_RANGE_0X000007FF)) != 0u) {
thedo 166:3a9487d57a5c 129 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 130 goto END;
thedo 166:3a9487d57a5c 131 }
thedo 166:3a9487d57a5c 132 END:
thedo 166:3a9487d57a5c 133 return vdec_error;
thedo 166:3a9487d57a5c 134 } /* End of function VDEC_ActivePeriodCheckParam() */
thedo 166:3a9487d57a5c 135
thedo 166:3a9487d57a5c 136 /**************************************************************************//**
thedo 166:3a9487d57a5c 137 * @brief Checks on sync separation parameter
thedo 166:3a9487d57a5c 138 * @param[in] param : Sync separation parameter
thedo 166:3a9487d57a5c 139 * @retval Error code
thedo 166:3a9487d57a5c 140 *****************************************************************************/
thedo 166:3a9487d57a5c 141 vdec_error_t VDEC_SyncSeparationCheckParam (const vdec_sync_separation_t * const param)
thedo 166:3a9487d57a5c 142 {
thedo 166:3a9487d57a5c 143 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 144
thedo 166:3a9487d57a5c 145 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 146
thedo 166:3a9487d57a5c 147 if (param == NULL) {
thedo 166:3a9487d57a5c 148 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 149 goto END;
thedo 166:3a9487d57a5c 150 }
thedo 166:3a9487d57a5c 151 /* Noise reduction LPF */
thedo 166:3a9487d57a5c 152 vdec_error = NoiseReductionLPFCheckParam(param->noise_rd_lpf);
thedo 166:3a9487d57a5c 153 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 154 goto END;
thedo 166:3a9487d57a5c 155 }
thedo 166:3a9487d57a5c 156 /* Sync slicer */
thedo 166:3a9487d57a5c 157 vdec_error = SyncSlicerCheckParam(param->sync_slicer);
thedo 166:3a9487d57a5c 158 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 159 goto END;
thedo 166:3a9487d57a5c 160 }
thedo 166:3a9487d57a5c 161 /* Horizontal AFC */
thedo 166:3a9487d57a5c 162 vdec_error = HorizontalAFCCheckParam(param->horizontal_afc);
thedo 166:3a9487d57a5c 163 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 164 goto END;
thedo 166:3a9487d57a5c 165 }
thedo 166:3a9487d57a5c 166 /* Vertical countdown */
thedo 166:3a9487d57a5c 167 vdec_error = VerticalCountdownCheckParam(param->vcount_down);
thedo 166:3a9487d57a5c 168 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 169 goto END;
thedo 166:3a9487d57a5c 170 }
thedo 166:3a9487d57a5c 171 /* AGC / PGA */
thedo 166:3a9487d57a5c 172 vdec_error = AgcPgaCheckParam(param->agc);
thedo 166:3a9487d57a5c 173 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 174 goto END;
thedo 166:3a9487d57a5c 175 }
thedo 166:3a9487d57a5c 176 /* Peak limiter control */
thedo 166:3a9487d57a5c 177 vdec_error = PeakLimiterControlCheckParam(param->peak_limiter);
thedo 166:3a9487d57a5c 178 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 179 goto END;
thedo 166:3a9487d57a5c 180 }
thedo 166:3a9487d57a5c 181 END:
thedo 166:3a9487d57a5c 182 return vdec_error;
thedo 166:3a9487d57a5c 183 } /* End of function VDEC_SyncSeparationCheckParam() */
thedo 166:3a9487d57a5c 184
thedo 166:3a9487d57a5c 185 /**************************************************************************//**
thedo 166:3a9487d57a5c 186 * @brief Checks on Y/C separation parameter
thedo 166:3a9487d57a5c 187 * @param[in] param : Y/C separation parameter
thedo 166:3a9487d57a5c 188 * @retval Error code
thedo 166:3a9487d57a5c 189 *****************************************************************************/
thedo 166:3a9487d57a5c 190 vdec_error_t VDEC_YcSeparationCheckParam (const vdec_yc_separation_t * const param)
thedo 166:3a9487d57a5c 191 {
thedo 166:3a9487d57a5c 192 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 193
thedo 166:3a9487d57a5c 194 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 195
thedo 166:3a9487d57a5c 196 if (param == NULL) {
thedo 166:3a9487d57a5c 197 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 198 goto END;
thedo 166:3a9487d57a5c 199 }
thedo 166:3a9487d57a5c 200 /* Over-range control */
thedo 166:3a9487d57a5c 201 vdec_error = OverRangeControlCheckParam(param->over_range);
thedo 166:3a9487d57a5c 202 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 203 goto END;
thedo 166:3a9487d57a5c 204 }
thedo 166:3a9487d57a5c 205 /* Y/C separation control */
thedo 166:3a9487d57a5c 206 vdec_error = YcSeparationControlCheckParam(param->yc_sep_ctrl);
thedo 166:3a9487d57a5c 207 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 208 goto END;
thedo 166:3a9487d57a5c 209 }
thedo 166:3a9487d57a5c 210 /* Two-dimensional cascade broadband (3.58/4.43/SECAM-DR)/TAKE-OFF filter TAP coefficient */
thedo 166:3a9487d57a5c 211 vdec_error = FilterTAPsCoefficientCheckParam(param->fil2_2d_wa);
thedo 166:3a9487d57a5c 212 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 213 goto END;
thedo 166:3a9487d57a5c 214 }
thedo 166:3a9487d57a5c 215 /* Two-dimensional cascade broadband (SECAM-DB) filter TAP coefficient */
thedo 166:3a9487d57a5c 216 vdec_error = FilterTAPsCoefficientCheckParam(param->fil2_2d_wb);
thedo 166:3a9487d57a5c 217 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 218 goto END;
thedo 166:3a9487d57a5c 219 }
thedo 166:3a9487d57a5c 220 /* Two-dimensional cascade narrowband (3.58/4.43/SECAM-DR) filter TAP coefficient */
thedo 166:3a9487d57a5c 221 vdec_error = FilterTAPsCoefficientCheckParam(param->fil2_2d_na);
thedo 166:3a9487d57a5c 222 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 223 goto END;
thedo 166:3a9487d57a5c 224 }
thedo 166:3a9487d57a5c 225 /* Two-dimensional cascade narrowband (SECAMDB) filter TAP coefficient */
thedo 166:3a9487d57a5c 226 vdec_error = FilterTAPsCoefficientCheckParam(param->fil2_2d_nb);
thedo 166:3a9487d57a5c 227 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 228 goto END;
thedo 166:3a9487d57a5c 229 }
thedo 166:3a9487d57a5c 230 END:
thedo 166:3a9487d57a5c 231 return vdec_error;
thedo 166:3a9487d57a5c 232 } /* End of function VDEC_YcSeparationCheckParam() */
thedo 166:3a9487d57a5c 233
thedo 166:3a9487d57a5c 234 /**************************************************************************//**
thedo 166:3a9487d57a5c 235 * @brief Checks on chroma decoding parameter
thedo 166:3a9487d57a5c 236 * @param[in] param : Chroma decoding parameter
thedo 166:3a9487d57a5c 237 * @retval Error code
thedo 166:3a9487d57a5c 238 *****************************************************************************/
thedo 166:3a9487d57a5c 239 vdec_error_t VDEC_ChromaDecodingCheckParam (const vdec_chroma_decoding_t * const param)
thedo 166:3a9487d57a5c 240 {
thedo 166:3a9487d57a5c 241 vdec_tint_ry_t * p_tint_ry;
thedo 166:3a9487d57a5c 242 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 243
thedo 166:3a9487d57a5c 244 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 245
thedo 166:3a9487d57a5c 246 if (param == NULL) {
thedo 166:3a9487d57a5c 247 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 248 goto END;
thedo 166:3a9487d57a5c 249 }
thedo 166:3a9487d57a5c 250 /* Chroma decoding control */
thedo 166:3a9487d57a5c 251 vdec_error = ChromaDecodingControlCheckParam(param->chrmdec_ctrl);
thedo 166:3a9487d57a5c 252 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 253 goto END;
thedo 166:3a9487d57a5c 254 }
thedo 166:3a9487d57a5c 255 /* Burst lock */
thedo 166:3a9487d57a5c 256 vdec_error = BurstLockCheckParam(param->burst_lock);
thedo 166:3a9487d57a5c 257 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 258 goto END;
thedo 166:3a9487d57a5c 259 }
thedo 166:3a9487d57a5c 260 /* ACC/color killer */
thedo 166:3a9487d57a5c 261 vdec_error = AccColorKillerCheckParam(param->acc);
thedo 166:3a9487d57a5c 262 if (vdec_error != VDEC_OK) {
thedo 166:3a9487d57a5c 263 goto END;
thedo 166:3a9487d57a5c 264 }
thedo 166:3a9487d57a5c 265 /* TINT/R-Y axis correction (only valid for NTSC/PAL) */
thedo 166:3a9487d57a5c 266 p_tint_ry = param->tint_ry;
thedo 166:3a9487d57a5c 267 if (p_tint_ry != NULL) {
thedo 166:3a9487d57a5c 268 /* Fine adjustment of R-Y demodulation axis and hue adjustment level */
thedo 166:3a9487d57a5c 269 if ((((uint32_t)p_tint_ry->tintsub & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) ||
thedo 166:3a9487d57a5c 270 (((uint32_t)p_tint_ry->tintmain & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u)) {
thedo 166:3a9487d57a5c 271 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 272 goto END;
thedo 166:3a9487d57a5c 273 }
thedo 166:3a9487d57a5c 274 }
thedo 166:3a9487d57a5c 275 END:
thedo 166:3a9487d57a5c 276 return vdec_error;
thedo 166:3a9487d57a5c 277 } /* End of function VDEC_ChromaDecodingCheckParam() */
thedo 166:3a9487d57a5c 278
thedo 166:3a9487d57a5c 279 /**************************************************************************//**
thedo 166:3a9487d57a5c 280 * @brief Checks on digital clamp parameter
thedo 166:3a9487d57a5c 281 * @param[in] param : Digital clamp parameter
thedo 166:3a9487d57a5c 282 * @retval Error code
thedo 166:3a9487d57a5c 283 *****************************************************************************/
thedo 166:3a9487d57a5c 284 vdec_error_t VDEC_DigitalClampCheckParam (const vdec_degital_clamp_t * const param)
thedo 166:3a9487d57a5c 285 {
thedo 166:3a9487d57a5c 286 vdec_pedestal_clamp_t * p_pedestal_clamp;
thedo 166:3a9487d57a5c 287 vdec_center_clamp_t * p_center_clamp;
thedo 166:3a9487d57a5c 288 vdec_noise_det_t * p_noise_det;
thedo 166:3a9487d57a5c 289 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 290
thedo 166:3a9487d57a5c 291 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 292
thedo 166:3a9487d57a5c 293 if (param == NULL) {
thedo 166:3a9487d57a5c 294 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 295 goto END;
thedo 166:3a9487d57a5c 296 }
thedo 166:3a9487d57a5c 297 /* Digital clamp response speed */
thedo 166:3a9487d57a5c 298 if (((uint32_t)param->dcpresponse & (uint32_t)(~VDEC_CPARA_RANGE_0X00000007)) != 0u) {
thedo 166:3a9487d57a5c 299 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 300 goto END;
thedo 166:3a9487d57a5c 301 }
thedo 166:3a9487d57a5c 302 /* Digital clamp start line (in 1-line units) */
thedo 166:3a9487d57a5c 303 if (((uint32_t)param->dcpstart & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 304 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 305 goto END;
thedo 166:3a9487d57a5c 306 }
thedo 166:3a9487d57a5c 307 /* Digital clamp end line (in 1-line units) */
thedo 166:3a9487d57a5c 308 if (((uint32_t)param->dcpend & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 309 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 310 goto END;
thedo 166:3a9487d57a5c 311 }
thedo 166:3a9487d57a5c 312 /* Digital clamp pulse width */
thedo 166:3a9487d57a5c 313 if (((uint32_t)param->dcpwidth & (uint32_t)(~VDEC_CPARA_RANGE_0X0000007F)) != 0u) {
thedo 166:3a9487d57a5c 314 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 315 goto END;
thedo 166:3a9487d57a5c 316 }
thedo 166:3a9487d57a5c 317
thedo 166:3a9487d57a5c 318 /* Pedestal clamp */
thedo 166:3a9487d57a5c 319 p_pedestal_clamp = param->pedestal_clamp;
thedo 166:3a9487d57a5c 320 if (p_pedestal_clamp != NULL) {
thedo 166:3a9487d57a5c 321 /* Clamp offset level (Y signal) */
thedo 166:3a9487d57a5c 322 if (((uint32_t)p_pedestal_clamp->blanklevel_y & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 323 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 324 goto END;
thedo 166:3a9487d57a5c 325 }
thedo 166:3a9487d57a5c 326 /* Digital clamp pulse horizontal start position (Y signal) */
thedo 166:3a9487d57a5c 327 if (((uint32_t)p_pedestal_clamp->dcppos_y & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) {
thedo 166:3a9487d57a5c 328 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 329 goto END;
thedo 166:3a9487d57a5c 330 }
thedo 166:3a9487d57a5c 331 }
thedo 166:3a9487d57a5c 332 /* Center clamp */
thedo 166:3a9487d57a5c 333 p_center_clamp = param->center_clamp;
thedo 166:3a9487d57a5c 334 if (p_center_clamp != NULL) {
thedo 166:3a9487d57a5c 335 /* Clamp offset level (Cb signal) */
thedo 166:3a9487d57a5c 336 if (((uint32_t)p_center_clamp->blanklevel_cb & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 337 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 338 goto END;
thedo 166:3a9487d57a5c 339 }
thedo 166:3a9487d57a5c 340 /* Clamp offset level (Cr signal) */
thedo 166:3a9487d57a5c 341 if (((uint32_t)p_center_clamp->blanklevel_cr & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 342 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 343 goto END;
thedo 166:3a9487d57a5c 344 }
thedo 166:3a9487d57a5c 345 /* Digital clamp pulse horizontal start position (Cb/Cr signal) */
thedo 166:3a9487d57a5c 346 if (((uint32_t)p_center_clamp->dcppos_c & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) {
thedo 166:3a9487d57a5c 347 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 348 goto END;
thedo 166:3a9487d57a5c 349 }
thedo 166:3a9487d57a5c 350 }
thedo 166:3a9487d57a5c 351 /* Noise detection */
thedo 166:3a9487d57a5c 352 p_noise_det = param->noise_det;
thedo 166:3a9487d57a5c 353 if (p_noise_det != NULL) {
thedo 166:3a9487d57a5c 354 /* Video signal for autocorrelation function */
thedo 166:3a9487d57a5c 355 if (p_noise_det->acfinput >= VDEC_ACFINPUT_NUM) {
thedo 166:3a9487d57a5c 356 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 357 goto END;
thedo 166:3a9487d57a5c 358 }
thedo 166:3a9487d57a5c 359 /* Delay time for autocorrelation function calculation */
thedo 166:3a9487d57a5c 360 if (((uint32_t)p_noise_det->acflagtime & (uint32_t)(~VDEC_CPARA_RANGE_0X0000001F)) != 0u) {
thedo 166:3a9487d57a5c 361 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 362 goto END;
thedo 166:3a9487d57a5c 363 }
thedo 166:3a9487d57a5c 364 /* Smoothing parameter of autocorrelation function data */
thedo 166:3a9487d57a5c 365 if (((uint32_t)p_noise_det->acffilter & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 366 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 367 goto END;
thedo 166:3a9487d57a5c 368 }
thedo 166:3a9487d57a5c 369 }
thedo 166:3a9487d57a5c 370 END:
thedo 166:3a9487d57a5c 371 return vdec_error;
thedo 166:3a9487d57a5c 372 } /* End of function VDEC_DigitalClampCheckParam() */
thedo 166:3a9487d57a5c 373
thedo 166:3a9487d57a5c 374 /**************************************************************************//**
thedo 166:3a9487d57a5c 375 * @brief Checks on output adjustment parameter
thedo 166:3a9487d57a5c 376 * @param[in] param : Output adjustment parameter
thedo 166:3a9487d57a5c 377 * @retval Error code
thedo 166:3a9487d57a5c 378 *****************************************************************************/
thedo 166:3a9487d57a5c 379 vdec_error_t VDEC_OutputCheckParam (const vdec_output_t * const param)
thedo 166:3a9487d57a5c 380 {
thedo 166:3a9487d57a5c 381 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 382
thedo 166:3a9487d57a5c 383 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 384
thedo 166:3a9487d57a5c 385 if (param == NULL) {
thedo 166:3a9487d57a5c 386 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 387 goto END;
thedo 166:3a9487d57a5c 388 }
thedo 166:3a9487d57a5c 389 /* Y signal gain coefficient */
thedo 166:3a9487d57a5c 390 if (((uint32_t)param->y_gain2 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 391 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 392 goto END;
thedo 166:3a9487d57a5c 393 }
thedo 166:3a9487d57a5c 394 /* Cb signal gain coefficient */
thedo 166:3a9487d57a5c 395 if (((uint32_t)param->cb_gain2 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 396 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 397 goto END;
thedo 166:3a9487d57a5c 398 }
thedo 166:3a9487d57a5c 399 /* Cr signal gain coefficient */
thedo 166:3a9487d57a5c 400 if (((uint32_t)param->cr_gain2 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 401 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 402 goto END;
thedo 166:3a9487d57a5c 403 }
thedo 166:3a9487d57a5c 404 END:
thedo 166:3a9487d57a5c 405 return vdec_error;
thedo 166:3a9487d57a5c 406 } /* End of function VDEC_OutputCheckParam() */
thedo 166:3a9487d57a5c 407
thedo 166:3a9487d57a5c 408 /**************************************************************************//**
thedo 166:3a9487d57a5c 409 * @brief Checks on noise reduction LPF parameter
thedo 166:3a9487d57a5c 410 * @param[in] p_noise_rd_lpf : Noise reduction LPF parameter
thedo 166:3a9487d57a5c 411 * @retval Error code
thedo 166:3a9487d57a5c 412 *****************************************************************************/
thedo 166:3a9487d57a5c 413 static vdec_error_t NoiseReductionLPFCheckParam (const vdec_noise_rd_lpf_t * const p_noise_rd_lpf)
thedo 166:3a9487d57a5c 414 {
thedo 166:3a9487d57a5c 415 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 416
thedo 166:3a9487d57a5c 417 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 418
thedo 166:3a9487d57a5c 419 /* Noise reduction LPF */
thedo 166:3a9487d57a5c 420 if (p_noise_rd_lpf != NULL) {
thedo 166:3a9487d57a5c 421 /* LPF cutoff frequency before vertical sync separation */
thedo 166:3a9487d57a5c 422 if (p_noise_rd_lpf->lpfvsync >= VDEC_LPF_VSYNC_NUM) {
thedo 166:3a9487d57a5c 423 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 424 goto END;
thedo 166:3a9487d57a5c 425 }
thedo 166:3a9487d57a5c 426 /* LPF cutoff frequency before horizontal sync separation */
thedo 166:3a9487d57a5c 427 if (p_noise_rd_lpf->lpfhsync >= VDEC_LPF_HSYNC_NUM) {
thedo 166:3a9487d57a5c 428 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 429 goto END;
thedo 166:3a9487d57a5c 430 }
thedo 166:3a9487d57a5c 431 }
thedo 166:3a9487d57a5c 432 END:
thedo 166:3a9487d57a5c 433 return vdec_error;
thedo 166:3a9487d57a5c 434 } /* End of function NoiseReductionLPFCheckParam() */
thedo 166:3a9487d57a5c 435
thedo 166:3a9487d57a5c 436 /**************************************************************************//**
thedo 166:3a9487d57a5c 437 * @brief Checks on auto level control sync slicer parameter
thedo 166:3a9487d57a5c 438 * @param[in] p_sync_slicer : Auto level control sync slicer parameter
thedo 166:3a9487d57a5c 439 * @retval Error code
thedo 166:3a9487d57a5c 440 *****************************************************************************/
thedo 166:3a9487d57a5c 441 static vdec_error_t SyncSlicerCheckParam (const vdec_sync_slicer_t * const p_sync_slicer)
thedo 166:3a9487d57a5c 442 {
thedo 166:3a9487d57a5c 443 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 444
thedo 166:3a9487d57a5c 445 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 446
thedo 166:3a9487d57a5c 447 /* Sync slicer */
thedo 166:3a9487d57a5c 448 if (p_sync_slicer != NULL) {
thedo 166:3a9487d57a5c 449 /* Reference level operation speed control for composite sync separation (for Hsync signal) */
thedo 166:3a9487d57a5c 450 if (p_sync_slicer->velocityshift_h >= VDEC_VELOCITY_SHIFT_NUM) {
thedo 166:3a9487d57a5c 451 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 452 goto END;
thedo 166:3a9487d57a5c 453 }
thedo 166:3a9487d57a5c 454 /* Auto-slice level setting for composite sync separator circuit (for Hsync signal) */
thedo 166:3a9487d57a5c 455 if (p_sync_slicer->slicermode_h >= VDEC_SLICE_MODE_NUM) {
thedo 166:3a9487d57a5c 456 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 457 goto END;
thedo 166:3a9487d57a5c 458 }
thedo 166:3a9487d57a5c 459 /* Auto-slice level setting for composite sync separation circuit (for Vsync signal) */
thedo 166:3a9487d57a5c 460 if (p_sync_slicer->slicermode_v >= VDEC_SLICE_MODE_NUM) {
thedo 166:3a9487d57a5c 461 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 462 goto END;
thedo 166:3a9487d57a5c 463 }
thedo 166:3a9487d57a5c 464 /* Max ratio of horizontal cycle to horizontal sync signal pulse width
thedo 166:3a9487d57a5c 465 and min ratio of horizontal cycle to horizontal sync signal pulse width (for Hsync signal) */
thedo 166:3a9487d57a5c 466 if ((((uint32_t)p_sync_slicer->syncmaxduty_h & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) ||
thedo 166:3a9487d57a5c 467 (((uint32_t)p_sync_slicer->syncminduty_h & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 468 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 469 goto END;
thedo 166:3a9487d57a5c 470 }
thedo 166:3a9487d57a5c 471 /* Clipping level */
thedo 166:3a9487d57a5c 472 if (p_sync_slicer->ssclipsel >= VDEC_CLIP_LV_NUM) {
thedo 166:3a9487d57a5c 473 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 474 goto END;
thedo 166:3a9487d57a5c 475 }
thedo 166:3a9487d57a5c 476 /* Slice level for composite sync signal separation (for Hsync signal) */
thedo 166:3a9487d57a5c 477 if (((uint32_t)p_sync_slicer->csyncslice_h & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 478 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 479 goto END;
thedo 166:3a9487d57a5c 480 }
thedo 166:3a9487d57a5c 481 /* Max ratio of horizontal cycle to horizontal sync signal pulse width
thedo 166:3a9487d57a5c 482 and min ratio of horizontal cycle to horizontal sync signal pulse width (for Vsync signal) */
thedo 166:3a9487d57a5c 483 if ((((uint32_t)p_sync_slicer->syncmaxduty_v & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) ||
thedo 166:3a9487d57a5c 484 (((uint32_t)p_sync_slicer->syncminduty_v & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 485 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 486 goto END;
thedo 166:3a9487d57a5c 487 }
thedo 166:3a9487d57a5c 488 /* Threshold for vertical sync separation */
thedo 166:3a9487d57a5c 489 if (((uint32_t)p_sync_slicer->vsyncslice & (uint32_t)(~VDEC_CPARA_RANGE_0X0000001F)) != 0u) {
thedo 166:3a9487d57a5c 490 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 491 goto END;
thedo 166:3a9487d57a5c 492 }
thedo 166:3a9487d57a5c 493 /* Slice level for composite sync signal separation (for Vsync signal) */
thedo 166:3a9487d57a5c 494 if (((uint32_t)p_sync_slicer->csyncslice_v & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 495 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 496 goto END;
thedo 166:3a9487d57a5c 497 }
thedo 166:3a9487d57a5c 498 }
thedo 166:3a9487d57a5c 499 END:
thedo 166:3a9487d57a5c 500 return vdec_error;
thedo 166:3a9487d57a5c 501 } /* End of function SyncSlicerCheckParam() */
thedo 166:3a9487d57a5c 502
thedo 166:3a9487d57a5c 503 /**************************************************************************//**
thedo 166:3a9487d57a5c 504 * @brief Checks on horizontal AFC parameter
thedo 166:3a9487d57a5c 505 * @param[in] p_horizontal_afc : Horizontal AFC parameter
thedo 166:3a9487d57a5c 506 * @retval Error code
thedo 166:3a9487d57a5c 507 *****************************************************************************/
thedo 166:3a9487d57a5c 508 static vdec_error_t HorizontalAFCCheckParam (const vdec_horizontal_afc_t * const p_horizontal_afc)
thedo 166:3a9487d57a5c 509 {
thedo 166:3a9487d57a5c 510 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 511
thedo 166:3a9487d57a5c 512 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 513
thedo 166:3a9487d57a5c 514 /* Horizontal AFC */
thedo 166:3a9487d57a5c 515 if (p_horizontal_afc != NULL) {
thedo 166:3a9487d57a5c 516 /* Horizontal AFC loop gain */
thedo 166:3a9487d57a5c 517 if (((uint32_t)p_horizontal_afc->hafcgain & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) {
thedo 166:3a9487d57a5c 518 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 519 goto END;
thedo 166:3a9487d57a5c 520 }
thedo 166:3a9487d57a5c 521 /* Horizontal AFC center oscillation frequency */
thedo 166:3a9487d57a5c 522 if (((uint32_t)p_horizontal_afc->hafcgain & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 523 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 524 goto END;
thedo 166:3a9487d57a5c 525 }
thedo 166:3a9487d57a5c 526 /* Start line of horizontal AFC normal operation */
thedo 166:3a9487d57a5c 527 if (((uint32_t)p_horizontal_afc->hafcstart & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) {
thedo 166:3a9487d57a5c 528 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 529 goto END;
thedo 166:3a9487d57a5c 530 }
thedo 166:3a9487d57a5c 531 /* Maximum oscillation frequency of horizontal AFC */
thedo 166:3a9487d57a5c 532 if (((uint32_t)p_horizontal_afc->hafcmax & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 533 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 534 goto END;
thedo 166:3a9487d57a5c 535 }
thedo 166:3a9487d57a5c 536 /* End line of horizontal AFC normal operation */
thedo 166:3a9487d57a5c 537 if (((uint32_t)p_horizontal_afc->hafcend & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) {
thedo 166:3a9487d57a5c 538 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 539 goto END;
thedo 166:3a9487d57a5c 540 }
thedo 166:3a9487d57a5c 541 /* Horizontal AFC VBI period operating mode */
thedo 166:3a9487d57a5c 542 if (p_horizontal_afc->hafcmode >= VDEC_HAFCMD_NUM) {
thedo 166:3a9487d57a5c 543 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 544 goto END;
thedo 166:3a9487d57a5c 545 }
thedo 166:3a9487d57a5c 546 /* Min oscillation frequency of horizontal AFC */
thedo 166:3a9487d57a5c 547 if (((uint32_t)p_horizontal_afc->hafcmin & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 548 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 549 goto END;
thedo 166:3a9487d57a5c 550 }
thedo 166:3a9487d57a5c 551 /* Phase comparator feedback adjust for low sync signal lock stability */
thedo 166:3a9487d57a5c 552 if (p_horizontal_afc->phdet_div >= VDEC_PHDET_DIV_NUM) {
thedo 166:3a9487d57a5c 553 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 554 goto END;
thedo 166:3a9487d57a5c 555 }
thedo 166:3a9487d57a5c 556 }
thedo 166:3a9487d57a5c 557 END:
thedo 166:3a9487d57a5c 558 return vdec_error;
thedo 166:3a9487d57a5c 559 } /* End of function HorizontalAFCCheckParam() */
thedo 166:3a9487d57a5c 560
thedo 166:3a9487d57a5c 561 /**************************************************************************//**
thedo 166:3a9487d57a5c 562 * @brief Checks on vertical count-down parameter
thedo 166:3a9487d57a5c 563 * @param[in] p_vcount_down : Vertical count-down parameter
thedo 166:3a9487d57a5c 564 * @retval Error code
thedo 166:3a9487d57a5c 565 *****************************************************************************/
thedo 166:3a9487d57a5c 566 static vdec_error_t VerticalCountdownCheckParam (const vdec_vcount_down_t * const p_vcount_down)
thedo 166:3a9487d57a5c 567 {
thedo 166:3a9487d57a5c 568 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 569
thedo 166:3a9487d57a5c 570 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 571
thedo 166:3a9487d57a5c 572 /* Vertical countdown */
thedo 166:3a9487d57a5c 573 if (p_vcount_down != NULL) {
thedo 166:3a9487d57a5c 574 /* Vertical countdown center oscillation frequency */
thedo 166:3a9487d57a5c 575 if (p_vcount_down->vcddefault >= VDEC_VCD_FRQ_NUM) {
thedo 166:3a9487d57a5c 576 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 577 goto END;
thedo 166:3a9487d57a5c 578 }
thedo 166:3a9487d57a5c 579 /* Vertical countdown sync area */
thedo 166:3a9487d57a5c 580 if (((uint32_t)p_vcount_down->vcdwindow & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 581 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 582 goto END;
thedo 166:3a9487d57a5c 583 }
thedo 166:3a9487d57a5c 584 /* Vertical countdown minimum oscillation frequency */
thedo 166:3a9487d57a5c 585 if (((uint32_t)p_vcount_down->vcdoffset & (uint32_t)(~VDEC_CPARA_RANGE_0X0000001F)) != 0u) {
thedo 166:3a9487d57a5c 586 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 587 goto END;
thedo 166:3a9487d57a5c 588 }
thedo 166:3a9487d57a5c 589 }
thedo 166:3a9487d57a5c 590 END:
thedo 166:3a9487d57a5c 591 return vdec_error;
thedo 166:3a9487d57a5c 592 } /* End of function VerticalCountdownCheckParam() */
thedo 166:3a9487d57a5c 593
thedo 166:3a9487d57a5c 594 /**************************************************************************//**
thedo 166:3a9487d57a5c 595 * @brief Checks on AGC/PGA parameter
thedo 166:3a9487d57a5c 596 * @param[in] p_agc : AGC/PGA parameter
thedo 166:3a9487d57a5c 597 * @retval Error code
thedo 166:3a9487d57a5c 598 *****************************************************************************/
thedo 166:3a9487d57a5c 599 static vdec_error_t AgcPgaCheckParam (const vdec_agc_t * const p_agc)
thedo 166:3a9487d57a5c 600 {
thedo 166:3a9487d57a5c 601 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 602
thedo 166:3a9487d57a5c 603 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 604
thedo 166:3a9487d57a5c 605 /* AGC / PGA */
thedo 166:3a9487d57a5c 606 if (p_agc != NULL) {
thedo 166:3a9487d57a5c 607 /* AGC response speed */
thedo 166:3a9487d57a5c 608 if (((uint32_t)p_agc->agcresponse & (uint32_t)(~VDEC_CPARA_RANGE_0X00000007)) != 0u) {
thedo 166:3a9487d57a5c 609 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 610 goto END;
thedo 166:3a9487d57a5c 611 }
thedo 166:3a9487d57a5c 612 /* Sync signal reference amplitude */
thedo 166:3a9487d57a5c 613 if (((uint32_t)p_agc->agclevel & (uint32_t)(~VDEC_CPARA_RANGE_0X000001FF)) != 0u) {
thedo 166:3a9487d57a5c 614 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 615 goto END;
thedo 166:3a9487d57a5c 616 }
thedo 166:3a9487d57a5c 617 /* AGC gain adjustment accuracy */
thedo 166:3a9487d57a5c 618 if (((uint32_t)p_agc->agcprecis & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 619 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 620 goto END;
thedo 166:3a9487d57a5c 621 }
thedo 166:3a9487d57a5c 622 /* PGA gain */
thedo 166:3a9487d57a5c 623 if (((uint32_t)p_agc->pga_gain & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 624 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 625 goto END;
thedo 166:3a9487d57a5c 626 }
thedo 166:3a9487d57a5c 627 }
thedo 166:3a9487d57a5c 628 END:
thedo 166:3a9487d57a5c 629 return vdec_error;
thedo 166:3a9487d57a5c 630 } /* End of function AgcPgaCheckParam() */
thedo 166:3a9487d57a5c 631
thedo 166:3a9487d57a5c 632 /**************************************************************************//**
thedo 166:3a9487d57a5c 633 * @brief Checks on peak limiter control parameter
thedo 166:3a9487d57a5c 634 * @param[in] p_peak_limiter : Peak limiter control parameter
thedo 166:3a9487d57a5c 635 * @retval Error code
thedo 166:3a9487d57a5c 636 *****************************************************************************/
thedo 166:3a9487d57a5c 637 static vdec_error_t PeakLimiterControlCheckParam (const vdec_peak_limiter_t * const p_peak_limiter)
thedo 166:3a9487d57a5c 638 {
thedo 166:3a9487d57a5c 639 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 640
thedo 166:3a9487d57a5c 641 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 642
thedo 166:3a9487d57a5c 643 /* Peak limiter control */
thedo 166:3a9487d57a5c 644 if (p_peak_limiter != NULL) {
thedo 166:3a9487d57a5c 645 /* Peak luminance value to operate peak limiter */
thedo 166:3a9487d57a5c 646 if (p_peak_limiter->peaklevel >= VDEC_PEAKLV_NUM) {
thedo 166:3a9487d57a5c 647 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 648 goto END;
thedo 166:3a9487d57a5c 649 }
thedo 166:3a9487d57a5c 650
thedo 166:3a9487d57a5c 651 /* Response speed with peak limiter gain decreased */
thedo 166:3a9487d57a5c 652 if (((uint32_t)p_peak_limiter->peakattack & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 653 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 654 goto END;
thedo 166:3a9487d57a5c 655 }
thedo 166:3a9487d57a5c 656 /* Response speed with peak limiter gain increased */
thedo 166:3a9487d57a5c 657 if (((uint32_t)p_peak_limiter->peakrelease & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 658 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 659 goto END;
thedo 166:3a9487d57a5c 660 }
thedo 166:3a9487d57a5c 661 /* Maximum compression rate of peak limiter */
thedo 166:3a9487d57a5c 662 if (p_peak_limiter->peakratio >= VDEC_PEAKRATIO_NUM) {
thedo 166:3a9487d57a5c 663 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 664 goto END;
thedo 166:3a9487d57a5c 665 }
thedo 166:3a9487d57a5c 666 /* Allowable number of overflowing pixels */
thedo 166:3a9487d57a5c 667 if (((uint32_t)p_peak_limiter->maxpeaksamples & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) {
thedo 166:3a9487d57a5c 668 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 669 goto END;
thedo 166:3a9487d57a5c 670 }
thedo 166:3a9487d57a5c 671 }
thedo 166:3a9487d57a5c 672 END:
thedo 166:3a9487d57a5c 673 return vdec_error;
thedo 166:3a9487d57a5c 674 } /* End of function PeakLimiterControlCheckParam() */
thedo 166:3a9487d57a5c 675
thedo 166:3a9487d57a5c 676 /**************************************************************************//**
thedo 166:3a9487d57a5c 677 * @brief Checks on over-range control parameter
thedo 166:3a9487d57a5c 678 * @param[in] p_over_range : Over-range control parameter
thedo 166:3a9487d57a5c 679 * @retval Error code
thedo 166:3a9487d57a5c 680 *****************************************************************************/
thedo 166:3a9487d57a5c 681 static vdec_error_t OverRangeControlCheckParam (const vdec_over_range_t * const p_over_range)
thedo 166:3a9487d57a5c 682 {
thedo 166:3a9487d57a5c 683 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 684
thedo 166:3a9487d57a5c 685 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 686
thedo 166:3a9487d57a5c 687 /* Over-range control */
thedo 166:3a9487d57a5c 688 if (p_over_range != NULL) {
thedo 166:3a9487d57a5c 689 /* A/D over-threshold level (between levels 0 and 1) */
thedo 166:3a9487d57a5c 690 if (((uint32_t)p_over_range->radj_o_level0 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 691 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 692 goto END;
thedo 166:3a9487d57a5c 693 }
thedo 166:3a9487d57a5c 694 /* A/D under-threshold level (between levels 2 and 3) */
thedo 166:3a9487d57a5c 695 if (((uint32_t)p_over_range->radj_u_level0 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 696 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 697 goto END;
thedo 166:3a9487d57a5c 698 }
thedo 166:3a9487d57a5c 699 /* A/D over-threshold level (between levels 1 and 2) */
thedo 166:3a9487d57a5c 700 if (((uint32_t)p_over_range->radj_o_level1 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 701 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 702 goto END;
thedo 166:3a9487d57a5c 703 }
thedo 166:3a9487d57a5c 704 /* A/D under-threshold level (between levels 1 and 2) */
thedo 166:3a9487d57a5c 705 if (((uint32_t)p_over_range->radj_u_level1 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 706 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 707 goto END;
thedo 166:3a9487d57a5c 708 }
thedo 166:3a9487d57a5c 709 /* A/D over-threshold level (between levels 2 and 3) */
thedo 166:3a9487d57a5c 710 if (((uint32_t)p_over_range->radj_o_level2 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 711 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 712 goto END;
thedo 166:3a9487d57a5c 713 }
thedo 166:3a9487d57a5c 714 /* A/D under-threshold level (between levels 0 and 1) */
thedo 166:3a9487d57a5c 715 if (((uint32_t)p_over_range->radj_u_level2 & (uint32_t)(~VDEC_CPARA_RANGE_0X000003FF)) != 0u) {
thedo 166:3a9487d57a5c 716 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 717 goto END;
thedo 166:3a9487d57a5c 718 }
thedo 166:3a9487d57a5c 719 }
thedo 166:3a9487d57a5c 720 END:
thedo 166:3a9487d57a5c 721 return vdec_error;
thedo 166:3a9487d57a5c 722 } /* End of function OverRangeControlCheckParam() */
thedo 166:3a9487d57a5c 723
thedo 166:3a9487d57a5c 724 /**************************************************************************//**
thedo 166:3a9487d57a5c 725 * @brief Checks on Y/C separation control parameter
thedo 166:3a9487d57a5c 726 * @param[in] p_yc_sep_ctrl : Y/C separation control parameter
thedo 166:3a9487d57a5c 727 * @retval Error code
thedo 166:3a9487d57a5c 728 *****************************************************************************/
thedo 166:3a9487d57a5c 729 static vdec_error_t YcSeparationControlCheckParam (const vdec_yc_sep_ctrl_t * const p_yc_sep_ctrl)
thedo 166:3a9487d57a5c 730 {
thedo 166:3a9487d57a5c 731 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 732
thedo 166:3a9487d57a5c 733 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 734
thedo 166:3a9487d57a5c 735 /* Y/C separation control */
thedo 166:3a9487d57a5c 736 if (p_yc_sep_ctrl != NULL) {
thedo 166:3a9487d57a5c 737 /* Two-dimensional Y/C separation filter select coefficient (K15, K13, and K11) */
thedo 166:3a9487d57a5c 738 if ((((uint32_t)p_yc_sep_ctrl->k15 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) ||
thedo 166:3a9487d57a5c 739 (((uint32_t)p_yc_sep_ctrl->k13 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) ||
thedo 166:3a9487d57a5c 740 (((uint32_t)p_yc_sep_ctrl->k11 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 741 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 742 goto END;
thedo 166:3a9487d57a5c 743 }
thedo 166:3a9487d57a5c 744 /* Two-dimensional Y/C separation filter select coefficient (K16, K14, and K12) */
thedo 166:3a9487d57a5c 745 if ((((uint32_t)p_yc_sep_ctrl->k16 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) ||
thedo 166:3a9487d57a5c 746 (((uint32_t)p_yc_sep_ctrl->k14 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) ||
thedo 166:3a9487d57a5c 747 (((uint32_t)p_yc_sep_ctrl->k12 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 748 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 749 goto END;
thedo 166:3a9487d57a5c 750 }
thedo 166:3a9487d57a5c 751 /* Two-dimensional Y/C separation filter select coefficient (K22A and K21A) */
thedo 166:3a9487d57a5c 752 if ((((uint32_t)p_yc_sep_ctrl->k22a & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) ||
thedo 166:3a9487d57a5c 753 (((uint32_t)p_yc_sep_ctrl->k21a & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 754 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 755 goto END;
thedo 166:3a9487d57a5c 756 }
thedo 166:3a9487d57a5c 757 /* Two-dimensional Y/C separation filter select coefficient (K22B and K21B) */
thedo 166:3a9487d57a5c 758 if ((((uint32_t)p_yc_sep_ctrl->k22b & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) ||
thedo 166:3a9487d57a5c 759 (((uint32_t)p_yc_sep_ctrl->k21b & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u)) {
thedo 166:3a9487d57a5c 760 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 761 goto END;
thedo 166:3a9487d57a5c 762 }
thedo 166:3a9487d57a5c 763 /* Two-dimensional Y/C separation filter select coefficient (K23B, K23A, and K24) */
thedo 166:3a9487d57a5c 764 if ((((uint32_t)p_yc_sep_ctrl->k23b & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) ||
thedo 166:3a9487d57a5c 765 (((uint32_t)p_yc_sep_ctrl->k23a & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) ||
thedo 166:3a9487d57a5c 766 (((uint32_t)p_yc_sep_ctrl->k24 & (uint32_t)(~VDEC_CPARA_RANGE_0X0000001F)) != 0u)) {
thedo 166:3a9487d57a5c 767 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 768 goto END;
thedo 166:3a9487d57a5c 769 }
thedo 166:3a9487d57a5c 770 /* Mixing ratio of signal after passing horizontal filter
thedo 166:3a9487d57a5c 771 to signal after passing former-stage horizontal filter */
thedo 166:3a9487d57a5c 772 if (p_yc_sep_ctrl->hsel_mix_y >= VDEC_FILMIX_RATIO_NUM) {
thedo 166:3a9487d57a5c 773 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 774 goto END;
thedo 166:3a9487d57a5c 775 }
thedo 166:3a9487d57a5c 776 /* Mixing ratio of signal after passing vertical filter
thedo 166:3a9487d57a5c 777 to signal after passing former-stage horizontal/vertical filter */
thedo 166:3a9487d57a5c 778 if (p_yc_sep_ctrl->vsel_mix_y >= VDEC_FILMIX_RATIO_NUM) {
thedo 166:3a9487d57a5c 779 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 780 goto END;
thedo 166:3a9487d57a5c 781 }
thedo 166:3a9487d57a5c 782 /* Mixing ratio of signal after passing horizontal/vertical filter
thedo 166:3a9487d57a5c 783 to signal after passing former-stage horizontal/vertical filter */
thedo 166:3a9487d57a5c 784 if (p_yc_sep_ctrl->hvsel_mix_y >= VDEC_FILMIX_RATIO_NUM) {
thedo 166:3a9487d57a5c 785 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 786 goto END;
thedo 166:3a9487d57a5c 787 }
thedo 166:3a9487d57a5c 788 /* Vertical luminance detection level for correlation detection filter */
thedo 166:3a9487d57a5c 789 if (((uint32_t)p_yc_sep_ctrl->v_y_level & (uint32_t)(~VDEC_CPARA_RANGE_0X000001FF)) != 0u) {
thedo 166:3a9487d57a5c 790 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 791 goto END;
thedo 166:3a9487d57a5c 792 }
thedo 166:3a9487d57a5c 793
thedo 166:3a9487d57a5c 794 /* Mixing ratio of c signal after passing horizontal/vertical adaptive filter
thedo 166:3a9487d57a5c 795 to signal after passing correlation detection filter */
thedo 166:3a9487d57a5c 796 if (p_yc_sep_ctrl->det2_mix_c >= VDEC_FILMIX_RATIO_NUM) {
thedo 166:3a9487d57a5c 797 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 798 goto END;
thedo 166:3a9487d57a5c 799 }
thedo 166:3a9487d57a5c 800 /* Mixing ratio of C signal for Y generation after passing
thedo 166:3a9487d57a5c 801 horizontal/vertical adaptive filter to signal after passing correlation */
thedo 166:3a9487d57a5c 802 if (p_yc_sep_ctrl->det2_mix_y >= VDEC_FILMIX_RATIO_NUM) {
thedo 166:3a9487d57a5c 803 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 804 goto END;
thedo 166:3a9487d57a5c 805 }
thedo 166:3a9487d57a5c 806 /* Two-dimensional cascade/TAKE-OFF filter mode select */
thedo 166:3a9487d57a5c 807 if (p_yc_sep_ctrl->fil2_mode_2d >= VDEC_2DFIL_MDSEL_NUM) {
thedo 166:3a9487d57a5c 808 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 809 goto END;
thedo 166:3a9487d57a5c 810 }
thedo 166:3a9487d57a5c 811 }
thedo 166:3a9487d57a5c 812 END:
thedo 166:3a9487d57a5c 813 return vdec_error;
thedo 166:3a9487d57a5c 814 } /* End of function YcSeparationControlCheckParam() */
thedo 166:3a9487d57a5c 815
thedo 166:3a9487d57a5c 816 /**************************************************************************//**
thedo 166:3a9487d57a5c 817 * @brief Checks on chroma filter TAP coefficient for Y/C separation
thedo 166:3a9487d57a5c 818 * @param[in] fil2_2d : Chroma filter TAP coefficient for Y/C separation
thedo 166:3a9487d57a5c 819 * @retval Error code
thedo 166:3a9487d57a5c 820 *****************************************************************************/
thedo 166:3a9487d57a5c 821 static vdec_error_t FilterTAPsCoefficientCheckParam (const vdec_chrfil_tap_t * const fil2_2d)
thedo 166:3a9487d57a5c 822 {
thedo 166:3a9487d57a5c 823 int32_t tap_coef;
thedo 166:3a9487d57a5c 824 const uint16_t * taps;
thedo 166:3a9487d57a5c 825 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 826
thedo 166:3a9487d57a5c 827 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 828
thedo 166:3a9487d57a5c 829 if (fil2_2d != NULL) {
thedo 166:3a9487d57a5c 830 taps = fil2_2d->fil2_2d_f;
thedo 166:3a9487d57a5c 831 for (tap_coef = 0; tap_coef < VDEC_CHRFIL_TAPCOEF_NUM; tap_coef++) {
thedo 166:3a9487d57a5c 832 if (((uint32_t)*taps & (uint32_t)(~VDEC_CPARA_RANGE_0X00001FFF)) != 0u) {
thedo 166:3a9487d57a5c 833 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 834 goto END;
thedo 166:3a9487d57a5c 835 }
thedo 166:3a9487d57a5c 836 taps++;
thedo 166:3a9487d57a5c 837 }
thedo 166:3a9487d57a5c 838 }
thedo 166:3a9487d57a5c 839 END:
thedo 166:3a9487d57a5c 840 return vdec_error;
thedo 166:3a9487d57a5c 841 } /* End of function FilterTAPsCoefficientCheckParam() */
thedo 166:3a9487d57a5c 842
thedo 166:3a9487d57a5c 843 /**************************************************************************//**
thedo 166:3a9487d57a5c 844 * @brief Checks on color system detection parameter
thedo 166:3a9487d57a5c 845 * @param[in] p_chrmdec_ctrl : Color system detection parameter
thedo 166:3a9487d57a5c 846 * @retval Error code
thedo 166:3a9487d57a5c 847 *****************************************************************************/
thedo 166:3a9487d57a5c 848 static vdec_error_t ChromaDecodingControlCheckParam (const vdec_chrmdec_ctrl_t * const p_chrmdec_ctrl)
thedo 166:3a9487d57a5c 849 {
thedo 166:3a9487d57a5c 850 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 851
thedo 166:3a9487d57a5c 852 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 853
thedo 166:3a9487d57a5c 854 /* Chroma decoding control */
thedo 166:3a9487d57a5c 855 if (p_chrmdec_ctrl != NULL) {
thedo 166:3a9487d57a5c 856 /* Default color system */
thedo 166:3a9487d57a5c 857 if (p_chrmdec_ctrl->defaultsys >= VDEC_COL_SYS_NUM) {
thedo 166:3a9487d57a5c 858 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 859 goto END;
thedo 166:3a9487d57a5c 860 }
thedo 166:3a9487d57a5c 861 /* Luminance signal delay adjustment */
thedo 166:3a9487d57a5c 862 if (((uint32_t)p_chrmdec_ctrl->lumadelay & (uint32_t)(~VDEC_CPARA_RANGE_0X0000001F)) != 0u) {
thedo 166:3a9487d57a5c 863 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 864 goto END;
thedo 166:3a9487d57a5c 865 }
thedo 166:3a9487d57a5c 866 /* Averaging processing for pre-demodulated line */
thedo 166:3a9487d57a5c 867 if ((p_chrmdec_ctrl->demodmode != VDEC_DEMOD_MD_NO) && (p_chrmdec_ctrl->demodmode != VDEC_DEMOD_MD_PAL)) {
thedo 166:3a9487d57a5c 868 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 869 goto END;
thedo 166:3a9487d57a5c 870 }
thedo 166:3a9487d57a5c 871 }
thedo 166:3a9487d57a5c 872 END:
thedo 166:3a9487d57a5c 873 return vdec_error;
thedo 166:3a9487d57a5c 874 } /* End of function ChromaDecodingControlCheckParam() */
thedo 166:3a9487d57a5c 875
thedo 166:3a9487d57a5c 876 /**************************************************************************//**
thedo 166:3a9487d57a5c 877 * @brief Checks on BCO parameter
thedo 166:3a9487d57a5c 878 * @param[in] p_burst_lock : BCO parameter
thedo 166:3a9487d57a5c 879 * @retval Error code
thedo 166:3a9487d57a5c 880 *****************************************************************************/
thedo 166:3a9487d57a5c 881 static vdec_error_t BurstLockCheckParam (const vdec_burst_lock_t * const p_burst_lock)
thedo 166:3a9487d57a5c 882 {
thedo 166:3a9487d57a5c 883 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 884
thedo 166:3a9487d57a5c 885 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 886
thedo 166:3a9487d57a5c 887 /* Burst lock */
thedo 166:3a9487d57a5c 888 if (p_burst_lock != NULL) {
thedo 166:3a9487d57a5c 889 /* Burst lock PLL lock range */
thedo 166:3a9487d57a5c 890 if (p_burst_lock->lockrange >= VDEC_LOCK_RANGE_NUM) {
thedo 166:3a9487d57a5c 891 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 892 goto END;
thedo 166:3a9487d57a5c 893 }
thedo 166:3a9487d57a5c 894 /* Burst lock PLL loop gain */
thedo 166:3a9487d57a5c 895 if (((uint32_t)p_burst_lock->loopgain & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 896 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 897 goto END;
thedo 166:3a9487d57a5c 898 }
thedo 166:3a9487d57a5c 899 /* Level for burst lock PLL to re-search free-run frequency */
thedo 166:3a9487d57a5c 900 if (((uint32_t)p_burst_lock->locklimit & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 901 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 902 goto END;
thedo 166:3a9487d57a5c 903 }
thedo 166:3a9487d57a5c 904 /* burst gate pulse position check */
thedo 166:3a9487d57a5c 905 if (((uint32_t)p_burst_lock->bgpcheck & (uint32_t)(~VDEC_CPARA_RANGE_0X00000001)) != 0u) {
thedo 166:3a9487d57a5c 906 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 907 goto END;
thedo 166:3a9487d57a5c 908 }
thedo 166:3a9487d57a5c 909 /* burst gate pulse width */
thedo 166:3a9487d57a5c 910 if (((uint32_t)p_burst_lock->bgpwidth & (uint32_t)(~VDEC_CPARA_RANGE_0X0000007F)) != 0u) {
thedo 166:3a9487d57a5c 911 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 912 goto END;
thedo 166:3a9487d57a5c 913 }
thedo 166:3a9487d57a5c 914 /* burst gate pulse start position */
thedo 166:3a9487d57a5c 915 if (((uint32_t)p_burst_lock->bgpstart & (uint32_t)(~VDEC_CPARA_RANGE_0X000000FF)) != 0u) {
thedo 166:3a9487d57a5c 916 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 917 goto END;
thedo 166:3a9487d57a5c 918 }
thedo 166:3a9487d57a5c 919 }
thedo 166:3a9487d57a5c 920 END:
thedo 166:3a9487d57a5c 921 return vdec_error;
thedo 166:3a9487d57a5c 922 } /* End of function BurstLockCheckParam() */
thedo 166:3a9487d57a5c 923
thedo 166:3a9487d57a5c 924 /**************************************************************************//**
thedo 166:3a9487d57a5c 925 * @brief Checks on ACC and color killer parameter
thedo 166:3a9487d57a5c 926 * @param[in] p_acc : ACC and color killer parameter
thedo 166:3a9487d57a5c 927 * @retval Error code
thedo 166:3a9487d57a5c 928 *****************************************************************************/
thedo 166:3a9487d57a5c 929 static vdec_error_t AccColorKillerCheckParam (const vdec_acc_t * const p_acc)
thedo 166:3a9487d57a5c 930 {
thedo 166:3a9487d57a5c 931 vdec_error_t vdec_error;
thedo 166:3a9487d57a5c 932
thedo 166:3a9487d57a5c 933 vdec_error = VDEC_OK;
thedo 166:3a9487d57a5c 934
thedo 166:3a9487d57a5c 935 /* ACC/color killer */
thedo 166:3a9487d57a5c 936 if (p_acc != NULL) {
thedo 166:3a9487d57a5c 937 /* Maximum ACC Gain */
thedo 166:3a9487d57a5c 938 if (p_acc->accmaxgain >= VDEC_ACC_MAX_GAIN_NUM) {
thedo 166:3a9487d57a5c 939 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 940 goto END;
thedo 166:3a9487d57a5c 941 }
thedo 166:3a9487d57a5c 942 /* ACC reference color burst amplitude */
thedo 166:3a9487d57a5c 943 if (((uint32_t)p_acc->acclevel & (uint32_t)(~VDEC_CPARA_RANGE_0X000001FF)) != 0u) {
thedo 166:3a9487d57a5c 944 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 945 goto END;
thedo 166:3a9487d57a5c 946 }
thedo 166:3a9487d57a5c 947 /* Chroma manual gain (sub) */
thedo 166:3a9487d57a5c 948 if (p_acc->chromasubgain >= VDEC_CHRM_SB_GAIN_NUM) {
thedo 166:3a9487d57a5c 949 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 950 goto END;
thedo 166:3a9487d57a5c 951 }
thedo 166:3a9487d57a5c 952 /* Chroma manual gain (main) */
thedo 166:3a9487d57a5c 953 if (((uint32_t)p_acc->chromamaingain & (uint32_t)(~VDEC_CPARA_RANGE_0X000001FF)) != 0u) {
thedo 166:3a9487d57a5c 954 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 955 goto END;
thedo 166:3a9487d57a5c 956 }
thedo 166:3a9487d57a5c 957 /* ACC response speed */
thedo 166:3a9487d57a5c 958 if (((uint32_t)p_acc->accresponse & (uint32_t)(~VDEC_CPARA_RANGE_0X00000003)) != 0u) {
thedo 166:3a9487d57a5c 959 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 960 goto END;
thedo 166:3a9487d57a5c 961 }
thedo 166:3a9487d57a5c 962 /* ACC gain adjustment accuracy */
thedo 166:3a9487d57a5c 963 if (((uint32_t)p_acc->accprecis & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 964 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 965 goto END;
thedo 166:3a9487d57a5c 966 }
thedo 166:3a9487d57a5c 967 /* Color killer operation start point */
thedo 166:3a9487d57a5c 968 if (((uint32_t)p_acc->killerlevel & (uint32_t)(~VDEC_CPARA_RANGE_0X0000003F)) != 0u) {
thedo 166:3a9487d57a5c 969 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 970 goto END;
thedo 166:3a9487d57a5c 971 }
thedo 166:3a9487d57a5c 972 /* The offset level to turn off the color killer */
thedo 166:3a9487d57a5c 973 if (((uint32_t)p_acc->killeroffset & (uint32_t)(~VDEC_CPARA_RANGE_0X0000000F)) != 0u) {
thedo 166:3a9487d57a5c 974 vdec_error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 975 goto END;
thedo 166:3a9487d57a5c 976 }
thedo 166:3a9487d57a5c 977 }
thedo 166:3a9487d57a5c 978 END:
thedo 166:3a9487d57a5c 979 return vdec_error;
thedo 166:3a9487d57a5c 980 } /* End of function AccColorKillerCheckParam() */
thedo 166:3a9487d57a5c 981
thedo 166:3a9487d57a5c 982 #endif /* R_VDEC_CHECK_PARAMETERS */
thedo 166:3a9487d57a5c 983