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 video_decoder.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 Video decoder function
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 <stdlib.h>
thedo 166:3a9487d57a5c 35 #include <string.h>
thedo 166:3a9487d57a5c 36
thedo 166:3a9487d57a5c 37 #include "r_typedefs.h"
thedo 166:3a9487d57a5c 38 #include "iodefine.h"
thedo 166:3a9487d57a5c 39
thedo 166:3a9487d57a5c 40 #include "r_vdec.h"
thedo 166:3a9487d57a5c 41 #include "r_vdec_user.h"
thedo 166:3a9487d57a5c 42
thedo 166:3a9487d57a5c 43 #include "video_decoder.h"
thedo 166:3a9487d57a5c 44
thedo 166:3a9487d57a5c 45
thedo 166:3a9487d57a5c 46 /******************************************************************************
thedo 166:3a9487d57a5c 47 Macro definitions
thedo 166:3a9487d57a5c 48 ******************************************************************************/
thedo 166:3a9487d57a5c 49 #define STBCR7_BIT7 (0x80u)
thedo 166:3a9487d57a5c 50 #define STBCR7_BIT6 (0x40u)
thedo 166:3a9487d57a5c 51
thedo 166:3a9487d57a5c 52 /*! Video decoder recommended value */
thedo 166:3a9487d57a5c 53 #define SRCLEFT_NTSC_3_58 ((uint16_t)256u)
thedo 166:3a9487d57a5c 54 #define SRCLEFT_NTSC_4_43 ((uint16_t)256u)
thedo 166:3a9487d57a5c 55 #define SRCLEFT_PAL_4_43 ((uint16_t)256u)
thedo 166:3a9487d57a5c 56 #define SRCLEFT_PAL_M ((uint16_t)256u)
thedo 166:3a9487d57a5c 57 #define SRCLEFT_PAL_N ((uint16_t)256u)
thedo 166:3a9487d57a5c 58 #define SRCLEFT_SECAM ((uint16_t)256u)
thedo 166:3a9487d57a5c 59 #define SRCLEFT_NTSC_443_60 ((uint16_t)256u)
thedo 166:3a9487d57a5c 60 #define SRCLEFT_PAL_60 ((uint16_t)256u)
thedo 166:3a9487d57a5c 61
thedo 166:3a9487d57a5c 62 #define SRCTOP_NTSC_3_58 ((uint16_t)16u)
thedo 166:3a9487d57a5c 63 #define SRCTOP_NTSC_4_43 ((uint16_t)19u)
thedo 166:3a9487d57a5c 64 #define SRCTOP_PAL_4_43 ((uint16_t)19u)
thedo 166:3a9487d57a5c 65 #define SRCTOP_PAL_M ((uint16_t)16u)
thedo 166:3a9487d57a5c 66 #define SRCTOP_PAL_N ((uint16_t)19u)
thedo 166:3a9487d57a5c 67 #define SRCTOP_SECAM ((uint16_t)19u)
thedo 166:3a9487d57a5c 68 #define SRCTOP_NTSC_443_60 ((uint16_t)16u)
thedo 166:3a9487d57a5c 69 #define SRCTOP_PAL_60 ((uint16_t)16u)
thedo 166:3a9487d57a5c 70
thedo 166:3a9487d57a5c 71 #define SRCHEIGHT_NTSC_3_58 ((uint16_t)241u)
thedo 166:3a9487d57a5c 72 #define SRCHEIGHT_NTSC_4_43 ((uint16_t)288u)
thedo 166:3a9487d57a5c 73 #define SRCHEIGHT_PAL_4_43 ((uint16_t)288u)
thedo 166:3a9487d57a5c 74 #define SRCHEIGHT_PAL_M ((uint16_t)241u)
thedo 166:3a9487d57a5c 75 #define SRCHEIGHT_PAL_N ((uint16_t)288u)
thedo 166:3a9487d57a5c 76 #define SRCHEIGHT_SECAM ((uint16_t)288u)
thedo 166:3a9487d57a5c 77 #define SRCHEIGHT_NTSC_443_60 ((uint16_t)241u)
thedo 166:3a9487d57a5c 78 #define SRCHEIGHT_PAL_60 ((uint16_t)241u)
thedo 166:3a9487d57a5c 79
thedo 166:3a9487d57a5c 80 #define SRCWIDTH_NTSC_3_58 ((uint16_t)1428u)
thedo 166:3a9487d57a5c 81 #define SRCWIDTH_NTSC_4_43 ((uint16_t)1412u)
thedo 166:3a9487d57a5c 82 #define SRCWIDTH_PAL_4_43 ((uint16_t)1412u)
thedo 166:3a9487d57a5c 83 #define SRCWIDTH_PAL_M ((uint16_t)1428u)
thedo 166:3a9487d57a5c 84 #define SRCWIDTH_PAL_N ((uint16_t)1412u)
thedo 166:3a9487d57a5c 85 #define SRCWIDTH_SECAM ((uint16_t)1412u)
thedo 166:3a9487d57a5c 86 #define SRCWIDTH_NTSC_443_60 ((uint16_t)1428u)
thedo 166:3a9487d57a5c 87 #define SRCWIDTH_PAL_60 ((uint16_t)1428u)
thedo 166:3a9487d57a5c 88
thedo 166:3a9487d57a5c 89 #define HAFCTYP_NTSC_3_58 ((uint16_t)692u)
thedo 166:3a9487d57a5c 90 #define HAFCTYP_NTSC_4_43 ((uint16_t)704u)
thedo 166:3a9487d57a5c 91 #define HAFCTYP_PAL_4_43 ((uint16_t)704u)
thedo 166:3a9487d57a5c 92 #define HAFCTYP_PAL_M ((uint16_t)692u)
thedo 166:3a9487d57a5c 93 #define HAFCTYP_PAL_N ((uint16_t)704u)
thedo 166:3a9487d57a5c 94 #define HAFCTYP_SECAM ((uint16_t)704u)
thedo 166:3a9487d57a5c 95 #define HAFCTYP_NTSC_443_60 ((uint16_t)692u)
thedo 166:3a9487d57a5c 96 #define HAFCTYP_PAL_60 ((uint16_t)692u)
thedo 166:3a9487d57a5c 97
thedo 166:3a9487d57a5c 98 #define HAFCMAX_NTSC_3_58 ((uint16_t)792u)
thedo 166:3a9487d57a5c 99 #define HAFCMAX_NTSC_4_43 ((uint16_t)785u)
thedo 166:3a9487d57a5c 100 #define HAFCMAX_PAL_4_43 ((uint16_t)785u)
thedo 166:3a9487d57a5c 101 #define HAFCMAX_PAL_M ((uint16_t)792u)
thedo 166:3a9487d57a5c 102 #define HAFCMAX_PAL_N ((uint16_t)785u)
thedo 166:3a9487d57a5c 103 #define HAFCMAX_SECAM ((uint16_t)785u)
thedo 166:3a9487d57a5c 104 #define HAFCMAX_NTSC_443_60 ((uint16_t)792u)
thedo 166:3a9487d57a5c 105 #define HAFCMAX_PAL_60 ((uint16_t)792u)
thedo 166:3a9487d57a5c 106
thedo 166:3a9487d57a5c 107 #define HAFCMIN_NTSC_3_58 ((uint16_t)592u)
thedo 166:3a9487d57a5c 108 #define HAFCMIN_NTSC_4_43 ((uint16_t)630u)
thedo 166:3a9487d57a5c 109 #define HAFCMIN_PAL_4_43 ((uint16_t)630u)
thedo 166:3a9487d57a5c 110 #define HAFCMIN_PAL_M ((uint16_t)592u)
thedo 166:3a9487d57a5c 111 #define HAFCMIN_PAL_N ((uint16_t)630u)
thedo 166:3a9487d57a5c 112 #define HAFCMIN_SECAM ((uint16_t)630u)
thedo 166:3a9487d57a5c 113 #define HAFCMIN_NTSC_443_60 ((uint16_t)592u)
thedo 166:3a9487d57a5c 114 #define HAFCMIN_PAL_60 ((uint16_t)592u)
thedo 166:3a9487d57a5c 115
thedo 166:3a9487d57a5c 116 #define VCDWINDOW_NTSC_3_58 ((uint16_t)30u)
thedo 166:3a9487d57a5c 117 #define VCDWINDOW_NTSC_4_43 ((uint16_t)30u)
thedo 166:3a9487d57a5c 118 #define VCDWINDOW_PAL_4_43 ((uint16_t)30u)
thedo 166:3a9487d57a5c 119 #define VCDWINDOW_PAL_M ((uint16_t)30u)
thedo 166:3a9487d57a5c 120 #define VCDWINDOW_PAL_N ((uint16_t)30u)
thedo 166:3a9487d57a5c 121 #define VCDWINDOW_SECAM ((uint16_t)30u)
thedo 166:3a9487d57a5c 122 #define VCDWINDOW_NTSC_443_60 ((uint16_t)30u)
thedo 166:3a9487d57a5c 123 #define VCDWINDOW_PAL_60 ((uint16_t)30u)
thedo 166:3a9487d57a5c 124
thedo 166:3a9487d57a5c 125 #define VCDOFFSET_NTSC_3_58 ((uint16_t)15u)
thedo 166:3a9487d57a5c 126 #define VCDOFFSET_NTSC_4_43 ((uint16_t)15u)
thedo 166:3a9487d57a5c 127 #define VCDOFFSET_PAL_4_43 ((uint16_t)15u)
thedo 166:3a9487d57a5c 128 #define VCDOFFSET_PAL_M ((uint16_t)15u)
thedo 166:3a9487d57a5c 129 #define VCDOFFSET_PAL_N ((uint16_t)15u)
thedo 166:3a9487d57a5c 130 #define VCDOFFSET_SECAM ((uint16_t)15u)
thedo 166:3a9487d57a5c 131 #define VCDOFFSET_NTSC_443_60 ((uint16_t)15u)
thedo 166:3a9487d57a5c 132 #define VCDOFFSET_PAL_60 ((uint16_t)15u)
thedo 166:3a9487d57a5c 133
thedo 166:3a9487d57a5c 134 #define ACCLEVEL_NTSC_3_58 ((uint16_t)220u)
thedo 166:3a9487d57a5c 135 #define ACCLEVEL_NTSC_4_43 ((uint16_t)220u)
thedo 166:3a9487d57a5c 136 #define ACCLEVEL_PAL_4_43 ((uint16_t)220u)
thedo 166:3a9487d57a5c 137 #define ACCLEVEL_PAL_M ((uint16_t)230u)
thedo 166:3a9487d57a5c 138 #define ACCLEVEL_PAL_N ((uint16_t)230u)
thedo 166:3a9487d57a5c 139 #define ACCLEVEL_SECAM ((uint16_t)220u)
thedo 166:3a9487d57a5c 140 #define ACCLEVEL_NTSC_443_60 ((uint16_t)220u)
thedo 166:3a9487d57a5c 141 #define ACCLEVEL_PAL_60 ((uint16_t)230u)
thedo 166:3a9487d57a5c 142
thedo 166:3a9487d57a5c 143 #define AGCLEVEL_NTSC_3_58 ((uint16_t)230u)
thedo 166:3a9487d57a5c 144 #define AGCLEVEL_NTSC_4_43 ((uint16_t)230u)
thedo 166:3a9487d57a5c 145 #define AGCLEVEL_PAL_4_43 ((uint16_t)242u)
thedo 166:3a9487d57a5c 146 #define AGCLEVEL_PAL_M ((uint16_t)242u)
thedo 166:3a9487d57a5c 147 #define AGCLEVEL_PAL_N ((uint16_t)242u)
thedo 166:3a9487d57a5c 148 #define AGCLEVEL_SECAM ((uint16_t)242u)
thedo 166:3a9487d57a5c 149 #define AGCLEVEL_NTSC_443_60 ((uint16_t)230u)
thedo 166:3a9487d57a5c 150 #define AGCLEVEL_PAL_60 ((uint16_t)242u)
thedo 166:3a9487d57a5c 151
thedo 166:3a9487d57a5c 152 #define K15_NTSC_3_58 ((uint16_t)2u)
thedo 166:3a9487d57a5c 153 #define K15_NTSC_4_43 ((uint16_t)2u)
thedo 166:3a9487d57a5c 154 #define K15_PAL_4_43 ((uint16_t)2u)
thedo 166:3a9487d57a5c 155 #define K15_PAL_M ((uint16_t)2u)
thedo 166:3a9487d57a5c 156 #define K15_PAL_N ((uint16_t)2u)
thedo 166:3a9487d57a5c 157 #define K15_SECAM ((uint16_t)2u)
thedo 166:3a9487d57a5c 158 #define K15_NTSC_443_60 ((uint16_t)2u)
thedo 166:3a9487d57a5c 159 #define K15_PAL_60 ((uint16_t)2u)
thedo 166:3a9487d57a5c 160
thedo 166:3a9487d57a5c 161 #define K13_NTSC_3_58 ((uint16_t)8u)
thedo 166:3a9487d57a5c 162 #define K13_NTSC_4_43 ((uint16_t)8u)
thedo 166:3a9487d57a5c 163 #define K13_PAL_4_43 ((uint16_t)8u)
thedo 166:3a9487d57a5c 164 #define K13_PAL_M ((uint16_t)8u)
thedo 166:3a9487d57a5c 165 #define K13_PAL_N ((uint16_t)8u)
thedo 166:3a9487d57a5c 166 #define K13_SECAM ((uint16_t)8u)
thedo 166:3a9487d57a5c 167 #define K13_NTSC_443_60 ((uint16_t)8u)
thedo 166:3a9487d57a5c 168 #define K13_PAL_60 ((uint16_t)8u)
thedo 166:3a9487d57a5c 169
thedo 166:3a9487d57a5c 170 #define K11_NTSC_3_58 ((uint16_t)4u)
thedo 166:3a9487d57a5c 171 #define K11_NTSC_4_43 ((uint16_t)4u)
thedo 166:3a9487d57a5c 172 #define K11_PAL_4_43 ((uint16_t)3u)
thedo 166:3a9487d57a5c 173 #define K11_PAL_M ((uint16_t)3u)
thedo 166:3a9487d57a5c 174 #define K11_PAL_N ((uint16_t)3u)
thedo 166:3a9487d57a5c 175 #define K11_SECAM ((uint16_t)4u)
thedo 166:3a9487d57a5c 176 #define K11_NTSC_443_60 ((uint16_t)4u)
thedo 166:3a9487d57a5c 177 #define K11_PAL_60 ((uint16_t)3u)
thedo 166:3a9487d57a5c 178
thedo 166:3a9487d57a5c 179 #define K16_NTSC_3_58 ((uint16_t)3u)
thedo 166:3a9487d57a5c 180 #define K16_NTSC_4_43 ((uint16_t)3u)
thedo 166:3a9487d57a5c 181 #define K16_PAL_4_43 ((uint16_t)4u)
thedo 166:3a9487d57a5c 182 #define K16_PAL_M ((uint16_t)4u)
thedo 166:3a9487d57a5c 183 #define K16_PAL_N ((uint16_t)4u)
thedo 166:3a9487d57a5c 184 #define K16_SECAM ((uint16_t)3u)
thedo 166:3a9487d57a5c 185 #define K16_NTSC_443_60 ((uint16_t)3u)
thedo 166:3a9487d57a5c 186 #define K16_PAL_60 ((uint16_t)4u)
thedo 166:3a9487d57a5c 187
thedo 166:3a9487d57a5c 188 #define K14_NTSC_3_58 ((uint16_t)16u)
thedo 166:3a9487d57a5c 189 #define K14_NTSC_4_43 ((uint16_t)16u)
thedo 166:3a9487d57a5c 190 #define K14_PAL_4_43 ((uint16_t)63u)
thedo 166:3a9487d57a5c 191 #define K14_PAL_M ((uint16_t)63u)
thedo 166:3a9487d57a5c 192 #define K14_PAL_N ((uint16_t)63u)
thedo 166:3a9487d57a5c 193 #define K14_SECAM ((uint16_t)16u)
thedo 166:3a9487d57a5c 194 #define K14_NTSC_443_60 ((uint16_t)16u)
thedo 166:3a9487d57a5c 195 #define K14_PAL_60 ((uint16_t)63u)
thedo 166:3a9487d57a5c 196
thedo 166:3a9487d57a5c 197 #define K12_NTSC_3_58 ((uint16_t)8u)
thedo 166:3a9487d57a5c 198 #define K12_NTSC_4_43 ((uint16_t)8u)
thedo 166:3a9487d57a5c 199 #define K12_PAL_4_43 ((uint16_t)2u)
thedo 166:3a9487d57a5c 200 #define K12_PAL_M ((uint16_t)2u)
thedo 166:3a9487d57a5c 201 #define K12_PAL_N ((uint16_t)2u)
thedo 166:3a9487d57a5c 202 #define K12_SECAM ((uint16_t)1u)
thedo 166:3a9487d57a5c 203 #define K12_NTSC_443_60 ((uint16_t)8u)
thedo 166:3a9487d57a5c 204 #define K12_PAL_60 ((uint16_t)2u)
thedo 166:3a9487d57a5c 205
thedo 166:3a9487d57a5c 206 #define K22A_NTSC_3_58 ((uint16_t)32u)
thedo 166:3a9487d57a5c 207 #define K22A_NTSC_4_43 ((uint16_t)32u)
thedo 166:3a9487d57a5c 208 #define K22A_PAL_4_43 ((uint16_t)32u)
thedo 166:3a9487d57a5c 209 #define K22A_PAL_M ((uint16_t)32u)
thedo 166:3a9487d57a5c 210 #define K22A_PAL_N ((uint16_t)32u)
thedo 166:3a9487d57a5c 211 #define K22A_SECAM ((uint16_t)32u)
thedo 166:3a9487d57a5c 212 #define K22A_NTSC_443_60 ((uint16_t)32u)
thedo 166:3a9487d57a5c 213 #define K22A_PAL_60 ((uint16_t)32u)
thedo 166:3a9487d57a5c 214
thedo 166:3a9487d57a5c 215 #define K21A_NTSC_3_58 ((uint16_t)6u)
thedo 166:3a9487d57a5c 216 #define K21A_NTSC_4_43 ((uint16_t)6u)
thedo 166:3a9487d57a5c 217 #define K21A_PAL_4_43 ((uint16_t)10u)
thedo 166:3a9487d57a5c 218 #define K21A_PAL_M ((uint16_t)10u)
thedo 166:3a9487d57a5c 219 #define K21A_PAL_N ((uint16_t)10u)
thedo 166:3a9487d57a5c 220 #define K21A_SECAM ((uint16_t)10u)
thedo 166:3a9487d57a5c 221 #define K21A_NTSC_443_60 ((uint16_t)6u)
thedo 166:3a9487d57a5c 222 #define K21A_PAL_60 ((uint16_t)10u)
thedo 166:3a9487d57a5c 223
thedo 166:3a9487d57a5c 224 #define K22B_NTSC_3_58 ((uint16_t)8u)
thedo 166:3a9487d57a5c 225 #define K22B_NTSC_4_43 ((uint16_t)8u)
thedo 166:3a9487d57a5c 226 #define K22B_PAL_4_43 ((uint16_t)15u)
thedo 166:3a9487d57a5c 227 #define K22B_PAL_M ((uint16_t)15u)
thedo 166:3a9487d57a5c 228 #define K22B_PAL_N ((uint16_t)15u)
thedo 166:3a9487d57a5c 229 #define K22B_SECAM ((uint16_t)15u)
thedo 166:3a9487d57a5c 230 #define K22B_NTSC_443_60 ((uint16_t)8u)
thedo 166:3a9487d57a5c 231 #define K22B_PAL_60 ((uint16_t)15u)
thedo 166:3a9487d57a5c 232
thedo 166:3a9487d57a5c 233 #define K21B_NTSC_3_58 ((uint16_t)6u)
thedo 166:3a9487d57a5c 234 #define K21B_NTSC_4_43 ((uint16_t)6u)
thedo 166:3a9487d57a5c 235 #define K21B_PAL_4_43 ((uint16_t)10u)
thedo 166:3a9487d57a5c 236 #define K21B_PAL_M ((uint16_t)10u)
thedo 166:3a9487d57a5c 237 #define K21B_PAL_N ((uint16_t)10u)
thedo 166:3a9487d57a5c 238 #define K21B_SECAM ((uint16_t)6u)
thedo 166:3a9487d57a5c 239 #define K21B_NTSC_443_60 ((uint16_t)6u)
thedo 166:3a9487d57a5c 240 #define K21B_PAL_60 ((uint16_t)10u)
thedo 166:3a9487d57a5c 241
thedo 166:3a9487d57a5c 242 #define K23B_NTSC_3_58 ((uint16_t)6u)
thedo 166:3a9487d57a5c 243 #define K23B_NTSC_4_43 ((uint16_t)6u)
thedo 166:3a9487d57a5c 244 #define K23B_PAL_4_43 ((uint16_t)3u)
thedo 166:3a9487d57a5c 245 #define K23B_PAL_M ((uint16_t)3u)
thedo 166:3a9487d57a5c 246 #define K23B_PAL_N ((uint16_t)3u)
thedo 166:3a9487d57a5c 247 #define K23B_SECAM ((uint16_t)3u)
thedo 166:3a9487d57a5c 248 #define K23B_NTSC_443_60 ((uint16_t)6u)
thedo 166:3a9487d57a5c 249 #define K23B_PAL_60 ((uint16_t)3u)
thedo 166:3a9487d57a5c 250
thedo 166:3a9487d57a5c 251 #define K23A_NTSC_3_58 ((uint16_t)3u)
thedo 166:3a9487d57a5c 252 #define K23A_NTSC_4_43 ((uint16_t)3u)
thedo 166:3a9487d57a5c 253 #define K23A_PAL_4_43 ((uint16_t)3u)
thedo 166:3a9487d57a5c 254 #define K23A_PAL_M ((uint16_t)3u)
thedo 166:3a9487d57a5c 255 #define K23A_PAL_N ((uint16_t)3u)
thedo 166:3a9487d57a5c 256 #define K23A_SECAM ((uint16_t)3u)
thedo 166:3a9487d57a5c 257 #define K23A_NTSC_443_60 ((uint16_t)3u)
thedo 166:3a9487d57a5c 258 #define K23A_PAL_60 ((uint16_t)3u)
thedo 166:3a9487d57a5c 259
thedo 166:3a9487d57a5c 260 #define K24_NTSC_3_58 ((uint16_t)5u)
thedo 166:3a9487d57a5c 261 #define K24_NTSC_4_43 ((uint16_t)5u)
thedo 166:3a9487d57a5c 262 #define K24_PAL_4_43 ((uint16_t)8u)
thedo 166:3a9487d57a5c 263 #define K24_PAL_M ((uint16_t)8u)
thedo 166:3a9487d57a5c 264 #define K24_PAL_N ((uint16_t)8u)
thedo 166:3a9487d57a5c 265 #define K24_SECAM ((uint16_t)8u)
thedo 166:3a9487d57a5c 266 #define K24_NTSC_443_60 ((uint16_t)5u)
thedo 166:3a9487d57a5c 267 #define K24_PAL_60 ((uint16_t)8u)
thedo 166:3a9487d57a5c 268
thedo 166:3a9487d57a5c 269 /* SyncSep */
thedo 166:3a9487d57a5c 270 #define SYNCMAXDUTY_H_VALUE ((uint16_t)15u)
thedo 166:3a9487d57a5c 271 #define SYNCMINDUTY_H_VALUE ((uint16_t)10u)
thedo 166:3a9487d57a5c 272 #define CSYNCSLICE_H_VALUE ((uint16_t)146u)
thedo 166:3a9487d57a5c 273 #define SYNCMAXDUTY_V_VALUE ((uint16_t)15u)
thedo 166:3a9487d57a5c 274 #define SYNCMINDUTY_V_VALUE ((uint16_t)9u)
thedo 166:3a9487d57a5c 275 #define VSYNCSLICE_VALUE ((uint16_t)10u)
thedo 166:3a9487d57a5c 276 #define CSYNCSLICE_V_VALUE ((uint16_t)146u)
thedo 166:3a9487d57a5c 277 #define HAFCGAIN_VALUE ((uint16_t)12u)
thedo 166:3a9487d57a5c 278 #define HAFCSTART_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 279 #define HAFCEND_VALUE ((uint16_t)8u)
thedo 166:3a9487d57a5c 280 #define AGCRESPONSE_VALUE ((uint16_t)4u)
thedo 166:3a9487d57a5c 281 #define AGCPRECIS_VALUE ((uint16_t)10u)
thedo 166:3a9487d57a5c 282 #define PGA_GAIN_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 283 #define PEAKATTACK_VALUE ((uint16_t)2u)
thedo 166:3a9487d57a5c 284 #define PEAKRELEASE_VALUE ((uint16_t)3u)
thedo 166:3a9487d57a5c 285 #define MAXPEAKSAMPLES_VALUE ((uint16_t)20u)
thedo 166:3a9487d57a5c 286
thedo 166:3a9487d57a5c 287 /* YcSep */
thedo 166:3a9487d57a5c 288 #define RADJ_O_LEVEL0_VALUE ((uint16_t)928u)
thedo 166:3a9487d57a5c 289 #define RADJ_U_LEVEL0_VALUE ((uint16_t)32u)
thedo 166:3a9487d57a5c 290 #define RADJ_O_LEVEL1_VALUE ((uint16_t)960u)
thedo 166:3a9487d57a5c 291 #define RADJ_U_LEVEL1_VALUE ((uint16_t)48u)
thedo 166:3a9487d57a5c 292 #define RADJ_O_LEVEL2_VALUE ((uint16_t)992u)
thedo 166:3a9487d57a5c 293 #define RADJ_U_LEVEL2_VALUE ((uint16_t)64u)
thedo 166:3a9487d57a5c 294 #define V_Y_LEVEL_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 295
thedo 166:3a9487d57a5c 296 /* ChromaDec */
thedo 166:3a9487d57a5c 297 #define LUMADELAY_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 298 #define LOOPGAIN_VALUE ((uint16_t)3u)
thedo 166:3a9487d57a5c 299 #define LOCKLIMIT_VALUE ((uint16_t)1u)
thedo 166:3a9487d57a5c 300 #define BGPCHECK_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 301 #define BGPWIDTH_VALUE ((uint16_t)54u)
thedo 166:3a9487d57a5c 302 #define BGPSTART_VALUE ((uint16_t)110u)
thedo 166:3a9487d57a5c 303 #define CHROMAMAINGAIN_VALUE ((uint16_t)210u)
thedo 166:3a9487d57a5c 304 #define ACCRESPONSE_VALUE ((uint16_t)1u)
thedo 166:3a9487d57a5c 305 #define ACCPRECIS_VALUE ((uint16_t)8u)
thedo 166:3a9487d57a5c 306 #define KILLERLEVEL_VALUE ((uint16_t)4u)
thedo 166:3a9487d57a5c 307 #define KILLEROFFSET_VALUE ((uint16_t)5u)
thedo 166:3a9487d57a5c 308
thedo 166:3a9487d57a5c 309 /* DigitalClamp */
thedo 166:3a9487d57a5c 310 #define BLANKLEVEL_Y_VALUE ((uint16_t)984u)
thedo 166:3a9487d57a5c 311 #define DCPPOS_Y_VALUE ((uint16_t)162u)
thedo 166:3a9487d57a5c 312 #define BLANKLEVEL_CB_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 313 #define BLANKLEVEL_CR_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 314 #define DCPPOS_C_VALUE ((uint16_t)54u)
thedo 166:3a9487d57a5c 315 #define ACFLAGTIME_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 316 #define ACFFILTER_VALUE ((uint16_t)3u)
thedo 166:3a9487d57a5c 317 #define DCPRESPONSE_VALUE ((uint16_t)0u)
thedo 166:3a9487d57a5c 318 #define DCPSTART_VALUE ((uint16_t)16u)
thedo 166:3a9487d57a5c 319 #define DCPEND_VALUE ((uint16_t)16u)
thedo 166:3a9487d57a5c 320 #define DCPWIDTH_VALUE ((uint16_t)27u)
thedo 166:3a9487d57a5c 321
thedo 166:3a9487d57a5c 322 /* Output */
thedo 166:3a9487d57a5c 323 #define Y_GAIN2_VALUE ((uint16_t)816u)
thedo 166:3a9487d57a5c 324 #define CB_GAIN2_VALUE ((uint16_t)663u)
thedo 166:3a9487d57a5c 325 #define CR_GAIN2_VALUE ((uint16_t)663u)
thedo 166:3a9487d57a5c 326
thedo 166:3a9487d57a5c 327
thedo 166:3a9487d57a5c 328 /******************************************************************************
thedo 166:3a9487d57a5c 329 Typedef definitions
thedo 166:3a9487d57a5c 330 ******************************************************************************/
thedo 166:3a9487d57a5c 331 /*! Video decoder recommended value */
thedo 166:3a9487d57a5c 332 typedef struct {
thedo 166:3a9487d57a5c 333 /* Capturing position setting */
thedo 166:3a9487d57a5c 334 uint16_t srcleft;
thedo 166:3a9487d57a5c 335 uint16_t srctop;
thedo 166:3a9487d57a5c 336 uint16_t srcheight;
thedo 166:3a9487d57a5c 337 uint16_t srcwidth;
thedo 166:3a9487d57a5c 338 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 339 uint16_t hafctyp;
thedo 166:3a9487d57a5c 340 uint16_t hafcmax;
thedo 166:3a9487d57a5c 341 uint16_t hafcmin;
thedo 166:3a9487d57a5c 342 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 343 vdec_onoff_t novcd50_;
thedo 166:3a9487d57a5c 344 vdec_onoff_t novcd60_;
thedo 166:3a9487d57a5c 345 vdec_vcddefault_t vcddefault;
thedo 166:3a9487d57a5c 346 uint16_t vcdwindow;
thedo 166:3a9487d57a5c 347 uint16_t vcdoffset;
thedo 166:3a9487d57a5c 348 /* BCO setting */
thedo 166:3a9487d57a5c 349 vdec_color_sys_t defaultsys;
thedo 166:3a9487d57a5c 350 vdec_onoff_t nontsc358_;
thedo 166:3a9487d57a5c 351 vdec_onoff_t nontsc443_;
thedo 166:3a9487d57a5c 352 vdec_onoff_t nopalm_;
thedo 166:3a9487d57a5c 353 vdec_onoff_t nopaln_;
thedo 166:3a9487d57a5c 354 vdec_onoff_t nopal443_;
thedo 166:3a9487d57a5c 355 vdec_onoff_t nosecam_;
thedo 166:3a9487d57a5c 356 /* ACC level setting */
thedo 166:3a9487d57a5c 357 uint16_t acclevel;
thedo 166:3a9487d57a5c 358 /* AGC level setting */
thedo 166:3a9487d57a5c 359 uint16_t agclevel;
thedo 166:3a9487d57a5c 360 /* Y/C separation setting */
thedo 166:3a9487d57a5c 361 uint16_t k15;
thedo 166:3a9487d57a5c 362 uint16_t k13;
thedo 166:3a9487d57a5c 363 uint16_t k11;
thedo 166:3a9487d57a5c 364 uint16_t k16;
thedo 166:3a9487d57a5c 365 uint16_t k14;
thedo 166:3a9487d57a5c 366 uint16_t k12;
thedo 166:3a9487d57a5c 367 uint16_t k22A;
thedo 166:3a9487d57a5c 368 uint16_t k21A;
thedo 166:3a9487d57a5c 369 uint16_t k22B;
thedo 166:3a9487d57a5c 370 uint16_t k21B;
thedo 166:3a9487d57a5c 371 uint16_t k23B;
thedo 166:3a9487d57a5c 372 uint16_t k23A;
thedo 166:3a9487d57a5c 373 uint16_t k24;
thedo 166:3a9487d57a5c 374 vdec_onoff_t det2_on;
thedo 166:3a9487d57a5c 375 vdec_filmix_ratio_t hsel_mix_y;
thedo 166:3a9487d57a5c 376 vdec_filmix_ratio_t vsel_mix_y;
thedo 166:3a9487d57a5c 377 vdec_filmix_ratio_t hvsel_mix_y;
thedo 166:3a9487d57a5c 378 vdec_filmix_ratio_t det2_mix_c;
thedo 166:3a9487d57a5c 379 vdec_filmix_ratio_t det2_mix_y;
thedo 166:3a9487d57a5c 380 vdec_2dfil_mdsel_t fil2_mode_2d;
thedo 166:3a9487d57a5c 381 vdec_2d_fil_sel_t fil2_narrow_2d;
thedo 166:3a9487d57a5c 382 } video_recmd_val_t;
thedo 166:3a9487d57a5c 383
thedo 166:3a9487d57a5c 384
thedo 166:3a9487d57a5c 385 /******************************************************************************
thedo 166:3a9487d57a5c 386 Imported global variables and functions (from other files)
thedo 166:3a9487d57a5c 387 ******************************************************************************/
thedo 166:3a9487d57a5c 388
thedo 166:3a9487d57a5c 389 /******************************************************************************
thedo 166:3a9487d57a5c 390 Exported global variables and functions (to be accessed by other files)
thedo 166:3a9487d57a5c 391 ******************************************************************************/
thedo 166:3a9487d57a5c 392
thedo 166:3a9487d57a5c 393 /******************************************************************************
thedo 166:3a9487d57a5c 394 Private global variables and functions
thedo 166:3a9487d57a5c 395 ******************************************************************************/
thedo 166:3a9487d57a5c 396 static void Input(const graphics_col_sys_t color_system, const vdec_channel_t channel);
thedo 166:3a9487d57a5c 397 static void SyncSep(const graphics_col_sys_t color_system, const vdec_channel_t channel);
thedo 166:3a9487d57a5c 398 static void YcSep(const graphics_col_sys_t color_system, const vdec_channel_t channel);
thedo 166:3a9487d57a5c 399 static void ChromaDec(const graphics_col_sys_t color_system, const vdec_channel_t channel);
thedo 166:3a9487d57a5c 400 static void DigitalClamp(const vdec_channel_t channel);
thedo 166:3a9487d57a5c 401 static void Output(const vdec_channel_t channel);
thedo 166:3a9487d57a5c 402
thedo 166:3a9487d57a5c 403 static void init_func(const uint32_t user_num);
thedo 166:3a9487d57a5c 404
thedo 166:3a9487d57a5c 405 static const video_recmd_val_t RecommendedValue[GRPH_COL_SYS_NUM] = {
thedo 166:3a9487d57a5c 406 { /* NTSC-3.58 */
thedo 166:3a9487d57a5c 407 /* Capturing position setting */
thedo 166:3a9487d57a5c 408 SRCLEFT_NTSC_3_58, SRCTOP_NTSC_3_58, SRCHEIGHT_NTSC_3_58, SRCWIDTH_NTSC_3_58,
thedo 166:3a9487d57a5c 409 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 410 HAFCTYP_NTSC_3_58, HAFCMAX_NTSC_3_58, HAFCMIN_NTSC_3_58,
thedo 166:3a9487d57a5c 411 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 412 VDEC_OFF, VDEC_ON, VDEC_VCD_FRQ_59_94HZ, VCDWINDOW_NTSC_3_58, VCDOFFSET_NTSC_3_58,
thedo 166:3a9487d57a5c 413 /* BCO setting */
thedo 166:3a9487d57a5c 414 VDEC_COL_SYS_NTSC, VDEC_ON, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF,
thedo 166:3a9487d57a5c 415 /* ACC level setting */
thedo 166:3a9487d57a5c 416 ACCLEVEL_NTSC_3_58,
thedo 166:3a9487d57a5c 417 /* AGC level setting */
thedo 166:3a9487d57a5c 418 AGCLEVEL_NTSC_3_58,
thedo 166:3a9487d57a5c 419 /* Y/C separation setting */
thedo 166:3a9487d57a5c 420 K15_NTSC_3_58, K13_NTSC_3_58, K11_NTSC_3_58, K16_NTSC_3_58, K14_NTSC_3_58, K12_NTSC_3_58,
thedo 166:3a9487d57a5c 421 K22A_NTSC_3_58, K21A_NTSC_3_58, K22B_NTSC_3_58, K21B_NTSC_3_58, K23B_NTSC_3_58, K23A_NTSC_3_58, K24_NTSC_3_58,
thedo 166:3a9487d57a5c 422 VDEC_ON, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 423 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_25, VDEC_2DFIL_MDSEL_CASCADE, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 424 },
thedo 166:3a9487d57a5c 425 { /* NTSC-4.43 */
thedo 166:3a9487d57a5c 426 /* Capturing position setting */
thedo 166:3a9487d57a5c 427 SRCLEFT_NTSC_4_43, SRCTOP_NTSC_4_43, SRCHEIGHT_NTSC_4_43, SRCWIDTH_NTSC_4_43,
thedo 166:3a9487d57a5c 428 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 429 HAFCTYP_NTSC_4_43, HAFCMAX_NTSC_4_43, HAFCMIN_NTSC_4_43,
thedo 166:3a9487d57a5c 430 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 431 VDEC_ON, VDEC_OFF, VDEC_VCD_FRQ_50HZ, VCDWINDOW_NTSC_4_43, VCDOFFSET_NTSC_4_43,
thedo 166:3a9487d57a5c 432 /* BCO setting */
thedo 166:3a9487d57a5c 433 VDEC_COL_SYS_NTSC, VDEC_OFF, VDEC_ON, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF,
thedo 166:3a9487d57a5c 434 /* ACC level setting */
thedo 166:3a9487d57a5c 435 ACCLEVEL_NTSC_4_43,
thedo 166:3a9487d57a5c 436 /* AGC level setting */
thedo 166:3a9487d57a5c 437 AGCLEVEL_NTSC_4_43,
thedo 166:3a9487d57a5c 438 /* Y/C separation setting */
thedo 166:3a9487d57a5c 439 K15_NTSC_4_43, K13_NTSC_4_43, K11_NTSC_4_43, K16_NTSC_4_43, K14_NTSC_4_43, K12_NTSC_4_43,
thedo 166:3a9487d57a5c 440 K22A_NTSC_4_43, K21A_NTSC_4_43, K22B_NTSC_4_43, K21B_NTSC_4_43, K23B_NTSC_4_43, K23A_NTSC_4_43, K24_NTSC_4_43,
thedo 166:3a9487d57a5c 441 VDEC_ON, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 442 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_25, VDEC_2DFIL_MDSEL_CASCADE, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 443 },
thedo 166:3a9487d57a5c 444 { /* PAL-4.43 */
thedo 166:3a9487d57a5c 445 /* Capturing position setting */
thedo 166:3a9487d57a5c 446 SRCLEFT_PAL_4_43, SRCTOP_PAL_4_43, SRCHEIGHT_PAL_4_43, SRCWIDTH_PAL_4_43,
thedo 166:3a9487d57a5c 447 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 448 HAFCTYP_PAL_4_43, HAFCMAX_PAL_4_43, HAFCMIN_PAL_4_43,
thedo 166:3a9487d57a5c 449 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 450 VDEC_ON, VDEC_OFF, VDEC_VCD_FRQ_50HZ, VCDWINDOW_PAL_4_43, VCDOFFSET_PAL_4_43,
thedo 166:3a9487d57a5c 451 /* BCO setting */
thedo 166:3a9487d57a5c 452 VDEC_COL_SYS_PAL, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_ON, VDEC_OFF,
thedo 166:3a9487d57a5c 453 /* ACC level setting */
thedo 166:3a9487d57a5c 454 ACCLEVEL_PAL_4_43,
thedo 166:3a9487d57a5c 455 /* AGC level setting */
thedo 166:3a9487d57a5c 456 AGCLEVEL_PAL_4_43,
thedo 166:3a9487d57a5c 457 /* Y/C separation setting */
thedo 166:3a9487d57a5c 458 K15_PAL_4_43, K13_PAL_4_43, K11_PAL_4_43, K16_PAL_4_43, K14_PAL_4_43, K12_PAL_4_43,
thedo 166:3a9487d57a5c 459 K22A_PAL_4_43, K21A_PAL_4_43, K22B_PAL_4_43, K21B_PAL_4_43, K23B_PAL_4_43, K23A_PAL_4_43, K24_PAL_4_43,
thedo 166:3a9487d57a5c 460 VDEC_OFF, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 461 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_2DFIL_MDSEL_BYPASS, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 462 },
thedo 166:3a9487d57a5c 463 { /* PAL-M */
thedo 166:3a9487d57a5c 464 /* Capturing position setting */
thedo 166:3a9487d57a5c 465 SRCLEFT_PAL_M, SRCTOP_PAL_M, SRCHEIGHT_PAL_M, SRCWIDTH_PAL_M,
thedo 166:3a9487d57a5c 466 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 467 HAFCTYP_PAL_M, HAFCMAX_PAL_M, HAFCMIN_PAL_M,
thedo 166:3a9487d57a5c 468 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 469 VDEC_OFF, VDEC_ON, VDEC_VCD_FRQ_59_94HZ, VCDWINDOW_PAL_M, VCDOFFSET_PAL_M,
thedo 166:3a9487d57a5c 470 /* BCO setting */
thedo 166:3a9487d57a5c 471 VDEC_COL_SYS_PAL, VDEC_OFF, VDEC_OFF, VDEC_ON, VDEC_OFF, VDEC_OFF, VDEC_OFF,
thedo 166:3a9487d57a5c 472 /* ACC level setting */
thedo 166:3a9487d57a5c 473 ACCLEVEL_PAL_M,
thedo 166:3a9487d57a5c 474 /* AGC level setting */
thedo 166:3a9487d57a5c 475 AGCLEVEL_PAL_M,
thedo 166:3a9487d57a5c 476 /* Y/C separation setting */
thedo 166:3a9487d57a5c 477 K15_PAL_M, K13_PAL_M, K11_PAL_M, K16_PAL_M, K14_PAL_M, K12_PAL_M,
thedo 166:3a9487d57a5c 478 K22A_PAL_M, K21A_PAL_M, K22B_PAL_M, K21B_PAL_M, K23B_PAL_M, K23A_PAL_M, K24_PAL_M,
thedo 166:3a9487d57a5c 479 VDEC_OFF, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 480 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_2DFIL_MDSEL_BYPASS, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 481 },
thedo 166:3a9487d57a5c 482 { /* PAL-N */
thedo 166:3a9487d57a5c 483 /* Capturing position setting */
thedo 166:3a9487d57a5c 484 SRCLEFT_PAL_N, SRCTOP_PAL_N, SRCHEIGHT_PAL_N, SRCWIDTH_PAL_N,
thedo 166:3a9487d57a5c 485 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 486 HAFCTYP_PAL_N, HAFCMAX_PAL_N, HAFCMIN_PAL_N,
thedo 166:3a9487d57a5c 487 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 488 VDEC_ON, VDEC_OFF, VDEC_VCD_FRQ_50HZ, VCDWINDOW_PAL_N, VCDOFFSET_PAL_N,
thedo 166:3a9487d57a5c 489 /* BCO setting */
thedo 166:3a9487d57a5c 490 VDEC_COL_SYS_PAL, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_ON, VDEC_OFF, VDEC_OFF,
thedo 166:3a9487d57a5c 491 /* ACC level setting */
thedo 166:3a9487d57a5c 492 ACCLEVEL_PAL_N,
thedo 166:3a9487d57a5c 493 /* AGC level setting */
thedo 166:3a9487d57a5c 494 AGCLEVEL_PAL_N,
thedo 166:3a9487d57a5c 495 /* Y/C separation setting */
thedo 166:3a9487d57a5c 496 K15_PAL_N, K13_PAL_N, K11_PAL_N, K16_PAL_N, K14_PAL_N, K12_PAL_N,
thedo 166:3a9487d57a5c 497 K22A_PAL_N, K21A_PAL_N, K22B_PAL_N, K21B_PAL_N, K23B_PAL_N, K23A_PAL_N, K24_PAL_N,
thedo 166:3a9487d57a5c 498 VDEC_OFF, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 499 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_2DFIL_MDSEL_BYPASS, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 500 },
thedo 166:3a9487d57a5c 501 { /* SECAM */
thedo 166:3a9487d57a5c 502 /* Capturing position setting */
thedo 166:3a9487d57a5c 503 SRCLEFT_SECAM, SRCTOP_SECAM, SRCHEIGHT_SECAM, SRCWIDTH_SECAM,
thedo 166:3a9487d57a5c 504 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 505 HAFCTYP_SECAM, HAFCMAX_SECAM, HAFCMIN_SECAM,
thedo 166:3a9487d57a5c 506 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 507 VDEC_ON, VDEC_OFF, VDEC_VCD_FRQ_50HZ, VCDWINDOW_SECAM, VCDOFFSET_SECAM,
thedo 166:3a9487d57a5c 508 /* BCO setting */
thedo 166:3a9487d57a5c 509 VDEC_COL_SYS_SECAM, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_ON,
thedo 166:3a9487d57a5c 510 /* ACC level setting */
thedo 166:3a9487d57a5c 511 ACCLEVEL_SECAM,
thedo 166:3a9487d57a5c 512 /* AGC level setting */
thedo 166:3a9487d57a5c 513 AGCLEVEL_SECAM,
thedo 166:3a9487d57a5c 514 /* Y/C separation setting */
thedo 166:3a9487d57a5c 515 K15_SECAM, K13_SECAM, K11_SECAM, K16_SECAM, K14_SECAM, K12_SECAM,
thedo 166:3a9487d57a5c 516 K22A_SECAM, K21A_SECAM, K22B_SECAM, K21B_SECAM, K23B_SECAM, K23A_SECAM, K24_SECAM,
thedo 166:3a9487d57a5c 517 VDEC_ON, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 518 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_2DFIL_MDSEL_CASCADE, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 519 },
thedo 166:3a9487d57a5c 520 { /* NTSC-4.43 (60Hz) */
thedo 166:3a9487d57a5c 521 /* Capturing position setting */
thedo 166:3a9487d57a5c 522 SRCLEFT_NTSC_443_60, SRCTOP_NTSC_443_60, SRCHEIGHT_NTSC_443_60, SRCWIDTH_NTSC_443_60,
thedo 166:3a9487d57a5c 523 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 524 HAFCTYP_NTSC_443_60, HAFCMAX_NTSC_443_60, HAFCMIN_NTSC_443_60,
thedo 166:3a9487d57a5c 525 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 526 VDEC_OFF, VDEC_ON, VDEC_VCD_FRQ_59_94HZ, VCDWINDOW_NTSC_443_60, VCDOFFSET_NTSC_443_60,
thedo 166:3a9487d57a5c 527 /* BCO setting */
thedo 166:3a9487d57a5c 528 VDEC_COL_SYS_NTSC, VDEC_OFF, VDEC_ON, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF,
thedo 166:3a9487d57a5c 529 /* ACC level setting */
thedo 166:3a9487d57a5c 530 ACCLEVEL_NTSC_443_60,
thedo 166:3a9487d57a5c 531 /* AGC level setting */
thedo 166:3a9487d57a5c 532 AGCLEVEL_NTSC_443_60,
thedo 166:3a9487d57a5c 533 /* Y/C separation setting */
thedo 166:3a9487d57a5c 534 K15_NTSC_443_60, K13_NTSC_443_60, K11_NTSC_443_60, K16_NTSC_443_60, K14_NTSC_443_60, K12_NTSC_443_60,
thedo 166:3a9487d57a5c 535 K22A_NTSC_443_60, K21A_NTSC_443_60, K22B_NTSC_443_60, K21B_NTSC_443_60, K23B_NTSC_443_60, K23A_NTSC_443_60,
thedo 166:3a9487d57a5c 536 K24_NTSC_443_60,
thedo 166:3a9487d57a5c 537 VDEC_ON, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_75, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 538 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_25, VDEC_2DFIL_MDSEL_CASCADE, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 539 },
thedo 166:3a9487d57a5c 540 { /* PAL-60 */
thedo 166:3a9487d57a5c 541 /* Capturing position setting */
thedo 166:3a9487d57a5c 542 SRCLEFT_PAL_60, SRCTOP_PAL_60, SRCHEIGHT_PAL_60, SRCWIDTH_PAL_60,
thedo 166:3a9487d57a5c 543 /* Horizontal AFC setting */
thedo 166:3a9487d57a5c 544 HAFCTYP_PAL_60, HAFCMAX_PAL_60, HAFCMIN_PAL_60,
thedo 166:3a9487d57a5c 545 /* Vertical countdown setting */
thedo 166:3a9487d57a5c 546 VDEC_OFF, VDEC_ON, VDEC_VCD_FRQ_59_94HZ, VCDWINDOW_PAL_60, VCDOFFSET_PAL_60,
thedo 166:3a9487d57a5c 547 /* BCO setting */
thedo 166:3a9487d57a5c 548 VDEC_COL_SYS_PAL, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_OFF, VDEC_ON, VDEC_OFF,
thedo 166:3a9487d57a5c 549 /* ACC level setting */
thedo 166:3a9487d57a5c 550 ACCLEVEL_PAL_60,
thedo 166:3a9487d57a5c 551 /* AGC level setting */
thedo 166:3a9487d57a5c 552 AGCLEVEL_PAL_60,
thedo 166:3a9487d57a5c 553 /* Y/C separation setting */
thedo 166:3a9487d57a5c 554 K15_PAL_60, K13_PAL_60, K11_PAL_60, K16_PAL_60, K14_PAL_60, K12_PAL_60,
thedo 166:3a9487d57a5c 555 K22A_PAL_60, K21A_PAL_60, K22B_PAL_60, K21B_PAL_60, K23B_PAL_60, K23A_PAL_60, K24_PAL_60,
thedo 166:3a9487d57a5c 556 VDEC_OFF, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0,
thedo 166:3a9487d57a5c 557 VDEC_FILMIX_RATIO_0, VDEC_FILMIX_RATIO_0, VDEC_2DFIL_MDSEL_BYPASS, VDEC_2D_FIL_SEL_17TAP
thedo 166:3a9487d57a5c 558 }
thedo 166:3a9487d57a5c 559 };
thedo 166:3a9487d57a5c 560 /* Two-Dimensional Cascade Broadband and Narrowband (3.58/4.43) Filter TAP Coefficient */
thedo 166:3a9487d57a5c 561 static const vdec_chrfil_tap_t wana_ntsc = {
thedo 166:3a9487d57a5c 562 {
thedo 166:3a9487d57a5c 563 (uint16_t)24u, (uint16_t)44u, (uint16_t)20u, (uint16_t)(0x1000u | 52u), (uint16_t)(0x1000u | 128u),
thedo 166:3a9487d57a5c 564 (uint16_t)(0x1000u | 128u), (uint16_t)(0x1000u | 12u), (uint16_t)132u, (uint16_t)200u
thedo 166:3a9487d57a5c 565 }
thedo 166:3a9487d57a5c 566 };
thedo 166:3a9487d57a5c 567 /* Two-Dimensional Cascade Broadband (SECAM-DR) Filter TAP Coefficient */
thedo 166:3a9487d57a5c 568 static const vdec_chrfil_tap_t wa_secam = {
thedo 166:3a9487d57a5c 569 {
thedo 166:3a9487d57a5c 570 (uint16_t)(0x1000u | 20u), (uint16_t)24u, (uint16_t)64u, (uint16_t)40u, (uint16_t)(0x1000u | 76u),
thedo 166:3a9487d57a5c 571 (uint16_t)(0x1000u | 164u), (uint16_t)(0x1000u | 84u), (uint16_t)108u, (uint16_t)216u
thedo 166:3a9487d57a5c 572 }
thedo 166:3a9487d57a5c 573 };
thedo 166:3a9487d57a5c 574 /* Two-Dimensional Cascade Broadband (SECAM-DB) Filter TAP Coefficient */
thedo 166:3a9487d57a5c 575 static const vdec_chrfil_tap_t wb_secam = {
thedo 166:3a9487d57a5c 576 {
thedo 166:3a9487d57a5c 577 (uint16_t)(0x1000u | 12u), (uint16_t)40u, (uint16_t)60u, (uint16_t)12u, (uint16_t)(0x1000u | 104u),
thedo 166:3a9487d57a5c 578 (uint16_t)(0x1000u | 156u), (uint16_t)(0x1000u | 64u), (uint16_t)120u, (uint16_t)208u
thedo 166:3a9487d57a5c 579 }
thedo 166:3a9487d57a5c 580 };
thedo 166:3a9487d57a5c 581 /* Two-Dimensional Cascade Narrowband (SECAM-DR) Filter TAP Coefficient */
thedo 166:3a9487d57a5c 582 static const vdec_chrfil_tap_t na_secam = {
thedo 166:3a9487d57a5c 583 {
thedo 166:3a9487d57a5c 584 (uint16_t)(0x1000u | 1008u), (uint16_t)1976u, (uint16_t)(0x1000u | 2024u), (uint16_t)444u, (uint16_t)1868u,
thedo 166:3a9487d57a5c 585 (uint16_t)(0x1000u | 2864u), (uint16_t)1352u, (uint16_t)1376u, (uint16_t)(0x1000u | 2240u)
thedo 166:3a9487d57a5c 586 }
thedo 166:3a9487d57a5c 587 };
thedo 166:3a9487d57a5c 588 /* Two-Dimensional Cascade Narrowband (SECAM-DB) Filter TAP Coefficient */
thedo 166:3a9487d57a5c 589 static const vdec_chrfil_tap_t nb_secam = {
thedo 166:3a9487d57a5c 590 {
thedo 166:3a9487d57a5c 591 (uint16_t)(0x1000u | 1080u), (uint16_t)2800u, (uint16_t)(0x1000u | 3308u), (uint16_t)1628u, (uint16_t)1444u,
thedo 166:3a9487d57a5c 592 (uint16_t)(0x1000u | 3308u), (uint16_t)2140u, (uint16_t)376u, (uint16_t)(0x1000u | 1384u)
thedo 166:3a9487d57a5c 593 }
thedo 166:3a9487d57a5c 594 };
thedo 166:3a9487d57a5c 595
thedo 166:3a9487d57a5c 596
thedo 166:3a9487d57a5c 597 /**************************************************************************//**
thedo 166:3a9487d57a5c 598 * @brief Video decoder initialization
thedo 166:3a9487d57a5c 599 * @param [in]adc_vinsel : Input pin control
thedo 166:3a9487d57a5c 600 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 601 * @retval Detected color system
thedo 166:3a9487d57a5c 602 *****************************************************************************/
thedo 166:3a9487d57a5c 603 vdec_error_t GRAPHICS_VideoDecoderInit (const vdec_adc_vinsel_t adc_vinsel, const vdec_channel_t channel, graphics_col_sys_t col_sys)
thedo 166:3a9487d57a5c 604 {
thedo 166:3a9487d57a5c 605 vdec_error_t error = VDEC_OK;
thedo 166:3a9487d57a5c 606
thedo 166:3a9487d57a5c 607 /* Video Decoder Driver Initialization */
thedo 166:3a9487d57a5c 608 error = R_VDEC_Initialize(channel, adc_vinsel, &init_func, (uint32_t)channel);
thedo 166:3a9487d57a5c 609 if (error == VDEC_OK) {
thedo 166:3a9487d57a5c 610 if (col_sys != GRPH_COL_SYS_UNKNOWN) {
thedo 166:3a9487d57a5c 611 /* Input */
thedo 166:3a9487d57a5c 612 Input(col_sys, channel);
thedo 166:3a9487d57a5c 613 /* Sync separation */
thedo 166:3a9487d57a5c 614 SyncSep(col_sys, channel);
thedo 166:3a9487d57a5c 615 /* Y/C separation */
thedo 166:3a9487d57a5c 616 YcSep(col_sys, channel);
thedo 166:3a9487d57a5c 617 /* Chroma decoding */
thedo 166:3a9487d57a5c 618 ChromaDec(col_sys, channel);
thedo 166:3a9487d57a5c 619 /* Digital clamp */
thedo 166:3a9487d57a5c 620 DigitalClamp(channel);
thedo 166:3a9487d57a5c 621 /* Output */
thedo 166:3a9487d57a5c 622 Output(channel);
thedo 166:3a9487d57a5c 623 } else {
thedo 166:3a9487d57a5c 624 error = VDEC_ERR_PARAM;
thedo 166:3a9487d57a5c 625 }
thedo 166:3a9487d57a5c 626 }
thedo 166:3a9487d57a5c 627 return error;
thedo 166:3a9487d57a5c 628 } /* End of function GRAPHICS_VideoDecoderInit() */
thedo 166:3a9487d57a5c 629
thedo 166:3a9487d57a5c 630
thedo 166:3a9487d57a5c 631 /**************************************************************************//**
thedo 166:3a9487d57a5c 632 * @brief User-defined function
thedo 166:3a9487d57a5c 633 * @param [in]user_num
thedo 166:3a9487d57a5c 634 * @retval None
thedo 166:3a9487d57a5c 635 *****************************************************************************/
thedo 166:3a9487d57a5c 636 static void init_func (const uint32_t user_num)
thedo 166:3a9487d57a5c 637 {
thedo 166:3a9487d57a5c 638 uint32_t reg_data;
thedo 166:3a9487d57a5c 639 volatile uint8_t dummy_read;
thedo 166:3a9487d57a5c 640
thedo 166:3a9487d57a5c 641 reg_data = (uint32_t)CPG.STBCR7;
thedo 166:3a9487d57a5c 642 if ((vdec_channel_t)user_num == VDEC_CHANNEL_0) {
thedo 166:3a9487d57a5c 643 /* Standby control register 7 (STBCR7)
thedo 166:3a9487d57a5c 644 b7 0-------; MSTP77 : 0 : Video decoder channel 0 enable */
thedo 166:3a9487d57a5c 645 reg_data &= (uint32_t)~STBCR7_BIT7;
thedo 166:3a9487d57a5c 646 } else {
thedo 166:3a9487d57a5c 647 /* Standby control register 7 (STBCR7)
thedo 166:3a9487d57a5c 648 b6 -0------; MSTP76 : 0 : Video decoder channel 1 enable */
thedo 166:3a9487d57a5c 649 reg_data &= (uint32_t)~STBCR7_BIT6;
thedo 166:3a9487d57a5c 650 }
thedo 166:3a9487d57a5c 651 CPG.STBCR7 = (uint8_t)reg_data;
thedo 166:3a9487d57a5c 652 /* In order to reflect the change, a dummy read should be done. */
thedo 166:3a9487d57a5c 653 dummy_read = CPG.STBCR7;
thedo 166:3a9487d57a5c 654 } /* End of function init_func() */
thedo 166:3a9487d57a5c 655
thedo 166:3a9487d57a5c 656 /**************************************************************************//**
thedo 166:3a9487d57a5c 657 * @brief Video decoder input setup
thedo 166:3a9487d57a5c 658 * @param [in]color_system : Color system
thedo 166:3a9487d57a5c 659 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 660 * @retval None
thedo 166:3a9487d57a5c 661 *****************************************************************************/
thedo 166:3a9487d57a5c 662 static void Input (const graphics_col_sys_t color_system, const vdec_channel_t channel)
thedo 166:3a9487d57a5c 663 {
thedo 166:3a9487d57a5c 664 vdec_error_t error;
thedo 166:3a9487d57a5c 665 vdec_active_period_t param;
thedo 166:3a9487d57a5c 666 const video_recmd_val_t * RecommendValTbl;
thedo 166:3a9487d57a5c 667
thedo 166:3a9487d57a5c 668 RecommendValTbl = &RecommendedValue[color_system];
thedo 166:3a9487d57a5c 669
thedo 166:3a9487d57a5c 670 param.srcleft = RecommendValTbl->srcleft; /* Left end of input video signal capturing area */
thedo 166:3a9487d57a5c 671 param.srctop = RecommendValTbl->srctop; /* Top end of input video signal capturing area */
thedo 166:3a9487d57a5c 672 param.srcheight = RecommendValTbl->srcheight; /* Height of input video signal capturing area */
thedo 166:3a9487d57a5c 673 param.srcwidth = RecommendValTbl->srcwidth; /* Width of input video signal capturing area */
thedo 166:3a9487d57a5c 674 /* Video decoder driver input */
thedo 166:3a9487d57a5c 675 error = R_VDEC_ActivePeriod(channel, &param);
thedo 166:3a9487d57a5c 676 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 677 }
thedo 166:3a9487d57a5c 678 } /* End of function Input() */
thedo 166:3a9487d57a5c 679
thedo 166:3a9487d57a5c 680 /**************************************************************************//**
thedo 166:3a9487d57a5c 681 * @brief Video decoder sync separation setup
thedo 166:3a9487d57a5c 682 * @param [in]color_system : Color system
thedo 166:3a9487d57a5c 683 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 684 * @retval None
thedo 166:3a9487d57a5c 685 *****************************************************************************/
thedo 166:3a9487d57a5c 686 static void SyncSep (const graphics_col_sys_t color_system, const vdec_channel_t channel)
thedo 166:3a9487d57a5c 687 {
thedo 166:3a9487d57a5c 688 vdec_error_t error;
thedo 166:3a9487d57a5c 689 vdec_sync_separation_t param;
thedo 166:3a9487d57a5c 690 vdec_noise_rd_lpf_t noise_rd_lpf_tmp;
thedo 166:3a9487d57a5c 691 vdec_sync_slicer_t sync_slicer_tmp;
thedo 166:3a9487d57a5c 692 vdec_horizontal_afc_t horizontal_afc_tmp;
thedo 166:3a9487d57a5c 693 vdec_vcount_down_t vcount_down_tmp;
thedo 166:3a9487d57a5c 694 vdec_agc_t agc_tmp;
thedo 166:3a9487d57a5c 695 vdec_peak_limiter_t peak_limiter_tmp;
thedo 166:3a9487d57a5c 696 const video_recmd_val_t * RecommendValTbl;
thedo 166:3a9487d57a5c 697
thedo 166:3a9487d57a5c 698 RecommendValTbl = &RecommendedValue[color_system];
thedo 166:3a9487d57a5c 699
thedo 166:3a9487d57a5c 700 /* Noise reduction LPF */
thedo 166:3a9487d57a5c 701 noise_rd_lpf_tmp.lpfvsync = VDEC_LPF_VSYNC_0_54; /* LPF cutoff frequency before vertical sync separation */
thedo 166:3a9487d57a5c 702 noise_rd_lpf_tmp.lpfhsync = VDEC_LPF_HSYNC_0_94; /* LPF cutoff frequency before horizontal sync separation */
thedo 166:3a9487d57a5c 703 /* Sync slicer */
thedo 166:3a9487d57a5c 704 sync_slicer_tmp.velocityshift_h = VDEC_VELOCITY_SHIFT_4; /* Reference level operation speed control for
thedo 166:3a9487d57a5c 705 composite sync separation (for Hsync signal) */
thedo 166:3a9487d57a5c 706 sync_slicer_tmp.slicermode_h = VDEC_SLICE_MODE_AUTO_50; /* Auto-slice level setting for composite sync
thedo 166:3a9487d57a5c 707 separator circuit (for Hsync signal) */
thedo 166:3a9487d57a5c 708 sync_slicer_tmp.slicermode_v = VDEC_SLICE_MODE_AUTO_50; /* Auto-slice level setting for composite sync
thedo 166:3a9487d57a5c 709 separation circuit (for Vsync signal) */
thedo 166:3a9487d57a5c 710 sync_slicer_tmp.syncmaxduty_h = SYNCMAXDUTY_H_VALUE; /* Max ratio of horizontal cycle to horizontal sync
thedo 166:3a9487d57a5c 711 signal pulse width (for Hsync signal) */
thedo 166:3a9487d57a5c 712 sync_slicer_tmp.syncminduty_h = SYNCMINDUTY_H_VALUE; /* Min ratio of horizontal cycle to horizontal sync
thedo 166:3a9487d57a5c 713 signal pulse width (for Hsync signal) */
thedo 166:3a9487d57a5c 714 sync_slicer_tmp.ssclipsel = VDEC_CLIP_LV_1023; /* Clipping level */
thedo 166:3a9487d57a5c 715 sync_slicer_tmp.csyncslice_h = CSYNCSLICE_H_VALUE; /* Slice level for composite sync
thedo 166:3a9487d57a5c 716 signal separation (for Hsync signal) */
thedo 166:3a9487d57a5c 717 sync_slicer_tmp.syncmaxduty_v = SYNCMAXDUTY_V_VALUE; /* Max ratio of horizontal cycle to horizontal sync
thedo 166:3a9487d57a5c 718 signal pulse width (for Vsync signal) */
thedo 166:3a9487d57a5c 719 sync_slicer_tmp.syncminduty_v = SYNCMINDUTY_V_VALUE; /* Min ratio of horizontal cycle to horizontal sync
thedo 166:3a9487d57a5c 720 signal pulse width (for Vsync signal) */
thedo 166:3a9487d57a5c 721 sync_slicer_tmp.vsyncdelay = VDEC_OFF; /* Delays the separated vertical sync signal for
thedo 166:3a9487d57a5c 722 1/4 horizontal cycle */
thedo 166:3a9487d57a5c 723 sync_slicer_tmp.vsyncslice = VSYNCSLICE_VALUE; /* Threshold for vertical sync separation */
thedo 166:3a9487d57a5c 724 sync_slicer_tmp.csyncslice_v = CSYNCSLICE_V_VALUE; /* Slice level for composite sync
thedo 166:3a9487d57a5c 725 signal separation (for Vsync signal) */
thedo 166:3a9487d57a5c 726 /* Horizontal AFC */
thedo 166:3a9487d57a5c 727 horizontal_afc_tmp.hafcgain = HAFCGAIN_VALUE; /* Horizontal AFC loop gain */
thedo 166:3a9487d57a5c 728 horizontal_afc_tmp.hafctyp = RecommendValTbl->hafctyp; /* Horizontal AFC center oscillation frequency */
thedo 166:3a9487d57a5c 729 horizontal_afc_tmp.hafcstart = HAFCSTART_VALUE; /* Start line of horizontal AFC normal operation */
thedo 166:3a9487d57a5c 730 horizontal_afc_tmp.nox2hosc = VDEC_ON; /* Disable of horizontal AFC double speed detection */
thedo 166:3a9487d57a5c 731 horizontal_afc_tmp.hafcmax = RecommendValTbl->hafcmax; /* Maximum oscillation frequency of horizontal AFC */
thedo 166:3a9487d57a5c 732 horizontal_afc_tmp.hafcend = HAFCEND_VALUE; /* End line of horizontal AFC normal operation */
thedo 166:3a9487d57a5c 733 horizontal_afc_tmp.hafcmode = VDEC_HAFCMD_AUTO_PHST; /* Horizontal AFC VBI period operating mode */
thedo 166:3a9487d57a5c 734 horizontal_afc_tmp.hafcmin = RecommendValTbl->hafcmin; /* Min oscillation frequency of horizontal AFC */
thedo 166:3a9487d57a5c 735 horizontal_afc_tmp.phdet_fix = VDEC_OFF; /* Forcible or LOWGAIN control */
thedo 166:3a9487d57a5c 736 horizontal_afc_tmp.phdet_div = VDEC_PHDET_DIV_1_32; /* Phase comparator feedback adjust for
thedo 166:3a9487d57a5c 737 low sync signal lock stability */
thedo 166:3a9487d57a5c 738 /* Vertical countdown */
thedo 166:3a9487d57a5c 739 vcount_down_tmp.novcd50_ = RecommendValTbl->novcd50_; /* Vertical countdown 50-Hz oscillation mode */
thedo 166:3a9487d57a5c 740 vcount_down_tmp.novcd60_ = RecommendValTbl->novcd60_; /* Vertical countdown 60-Hz (59.94-Hz)
thedo 166:3a9487d57a5c 741 oscillation mode */
thedo 166:3a9487d57a5c 742 vcount_down_tmp.vcddefault = RecommendValTbl->vcddefault; /* Vertical countdown center oscillation frequency */
thedo 166:3a9487d57a5c 743 vcount_down_tmp.vcdwindow = RecommendValTbl->vcdwindow; /* Vertical countdown sync area */
thedo 166:3a9487d57a5c 744 vcount_down_tmp.vcdoffset = RecommendValTbl->vcdoffset; /* Vertical countdown minimum oscillation frequency */
thedo 166:3a9487d57a5c 745 /* AGC / PGA */
thedo 166:3a9487d57a5c 746 agc_tmp.agcmode = VDEC_ON; /* A/D converter AGC ON/OFF control & PGA gain select */
thedo 166:3a9487d57a5c 747 agc_tmp.doreduce = VDEC_OFF; /* Manual control of sync signal amplitude detection
thedo 166:3a9487d57a5c 748 during VBI period */
thedo 166:3a9487d57a5c 749 agc_tmp.noreduce_ = VDEC_ON; /* Control of sync signal amplitude detection during VBI period */
thedo 166:3a9487d57a5c 750 agc_tmp.agcresponse = AGCRESPONSE_VALUE; /* AGC response speed */
thedo 166:3a9487d57a5c 751 agc_tmp.agclevel = RecommendValTbl->agclevel;/* Sync signal reference amplitude */
thedo 166:3a9487d57a5c 752 agc_tmp.agcprecis = AGCPRECIS_VALUE; /* AGC gain adjustment accuracy */
thedo 166:3a9487d57a5c 753 agc_tmp.pga_gain = PGA_GAIN_VALUE; /* PGA gain */
thedo 166:3a9487d57a5c 754 /* Peak limiter control */
thedo 166:3a9487d57a5c 755 peak_limiter_tmp.peaklevel = VDEC_PEAKLV_992; /* Peak luminance value to operate peak limiter */
thedo 166:3a9487d57a5c 756 peak_limiter_tmp.peakattack = PEAKATTACK_VALUE; /* Response speed with peak limiter gain decreased */
thedo 166:3a9487d57a5c 757 peak_limiter_tmp.peakrelease = PEAKRELEASE_VALUE; /* Response speed with peak limiter gain increased */
thedo 166:3a9487d57a5c 758 peak_limiter_tmp.peakratio = VDEC_PEAKRATIO_50; /* Maximum compression rate of peak limiter */
thedo 166:3a9487d57a5c 759 peak_limiter_tmp.maxpeaksamples = MAXPEAKSAMPLES_VALUE; /* Allowable number of overflowing pixels */
thedo 166:3a9487d57a5c 760
thedo 166:3a9487d57a5c 761 param.noise_rd_lpf = &noise_rd_lpf_tmp; /* Noise reduction LPF */
thedo 166:3a9487d57a5c 762 param.sync_slicer = &sync_slicer_tmp; /* Sync slicer */
thedo 166:3a9487d57a5c 763 param.horizontal_afc = &horizontal_afc_tmp; /* Horizontal AFC */
thedo 166:3a9487d57a5c 764 param.vcount_down = &vcount_down_tmp; /* Vertical countdown */
thedo 166:3a9487d57a5c 765 param.agc = &agc_tmp; /* AGC / PGA */
thedo 166:3a9487d57a5c 766 param.peak_limiter = &peak_limiter_tmp; /* Peak limiter control */
thedo 166:3a9487d57a5c 767 /* Video decoder driver sync separation */
thedo 166:3a9487d57a5c 768 error = R_VDEC_SyncSeparation(channel, &param);
thedo 166:3a9487d57a5c 769 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 770 }
thedo 166:3a9487d57a5c 771 } /* End of function SyncSep() */
thedo 166:3a9487d57a5c 772
thedo 166:3a9487d57a5c 773 /**************************************************************************//**
thedo 166:3a9487d57a5c 774 * @brief Video decoder Y/C separation setup
thedo 166:3a9487d57a5c 775 * @param [in]color_system : Color system
thedo 166:3a9487d57a5c 776 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 777 * @retval None
thedo 166:3a9487d57a5c 778 *****************************************************************************/
thedo 166:3a9487d57a5c 779 static void YcSep (const graphics_col_sys_t color_system, const vdec_channel_t channel)
thedo 166:3a9487d57a5c 780 {
thedo 166:3a9487d57a5c 781 vdec_error_t error;
thedo 166:3a9487d57a5c 782 vdec_yc_separation_t param;
thedo 166:3a9487d57a5c 783 vdec_over_range_t over_range_tmp;
thedo 166:3a9487d57a5c 784 vdec_yc_sep_ctrl_t yc_sep_ctrl_tmp;
thedo 166:3a9487d57a5c 785 const video_recmd_val_t * RecommendValTbl;
thedo 166:3a9487d57a5c 786
thedo 166:3a9487d57a5c 787 RecommendValTbl = &RecommendedValue[color_system];
thedo 166:3a9487d57a5c 788
thedo 166:3a9487d57a5c 789 /* Over-range control */
thedo 166:3a9487d57a5c 790 over_range_tmp.radj_o_level0 = RADJ_O_LEVEL0_VALUE; /* A/D over-threshold level (between levels 0 and 1) */
thedo 166:3a9487d57a5c 791 over_range_tmp.radj_u_level0 = RADJ_U_LEVEL0_VALUE; /* A/D under-threshold level (between levels 2 and 3) */
thedo 166:3a9487d57a5c 792 over_range_tmp.radj_o_level1 = RADJ_O_LEVEL1_VALUE; /* A/D over-threshold level (between levels 1 and 2) */
thedo 166:3a9487d57a5c 793 over_range_tmp.radj_u_level1 = RADJ_U_LEVEL1_VALUE; /* A/D under-threshold level (between levels 1 and 2) */
thedo 166:3a9487d57a5c 794 over_range_tmp.radj_o_level2 = RADJ_O_LEVEL2_VALUE; /* A/D over-threshold level (between levels 2 and 3) */
thedo 166:3a9487d57a5c 795 over_range_tmp.radj_u_level2 = RADJ_U_LEVEL2_VALUE; /* A/D under-threshold level (between levels 0 and 1) */
thedo 166:3a9487d57a5c 796 over_range_tmp.ucmp_sw = VDEC_ON; /* Over-range detection */
thedo 166:3a9487d57a5c 797 over_range_tmp.dcmp_sw = VDEC_ON; /* Under-range detection */
thedo 166:3a9487d57a5c 798 over_range_tmp.hwide_sw = VDEC_ON; /* Horizontal enlargement of over/under-range level */
thedo 166:3a9487d57a5c 799 /* Y/C separation control */
thedo 166:3a9487d57a5c 800 /* Two-dimensional Y/C separation filter select coefficient */
thedo 166:3a9487d57a5c 801 yc_sep_ctrl_tmp.k15 = RecommendValTbl->k15; /* K15 */
thedo 166:3a9487d57a5c 802 yc_sep_ctrl_tmp.k13 = RecommendValTbl->k13; /* K13 */
thedo 166:3a9487d57a5c 803 yc_sep_ctrl_tmp.k11 = RecommendValTbl->k11; /* K11 */
thedo 166:3a9487d57a5c 804 yc_sep_ctrl_tmp.k16 = RecommendValTbl->k16; /* K16 */
thedo 166:3a9487d57a5c 805 yc_sep_ctrl_tmp.k14 = RecommendValTbl->k14; /* K14 */
thedo 166:3a9487d57a5c 806 yc_sep_ctrl_tmp.k12 = RecommendValTbl->k12; /* K12 */
thedo 166:3a9487d57a5c 807 yc_sep_ctrl_tmp.k22a = RecommendValTbl->k22A; /* K22A */
thedo 166:3a9487d57a5c 808 yc_sep_ctrl_tmp.k21a = RecommendValTbl->k21A; /* K21A */
thedo 166:3a9487d57a5c 809 yc_sep_ctrl_tmp.k22b = RecommendValTbl->k22B; /* K22B */
thedo 166:3a9487d57a5c 810 yc_sep_ctrl_tmp.k21b = RecommendValTbl->k21B; /* K21B */
thedo 166:3a9487d57a5c 811 yc_sep_ctrl_tmp.k23b = RecommendValTbl->k23B; /* K23B */
thedo 166:3a9487d57a5c 812 yc_sep_ctrl_tmp.k23a = RecommendValTbl->k23A; /* K23A */
thedo 166:3a9487d57a5c 813 yc_sep_ctrl_tmp.k24 = RecommendValTbl->k24; /* K24 */
thedo 166:3a9487d57a5c 814 yc_sep_ctrl_tmp.hbpf_narrow = VDEC_LSTG_BPFSEL_BYPASS; /* Latter-stage horizontal BPF select */
thedo 166:3a9487d57a5c 815 yc_sep_ctrl_tmp.hvbpf_narrow = VDEC_LSTG_BPFSEL_BYPASS; /* Latter-stage horizontal/vertical BPF select */
thedo 166:3a9487d57a5c 816 yc_sep_ctrl_tmp.hbpf1_9tap_on = VDEC_FSTG_BPFSEL_17TAP; /* Former-stage horizontal BPF select */
thedo 166:3a9487d57a5c 817 yc_sep_ctrl_tmp.hvbpf1_9tap_on = VDEC_FSTG_BPFSEL_17TAP; /* Former-stage horizontal/vertical BPF select */
thedo 166:3a9487d57a5c 818 yc_sep_ctrl_tmp.hfil_tap_sel = VDEC_HFIL_TAP_SEL_17TAP; /* Horizontal filter and horizontal/vertical filter
thedo 166:3a9487d57a5c 819 bandwidth switch signal */
thedo 166:3a9487d57a5c 820 yc_sep_ctrl_tmp.det2_on = RecommendValTbl->det2_on; /* Two-dimensional filter mixing select */
thedo 166:3a9487d57a5c 821 yc_sep_ctrl_tmp.hsel_mix_y = RecommendValTbl->hsel_mix_y; /* Mixing ratio of signal after passing
thedo 166:3a9487d57a5c 822 horizontal filter to signal after passing
thedo 166:3a9487d57a5c 823 former-stage horizontal filter */
thedo 166:3a9487d57a5c 824 yc_sep_ctrl_tmp.vsel_mix_y = RecommendValTbl->vsel_mix_y; /* Mixing ratio of signal after passing
thedo 166:3a9487d57a5c 825 vertical filter to signal after passing
thedo 166:3a9487d57a5c 826 former-stage horizontal/vertical filter */
thedo 166:3a9487d57a5c 827 yc_sep_ctrl_tmp.hvsel_mix_y = RecommendValTbl->hvsel_mix_y; /* Mixing ratio of signal after passing
thedo 166:3a9487d57a5c 828 horizontal/vertical filter to signal
thedo 166:3a9487d57a5c 829 after passing former-stage
thedo 166:3a9487d57a5c 830 horizontal/vertical filter */
thedo 166:3a9487d57a5c 831 yc_sep_ctrl_tmp.v_y_level = V_Y_LEVEL_VALUE; /* Vertical luminance detection level
thedo 166:3a9487d57a5c 832 for correlation detection filter */
thedo 166:3a9487d57a5c 833 yc_sep_ctrl_tmp.det2_mix_c = RecommendValTbl->det2_mix_c; /* Mixing ratio of c signal after passing
thedo 166:3a9487d57a5c 834 horizontal/vertical adaptive filter
thedo 166:3a9487d57a5c 835 to signal after passing correlation detection
thedo 166:3a9487d57a5c 836 filter */
thedo 166:3a9487d57a5c 837 yc_sep_ctrl_tmp.det2_mix_y = RecommendValTbl->det2_mix_y; /* Mixing ratio of c signal for y generation after
thedo 166:3a9487d57a5c 838 passing horizontal/vertical adaptive filter to
thedo 166:3a9487d57a5c 839 signal after passing correlation */
thedo 166:3a9487d57a5c 840 yc_sep_ctrl_tmp.fil2_mode_2d = RecommendValTbl->fil2_mode_2d;/* Two-dimensional cascade/TAKE-OFF
thedo 166:3a9487d57a5c 841 filter mode select */
thedo 166:3a9487d57a5c 842 yc_sep_ctrl_tmp.fil2_narrow_2d = RecommendValTbl->fil2_narrow_2d; /* Two-dimensional cascade filter select */
thedo 166:3a9487d57a5c 843
thedo 166:3a9487d57a5c 844 param.over_range = &over_range_tmp; /* Over-range control */
thedo 166:3a9487d57a5c 845 param.yc_sep_ctrl = &yc_sep_ctrl_tmp; /* Y/C separation control */
thedo 166:3a9487d57a5c 846 param.fil2_2d_wa = NULL; /* Two-dimensional cascade broadband
thedo 166:3a9487d57a5c 847 (3.58/4.43/SECAM-DR)/TAKE-OFF filter TAP coefficient */
thedo 166:3a9487d57a5c 848 param.fil2_2d_wb = NULL; /* Two-dimensional cascade broadband (SECAM-DB) filter TAP coefficient */
thedo 166:3a9487d57a5c 849 param.fil2_2d_na = NULL; /* Two-dimensional cascade narrowband
thedo 166:3a9487d57a5c 850 (3.58/4.43/SECAM-DR) filter TAP coefficient */
thedo 166:3a9487d57a5c 851 param.fil2_2d_nb = NULL; /* Two-dimensional cascade narrowband (SECAMDB) filter TAP coefficient */
thedo 166:3a9487d57a5c 852 if ((color_system == GRPH_COL_SYS_NTSC_358) ||
thedo 166:3a9487d57a5c 853 (color_system == GRPH_COL_SYS_NTSC_443) ||
thedo 166:3a9487d57a5c 854 (color_system == GRPH_COL_SYS_NTSC_443_60)) {
thedo 166:3a9487d57a5c 855 param.fil2_2d_wa = &wana_ntsc;
thedo 166:3a9487d57a5c 856 param.fil2_2d_na = &wana_ntsc;
thedo 166:3a9487d57a5c 857 } else if (color_system == GRPH_COL_SYS_SECAM) {
thedo 166:3a9487d57a5c 858 param.fil2_2d_wa = &wa_secam;
thedo 166:3a9487d57a5c 859 param.fil2_2d_wb = &wb_secam;
thedo 166:3a9487d57a5c 860 param.fil2_2d_na = &na_secam;
thedo 166:3a9487d57a5c 861 param.fil2_2d_nb = &nb_secam;
thedo 166:3a9487d57a5c 862 } else {
thedo 166:3a9487d57a5c 863 /* Do nothing */
thedo 166:3a9487d57a5c 864 }
thedo 166:3a9487d57a5c 865 /* Video decoder driver y/c separation */
thedo 166:3a9487d57a5c 866 error = R_VDEC_YcSeparation(channel, &param);
thedo 166:3a9487d57a5c 867 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 868 }
thedo 166:3a9487d57a5c 869 } /* End of function YcSep() */
thedo 166:3a9487d57a5c 870
thedo 166:3a9487d57a5c 871 /**************************************************************************//**
thedo 166:3a9487d57a5c 872 * @brief Video decoder chroma decoding setup
thedo 166:3a9487d57a5c 873 * @param [in]color_system : Color system
thedo 166:3a9487d57a5c 874 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 875 * @retval None
thedo 166:3a9487d57a5c 876 *****************************************************************************/
thedo 166:3a9487d57a5c 877 static void ChromaDec (const graphics_col_sys_t color_system, const vdec_channel_t channel)
thedo 166:3a9487d57a5c 878 {
thedo 166:3a9487d57a5c 879 vdec_error_t error;
thedo 166:3a9487d57a5c 880 vdec_chroma_decoding_t param;
thedo 166:3a9487d57a5c 881 vdec_chrmdec_ctrl_t chrmdec_ctrl_tmp;
thedo 166:3a9487d57a5c 882 vdec_burst_lock_t burst_lock_tmp;
thedo 166:3a9487d57a5c 883 vdec_acc_t acc_tmp;
thedo 166:3a9487d57a5c 884 const video_recmd_val_t * RecommendValTbl;
thedo 166:3a9487d57a5c 885
thedo 166:3a9487d57a5c 886 RecommendValTbl = &RecommendedValue[color_system];
thedo 166:3a9487d57a5c 887
thedo 166:3a9487d57a5c 888 /* Chroma decoding control */
thedo 166:3a9487d57a5c 889 chrmdec_ctrl_tmp.defaultsys = RecommendValTbl->defaultsys; /* Default color system */
thedo 166:3a9487d57a5c 890 chrmdec_ctrl_tmp.nontsc358_ = RecommendValTbl->nontsc358_; /* NTSC-M detection control */
thedo 166:3a9487d57a5c 891 chrmdec_ctrl_tmp.nontsc443_ = RecommendValTbl->nontsc443_; /* NTSC-4.43 detection control */
thedo 166:3a9487d57a5c 892 chrmdec_ctrl_tmp.nopalm_ = RecommendValTbl->nopalm_; /* PAL-M detection control */
thedo 166:3a9487d57a5c 893 chrmdec_ctrl_tmp.nopaln_ = RecommendValTbl->nopaln_; /* PAL-N detection control */
thedo 166:3a9487d57a5c 894 chrmdec_ctrl_tmp.nopal443_ = RecommendValTbl->nopal443_; /* PAL-B, G, H, I, D detection control */
thedo 166:3a9487d57a5c 895 chrmdec_ctrl_tmp.nosecam_ = RecommendValTbl->nosecam_; /* SECAM detection control */
thedo 166:3a9487d57a5c 896 chrmdec_ctrl_tmp.lumadelay = LUMADELAY_VALUE; /* Luminance signal delay adjustment */
thedo 166:3a9487d57a5c 897 chrmdec_ctrl_tmp.chromalpf = VDEC_OFF; /* LPF for demodulated chroma */
thedo 166:3a9487d57a5c 898 chrmdec_ctrl_tmp.demodmode = VDEC_DEMOD_MD_PAL; /* Averaging processing for pre-demodulated line */
thedo 166:3a9487d57a5c 899 /* Burst lock */
thedo 166:3a9487d57a5c 900 burst_lock_tmp.lockrange = VDEC_LOCK_RANGE_800HZ;/* Burst lock PLL lock range */
thedo 166:3a9487d57a5c 901 burst_lock_tmp.loopgain = LOOPGAIN_VALUE; /* Burst lock PLL loop gain */
thedo 166:3a9487d57a5c 902 burst_lock_tmp.locklimit = LOCKLIMIT_VALUE; /* Level for burst lock PLL to re-search free-run frequency */
thedo 166:3a9487d57a5c 903 burst_lock_tmp.bgpcheck = BGPCHECK_VALUE; /* burst gate pulse position check */
thedo 166:3a9487d57a5c 904 burst_lock_tmp.bgpwidth = BGPWIDTH_VALUE; /* burst gate pulse width */
thedo 166:3a9487d57a5c 905 burst_lock_tmp.bgpstart = BGPSTART_VALUE; /* burst gate pulse start position */
thedo 166:3a9487d57a5c 906 /* ACC / color killer */
thedo 166:3a9487d57a5c 907 acc_tmp.accmode = VDEC_ACC_MD_AUTO; /* ACC operating mode */
thedo 166:3a9487d57a5c 908 acc_tmp.accmaxgain = VDEC_ACC_MAX_GAIN_6; /* Maximum ACC Gain */
thedo 166:3a9487d57a5c 909 acc_tmp.acclevel = RecommendValTbl->acclevel;/* ACC reference color burst amplitude */
thedo 166:3a9487d57a5c 910 acc_tmp.chromasubgain = VDEC_CHRM_SB_GAIN_1; /* Chroma manual gain (sub) */
thedo 166:3a9487d57a5c 911 acc_tmp.chromamaingain = CHROMAMAINGAIN_VALUE; /* Chroma manual gain (main) */
thedo 166:3a9487d57a5c 912 acc_tmp.accresponse = ACCRESPONSE_VALUE; /* ACC response speed */
thedo 166:3a9487d57a5c 913 acc_tmp.accprecis = ACCPRECIS_VALUE; /* ACC gain adjustment accuracy */
thedo 166:3a9487d57a5c 914 acc_tmp.killermode = VDEC_OFF; /* Forced color killer mode ON/OFF */
thedo 166:3a9487d57a5c 915 acc_tmp.killerlevel = KILLERLEVEL_VALUE; /* Color killer operation start point */
thedo 166:3a9487d57a5c 916 acc_tmp.killeroffset = KILLEROFFSET_VALUE; /* The offset level to turn off the color killer */
thedo 166:3a9487d57a5c 917
thedo 166:3a9487d57a5c 918 param.chrmdec_ctrl = &chrmdec_ctrl_tmp; /* Chroma decoding control */
thedo 166:3a9487d57a5c 919 param.burst_lock = &burst_lock_tmp; /* Burst lock */
thedo 166:3a9487d57a5c 920 param.acc = &acc_tmp; /* ACC/color killer */
thedo 166:3a9487d57a5c 921 param.tint_ry = NULL; /* TINT/R-Y axis correction (only valid for NTSC/PAL) */
thedo 166:3a9487d57a5c 922 /* Video decoder driver chroma decoding */
thedo 166:3a9487d57a5c 923 error = R_VDEC_ChromaDecoding(channel, &param);
thedo 166:3a9487d57a5c 924 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 925 }
thedo 166:3a9487d57a5c 926 } /* End of function ChromaDec() */
thedo 166:3a9487d57a5c 927
thedo 166:3a9487d57a5c 928 /**************************************************************************//**
thedo 166:3a9487d57a5c 929 * @brief Video decoder digital clamp setup
thedo 166:3a9487d57a5c 930 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 931 * @retval None
thedo 166:3a9487d57a5c 932 *****************************************************************************/
thedo 166:3a9487d57a5c 933 static void DigitalClamp (const vdec_channel_t channel)
thedo 166:3a9487d57a5c 934 {
thedo 166:3a9487d57a5c 935 vdec_error_t error;
thedo 166:3a9487d57a5c 936 vdec_degital_clamp_t param;
thedo 166:3a9487d57a5c 937 vdec_pedestal_clamp_t pedestal_clamp_tmp;
thedo 166:3a9487d57a5c 938 vdec_center_clamp_t center_clamp_tmp;
thedo 166:3a9487d57a5c 939 vdec_noise_det_t noise_det_tmp;
thedo 166:3a9487d57a5c 940
thedo 166:3a9487d57a5c 941 /* Pedestal clamp */
thedo 166:3a9487d57a5c 942 pedestal_clamp_tmp.dcpmode_y = VDEC_DCPMODE_AUTO; /* Clamp level setting mode */
thedo 166:3a9487d57a5c 943 pedestal_clamp_tmp.blanklevel_y = BLANKLEVEL_Y_VALUE; /* Clamp offset level (Y signal) */
thedo 166:3a9487d57a5c 944 pedestal_clamp_tmp.dcppos_y = DCPPOS_Y_VALUE; /* Digital clamp pulse horizontal start position (Y signal) */
thedo 166:3a9487d57a5c 945 /* Center clamp */
thedo 166:3a9487d57a5c 946 center_clamp_tmp.dcpmode_c = VDEC_DCPMODE_MANUAL; /* Clamp level setting mode */
thedo 166:3a9487d57a5c 947 center_clamp_tmp.blanklevel_cb = BLANKLEVEL_CB_VALUE; /* Clamp offset level (Cb signal) */
thedo 166:3a9487d57a5c 948 center_clamp_tmp.blanklevel_cr = BLANKLEVEL_CR_VALUE; /* Clamp offset level (Cr signal) */
thedo 166:3a9487d57a5c 949 center_clamp_tmp.dcppos_c = DCPPOS_C_VALUE; /* Digital clamp pulse
thedo 166:3a9487d57a5c 950 horizontal start position (Cb/Cr signal) */
thedo 166:3a9487d57a5c 951 /* Noise detection */
thedo 166:3a9487d57a5c 952 noise_det_tmp.acfinput = VDEC_ACFINPUT_Y; /* Video signal for autocorrelation function */
thedo 166:3a9487d57a5c 953 noise_det_tmp.acflagtime = ACFLAGTIME_VALUE; /* Delay time for autocorrelation function calculation */
thedo 166:3a9487d57a5c 954 noise_det_tmp.acffilter = ACFFILTER_VALUE; /* Smoothing parameter of autocorrelation function data */
thedo 166:3a9487d57a5c 955
thedo 166:3a9487d57a5c 956 param.dcpcheck = VDEC_OFF; /* Digital clamp pulse position check */
thedo 166:3a9487d57a5c 957 param.dcpresponse = DCPRESPONSE_VALUE; /* Digital clamp response speed */
thedo 166:3a9487d57a5c 958 param.dcpstart = DCPSTART_VALUE; /* Digital clamp start line (in 1-line units) */
thedo 166:3a9487d57a5c 959 param.dcpend = DCPEND_VALUE; /* Digital clamp end line (in 1-line units) */
thedo 166:3a9487d57a5c 960 param.dcpwidth = DCPWIDTH_VALUE; /* Digital clamp pulse width */
thedo 166:3a9487d57a5c 961 param.pedestal_clamp = &pedestal_clamp_tmp; /* Pedestal clamp */
thedo 166:3a9487d57a5c 962 param.center_clamp = &center_clamp_tmp; /* Center clamp */
thedo 166:3a9487d57a5c 963 param.noise_det = &noise_det_tmp; /* Noise detection */
thedo 166:3a9487d57a5c 964 /* Video decoder driver digital clamp */
thedo 166:3a9487d57a5c 965 error = R_VDEC_DigitalClamp(channel, &param);
thedo 166:3a9487d57a5c 966 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 967 }
thedo 166:3a9487d57a5c 968 } /* End of function DigitalClamp() */
thedo 166:3a9487d57a5c 969
thedo 166:3a9487d57a5c 970 /**************************************************************************//**
thedo 166:3a9487d57a5c 971 * @brief Video decoder output adjustment setup
thedo 166:3a9487d57a5c 972 * @param [in]channel : Channel
thedo 166:3a9487d57a5c 973 * @retval None
thedo 166:3a9487d57a5c 974 *****************************************************************************/
thedo 166:3a9487d57a5c 975 static void Output (const vdec_channel_t channel)
thedo 166:3a9487d57a5c 976 {
thedo 166:3a9487d57a5c 977 vdec_error_t error;
thedo 166:3a9487d57a5c 978 vdec_output_t param;
thedo 166:3a9487d57a5c 979
thedo 166:3a9487d57a5c 980 param.y_gain2 = Y_GAIN2_VALUE; /* Y signal gain coefficient */
thedo 166:3a9487d57a5c 981 param.cb_gain2 = CB_GAIN2_VALUE; /* Cb signal gain coefficient */
thedo 166:3a9487d57a5c 982 param.cr_gain2 = CR_GAIN2_VALUE; /* Cr signal gain coefficient */
thedo 166:3a9487d57a5c 983 /* Video decoder driver output */
thedo 166:3a9487d57a5c 984 error = R_VDEC_Output(channel, &param);
thedo 166:3a9487d57a5c 985 if (error != VDEC_OK) {
thedo 166:3a9487d57a5c 986 }
thedo 166:3a9487d57a5c 987 } /* End of function Output() */