blob: 0552799b80852b2a1e2a5c5ab426f51c73933904 [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,
Chih-Chung Chang99698662011-06-30 14:21:38 +080051 VIDEO_EFFECT_FADETOBLACK = 2048,
Chih-Chung Chang99698662011-06-30 14:21:38 +080052};
53
54typedef struct {
55 M4VIFI_UInt8 *vidBuffer;
56 M4OSA_UInt32 videoWidth;
57 M4OSA_UInt32 videoHeight;
58 M4OSA_UInt32 timeMs;
59 M4OSA_UInt32 timeOffset; //has the duration of clips played.
60 //The flag shall be used for Framing.
61 M4VSS3GPP_EffectSettings* effectsSettings;
62 M4OSA_UInt32 numberEffects;
63 M4OSA_UInt32 outVideoWidth;
64 M4OSA_UInt32 outVideoHeight;
65 M4OSA_UInt32 currentVideoEffect;
66 M4OSA_Bool isFiftiesEffectStarted;
67 M4xVSS_MediaRendering renderingMode;
68 uint8_t *pOutBuffer;
69 size_t outBufferStride;
70 M4VIFI_UInt8* overlayFrameRGBBuffer;
71 M4VIFI_UInt8* overlayFrameYUVBuffer;
72} vePostProcessParams;
73
74M4VIFI_UInt8 M4VIFI_YUV420PlanarToYUV420Semiplanar(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
75M4VIFI_UInt8 M4VIFI_SemiplanarYUV420toYUV420(void *user_data, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut );
76
77M4OSA_ERR M4VSS3GPP_externalVideoEffectColor(M4OSA_Void *pFunctionContext, M4VIFI_ImagePlane *PlaneIn,
78 M4VIFI_ImagePlane *PlaneOut,M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind);
79
80M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
81
82M4OSA_ERR M4VSS3GPP_externalVideoEffectFifties( M4OSA_Void *pUserData, M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut, M4VSS3GPP_ExternalProgress *pProgress, M4OSA_UInt32 uiEffectKind );
83
84unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, unsigned long lum_factor, void *user_data);
Chih-Chung Chang99698662011-06-30 14:21:38 +080085
86M4OSA_ERR M4xVSS_internalConvertRGBtoYUV(M4xVSS_FramingStruct* framingCtx);
87M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *pPlaneIn,
88 M4VIFI_ImagePlane *pPlaneOut);
89
90M4OSA_ERR M4xVSS_internalConvertRGB888toYUV(M4xVSS_FramingStruct* framingCtx);
91M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane PlaneOut[3]);
92
93/*+ Handle the image files here */
94M4OSA_ERR LvGetImageThumbNail(const char *fileName, M4OSA_UInt32 height, M4OSA_UInt32 width, M4OSA_Void **pBuffer);
95/*- Handle the image files here */
96
97M4OSA_ERR applyRenderingMode(M4VIFI_ImagePlane* pPlaneIn, M4VIFI_ImagePlane* pPlaneOut, M4xVSS_MediaRendering mediaRendering);
98
99
100M4VIFI_UInt8 M4VIFI_YUV420toYUV420(void *user_data, M4VIFI_ImagePlane PlaneIn[3], M4VIFI_ImagePlane *PlaneOut );
101M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData,
102 M4VIFI_ImagePlane *pPlaneIn,
103 M4VIFI_ImagePlane *pPlaneOut);
104
105M4OSA_Void prepareYUV420ImagePlane(M4VIFI_ImagePlane *plane,
106 M4OSA_UInt32 width, M4OSA_UInt32 height, M4VIFI_UInt8 *buffer,
107 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
108
109M4OSA_Void prepareYV12ImagePlane(M4VIFI_ImagePlane *plane,
110 M4OSA_UInt32 width, M4OSA_UInt32 height, M4OSA_UInt32 stride, M4VIFI_UInt8 *buffer);
111
112M4OSA_Void swapImagePlanes(
113 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
114 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2);
115
116M4OSA_Void computePercentageDone(
117 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
118 M4OSA_UInt32 effectDuration, M4OSA_Double *percentageDone);
119
120M4OSA_Void computeProgressForVideoEffect(
121 M4OSA_UInt32 ctsMs, M4OSA_UInt32 effectStartTimeMs,
122 M4OSA_UInt32 effectDuration, M4VSS3GPP_ExternalProgress* extProgress);
123
124M4OSA_ERR prepareFramingStructure(
125 M4xVSS_FramingStruct* framingCtx,
126 M4VSS3GPP_EffectSettings* effectsSettings, M4OSA_UInt32 index,
127 M4VIFI_UInt8* overlayRGB, M4VIFI_UInt8* overlayYUV);
128
129M4OSA_ERR applyColorEffect(M4xVSS_VideoEffectType colorEffect,
130 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
131 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_UInt16 rgbColorData);
132
133M4OSA_ERR applyLumaEffect(M4VSS3GPP_VideoEffectType videoEffect,
134 M4VIFI_ImagePlane *planeIn, M4VIFI_ImagePlane *planeOut,
135 M4VIFI_UInt8 *buffer1, M4VIFI_UInt8 *buffer2, M4OSA_Int32 lum_factor);
136
Chih-Chung Chang99698662011-06-30 14:21:38 +0800137M4OSA_ERR applyEffectsAndRenderingMode(vePostProcessParams *params,
138 M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);
139
140#endif // ANDROID_VE_TOOLS_H