ColorConverter.h revision 2a4a7d5af053a17586a262a1267ba993e31790f1
1/* 2 * Copyright (C) 2009 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 COLOR_CONVERTER_H_ 18 19#define COLOR_CONVERTER_H_ 20 21#include <sys/types.h> 22 23#include <OMX_Video.h> 24 25namespace android { 26 27struct ColorConverter { 28 ColorConverter(OMX_COLOR_FORMATTYPE from, OMX_COLOR_FORMATTYPE to); 29 ~ColorConverter(); 30 31 bool isValid() const; 32 33 void convert( 34 size_t width, size_t height, 35 const void *srcBits, size_t srcSkip, 36 void *dstBits, size_t dstSkip); 37 38private: 39 OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat; 40 uint8_t *mClip; 41 42 uint8_t *initClip(); 43 44 void convertCbYCrY( 45 size_t width, size_t height, 46 const void *srcBits, size_t srcSkip, 47 void *dstBits, size_t dstSkip); 48 49 void convertYUV420Planar( 50 size_t width, size_t height, 51 const void *srcBits, size_t srcSkip, 52 void *dstBits, size_t dstSkip); 53 54 void convertQCOMYUV420SemiPlanar( 55 size_t width, size_t height, 56 const void *srcBits, size_t srcSkip, 57 void *dstBits, size_t dstSkip); 58 59 ColorConverter(const ColorConverter &); 60 ColorConverter &operator=(const ColorConverter &); 61}; 62 63} // namespace android 64 65#endif // COLOR_CONVERTER_H_ 66