2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H
18 #define HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H
21 * Contains declaration of a class NV21JpegCompressor that encapsulates a
22 * converter between YV21, and JPEG formats.
26 #include <utils/threads.h>
30 /* Encapsulates a converter between YV12, and JPEG formats.
32 class NV21JpegCompressor
35 /* Constructs JpegCompressor instance. */
37 /* Destructs JpegCompressor instance. */
38 ~NV21JpegCompressor();
40 /****************************************************************************
42 ***************************************************************************/
45 /* Compresses raw NV21 image into a JPEG.
46 * The compressed image will be saved in mStream member of this class. Use
47 * getCompressedSize method to obtain buffer size of the compressed image,
48 * and getCompressedImage to copy out the compressed image.
50 * image - Raw NV21 image.
51 * width, height - Image dimensions.
52 * quality - JPEG quality.
54 * NO_ERROR on success, or an appropriate error status.
57 status_t compressRawImage(const void* image,
62 /* Get size of the compressed JPEG buffer.
63 * This method must be called only after a successful completion of
64 * compressRawImage call.
66 * Size of the compressed JPEG buffer.
68 size_t getCompressedSize();
70 /* Copies out compressed JPEG buffer.
71 * This method must be called only after a successful completion of
72 * compressRawImage call.
74 * buff - Buffer where to copy the JPEG. Must be large enough to contain the
77 void getCompressedImage(void* buff);
79 /****************************************************************************
81 ***************************************************************************/
84 /* Strides for Y (the first element), and UV (the second one) panes. */
88 // library handle to dlopen
93 }; /* namespace android */
95 #endif /* HW_EMULATOR_CAMERA_JPEG_COMPRESSOR_H */