blob: 36d286e60e3110b7f7e83aa58d29f6bc2d51757a [file] [log] [blame]
Chih-Chung Chang99698662011-06-30 14:21:38 +08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_VE_TOOLS_H
18#define ANDROID_VE_TOOLS_H
19
20#include "M4OSA_Types.h"
21#include "M4OSA_Memory.h"
22#include "M4OSA_Debug.h"
23#include "M4VIFI_FiltersAPI.h"
24/* Macro definitions */
25#include "M4VIFI_Defines.h"
26/* Clip table declaration */
27#include "M4VIFI_Clip.h"
28#include "M4VFL_transition.h"
29#include "M4VSS3GPP_API.h"
30#include "M4xVSS_API.h"
31#include "M4xVSS_Internal.h"
32
33#include "M4AIR_API.h"
34#include "PreviewRenderer.h"
35#define MEDIA_RENDERING_INVALID 255
36
37#define TRANSPARENT_COLOR 0x7E0
38#define LUM_FACTOR_MAX 10
39enum {
40 VIDEO_EFFECT_NONE = 0,
41 VIDEO_EFFECT_BLACKANDWHITE = 1,
42 VIDEO_EFFECT_PINK = 2,
43 VIDEO_EFFECT_GREEN = 4,
44 VIDEO_EFFECT_SEPIA = 8,
45 VIDEO_EFFECT_NEGATIVE = 16,
46 VIDEO_EFFECT_FRAMING = 32,
47 VIDEO_EFFECT_FIFTIES = 64,
48 VIDEO_EFFECT_COLOR_RGB16 = 128,
49 VIDEO_EFFECT_GRADIENT = 256,
50 VIDEO_EFFECT_FADEFROMBLACK = 512,
51 VIDEO_EFFECT_CURTAINOPEN = 1024,
52 VIDEO_EFFECT_FADETOBLACK = 2048,
53 VIDEO_EFFECT_CURTAINCLOSE = 4096,
54};
55
56typedef struct {
57 M4VIFI_UInt8 *vidBuffer;
58 M4OSA_UInt32 videoWidth;
59 M4OSA_UInt32 videoHeight;
60 M4OSA_UInt32 timeMs;
61 M4OSA_UInt32 timeOffset; //has the duration of clips played.
62 //The flag shall be used for Framing.
63 M4VSS3GPP_EffectSettings* effectsSettings;
64 M4OSA_UInt32 numberEffects;
65 M4OSA_UInt32 outVideoWidth;
66 M4OSA_UInt32 outVideoHeight;
67 M4OSA_UInt32 currentVideoEffect;
68 M4OSA_Bool isFiftiesEffectStarted;
69 M4xVSS_MediaRendering renderingMode;
70 uint8_t *pOutBuffer;
71 size_t outBufferStride;
72 M4VIFI_UInt8* overlayFrameRGBBuffer;
73 M4VIFI_UInt8* overlayFrameYUVBuffer;
74} vePostProcessParams;
75
76M4VIFI_UInt8 M4VIFI_YUV420PlanarToYUV420Semiplanar(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
77M4VIFI_UInt8 M4VIFI_SemiplanarYUV420toYUV420(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
78
79M4OSA_ERR M4VSS3GPP_externalVideoEffectColor(M4OSA_Void *pFunctionContext, M4VIFI_ImagePlane *PlaneIn,
80 M4VIFI_ImagePlane *PlaneOut,M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind);
81
82M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
83
84M4OSA_ERR M4VSS3GPP_externalVideoEffectFifties( M4OSA_Void *pUserData, M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
85
86unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, unsigned long lum_factor, void *user_data);
87unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, M4VFL_CurtainParam *curtain_factor, void *user_data);
88
89M4OSA_ERR M4xVSS_internalConvertRGBtoYUV(M4xVSS_FramingStruct* framingCtx);
90M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *pPlaneIn,
91 M4VIFI_ImagePlane *pPlaneOut);
92
93M4OSA_ERR M4xVSS_internalConvertRGB888toYUV(M4xVSS_FramingStruct* framingCtx);
94M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane PlaneOut[3]);
95
96/*+ Handle the image files here */
97M4OSA_ERR LvGetImageThumbNail(const char *fileName, M4OSA_UInt32 height, M4OSA_UInt32 width, M4OSA_Void **pBuffer);
98/*- Handle the image files here */
99
100M4OSA_ERR applyRenderingMode(M4VIFI_ImagePlane* pPlaneIn, M4VIFI_ImagePlane* pPlaneOut, M4xVSS_MediaRendering mediaRendering);
101
102
103M4VIFI_UInt8 M4VIFI_YUV420toYUV420(void *user_data, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut );
104M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData,
105 M4VIFI_ImagePlane *pPlaneIn,
106 M4VIFI_ImagePlane *pPlaneOut);
107
108M4OSA_Void prepareYUV420ImagePlane(M4VIFI_ImagePlane *plane,
109 M4OSA_UInt32 width, M4OSA_UInt32 height, M4VIFI_UInt8 *buffer,
110 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
111
112M4OSA_Void prepareYV12ImagePlane(M4VIFI_ImagePlane *plane,
113 M4OSA_UInt32 width, M4OSA_UInt32 height, M4OSA_UInt32 stride, M4VIFI_UInt8 *buffer);
114
115M4OSA_Void swapImagePlanes(
116 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
117 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2);
118
119M4OSA_Void computePercentageDone(
120 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
121 M4OSA_UInt32 effectDuration, M4OSA_Double *percentageDone);
122
123M4OSA_Void computeProgressForVideoEffect(
124 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
125 M4OSA_UInt32 effectDuration, M4VSS3GPP_ExternalProgress* extProgress);
126
127M4OSA_ERR prepareFramingStructure(
128 M4xVSS_FramingStruct* framingCtx,
129 M4VSS3GPP_EffectSettings* effectsSettings, M4OSA_UInt32 index,
130 M4VIFI_UInt8* overlayRGB, M4VIFI_UInt8* overlayYUV);
131
132M4OSA_ERR applyColorEffect(M4xVSS_VideoEffectType colorEffect,
133 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
134 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_UInt16 rgbColorData);
135
136M4OSA_ERR applyLumaEffect(M4VSS3GPP_VideoEffectType videoEffect,
137 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
138 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_Int32 lum_factor);
139
140M4OSA_ERR applyCurtainEffect(M4VSS3GPP_VideoEffectType videoEffect,
141 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
142 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4VFL_CurtainParam* curtainParams);
143
144M4OSA_ERR applyEffectsAndRenderingMode(vePostProcessParams *params,
145 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
146
147#endif // ANDROID_VE_TOOLS_H