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 __JPEGE_SYNTAX_H__ 18 #define __JPEGE_SYNTAX_H__ 19 20 #include "mpp_frame.h" 21 #include "rk_venc_cmd.h" 22 23 #define MAX_NUMBER_OF_COMPONENTS 3 24 #define DCT_SIZE 8 25 26 typedef enum EntroyTblClass_t { 27 TABLE_DC = 0, 28 TABLE_AC = 1, 29 } EntroyTblClass; 30 31 typedef union JPEGCompInfo_t { 32 struct { 33 RK_U32 component_id : 8; 34 RK_U32 h_sample_factor : 8; 35 RK_U32 v_sample_factor : 8; 36 RK_U32 tbl_selector : 8; 37 }; 38 RK_U32 val; 39 } JPEGCompInfo; 40 41 typedef struct JpegeSyntax_t { 42 RK_U32 width; 43 RK_U32 height; 44 RK_U32 hor_stride; 45 RK_U32 ver_stride; 46 RK_U32 mcu_hor_cnt; 47 RK_U32 mcu_ver_cnt; 48 RK_U32 mcu_cnt; 49 RK_U32 mcu_width; 50 RK_U32 mcu_height; 51 MppFrameFormat format; 52 MppFrameChromaFormat format_out; 53 MppFrameColorSpace color; 54 MppEncRotationCfg rotation; 55 RK_S32 mirroring; 56 RK_U32 offset_x; 57 RK_U32 offset_y; 58 59 /* For quantization table */ 60 RK_S32 q_mode; 61 RK_S32 quant; 62 RK_S32 q_factor; 63 RK_S32 qf_min; 64 RK_S32 qf_max; 65 RK_U8 *qtable_y; 66 RK_U8 *qtable_u; 67 RK_U8 *qtable_v; 68 69 /* 70 * For color conversion 71 * 72 * 0 = bt601 73 * 1 = bt709 74 * 2 = user defined 75 */ 76 RK_U32 color_conversion_type; 77 RK_U32 coeffA; 78 RK_U32 coeffB; 79 RK_U32 coeffC; 80 RK_U32 coeffE; 81 RK_U32 coeffF; 82 83 /* For slice encoding mode */ 84 RK_U32 slice_enable; 85 RK_U32 slice_size_mb_rows; 86 87 /* 88 * For unit type and density 89 * 90 * units_type 0 - no unit 91 * 1 - dots per inch 92 * 2 - dots per cm 93 * 94 * X/Y density specify the pixel aspect ratio 95 */ 96 RK_U32 units_type; 97 RK_U32 density_x; 98 RK_U32 density_y; 99 100 /* For comment header */ 101 RK_U32 comment_length; 102 RK_U8 *comment_data; 103 104 /* For jpeg low delay slice encoding */ 105 RK_U32 low_delay; 106 RK_U32 part_rows; 107 RK_U32 restart_ri; 108 109 RK_U32 nb_components; 110 JPEGCompInfo comp_info[MAX_NUMBER_OF_COMPONENTS]; 111 } JpegeSyntax; 112 113 typedef struct JpegeFeedback_t { 114 RK_U32 hw_status; /* zero -> correct; non-zero -> error */ 115 RK_U32 stream_length; 116 } JpegeFeedback; 117 118 #endif 119