1 /* 2 * Copyright 2015 Rockchip Electronics Co. LTD 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 __HAL_JPEGE_HDR_H__ 18 #define __HAL_JPEGE_HDR_H__ 19 20 #include "jpege_syntax.h" 21 22 typedef void *JpegeBits; 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 #define QUANTIZE_TABLE_SIZE 64 29 typedef struct HalJpegeRc_t { 30 RK_S32 q_mode; 31 RK_S32 quant; 32 RK_S32 q_factor; 33 RK_U8 qtable_y[QUANTIZE_TABLE_SIZE]; 34 RK_U8 qtable_u[QUANTIZE_TABLE_SIZE]; 35 RK_U8 qtable_v[QUANTIZE_TABLE_SIZE]; 36 const RK_U8 *qtables[3]; 37 } HalJpegeRc; 38 39 void jpege_bits_init(JpegeBits *ctx); 40 void jpege_bits_deinit(JpegeBits ctx); 41 42 void jpege_bits_setup(JpegeBits ctx, RK_U8 *buf, RK_S32 size); 43 void jpege_bits_put(JpegeBits ctx, RK_U32 val, RK_S32 len); 44 void jpege_bits_align_byte(JpegeBits ctx); 45 void jpege_seek_bits(JpegeBits ctx, RK_S32 len); 46 RK_U8 *jpege_bits_get_buf(JpegeBits ctx); 47 RK_S32 jpege_bits_get_bitpos(JpegeBits ctx); 48 RK_S32 jpege_bits_get_bytepos(JpegeBits ctx); 49 50 MPP_RET write_jpeg_header(JpegeBits *bits, JpegeSyntax *syntax, HalJpegeRc *rc); 51 52 void hal_jpege_rc_init(HalJpegeRc *hal_rc); 53 void hal_jpege_rc_update(HalJpegeRc *hal_rc, JpegeSyntax *syntax); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /*__HAL_JPEGE_HDR_H__*/ 60 61