M4VFL_transition.h revision 7c9d8018755adf1857571125ba1b3598c96ea506
1/* 2 * Copyright (C) 2004-2011 NXP Software 3 * Copyright (C) 2011 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 /** 18 ****************************************************************************** 19 * @file M4TRAN_transition.h 20 * @brief 21 * @note 22 ****************************************************************************** 23*/ 24 25#ifndef __M4VFL_TRANSITION_H__ 26#define __M4VFL_TRANSITION_H__ 27 28#ifdef __cplusplus 29extern "C" { 30#endif 31typedef unsigned char UInt8; 32typedef unsigned long UInt32; 33 34typedef struct S_M4ViComImagePlane 35{ 36 UInt32 u_width; /* active width, in pixels */ 37 UInt32 u_height; /* active height, in lines */ 38 UInt32 u_topleft; /* index of 1st active pixel */ 39 UInt32 u_stride; /* line stride, in bytes */ 40 UInt8 *pac_data; /* buffer address */ 41} M4ViComImagePlane; 42 43typedef struct S_M4VFL_modifLumParam 44{ 45 unsigned short lum_factor; 46 unsigned short copy_chroma; 47} M4VFL_ModifLumParam; 48 49typedef struct S_M4VFL_CurtainParam 50{ 51 unsigned short nb_black_lines; 52 unsigned char top_is_black; 53} M4VFL_CurtainParam; 54 55#define M4VIFI_OK 0 56#define M4VIFI_ILLEGAL_FRAME_HEIGHT 8 57#define M4VIFI_ILLEGAL_FRAME_WIDTH 9 58 59unsigned char M4VFL_modifyLumaByStep(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 60 M4VFL_ModifLumParam *lum_param, void *user_data); 61 62unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 63 unsigned long lum_factor, void *user_data); 64 65unsigned char M4VFL_applyClosingCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 66 unsigned short curtain_factor, void *user_data); 67 68unsigned char M4VFL_applyOpeningCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 69 unsigned short curtain_factor, void *user_data); 70 71unsigned char M4VFL_applyFallingCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 72 unsigned short curtain_factor, void *user_data); 73 74 75/** 76 ****************************************************************************** 77 * unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 78 * M4VFL_CurtainParam *curtain_factor, void *user_data) 79 * @brief This function applies a black curtain onto a YUV420 image. 80 * @note THis function writes black lines either at the top of the image or at 81 * the bottom of the image. The other lines are copied from the source image. 82 * First the number of black lines is compted and is rounded to an even integer. 83 * @param plane_in: (IN) pointer to the 3 image planes of the source image 84 * @param plane_out: (OUT) pointer to the 3 image planes of the destination image 85 * @param user_data: (IN) pointer to some user_data 86 * @param curtain_factor: (IN) structure with the parameters of the curtain (nb of black lines 87 * and if at the top/bottom of the image) 88 * @return 0: there is no error 89 ****************************************************************************** 90*/ 91unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, 92 M4VFL_CurtainParam *curtain_factor, void *user_data); 93 94 95/** 96 ************************************************************************************************* 97 * M4OSA_ERR M4VIFI_ImageBlendingonYUV420 (void *pUserData, 98 * M4VIFI_ImagePlane *pPlaneIn1, 99 * M4VIFI_ImagePlane *pPlaneIn2, 100 * M4VIFI_ImagePlane *pPlaneOut, 101 * M4VIFI_UInt32 Progress) 102 * @brief Blends two YUV 4:2:0 Planar images. 103 * @note Blends YUV420 planar images, 104 * Map the value of progress from (0 - 1000) to (0 - 1024) 105 * Set the range of blendingfactor, 106 * 1. from 0 to (Progress << 1) ;for Progress <= 512 107 * 2. from (( Progress - 512)<< 1) to 1024 ;otherwise 108 * Set the increment of blendingfactor for each element in the image row by the factor, 109 * = (Range-1) / (image width-1) ;for width >= range 110 * = (Range) / (image width) ;otherwise 111 * Loop on each(= i) row of output Y plane (steps of 2) 112 * Loop on each(= j) column of output Y plane (steps of 2) 113 * Get four Y samples and one U & V sample from two input YUV4:2:0 images and 114 * Compute four Y sample and one U & V sample for output YUV4:2:0 image 115 * using the following, 116 * Out(i,j) = blendingfactor(i,j) * In1(i,j)+ (l - blendingfactor(i,j)) * In2(i,j) 117 * end loop column 118 * end loop row. 119 * @param pUserData: (IN) User Specific Parameter 120 * @param pPlaneIn1: (IN) Pointer to an array of image plane structures maintained for Y, U 121 * and V planes. 122 * @param pPlaneIn2: (IN) Pointer to an array of image plane structures maintained for Y, U 123 * and V planes. 124 * @param pPlaneOut: (OUT) Pointer to an array of image plane structures maintained for Y, U 125 * and V planes. 126 * @param Progress: (IN) Progress value (varies between 0 and 1000) 127 * @return M4VIFI_OK: No error 128 * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: Error in height 129 * @return M4VIFI_ILLEGAL_FRAME_WIDTH: Error in width 130 ***********************************************************************************************/ 131unsigned char M4VIFI_ImageBlendingonYUV420 (void *pUserData, M4ViComImagePlane *pPlaneIn1, 132 M4ViComImagePlane *pPlaneIn2, 133 M4ViComImagePlane *pPlaneOut, UInt32 Progress); 134 135#ifdef __cplusplus 136} 137#endif /* __cplusplus */ 138 139#endif // __M4VFL_TRANSITION_H__ 140