merge with master
[framework/osp/image-core.git] / src / inc / FMedia_ColorConverter.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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   FMedia_ColorConverter.h
20  * @brief  This is the header file for the FMedia::_ColorConverter.
21  *
22  * This header file contains the declarations of the FMedia::_ColorConverter.
23  *
24  */
25 #ifndef _FMEDIA_INTERNAL_COLORCONVERTER_H_
26 #define _FMEDIA_INTERNAL_COLORCONVERTER_H_
27
28 #include <FMedia_Ffmpeg.h>
29 #include <FMediaImageTypes.h>
30
31 namespace Tizen { namespace Media
32 {
33
34 class _OSP_EXPORT_ _ColorConverter
35         : public Tizen::Base::Object
36 {
37 public:
38         _ColorConverter(void);
39
40         virtual ~_ColorConverter(void);
41
42         /**
43          * Initializes this instance of converter
44          *
45          * @return         An error code
46          * @exception  E_SUCCESS                        The method is successful.
47          * @exception  E_INVALID_ARG            The arguments to the method are invalid:
48          *                                                                              All dimensions should be greater than zero.
49          * @exception  E_UNSUPPORTED_FORMAT     A pixelformat argument is not supported.
50          * @exception  E_SYSTEM                         A system error has occurred.
51          */
52         result Construct(MediaPixelFormat srcFormat, int srcWidth, int srcHeight,
53                                          MediaPixelFormat dstFormat, int dstWidth, int dstHeight,
54                                          ImageScalingMethod scalingMethod = IMAGE_SCALING_METHOD_FAST_BILINEAR);
55
56 public:
57         /**
58          * convert pixel format
59          *
60          * @return      An error code
61          * @exception  E_SUCCESS                The method is successful.
62          * @exception  E_SYSTEM         A system error has occurred.
63          */
64         Tizen::Base::ByteBuffer* ConvertN(const Tizen::Base::ByteBuffer& srcBuf);
65
66         /**
67          * convert pixel format
68          *
69          * @return      An error code
70          * @exception  E_SUCCESS                The method is successful.
71          * @exception  E_SYSTEM         A system error has occurred.
72          */
73         byte* ConvertN(const byte* pSrcBuf, int srcLength, int& dstLength);
74         /**
75          * convert pixel format
76          *
77          * @return      An error code
78          * @exception  E_SUCCESS                The method is successful.
79          * @exception  E_SYSTEM         A system error has occurred.
80          */
81         result Convert(const byte* srcBuf, int srcLength, byte* dstBuf, int dstLength);
82
83 private:
84         int __srcWidth;
85         int __srcHeight;
86         int __dstWidth;
87         int __dstHeight;
88         int __origSrcWidth;
89         int __origSrcHeight;
90         int __origDstWidth;
91         int __origDstHeight;
92         MediaPixelFormat __srcFormat;
93         MediaPixelFormat __dstFormat;
94         PixelFormat __ffSrcFormat;
95         PixelFormat __ffDstFormat;
96
97         struct SwsContext* __pCvtCtxt;
98
99         bool __toResizeIn;
100         bool __toResizeOut;
101 }; // class _ColorConverter
102
103 }} // Tizen::Media
104
105 #endif