mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-30 04:02:07 +08:00
[jpegd]: handle special stream and eos in parser_prepare and format source code with mpp_astyle.sh in Linux Server.
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1102 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -100,7 +100,7 @@ enum {
|
||||
JPEGDEC_THUMBNAIL = 1
|
||||
};
|
||||
|
||||
enum{
|
||||
enum {
|
||||
SOF0 = 0xC0,
|
||||
SOF1 = 0xC1,
|
||||
SOF2 = 0xC2,
|
||||
@@ -168,22 +168,22 @@ enum{
|
||||
};
|
||||
|
||||
typedef struct JpegParserContext {
|
||||
MppBufSlots packet_slots;
|
||||
MppBufSlots packet_slots;
|
||||
MppBufSlots frame_slots;
|
||||
RK_S32 frame_slot_index; /* slot index for output */
|
||||
RK_U8 *recv_buffer;
|
||||
JpegSyntaxParam *pSyntax;
|
||||
JpegSyntaxParam *pSyntax;
|
||||
JpegDecImageInfo imageInfo;
|
||||
|
||||
RK_U32 streamLength; /* input stream length or buffer size */
|
||||
RK_U32 streamLength; /* input stream length or buffer size */
|
||||
RK_U32 bufferSize; /* input stream buffer size */
|
||||
RK_U32 decImageType; /* Full image or Thumbnail to be decoded */
|
||||
RK_U32 sliceMbSet; /* slice mode: mcu rows to decode */
|
||||
RK_U32 color_conv;
|
||||
RK_U32 color_conv;
|
||||
RK_U32 dri_en;
|
||||
|
||||
MppPacket input_packet;
|
||||
MppFrame output_frame;
|
||||
MppFrame output_frame;
|
||||
RK_U32 is8190;
|
||||
RK_U32 fuseBurned;
|
||||
RK_U32 minSupportedWidth;
|
||||
@@ -194,10 +194,10 @@ typedef struct JpegParserContext {
|
||||
RK_U32 maxSupportedSliceSize;
|
||||
RK_U32 extensionsSupported;
|
||||
|
||||
RK_S64 pts;
|
||||
|
||||
RK_U32 parser_debug_enable;
|
||||
RK_U32 input_jpeg_count;
|
||||
}JpegParserContext;
|
||||
RK_S64 pts;
|
||||
RK_U32 eos;
|
||||
RK_U32 parser_debug_enable;
|
||||
RK_U32 input_jpeg_count;
|
||||
} JpegParserContext;
|
||||
|
||||
#endif /* __JPEGD_PARSER_H__ */
|
||||
|
||||
@@ -39,53 +39,53 @@ extern RK_U32 jpegd_log;
|
||||
|
||||
|
||||
#define JPEGD_ASSERT(val)\
|
||||
do {\
|
||||
if (JPEGD_DBG_ASSERT)\
|
||||
{ mpp_assert(val); }\
|
||||
} while (0)
|
||||
do {\
|
||||
if (JPEGD_DBG_ASSERT)\
|
||||
{ mpp_assert(val); }\
|
||||
} while (0)
|
||||
|
||||
|
||||
//check function return
|
||||
#define CHECK_FUN(val) \
|
||||
do{ \
|
||||
if((val) < 0) { \
|
||||
ret = (val); \
|
||||
mpp_log("func return error(Line %d), ret:%d\n", __LINE__, ret); \
|
||||
goto __FAILED; \
|
||||
} \
|
||||
} while (0)
|
||||
do{ \
|
||||
if((val) < 0) { \
|
||||
ret = (val); \
|
||||
mpp_log("func return error(Line %d), ret:%d\n", __LINE__, ret); \
|
||||
goto __FAILED; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
//memory malloc check
|
||||
#define CHECK_MEM(val, ...)\
|
||||
do{ if(!(val)) {\
|
||||
ret = MPP_ERR_MALLOC;\
|
||||
mpp_log("malloc buffer error(Line %d), pointer:%p\n", __LINE__, val);\
|
||||
goto __FAILED;\
|
||||
} } while (0)
|
||||
do{ if(!(val)) {\
|
||||
ret = MPP_ERR_MALLOC;\
|
||||
mpp_log("malloc buffer error(Line %d), pointer:%p\n", __LINE__, val);\
|
||||
goto __FAILED;\
|
||||
} } while (0)
|
||||
|
||||
#define JPEGD_VERBOSE_LOG(fmt, ...) \
|
||||
do {\
|
||||
if (JPEGD_VBE_LOG & jpegd_log)\
|
||||
{ mpp_log("[Verbose] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
do {\
|
||||
if (JPEGD_VBE_LOG & jpegd_log)\
|
||||
{ mpp_log("[Verbose] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
|
||||
#define JPEGD_DEBUG_LOG(fmt, ...) \
|
||||
do {\
|
||||
if (JPEGD_DBG_LOG & jpegd_log)\
|
||||
{ mpp_log("[Debug] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
do {\
|
||||
if (JPEGD_DBG_LOG & jpegd_log)\
|
||||
{ mpp_log("[Debug] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
|
||||
#define JPEGD_INFO_LOG(fmt, ...) \
|
||||
do {\
|
||||
if (JPEGD_INF_LOG & jpegd_log)\
|
||||
{ mpp_log("[Info] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
do {\
|
||||
if (JPEGD_INF_LOG & jpegd_log)\
|
||||
{ mpp_log("[Info] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
|
||||
#define JPEGD_ERROR_LOG(fmt, ...) \
|
||||
do {\
|
||||
if (JPEGD_ERR_LOG & jpegd_log)\
|
||||
{ mpp_log("[Error] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
do {\
|
||||
if (JPEGD_ERR_LOG & jpegd_log)\
|
||||
{ mpp_log("[Error] func(%s), line(%d), "fmt"", __FUNCTION__, __LINE__, ##__VA_ARGS__); }\
|
||||
} while (0)
|
||||
|
||||
|
||||
MPP_RET jpegd_prepare(void *ctx, MppPacket pkt, HalDecTask *task);
|
||||
|
||||
@@ -340,7 +340,7 @@ typedef struct {
|
||||
*/
|
||||
} JpegDecImageInfo;
|
||||
|
||||
typedef struct JpegSyntaxParam{
|
||||
typedef struct JpegSyntaxParam {
|
||||
StreamStorage stream;
|
||||
FrameInfo frame;
|
||||
ImageData image;
|
||||
@@ -349,12 +349,12 @@ typedef struct JpegSyntaxParam{
|
||||
HuffmanTables vlc;
|
||||
QuantTables quant;
|
||||
JpegDecImageInfo imageInfo;
|
||||
RK_U32 ppInputFomart;
|
||||
RK_U32 ppInputFomart;
|
||||
PostProcessInfo ppInfo;
|
||||
RK_U32 is8190;
|
||||
RK_U32 fuseBurned;
|
||||
RK_U32 ppScaleW;
|
||||
RK_U32 ppScaleH;
|
||||
RK_U32 ppScaleW;
|
||||
RK_U32 ppScaleH;
|
||||
RK_U32 minSupportedWidth;
|
||||
RK_U32 minSupportedHeight;
|
||||
RK_U32 maxSupportedWidth;
|
||||
@@ -370,7 +370,7 @@ typedef struct JpegSyntaxParam{
|
||||
|
||||
const void *ppInstance;
|
||||
VPUMemLinear_t *pictureMem;
|
||||
}JpegSyntaxParam;
|
||||
} JpegSyntaxParam;
|
||||
|
||||
|
||||
#endif /*__JPEGD_SYNTAX__*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,7 @@
|
||||
#define PP_OUT_FORMAT_YUV420INTERLAVE 5
|
||||
|
||||
|
||||
typedef struct JpegRegSet{
|
||||
typedef struct JpegRegSet {
|
||||
struct {
|
||||
RK_U32 sw_pp_max_burst : 5;
|
||||
RK_U32 sw_pp_scmd_dis : 1;
|
||||
@@ -79,178 +79,178 @@ typedef struct JpegRegSet{
|
||||
RK_U32 sw_pp_axi_wr_id : 8;
|
||||
} reg0;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_color_coeffa1 : 10;
|
||||
RK_U32 sw_color_coeffa2 : 10;
|
||||
RK_U32 sw_color_coeffb : 10;
|
||||
} reg1;
|
||||
struct {
|
||||
RK_U32 sw_color_coeffa1 : 10;
|
||||
RK_U32 sw_color_coeffa2 : 10;
|
||||
RK_U32 sw_color_coeffb : 10;
|
||||
} reg1;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_color_coeffc : 10;
|
||||
RK_U32 sw_color_coeffd : 10;
|
||||
RK_U32 sw_color_coeffe : 10;
|
||||
} reg2;
|
||||
struct {
|
||||
RK_U32 sw_color_coeffc : 10;
|
||||
RK_U32 sw_color_coeffd : 10;
|
||||
RK_U32 sw_color_coeffe : 10;
|
||||
} reg2;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_pp_color_coefff : 8;
|
||||
} reg3;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_scale_wratio : 18;
|
||||
RK_U32 sw_hor_scale_mode : 2;
|
||||
RK_U32 sw_ver_scale_mode : 2;
|
||||
} reg4;
|
||||
struct {
|
||||
RK_U32 sw_scale_wratio : 18;
|
||||
RK_U32 sw_hor_scale_mode : 2;
|
||||
RK_U32 sw_ver_scale_mode : 2;
|
||||
} reg4;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_scale_hratio : 18;
|
||||
} reg5;
|
||||
struct {
|
||||
RK_U32 sw_scale_hratio : 18;
|
||||
} reg5;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_wscale_invra : 16;
|
||||
RK_U32 sw_hscale_invra : 16;
|
||||
} reg6;
|
||||
struct {
|
||||
RK_U32 sw_wscale_invra : 16;
|
||||
RK_U32 sw_hscale_invra : 16;
|
||||
} reg6;
|
||||
|
||||
RK_U32 reg7;
|
||||
RK_U32 reg8;
|
||||
RK_U32 reg9_r_mask;
|
||||
RK_U32 reg10_g_mask;
|
||||
RK_U32 reg11_b_mask;
|
||||
RK_U32 reg12_pp_bot_yin_base;
|
||||
RK_U32 reg13_pp_bot_cin_base;
|
||||
RK_U32 reg7;
|
||||
RK_U32 reg8;
|
||||
RK_U32 reg9_r_mask;
|
||||
RK_U32 reg10_g_mask;
|
||||
RK_U32 reg11_b_mask;
|
||||
RK_U32 reg12_pp_bot_yin_base;
|
||||
RK_U32 reg13_pp_bot_cin_base;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_crop_startx : 9;
|
||||
RK_U32 sw_crop_starty_ext : 3;
|
||||
RK_U32 sw_reserved_1 : 4;
|
||||
RK_U32 sw_crop_starty : 8;
|
||||
RK_U32 sw_crop_startx_ext : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_pp_crop8_d_e : 1;
|
||||
RK_U32 sw_pp_crop8_r_e : 1;
|
||||
RK_U32 sw_reserved_1 : 4;
|
||||
RK_U32 sw_crop_starty : 8;
|
||||
RK_U32 sw_crop_startx_ext : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_pp_crop8_d_e : 1;
|
||||
RK_U32 sw_pp_crop8_r_e : 1;
|
||||
} reg14;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_rangemap_coef_y : 5;
|
||||
RK_U32 sw_ycbcr_range : 1;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_rangemap_coef_c : 5;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_rangemap_coef_c : 5;
|
||||
} reg15;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_rgb_r_padd : 5;
|
||||
RK_U32 sw_reserved_1 : 3;
|
||||
RK_U32 sw_rgb_g_padd : 5;
|
||||
RK_U32 sw_reserved_2 : 3;
|
||||
RK_U32 sw_rgb_b_padd : 5;
|
||||
} reg16;
|
||||
struct {
|
||||
RK_U32 sw_rgb_r_padd : 5;
|
||||
RK_U32 sw_reserved_1 : 3;
|
||||
RK_U32 sw_rgb_g_padd : 5;
|
||||
RK_U32 sw_reserved_2 : 3;
|
||||
RK_U32 sw_rgb_b_padd : 5;
|
||||
} reg16;
|
||||
|
||||
RK_U32 reg17;
|
||||
RK_U32 reg18_pp_in_lu_base;
|
||||
RK_U32 reg19;
|
||||
RK_U32 reg20;
|
||||
RK_U32 reg21_pp_out_lu_base;
|
||||
RK_U32 reg22_pp_out_ch_base;
|
||||
RK_U32 reg23;
|
||||
RK_U32 reg24;
|
||||
RK_U32 reg25;
|
||||
RK_U32 reg26;
|
||||
RK_U32 reg27;
|
||||
RK_U32 reg28;
|
||||
RK_U32 reg29;
|
||||
RK_U32 reg30;
|
||||
RK_U32 reg17;
|
||||
RK_U32 reg18_pp_in_lu_base;
|
||||
RK_U32 reg19;
|
||||
RK_U32 reg20;
|
||||
RK_U32 reg21_pp_out_lu_base;
|
||||
RK_U32 reg22_pp_out_ch_base;
|
||||
RK_U32 reg23;
|
||||
RK_U32 reg24;
|
||||
RK_U32 reg25;
|
||||
RK_U32 reg26;
|
||||
RK_U32 reg27;
|
||||
RK_U32 reg28;
|
||||
RK_U32 reg29;
|
||||
RK_U32 reg30;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_contrast_thr1 : 8;
|
||||
RK_U32 sw_contrast_thr2 : 8;
|
||||
} reg31;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_contrast_off1 : 10;
|
||||
RK_U32 sw_reserved_1 : 6;
|
||||
RK_U32 sw_contrast_off2 : 10;
|
||||
RK_U32 sw_reserved_1 : 6;
|
||||
RK_U32 sw_contrast_off2 : 10;
|
||||
} reg32;
|
||||
|
||||
RK_U32 reg33;
|
||||
RK_U32 reg33;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_pp_in_width : 9;
|
||||
RK_U32 sw_pp_in_w_ext : 3;
|
||||
RK_U32 sw_ext_orig_width : 9;
|
||||
RK_U32 sw_pp_in_height : 8;
|
||||
RK_U32 sw_pp_in_h_ext : 3;
|
||||
RK_U32 sw_ext_orig_width : 9;
|
||||
RK_U32 sw_pp_in_height : 8;
|
||||
RK_U32 sw_pp_in_h_ext : 3;
|
||||
} reg34;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_pp_out_width : 11;
|
||||
RK_U32 sw_reserved_1 : 5;
|
||||
RK_U32 sw_pp_out_height : 11;
|
||||
RK_U32 sw_pp_out_height : 11;
|
||||
} reg35;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_dither_select_r : 2;
|
||||
RK_U32 sw_dither_select_g : 2;
|
||||
RK_U32 sw_dither_select_b : 2;
|
||||
RK_U32 sw_dither_select_b : 2;
|
||||
} reg36;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_pp_in_endian : 1;
|
||||
RK_U32 sw_pp_in_a1_endian : 1;
|
||||
RK_U32 sw_pp_in_a2_endsel : 1;
|
||||
RK_U32 sw_pp_out_endian : 1;
|
||||
RK_U32 sw_rgb_pix_in32 : 1;
|
||||
RK_U32 sw_pp_in_a2_endsel : 1;
|
||||
RK_U32 sw_pp_out_endian : 1;
|
||||
RK_U32 sw_rgb_pix_in32 : 1;
|
||||
RK_U32 sw_reserved_1 : 3;
|
||||
RK_U32 sw_pp_in_swap32_e : 1;
|
||||
RK_U32 sw_pp_in_a1_swap32 : 1;
|
||||
RK_U32 sw_pp_out_swap16_e : 1;
|
||||
RK_U32 sw_pp_out_swap32_e : 1;
|
||||
RK_U32 sw_reserved_2 : 4;
|
||||
RK_U32 sw_pp_in_start_ch : 1;
|
||||
RK_U32 sw_pp_out_start_ch : 1;
|
||||
RK_U32 sw_pp_in_cr_first : 1;
|
||||
RK_U32 sw_pp_out_cr_first : 1;
|
||||
RK_U32 sw_reserved_3 : 4;
|
||||
RK_U32 sw_pp_in_swap32_e : 1;
|
||||
RK_U32 sw_pp_in_a1_swap32 : 1;
|
||||
RK_U32 sw_pp_out_swap16_e : 1;
|
||||
RK_U32 sw_pp_out_swap32_e : 1;
|
||||
RK_U32 sw_reserved_2 : 4;
|
||||
RK_U32 sw_pp_in_start_ch : 1;
|
||||
RK_U32 sw_pp_out_start_ch : 1;
|
||||
RK_U32 sw_pp_in_cr_first : 1;
|
||||
RK_U32 sw_pp_out_cr_first : 1;
|
||||
RK_U32 sw_reserved_3 : 4;
|
||||
RK_U32 sw_pp_in_struct : 3;
|
||||
} reg37;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_rotation_mode : 3;
|
||||
RK_U32 sw_reserved_1 : 5;
|
||||
RK_U32 sw_pp_in_format : 3;
|
||||
RK_U32 sw_pp_out_format : 3;
|
||||
RK_U32 sw_reserved_2 : 2;
|
||||
RK_U32 sw_pp_in_format_es : 3;
|
||||
RK_U32 sw_pp_in_format : 3;
|
||||
RK_U32 sw_pp_out_format : 3;
|
||||
RK_U32 sw_reserved_2 : 2;
|
||||
RK_U32 sw_pp_in_format_es : 3;
|
||||
} reg38;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_display_width : 12;
|
||||
} reg39;
|
||||
|
||||
RK_U32 reg40;
|
||||
RK_U32 reg40;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
RK_U32 sw_pp_e : 1;
|
||||
RK_U32 sw_deint_blend_e : 1;
|
||||
RK_U32 sw_deint_e : 1;
|
||||
RK_U32 sw_pp_clk_gate_e : 1;
|
||||
RK_U32 sw_pp_pipeline_e : 1;
|
||||
RK_U32 sw_deint_e : 1;
|
||||
RK_U32 sw_pp_clk_gate_e : 1;
|
||||
RK_U32 sw_pp_pipeline_e : 1;
|
||||
RK_U32 sw_reserved_1 : 3;
|
||||
RK_U32 sw_rangemap_y_e : 1;
|
||||
RK_U32 sw_rangemap_c_e : 1;
|
||||
RK_U32 sw_reserved_2 : 6;
|
||||
RK_U32 sw_pp_data_disc_e : 1;
|
||||
RK_U32 sw_reserved_3 : 3;
|
||||
RK_U32 sw_mask1_e : 1;
|
||||
RK_U32 sw_mask2_e : 1;
|
||||
RK_U32 sw_mask1_ablend_e : 1;
|
||||
RK_U32 sw_mask2_ablend_e : 1;
|
||||
RK_U32 sw_up_cross_e : 1;
|
||||
RK_U32 sw_down_cross_e : 1;
|
||||
RK_U32 sw_left_cross_e : 1;
|
||||
RK_U32 sw_right_cross_e : 1;
|
||||
RK_U32 sw_pp_ahb_hlock_e : 1;
|
||||
RK_U32 sw_reserved_2 : 6;
|
||||
RK_U32 sw_pp_data_disc_e : 1;
|
||||
RK_U32 sw_reserved_3 : 3;
|
||||
RK_U32 sw_mask1_e : 1;
|
||||
RK_U32 sw_mask2_e : 1;
|
||||
RK_U32 sw_mask1_ablend_e : 1;
|
||||
RK_U32 sw_mask2_ablend_e : 1;
|
||||
RK_U32 sw_up_cross_e : 1;
|
||||
RK_U32 sw_down_cross_e : 1;
|
||||
RK_U32 sw_left_cross_e : 1;
|
||||
RK_U32 sw_right_cross_e : 1;
|
||||
RK_U32 sw_pp_ahb_hlock_e : 1;
|
||||
} reg41;
|
||||
|
||||
RK_U32 ppReg2[8];
|
||||
RK_U32 ppReg2[8];
|
||||
struct {
|
||||
RK_U32 sw_dec_out_tiled_e : 1;
|
||||
RK_U32 sw_dec_latency : 6;
|
||||
@@ -433,12 +433,12 @@ typedef struct JpegRegSet{
|
||||
RK_U32 sw_cb_ac_vlctable : 1;
|
||||
RK_U32 sw_cr_ac_vlctable : 1;
|
||||
RK_U32 sw_jpeg_stream_all : 1;
|
||||
RK_U32 sw_jpeg_filright_e : 1;
|
||||
RK_U32 sw_jpeg_mode : 3;
|
||||
RK_U32 sw_jpeg_qtables : 2;
|
||||
RK_U32 sw_reserved_1 : 12;
|
||||
RK_U32 sw_sync_marker_e : 1;
|
||||
RK_U32 sw_strm_start_bit : 6;
|
||||
RK_U32 sw_jpeg_filright_e : 1;
|
||||
RK_U32 sw_jpeg_mode : 3;
|
||||
RK_U32 sw_jpeg_qtables : 2;
|
||||
RK_U32 sw_reserved_1 : 12;
|
||||
RK_U32 sw_sync_marker_e : 1;
|
||||
RK_U32 sw_strm_start_bit : 6;
|
||||
} reg122;
|
||||
|
||||
struct {
|
||||
@@ -520,112 +520,112 @@ typedef struct JpegRegSet{
|
||||
} reg133;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac1_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 1;
|
||||
RK_U32 sw_ac1_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac1_code3_cnt : 4;
|
||||
RK_U32 sw_ac1_code4_cnt : 5;
|
||||
RK_U32 sw_ac1_code5_cnt : 6;
|
||||
RK_U32 sw_reserved_3 : 2;
|
||||
RK_U32 sw_ac1_code6_cnt : 7;
|
||||
}reg134;
|
||||
RK_U32 sw_ac1_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 1;
|
||||
RK_U32 sw_ac1_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac1_code3_cnt : 4;
|
||||
RK_U32 sw_ac1_code4_cnt : 5;
|
||||
RK_U32 sw_ac1_code5_cnt : 6;
|
||||
RK_U32 sw_reserved_3 : 2;
|
||||
RK_U32 sw_ac1_code6_cnt : 7;
|
||||
} reg134;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac1_code7_cnt : 8;
|
||||
RK_U32 sw_ac1_code8_cnt : 8;
|
||||
RK_U32 sw_ac1_code9_cnt : 8;
|
||||
RK_U32 sw_ac1_code10_cnt : 8;
|
||||
}reg135;
|
||||
RK_U32 sw_ac1_code7_cnt : 8;
|
||||
RK_U32 sw_ac1_code8_cnt : 8;
|
||||
RK_U32 sw_ac1_code9_cnt : 8;
|
||||
RK_U32 sw_ac1_code10_cnt : 8;
|
||||
} reg135;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac1_code11_cnt : 8;
|
||||
RK_U32 sw_ac1_code12_cnt : 8;
|
||||
RK_U32 sw_ac1_code13_cnt : 8;
|
||||
RK_U32 sw_ac1_code14_cnt : 8;
|
||||
}reg136;
|
||||
RK_U32 sw_ac1_code11_cnt : 8;
|
||||
RK_U32 sw_ac1_code12_cnt : 8;
|
||||
RK_U32 sw_ac1_code13_cnt : 8;
|
||||
RK_U32 sw_ac1_code14_cnt : 8;
|
||||
} reg136;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac1_code15_cnt : 8;
|
||||
RK_U32 sw_ac1_code16_cnt : 8;
|
||||
RK_U32 sw_ac2_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 1;
|
||||
RK_U32 sw_ac2_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac2_code3_cnt : 4;
|
||||
RK_U32 sw_ac2_code4_cnt : 5;
|
||||
RK_U32 sw_ac1_code15_cnt : 8;
|
||||
RK_U32 sw_ac1_code16_cnt : 8;
|
||||
RK_U32 sw_ac2_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 1;
|
||||
RK_U32 sw_ac2_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac2_code3_cnt : 4;
|
||||
RK_U32 sw_ac2_code4_cnt : 5;
|
||||
} reg137;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac2_code5_cnt : 6;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_ac2_code6_cnt : 7;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac2_code7_cnt : 8;
|
||||
RK_U32 sw_ac2_code8_cnt : 8;
|
||||
RK_U32 sw_ac2_code5_cnt : 6;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_ac2_code6_cnt : 7;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_ac2_code7_cnt : 8;
|
||||
RK_U32 sw_ac2_code8_cnt : 8;
|
||||
} reg138;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac2_code9_cnt : 8;
|
||||
RK_U32 sw_ac2_code10_cnt : 8;
|
||||
RK_U32 sw_ac2_code11_cnt : 8;
|
||||
RK_U32 sw_ac2_code12_cnt : 8;
|
||||
}reg139;
|
||||
RK_U32 sw_ac2_code9_cnt : 8;
|
||||
RK_U32 sw_ac2_code10_cnt : 8;
|
||||
RK_U32 sw_ac2_code11_cnt : 8;
|
||||
RK_U32 sw_ac2_code12_cnt : 8;
|
||||
} reg139;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_ac2_code13_cnt : 8;
|
||||
RK_U32 sw_ac2_code14_cnt : 8;
|
||||
RK_U32 sw_ac2_code15_cnt : 8;
|
||||
RK_U32 sw_ac2_code16_cnt : 8;
|
||||
}reg140;
|
||||
RK_U32 sw_ac2_code13_cnt : 8;
|
||||
RK_U32 sw_ac2_code14_cnt : 8;
|
||||
RK_U32 sw_ac2_code15_cnt : 8;
|
||||
RK_U32 sw_ac2_code16_cnt : 8;
|
||||
} reg140;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_dc1_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_dc1_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_dc1_code3_cnt : 4;
|
||||
RK_U32 sw_dc1_code4_cnt : 4;
|
||||
RK_U32 sw_dc1_code5_cnt : 4;
|
||||
RK_U32 sw_dc1_code6_cnt : 4;
|
||||
RK_U32 sw_dc1_code7_cnt : 4;
|
||||
RK_U32 sw_dc1_code8_cnt : 4;
|
||||
}reg141;
|
||||
struct {
|
||||
RK_U32 sw_dc1_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_dc1_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_dc1_code3_cnt : 4;
|
||||
RK_U32 sw_dc1_code4_cnt : 4;
|
||||
RK_U32 sw_dc1_code5_cnt : 4;
|
||||
RK_U32 sw_dc1_code6_cnt : 4;
|
||||
RK_U32 sw_dc1_code7_cnt : 4;
|
||||
RK_U32 sw_dc1_code8_cnt : 4;
|
||||
} reg141;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_dc1_code9_cnt : 4;
|
||||
RK_U32 sw_dc1_code10_cnt : 4;
|
||||
RK_U32 sw_dc1_code11_cnt : 4;
|
||||
RK_U32 sw_dc1_code12_cnt : 4;
|
||||
RK_U32 sw_dc1_code13_cnt : 4;
|
||||
RK_U32 sw_dc1_code14_cnt : 4;
|
||||
RK_U32 sw_dc1_code15_cnt : 4;
|
||||
RK_U32 sw_dc1_code16_cnt : 4;
|
||||
}reg142;
|
||||
struct {
|
||||
RK_U32 sw_dc1_code9_cnt : 4;
|
||||
RK_U32 sw_dc1_code10_cnt : 4;
|
||||
RK_U32 sw_dc1_code11_cnt : 4;
|
||||
RK_U32 sw_dc1_code12_cnt : 4;
|
||||
RK_U32 sw_dc1_code13_cnt : 4;
|
||||
RK_U32 sw_dc1_code14_cnt : 4;
|
||||
RK_U32 sw_dc1_code15_cnt : 4;
|
||||
RK_U32 sw_dc1_code16_cnt : 4;
|
||||
} reg142;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_dc2_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_dc2_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_dc2_code3_cnt : 4;
|
||||
RK_U32 sw_dc2_code4_cnt : 4;
|
||||
RK_U32 sw_dc2_code5_cnt : 4;
|
||||
RK_U32 sw_dc2_code6_cnt : 4;
|
||||
RK_U32 sw_dc2_code7_cnt : 4;
|
||||
RK_U32 sw_dc2_code8_cnt : 4;
|
||||
}reg143;
|
||||
struct {
|
||||
RK_U32 sw_dc2_code1_cnt : 2;
|
||||
RK_U32 sw_reserved_1 : 2;
|
||||
RK_U32 sw_dc2_code2_cnt : 3;
|
||||
RK_U32 sw_reserved_2 : 1;
|
||||
RK_U32 sw_dc2_code3_cnt : 4;
|
||||
RK_U32 sw_dc2_code4_cnt : 4;
|
||||
RK_U32 sw_dc2_code5_cnt : 4;
|
||||
RK_U32 sw_dc2_code6_cnt : 4;
|
||||
RK_U32 sw_dc2_code7_cnt : 4;
|
||||
RK_U32 sw_dc2_code8_cnt : 4;
|
||||
} reg143;
|
||||
|
||||
struct {
|
||||
RK_U32 sw_dc2_code9_cnt : 4;
|
||||
RK_U32 sw_dc2_code10_cnt : 4;
|
||||
RK_U32 sw_dc2_code11_cnt : 4;
|
||||
RK_U32 sw_dc2_code12_cnt : 4;
|
||||
RK_U32 sw_dc2_code13_cnt : 4;
|
||||
RK_U32 sw_dc2_code14_cnt : 4;
|
||||
RK_U32 sw_dc2_code15_cnt : 4;
|
||||
RK_U32 sw_dc2_code16_cnt : 4;
|
||||
}reg144;
|
||||
struct {
|
||||
RK_U32 sw_dc2_code9_cnt : 4;
|
||||
RK_U32 sw_dc2_code10_cnt : 4;
|
||||
RK_U32 sw_dc2_code11_cnt : 4;
|
||||
RK_U32 sw_dc2_code12_cnt : 4;
|
||||
RK_U32 sw_dc2_code13_cnt : 4;
|
||||
RK_U32 sw_dc2_code14_cnt : 4;
|
||||
RK_U32 sw_dc2_code15_cnt : 4;
|
||||
RK_U32 sw_dc2_code16_cnt : 4;
|
||||
} reg144;
|
||||
|
||||
RK_U32 reg145_bitpl_ctrl_base;
|
||||
RK_U32 reg_dct_strm1_base[2];
|
||||
@@ -710,14 +710,14 @@ typedef struct JpegHalContext {
|
||||
JpegRegSet regs;
|
||||
MppBufferGroup group;
|
||||
MppBuffer frame_buf;
|
||||
MppBuffer pTableBase;
|
||||
MppBuffer pTableBase;
|
||||
|
||||
RK_U32 hal_debug_enable;
|
||||
RK_U32 frame_count;
|
||||
RK_U32 output_yuv_count;
|
||||
RK_U32 hal_debug_enable;
|
||||
RK_U32 frame_count;
|
||||
RK_U32 output_yuv_count;
|
||||
|
||||
FILE *fp_reg_in;
|
||||
FILE *fp_reg_out;
|
||||
}JpegHalContext;
|
||||
} JpegHalContext;
|
||||
|
||||
#endif /* __HAL_JPEGD_REG_H__ */
|
||||
|
||||
@@ -72,12 +72,12 @@ typedef struct jpegdDemoCtx {
|
||||
MppBufferGroup strmbuf_grp;
|
||||
MppPacket pkt;
|
||||
|
||||
FILE* pOutFile;
|
||||
FILE* pOutFile;
|
||||
|
||||
RK_U8 *strmbuf;
|
||||
RK_U32 strmbytes;
|
||||
RK_U32 dec_frm_num;
|
||||
}jpegdDemoCtx;
|
||||
} jpegdDemoCtx;
|
||||
|
||||
static OptionInfo jpeg_parserCmd[] = {
|
||||
{"i", "input_file", "input bitstream file"},
|
||||
@@ -97,10 +97,10 @@ MPP_RET jpegd_readbytes_from_file(RK_U8* buf, RK_S32 aBytes, FILE* fp)
|
||||
}
|
||||
|
||||
RK_S32 rd_bytes = fread(buf, 1, aBytes, fp);
|
||||
if(rd_bytes != aBytes){
|
||||
mpp_log("read %u bytes from file fail, actually only %#x bytes is read.", (RK_U32)aBytes, rd_bytes);
|
||||
if (rd_bytes != aBytes) {
|
||||
mpp_log("read %u bytes from file fail, actually only %#x bytes is read.", (RK_U32)aBytes, rd_bytes);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
mpp_log("read %d bytes from file sucessfully, the first 4 bytes: %08x", rd_bytes, *((RK_U32*)buf));
|
||||
|
||||
return ret;
|
||||
@@ -126,13 +126,13 @@ static void jpeg_show_options(int count, OptionInfo *options)
|
||||
static RK_S32 jpeg_show_help()
|
||||
{
|
||||
mpp_log("usage: parserDemo [options] input_file, \n\n");
|
||||
jpeg_show_options(sizeof(jpeg_parserCmd)/sizeof(OptionInfo), jpeg_parserCmd);
|
||||
jpeg_show_options(sizeof(jpeg_parserCmd) / sizeof(OptionInfo), jpeg_parserCmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static RK_S32 jpeg_parse_options(int argc, char **argv, parserDemoCmdCtx* cmdCxt)
|
||||
{
|
||||
mpp_log("jpeg_parse_options enter\n");
|
||||
mpp_log("jpeg_parse_options enter\n");
|
||||
const char *opt;
|
||||
RK_S32 optindex, handleoptions = 1, ret = 0;
|
||||
|
||||
@@ -235,13 +235,13 @@ PARSE_OPINIONS_OUT:
|
||||
jpeg_show_usage();
|
||||
return MPP_ERR_STREAM;
|
||||
}
|
||||
mpp_log("jpeg_parse_options exit\n");
|
||||
mpp_log("jpeg_parse_options exit\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET jpegd_test_deinit(jpegdDemoCtx *ctx)
|
||||
{
|
||||
FUN_TEST("Enter");
|
||||
FUN_TEST("Enter");
|
||||
MppDec *pApi = &(ctx->api);
|
||||
if (pApi->parser) {
|
||||
parser_deinit(pApi->parser);
|
||||
@@ -271,233 +271,233 @@ MPP_RET jpegd_test_deinit(jpegdDemoCtx *ctx)
|
||||
mpp_err("strmbuf_grp deinit");
|
||||
mpp_buffer_group_put(ctx->strmbuf_grp);
|
||||
}
|
||||
if(ctx->strmbuf) {
|
||||
if (ctx->strmbuf) {
|
||||
mpp_err("strmbuf free");
|
||||
mpp_free(ctx->strmbuf);
|
||||
}
|
||||
if(ctx->pOutFile){
|
||||
if (ctx->pOutFile) {
|
||||
mpp_err("close output file");
|
||||
fclose(ctx->pOutFile);
|
||||
ctx->pOutFile = NULL;
|
||||
}
|
||||
fclose(ctx->pOutFile);
|
||||
ctx->pOutFile = NULL;
|
||||
}
|
||||
|
||||
FUN_TEST("Exit");
|
||||
FUN_TEST("Exit");
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET jpegd_test_init(parserDemoCmdCtx *cmd, jpegdDemoCtx *ctx)
|
||||
{
|
||||
FUN_TEST("Enter");
|
||||
MPP_RET ret = MPP_OK;
|
||||
MppDec *pMppDec = NULL;
|
||||
ParserCfg parser_cfg;
|
||||
MppHalCfg hal_cfg;
|
||||
FUN_TEST("Enter");
|
||||
MPP_RET ret = MPP_OK;
|
||||
MppDec *pMppDec = NULL;
|
||||
ParserCfg parser_cfg;
|
||||
MppHalCfg hal_cfg;
|
||||
|
||||
memset(ctx, 0, sizeof(jpegdDemoCtx));
|
||||
ctx->cfg = cmd;
|
||||
memset(ctx, 0, sizeof(jpegdDemoCtx));
|
||||
ctx->cfg = cmd;
|
||||
|
||||
//demo configure
|
||||
ctx->pOutFile = fopen("/data/spurs.yuv", "wb+");
|
||||
if(NULL == ctx->pOutFile){
|
||||
JPEGD_ERROR_LOG("create spurs.yuv failed");
|
||||
}
|
||||
//demo configure
|
||||
ctx->pOutFile = fopen("/data/spurs.yuv", "wb+");
|
||||
if (NULL == ctx->pOutFile) {
|
||||
JPEGD_ERROR_LOG("create spurs.yuv failed");
|
||||
}
|
||||
|
||||
//malloc buffers for software
|
||||
CHECK_MEM(ctx->strmbuf = mpp_malloc_size(RK_U8, JPEGD_STREAM_BUFF_SIZE));
|
||||
//malloc buffers for software
|
||||
CHECK_MEM(ctx->strmbuf = mpp_malloc_size(RK_U8, JPEGD_STREAM_BUFF_SIZE));
|
||||
|
||||
//malloc buffers for hardware
|
||||
if (ctx->frmbuf_grp == NULL) {
|
||||
ret = mpp_buffer_group_get_internal(&ctx->frmbuf_grp, MPP_BUFFER_TYPE_ION);
|
||||
if (MPP_OK != ret) {
|
||||
mpp_err("frmbuf_grp: jpegd mpp_buffer_group_get_internal failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
}
|
||||
if (ctx->strmbuf_grp == NULL) {
|
||||
ret = mpp_buffer_group_get_internal(&ctx->strmbuf_grp, MPP_BUFFER_TYPE_ION);
|
||||
if (MPP_OK != ret) {
|
||||
mpp_err("strmbuf_grp: jpegd mpp_buffer_group_get_internal failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
}
|
||||
//malloc buffers for hardware
|
||||
if (ctx->frmbuf_grp == NULL) {
|
||||
ret = mpp_buffer_group_get_internal(&ctx->frmbuf_grp, MPP_BUFFER_TYPE_ION);
|
||||
if (MPP_OK != ret) {
|
||||
mpp_err("frmbuf_grp: jpegd mpp_buffer_group_get_internal failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
}
|
||||
if (ctx->strmbuf_grp == NULL) {
|
||||
ret = mpp_buffer_group_get_internal(&ctx->strmbuf_grp, MPP_BUFFER_TYPE_ION);
|
||||
if (MPP_OK != ret) {
|
||||
mpp_err("strmbuf_grp: jpegd mpp_buffer_group_get_internal failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
//api config
|
||||
pMppDec = &ctx->api;
|
||||
pMppDec->coding = MPP_VIDEO_CodingMJPEG;
|
||||
//api config
|
||||
pMppDec = &ctx->api;
|
||||
pMppDec->coding = MPP_VIDEO_CodingMJPEG;
|
||||
|
||||
CHECK_FUN(mpp_buf_slot_init(&pMppDec->frame_slots));
|
||||
CHECK_MEM(pMppDec->frame_slots);
|
||||
mpp_buf_slot_setup(pMppDec->frame_slots, 2);
|
||||
CHECK_FUN(mpp_buf_slot_init(&pMppDec->frame_slots));
|
||||
CHECK_MEM(pMppDec->frame_slots);
|
||||
mpp_buf_slot_setup(pMppDec->frame_slots, 2);
|
||||
|
||||
CHECK_FUN(mpp_buf_slot_init(&pMppDec->packet_slots));
|
||||
CHECK_MEM(pMppDec->packet_slots);
|
||||
mpp_buf_slot_setup(pMppDec->packet_slots, 2);
|
||||
CHECK_FUN(mpp_buf_slot_init(&pMppDec->packet_slots));
|
||||
CHECK_MEM(pMppDec->packet_slots);
|
||||
mpp_buf_slot_setup(pMppDec->packet_slots, 2);
|
||||
|
||||
//parser config
|
||||
memset(&parser_cfg, 0, sizeof(parser_cfg));
|
||||
parser_cfg.coding = pMppDec->coding;
|
||||
parser_cfg.frame_slots = pMppDec->frame_slots;
|
||||
parser_cfg.packet_slots = pMppDec->packet_slots;
|
||||
parser_cfg.task_count = 2;
|
||||
parser_cfg.need_split = 0;
|
||||
CHECK_FUN(parser_init(&pMppDec->parser, &parser_cfg));
|
||||
//parser config
|
||||
memset(&parser_cfg, 0, sizeof(parser_cfg));
|
||||
parser_cfg.coding = pMppDec->coding;
|
||||
parser_cfg.frame_slots = pMppDec->frame_slots;
|
||||
parser_cfg.packet_slots = pMppDec->packet_slots;
|
||||
parser_cfg.task_count = 2;
|
||||
parser_cfg.need_split = 0;
|
||||
CHECK_FUN(parser_init(&pMppDec->parser, &parser_cfg));
|
||||
|
||||
//hal config
|
||||
memset(&hal_cfg, 0, sizeof(hal_cfg));
|
||||
hal_cfg.type = MPP_CTX_DEC;
|
||||
hal_cfg.coding = pMppDec->coding;
|
||||
hal_cfg.work_mode = HAL_MODE_LIBVPU;
|
||||
{
|
||||
RK_U32 hal_device_id = 0;
|
||||
//mpp_env_get_u32("h264d_chg_org", &hal_device_id, 1);
|
||||
hal_device_id = 0;
|
||||
if (hal_device_id == 1) {
|
||||
hal_cfg.device_id = HAL_RKVDEC;
|
||||
} else {
|
||||
hal_cfg.device_id = HAL_VDPU;
|
||||
}
|
||||
}
|
||||
hal_cfg.frame_slots = pMppDec->frame_slots;
|
||||
hal_cfg.packet_slots = pMppDec->packet_slots;
|
||||
hal_cfg.task_count = parser_cfg.task_count;
|
||||
CHECK_FUN(mpp_hal_init(&pMppDec->hal, &hal_cfg));
|
||||
pMppDec->tasks = hal_cfg.tasks;
|
||||
//hal config
|
||||
memset(&hal_cfg, 0, sizeof(hal_cfg));
|
||||
hal_cfg.type = MPP_CTX_DEC;
|
||||
hal_cfg.coding = pMppDec->coding;
|
||||
hal_cfg.work_mode = HAL_MODE_LIBVPU;
|
||||
{
|
||||
RK_U32 hal_device_id = 0;
|
||||
//mpp_env_get_u32("h264d_chg_org", &hal_device_id, 1);
|
||||
hal_device_id = 0;
|
||||
if (hal_device_id == 1) {
|
||||
hal_cfg.device_id = HAL_RKVDEC;
|
||||
} else {
|
||||
hal_cfg.device_id = HAL_VDPU;
|
||||
}
|
||||
}
|
||||
hal_cfg.frame_slots = pMppDec->frame_slots;
|
||||
hal_cfg.packet_slots = pMppDec->packet_slots;
|
||||
hal_cfg.task_count = parser_cfg.task_count;
|
||||
CHECK_FUN(mpp_hal_init(&pMppDec->hal, &hal_cfg));
|
||||
pMppDec->tasks = hal_cfg.tasks;
|
||||
|
||||
memset(&ctx->task, 0, sizeof(ctx->task));
|
||||
memset(ctx->task.refer, -1, sizeof(ctx->task.refer));
|
||||
ctx->task.input = -1;
|
||||
memset(&ctx->task, 0, sizeof(ctx->task));
|
||||
memset(ctx->task.refer, -1, sizeof(ctx->task.refer));
|
||||
ctx->task.input = -1;
|
||||
|
||||
FUN_TEST("Exit");
|
||||
return MPP_OK;
|
||||
FUN_TEST("Exit");
|
||||
return MPP_OK;
|
||||
__FAILED:
|
||||
FUN_TEST("Exit");
|
||||
return ret;
|
||||
FUN_TEST("Exit");
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET jpegd_parser_test(parserDemoCmdCtx *cmd)
|
||||
{
|
||||
FUN_TEST("Enter");
|
||||
MPP_RET ret = MPP_OK;
|
||||
MppDec *pMppDec = NULL;
|
||||
HalDecTask *curtask = NULL;
|
||||
jpegdDemoCtx DemoCtx;
|
||||
FUN_TEST("Enter");
|
||||
MPP_RET ret = MPP_OK;
|
||||
MppDec *pMppDec = NULL;
|
||||
HalDecTask *curtask = NULL;
|
||||
jpegdDemoCtx DemoCtx;
|
||||
FILE* pInFile = NULL;
|
||||
RK_S32 fileSize = 0;
|
||||
RK_S32 fileSize = 0;
|
||||
|
||||
// 1.jpegd_test_init
|
||||
jpegd_test_init(cmd, &DemoCtx);
|
||||
jpegd_test_init(cmd, &DemoCtx);
|
||||
|
||||
pMppDec = &DemoCtx.api;
|
||||
curtask = &DemoCtx.task;
|
||||
pMppDec = &DemoCtx.api;
|
||||
curtask = &DemoCtx.task;
|
||||
|
||||
do {
|
||||
RK_S32 slot_idx = 0;
|
||||
do {
|
||||
RK_S32 slot_idx = 0;
|
||||
|
||||
if (cmd->have_input) {
|
||||
mpp_log("input bitstream w: %d, h: %d, path: %s\n",
|
||||
cmd->width, cmd->height, cmd->input_file);
|
||||
if (cmd->have_input) {
|
||||
mpp_log("input bitstream w: %d, h: %d, path: %s\n",
|
||||
cmd->width, cmd->height, cmd->input_file);
|
||||
|
||||
pInFile = fopen(cmd->input_file, "rb");
|
||||
if (pInFile == NULL) {
|
||||
mpp_log("input file not exsist\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
} else {
|
||||
mpp_log("please set input bitstream file\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
pInFile = fopen(cmd->input_file, "rb");
|
||||
if (pInFile == NULL) {
|
||||
mpp_log("input file not exsist\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
} else {
|
||||
mpp_log("please set input bitstream file\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
|
||||
fseek(pInFile, 0L, SEEK_END);
|
||||
fileSize = ftell(pInFile);
|
||||
fseek(pInFile, 0L, SEEK_SET);
|
||||
fseek(pInFile, 0L, SEEK_END);
|
||||
fileSize = ftell(pInFile);
|
||||
fseek(pInFile, 0L, SEEK_SET);
|
||||
|
||||
// 2.jpegd_readbytes_from_file
|
||||
ret = jpegd_readbytes_from_file(DemoCtx.strmbuf, fileSize, pInFile);
|
||||
if(ret != MPP_OK){
|
||||
mpp_log("read bytes from file failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
mpp_packet_init(&DemoCtx.pkt, DemoCtx.strmbuf, fileSize);
|
||||
// 2.jpegd_readbytes_from_file
|
||||
ret = jpegd_readbytes_from_file(DemoCtx.strmbuf, fileSize, pInFile);
|
||||
if (ret != MPP_OK) {
|
||||
mpp_log("read bytes from file failed\n");
|
||||
goto __FAILED;
|
||||
}
|
||||
mpp_packet_init(&DemoCtx.pkt, DemoCtx.strmbuf, fileSize);
|
||||
|
||||
// 3.parser_prepare
|
||||
CHECK_FUN(parser_prepare(pMppDec->parser, DemoCtx.pkt, curtask)); // jpegd_parser_prepare
|
||||
// 3.parser_prepare
|
||||
CHECK_FUN(parser_prepare(pMppDec->parser, DemoCtx.pkt, curtask)); // jpegd_parser_prepare
|
||||
|
||||
if (-1 == curtask->input) {
|
||||
if (MPP_OK == mpp_buf_slot_get_unused(pMppDec->packet_slots, &slot_idx) ) {
|
||||
MppBuffer buffer = NULL;
|
||||
curtask->input = slot_idx;
|
||||
if (-1 == curtask->input) {
|
||||
if (MPP_OK == mpp_buf_slot_get_unused(pMppDec->packet_slots, &slot_idx) ) {
|
||||
MppBuffer buffer = NULL;
|
||||
curtask->input = slot_idx;
|
||||
|
||||
mpp_buf_slot_get_prop(pMppDec->packet_slots, slot_idx, SLOT_BUFFER, &buffer);
|
||||
if (NULL == buffer) {
|
||||
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pMppDec->packet_slots);
|
||||
if (size == 0) {
|
||||
size = (1024 * 1024);
|
||||
}
|
||||
mpp_buf_slot_get_prop(pMppDec->packet_slots, slot_idx, SLOT_BUFFER, &buffer);
|
||||
if (NULL == buffer) {
|
||||
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pMppDec->packet_slots);
|
||||
if (size == 0) {
|
||||
size = (1024 * 1024);
|
||||
}
|
||||
|
||||
mpp_buffer_get(DemoCtx.strmbuf_grp, &buffer, size);
|
||||
if (buffer != NULL){
|
||||
mpp_err("mpp_buf_slot_get_prop, buffer:%p, size:%d", buffer, size);
|
||||
mpp_buf_slot_set_prop(pMppDec->packet_slots, slot_idx, SLOT_BUFFER, buffer);
|
||||
}
|
||||
}
|
||||
mpp_buffer_get(DemoCtx.strmbuf_grp, &buffer, size);
|
||||
if (buffer != NULL) {
|
||||
mpp_err("mpp_buf_slot_get_prop, buffer:%p, size:%d", buffer, size);
|
||||
mpp_buf_slot_set_prop(pMppDec->packet_slots, slot_idx, SLOT_BUFFER, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
mpp_buffer_write(buffer, 0,
|
||||
mpp_packet_get_data(curtask->input_packet),
|
||||
mpp_packet_get_size(curtask->input_packet));
|
||||
mpp_buffer_write(buffer, 0,
|
||||
mpp_packet_get_data(curtask->input_packet),
|
||||
mpp_packet_get_size(curtask->input_packet));
|
||||
|
||||
mpp_err("%s Line %d, (*input_packet):%p, length:%d", __func__,__LINE__,
|
||||
mpp_packet_get_data(curtask->input_packet),
|
||||
mpp_packet_get_size(curtask->input_packet));
|
||||
DemoCtx.pkt_buf = buffer;
|
||||
mpp_err("%s Line %d, (*input_packet):%p, length:%d", __func__, __LINE__,
|
||||
mpp_packet_get_data(curtask->input_packet),
|
||||
mpp_packet_get_size(curtask->input_packet));
|
||||
DemoCtx.pkt_buf = buffer;
|
||||
|
||||
mpp_buf_slot_set_flag(pMppDec->packet_slots, curtask->input, SLOT_CODEC_READY);
|
||||
mpp_buf_slot_set_flag(pMppDec->packet_slots, curtask->input, SLOT_HAL_INPUT);
|
||||
}
|
||||
}
|
||||
mpp_buf_slot_set_flag(pMppDec->packet_slots, curtask->input, SLOT_CODEC_READY);
|
||||
mpp_buf_slot_set_flag(pMppDec->packet_slots, curtask->input, SLOT_HAL_INPUT);
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_FUN(parser_parse(pMppDec->parser, curtask)); // jpegd_parser_parse
|
||||
CHECK_FUN(parser_parse(pMppDec->parser, curtask)); // jpegd_parser_parse
|
||||
|
||||
if (curtask->valid) {
|
||||
HalTaskInfo task_info;
|
||||
MppBuffer buffer = NULL;
|
||||
task_info.dec = *curtask;
|
||||
RK_S32 index = curtask->output;
|
||||
if (curtask->valid) {
|
||||
HalTaskInfo task_info;
|
||||
MppBuffer buffer = NULL;
|
||||
task_info.dec = *curtask;
|
||||
RK_S32 index = curtask->output;
|
||||
|
||||
if (mpp_buf_slot_is_changed(pMppDec->frame_slots)) {
|
||||
mpp_buf_slot_ready(pMppDec->frame_slots);
|
||||
}
|
||||
if (mpp_buf_slot_is_changed(pMppDec->frame_slots)) {
|
||||
mpp_buf_slot_ready(pMppDec->frame_slots);
|
||||
}
|
||||
|
||||
mpp_buf_slot_get_prop(pMppDec->frame_slots, index, SLOT_BUFFER, &buffer);
|
||||
if (NULL == buffer) {
|
||||
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pMppDec->frame_slots);
|
||||
if (size == 0) {
|
||||
size = 1920 * 1080 * 5;
|
||||
}
|
||||
mpp_buf_slot_get_prop(pMppDec->frame_slots, index, SLOT_BUFFER, &buffer);
|
||||
if (NULL == buffer) {
|
||||
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pMppDec->frame_slots);
|
||||
if (size == 0) {
|
||||
size = 1920 * 1080 * 5;
|
||||
}
|
||||
|
||||
mpp_buffer_get(DemoCtx.frmbuf_grp, &buffer, size);
|
||||
if (buffer){
|
||||
mpp_buf_slot_set_prop(pMppDec->frame_slots, index, SLOT_BUFFER, buffer);
|
||||
mpp_err("frame_slots, buffer:%p, size:%d", buffer, size);
|
||||
}
|
||||
mpp_buffer_get(DemoCtx.frmbuf_grp, &buffer, size);
|
||||
if (buffer) {
|
||||
mpp_buf_slot_set_prop(pMppDec->frame_slots, index, SLOT_BUFFER, buffer);
|
||||
mpp_err("frame_slots, buffer:%p, size:%d", buffer, size);
|
||||
}
|
||||
|
||||
DemoCtx.pic_buf = buffer;
|
||||
}
|
||||
DemoCtx.pic_buf = buffer;
|
||||
}
|
||||
|
||||
mpp_hal_reg_gen(pMppDec->hal, &task_info); // jpegd_hal_gen_regs
|
||||
mpp_hal_hw_start(pMppDec->hal, &task_info); // jpegd_hal_start
|
||||
mpp_hal_hw_wait(pMppDec->hal, &task_info); // jpegd_hal_wait
|
||||
mpp_hal_reg_gen(pMppDec->hal, &task_info); // jpegd_hal_gen_regs
|
||||
mpp_hal_hw_start(pMppDec->hal, &task_info); // jpegd_hal_start
|
||||
mpp_hal_hw_wait(pMppDec->hal, &task_info); // jpegd_hal_wait
|
||||
|
||||
parser_reset(pMppDec->parser); //[TEMP] jpegd_parser_reset
|
||||
parser_reset(pMppDec->parser); //[TEMP] jpegd_parser_reset
|
||||
|
||||
void* pOutYUV = NULL;
|
||||
pOutYUV = mpp_buffer_get_ptr(DemoCtx.pic_buf);
|
||||
void* pOutYUV = NULL;
|
||||
pOutYUV = mpp_buffer_get_ptr(DemoCtx.pic_buf);
|
||||
if (pOutYUV) {
|
||||
JPEGD_INFO_LOG("pOutYUV:%p", pOutYUV);
|
||||
JpegSyntaxParam *pTmpSyn = (JpegSyntaxParam *)curtask->syntax.data;
|
||||
RK_U32 width = pTmpSyn->frame.hwX;
|
||||
RK_U32 height = pTmpSyn->frame.hwY;
|
||||
JPEGD_INFO_LOG("pOutYUV:%p", pOutYUV);
|
||||
JpegSyntaxParam *pTmpSyn = (JpegSyntaxParam *)curtask->syntax.data;
|
||||
RK_U32 width = pTmpSyn->frame.hwX;
|
||||
RK_U32 height = pTmpSyn->frame.hwY;
|
||||
|
||||
JPEGD_INFO_LOG("Output Image: %d*%d", width, height);
|
||||
JPEGD_INFO_LOG("Output Image: %d*%d", width, height);
|
||||
if (DemoCtx.pOutFile) {
|
||||
fwrite(pOutYUV, 1, width * height * 3 / 2, DemoCtx.pOutFile);
|
||||
fflush(DemoCtx.pOutFile);
|
||||
@@ -505,40 +505,40 @@ MPP_RET jpegd_parser_test(parserDemoCmdCtx *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
/*** parser packet deinit ***/
|
||||
if(DemoCtx.pkt_buf) {
|
||||
mpp_buffer_put(DemoCtx.pkt_buf);
|
||||
}
|
||||
if(DemoCtx.pic_buf) {
|
||||
mpp_buffer_put(DemoCtx.pic_buf);
|
||||
}
|
||||
/*** parser packet deinit ***/
|
||||
if (DemoCtx.pkt_buf) {
|
||||
mpp_buffer_put(DemoCtx.pkt_buf);
|
||||
}
|
||||
if (DemoCtx.pic_buf) {
|
||||
mpp_buffer_put(DemoCtx.pic_buf);
|
||||
}
|
||||
|
||||
mpp_buf_slot_clr_flag(pMppDec->packet_slots, curtask->input, SLOT_HAL_INPUT);
|
||||
mpp_buf_slot_clr_flag(pMppDec->frame_slots, curtask->output, SLOT_HAL_OUTPUT);
|
||||
mpp_buf_slot_clr_flag(pMppDec->packet_slots, curtask->input, SLOT_HAL_INPUT);
|
||||
mpp_buf_slot_clr_flag(pMppDec->frame_slots, curtask->output, SLOT_HAL_OUTPUT);
|
||||
|
||||
memset(curtask, 0, sizeof(HalDecTask));
|
||||
memset(&curtask->refer, -1, sizeof(curtask->refer));
|
||||
curtask->input = -1;
|
||||
memset(curtask, 0, sizeof(HalDecTask));
|
||||
memset(&curtask->refer, -1, sizeof(curtask->refer));
|
||||
curtask->input = -1;
|
||||
|
||||
DemoCtx.dec_frm_num ++;
|
||||
}while(0);
|
||||
DemoCtx.dec_frm_num ++;
|
||||
} while (0);
|
||||
|
||||
CHECK_FUN(mpp_dec_flush(pMppDec));
|
||||
CHECK_FUN(mpp_dec_flush(pMppDec));
|
||||
|
||||
__FAILED:
|
||||
if(pInFile){
|
||||
fclose(pInFile);
|
||||
pInFile = NULL;
|
||||
}
|
||||
jpegd_test_deinit(&DemoCtx);
|
||||
if (pInFile) {
|
||||
fclose(pInFile);
|
||||
pInFile = NULL;
|
||||
}
|
||||
jpegd_test_deinit(&DemoCtx);
|
||||
|
||||
FUN_TEST("Exit");
|
||||
FUN_TEST("Exit");
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FUN_TEST("Enter");
|
||||
FUN_TEST("Enter");
|
||||
|
||||
RK_S32 ret = 0;
|
||||
parserDemoCmdCtx demoCmdCtx;
|
||||
@@ -565,6 +565,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
jpegd_parser_test(cmd);
|
||||
|
||||
FUN_TEST("Exit");
|
||||
FUN_TEST("Exit");
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user