1/*
2 * Copyright (C) 2010 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_CAMERA_HARDWARE_DECODER_LIBJPEG_H
18#define ANDROID_CAMERA_HARDWARE_DECODER_LIBJPEG_H
19
20#include "CameraHal.h"
21
22extern "C" {
23#include "jhead.h"
24
25#undef TRUE
26#undef FALSE
27
28}
29
30
31namespace Ti {
32namespace Camera {
33
34class Decoder_libjpeg
35{
36
37public:
38    Decoder_libjpeg();
39    ~Decoder_libjpeg();
40    int readDHTSize();
41    int appendDHT(unsigned char *jpeg_src, int filled_len, unsigned char *jpeg_with_dht_buffer, int buff_size);
42    bool decode(unsigned char *jpeg_src, int filled_len, unsigned char *nv12_buffer, int stride);
43
44private:
45    void release();
46    unsigned char **Y_Plane;
47    unsigned char **U_Plane;
48    unsigned char **V_Plane;
49    unsigned char *UV_Plane;
50    unsigned int mWidth, mHeight;
51};
52
53} // namespace Camera
54} // namespace Ti
55
56#endif
57
58