blob: 5140e8b726d7c8037144f2574abbcb25d2c18815 [file] [log] [blame]
Dharmaray Kundargi643290d2011-01-16 16:02:42 -08001/*
2 * Copyright (C) 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#ifndef ANDROID_VE_TOOLS_H
19#define ANDROID_VE_TOOLS_H
20
21#include "M4OSA_Types.h"
22#include "M4OSA_Memory.h"
23#include "M4OSA_Debug.h"
24#include "M4VIFI_FiltersAPI.h"
25/* Macro definitions */
26#include "M4VIFI_Defines.h"
27/* Clip table declaration */
28#include "M4VIFI_Clip.h"
29#include "M4VFL_transition.h"
30#include "M4VSS3GPP_API.h"
31#include "M4xVSS_API.h"
32#include "M4xVSS_Internal.h"
33
34#include "M4AIR_API.h"
35#include "PreviewRenderer.h"
36#define MEDIA_RENDERING_INVALID 255
37
38#define TRANSPARENT_COLOR 0x7E0
39#define LUM_FACTOR_MAX 10
40enum {
41 VIDEO_EFFECT_NONE = 0,
42 VIDEO_EFFECT_BLACKANDWHITE = 1,
43 VIDEO_EFFECT_PINK = 2,
44 VIDEO_EFFECT_GREEN = 4,
45 VIDEO_EFFECT_SEPIA = 8,
46 VIDEO_EFFECT_NEGATIVE = 16,
47 VIDEO_EFFECT_FRAMING = 32,
48 VIDEO_EFFECT_FIFTIES = 64,
49 VIDEO_EFFECT_COLOR_RGB16 = 128,
50 VIDEO_EFFECT_GRADIENT = 256,
51 VIDEO_EFFECT_FADEFROMBLACK = 512,
52 VIDEO_EFFECT_CURTAINOPEN = 1024,
53 VIDEO_EFFECT_FADETOBLACK = 2048,
54 VIDEO_EFFECT_CURTAINCLOSE = 4096,
55};
56
57typedef struct {
58 M4VIFI_UInt8 *vidBuffer;
59 M4OSA_UInt32 videoWidth;
60 M4OSA_UInt32 videoHeight;
61 M4OSA_UInt32 timeMs;
62 M4OSA_UInt32 timeOffset; //has the duration of clips played.
63 //The flag shall be used for Framing.
64 M4VSS3GPP_EffectSettings* effectsSettings;
65 M4OSA_UInt32 numberEffects;
66 M4OSA_UInt32 outVideoWidth;
67 M4OSA_UInt32 outVideoHeight;
68 M4OSA_UInt32 currentVideoEffect;
69 M4OSA_Bool isFiftiesEffectStarted;
70 M4xVSS_MediaRendering renderingMode;
71 uint8_t *pOutBuffer;
72 size_t outBufferStride;
73 M4VIFI_UInt8* overlayFrameRGBBuffer;
74 M4VIFI_UInt8* overlayFrameYUVBuffer;
75} vePostProcessParams;
76
77M4VIFI_UInt8 M4VIFI_YUV420PlanarToYUV420Semiplanar(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
78M4VIFI_UInt8 M4VIFI_SemiplanarYUV420toYUV420(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
79
80M4OSA_ERR M4VSS3GPP_externalVideoEffectColor(M4OSA_Void *pFunctionContext, M4VIFI_ImagePlane *PlaneIn,
81 M4VIFI_ImagePlane *PlaneOut,M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind);
82
83M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
84
85M4OSA_ERR M4VSS3GPP_externalVideoEffectFifties( M4OSA_Void *pUserData, M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
86
87unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, unsigned long lum_factor, void *user_data);
88unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, M4VFL_CurtainParam *curtain_factor, void *user_data);
89
90M4OSA_ERR M4xVSS_internalConvertRGBtoYUV(M4xVSS_FramingStruct* framingCtx);
91M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *pPlaneIn,
92 M4VIFI_ImagePlane *pPlaneOut);
93
94M4OSA_ERR M4xVSS_internalConvertRGB888toYUV(M4xVSS_FramingStruct* framingCtx);
95M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane PlaneOut[3]);
96
97/*+ Handle the image files here */
98M4OSA_ERR LvGetImageThumbNail(const char *fileName, M4OSA_UInt32 height, M4OSA_UInt32 width, M4OSA_Void **pBuffer);
99/*- Handle the image files here */
100
101M4OSA_ERR applyRenderingMode(M4VIFI_ImagePlane* pPlaneIn, M4VIFI_ImagePlane* pPlaneOut, M4xVSS_MediaRendering mediaRendering);
102
103
104M4VIFI_UInt8 M4VIFI_YUV420toYUV420(void *user_data, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut );
105M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData,
106 M4VIFI_ImagePlane *pPlaneIn,
107 M4VIFI_ImagePlane *pPlaneOut);
108
109M4OSA_Void prepareYUV420ImagePlane(M4VIFI_ImagePlane *plane,
Dharmaray Kundargi35cb2de2011-01-19 19:09:27 -0800110 M4OSA_UInt32 width, M4OSA_UInt32 height, M4VIFI_UInt8 *buffer,
111 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
Dharmaray Kundargi643290d2011-01-16 16:02:42 -0800112
113M4OSA_Void prepareYV12ImagePlane(M4VIFI_ImagePlane *plane,
114 M4OSA_UInt32 width, M4OSA_UInt32 height, M4OSA_UInt32 stride, M4VIFI_UInt8 *buffer);
115
116M4OSA_Void swapImagePlanes(
117 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
118 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2);
119
120M4OSA_Void computePercentageDone(
121 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
122 M4OSA_UInt32 effectDuration, M4OSA_Double *percentageDone);
123
124M4OSA_Void computeProgressForVideoEffect(
125 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
126 M4OSA_UInt32 effectDuration, M4VSS3GPP_ExternalProgress* extProgress);
127
128M4OSA_ERR prepareFramingStructure(
129 M4xVSS_FramingStruct* framingCtx,
130 M4VSS3GPP_EffectSettings* effectsSettings, M4OSA_UInt32 index,
131 M4VIFI_UInt8* overlayRGB, M4VIFI_UInt8* overlayYUV);
132
133M4OSA_ERR applyColorEffect(M4xVSS_VideoEffectType colorEffect,
134 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
135 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_UInt16 rgbColorData);
136
137M4OSA_ERR applyLumaEffect(M4VSS3GPP_VideoEffectType videoEffect,
138 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
139 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_Int32 lum_factor);
140
141M4OSA_ERR applyCurtainEffect(M4VSS3GPP_VideoEffectType videoEffect,
142 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
143 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4VFL_CurtainParam* curtainParams);
144
Dharmaray Kundargi35cb2de2011-01-19 19:09:27 -0800145M4OSA_ERR applyEffectsAndRenderingMode(vePostProcessParams *params,
146 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
147
Dharmaray Kundargi643290d2011-01-16 16:02:42 -0800148#endif // ANDROID_VE_TOOLS_H