1 /* Copyright (c) 2011, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef MM_OMX_JPEG_ENCODER_H_ 30 #define MM_OMX_JPEG_ENCODER_H_ 31 #include <linux/msm_ion.h> 32 #include "QCamera_Intf.h" 33 34 typedef struct omx_jpeg_encode_params_t { 35 const cam_ctrl_dimension_t * dimension; 36 const uint8_t * thumbnail_buf; 37 int thumbnail_fd; 38 uint32_t thumbnail_offset; 39 const uint8_t * snapshot_buf; 40 int snapshot_fd; 41 uint32_t snapshot_offset; 42 common_crop_t *scaling_params; 43 exif_tags_info_t *exif_data; 44 int exif_numEntries; 45 int32_t a_cbcroffset; 46 cam_point_t* main_crop_offset; 47 cam_point_t* thumb_crop_offset; 48 int hasThumbnail; 49 cam_format_t main_format; 50 cam_format_t thumbnail_format; 51 }omx_jpeg_encode_params; 52 53 int8_t omxJpegOpen(); 54 int8_t omxJpegStart(uint8_t hw_encode_enable); 55 int8_t omxJpegEncode(omx_jpeg_encode_params *encode_params); 56 int8_t omxJpegEncodeNext(omx_jpeg_encode_params *encode_params); 57 void omxJpegFinish(); 58 void omxJpegClose(); 59 void omxJpegAbort(); 60 61 int8_t mm_jpeg_encoder_setMainImageQuality(uint32_t quality); 62 int8_t mm_jpeg_encoder_setThumbnailQuality(uint32_t quality); 63 int8_t mm_jpeg_encoder_setRotation(int rotation,int isZSL); 64 void jpege_set_phy_offset(uint32_t a_phy_offset); 65 int8_t mm_jpeg_encoder_get_buffer_offset(uint32_t width, uint32_t height, 66 uint32_t* p_y_offset, uint32_t* p_cbcr_offset, 67 uint32_t* p_buf_size,uint8_t *num_planes, 68 uint32_t planes[]); 69 typedef void (*jpegfragment_callback_t)(uint8_t * buff_ptr, 70 uint32_t buff_size, void* user_data); 71 typedef void (*jpeg_callback_t)(jpeg_event_t, void *); 72 73 void set_callbacks( 74 jpegfragment_callback_t fragcallback, 75 jpeg_callback_t eventcallback, 76 void* userdata, 77 void* output_buffer, 78 int * outBufferSize 79 ); 80 81 82 #endif /* MM_OMX_JPEG_ENCODER_H_ */ 83