Hardware JPEGDEC APIs

[English]

JPEGDEC API Categories

JPEGDEC APIs:

HW JPEG DECODE Config

jpeg dec Overview

Figure 1. jpeg decode config flow

API Reference

Header File

Functions

bk_err_t bk_jpeg_dec_driver_init(void)

HW JPEG DEC API.

this api open the jpeg decode clk

bk_err_t bk_jpeg_dec_driver_deinit(void)

this api close the jpeg decode clk

  • disable jpeg decode

bk_err_t bk_jpeg_dec_line_int_en(uint32_t line_num)

this api used for jpeg decode config

Usage example:

 if x pixel 320, you set bk_jpeg_dec_line_int_en(32), every 32 line will enter isr, in all ten times
 if x pixel 240, you set bk_jpeg_dec_line_int_en(24), every 24 line will enter isr, in all ten times

参数
  • xpixel – jpeg decode picture x pixel

    • input_buf decode input data addr

      • output_buf decode output data addr

  • lin_num – decode line num ,should multiple of 8,

返回

  • BK_OK: succeed

  • others: other errors.

this api used for jpeg decode line interrupt config decode can select a frame complete done isr(defult) , or this decode lin_num enter int isr

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_jpeg_dec_line_int_dis(void)

this api used for disable jpeg decode line num int

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_jpeg_dec_hw_start(uint32_t length, unsigned char *input_buf, unsigned char *output_buf)

this api start jpeg decode

参数

length – jpeg length

  • input_buf jpeg data src addr

  • output_buf jpeg decode output addr

返回

0: jpeg decode ok; others: error

bk_err_t bk_jpeg_dec_dma_start(uint32_t length, unsigned char *input_buf, unsigned char *output_buf)

this api start jpeg decode

参数

length – jpeg length

  • input_buf jpeg data src addr

  • output_buf jpeg decode output addr

返回

0: jpeg decode ok; others: error

bk_err_t bk_jpeg_dec_stop(void)

stop jpeg decode

返回

0: jpeg decode stop ok; others: error

bk_err_t bk_jpeg_dec_isr_register(jpeg_dec_isr_t jpeg_dec_isr)

This API is direct registerjpeg dec cpu isr.

参数

isr, : – isr function

返回

  • BK_OK: succeed

  • others: other errors.

API Typedefs

Header File

Structures

struct jpeg_dec_res_t

jpeg dec isr return value

Public Members

bool ok

jpeg decoder success

uint16_t pixel_x

jpeg x pixel

uint16_t pixel_y

jpeg y pixel

uint32_t size

jpeg size

Macros

USE_JPEG_DEC_COMPLETE_CALLBACKS

set 1, register jpeg decode complete callback, set 0, register jpeg dec cpu isr

Type Definitions

typedef void (*jpeg_dec_isr_cb_t)(jpeg_dec_res_t *result)

refistrer type jpeg decode complete isr function

param return jpeg x pixel , y pixel , and jpeg size

Return

  • BK_OK: succeed

  • others: other errors.jpegdec int isr register func type

Enumerations

enum JRESULT

Error code

Values:

enumerator JDR_OK

0: Succeeded

enumerator JDR_INTR

1: Interrupted by output function

enumerator JDR_INP

2: Device error or wrong termination of input stream

enumerator JDR_MEM1

3: Insufficient memory pool for the image

enumerator JDR_MEM2

4: Insufficient stream input buffer

enumerator JDR_PAR

5: Parameter error

enumerator JDR_FMT1

6: Data format error (may be damaged data)

enumerator JDR_FMT2

7: Right format but not supported

enumerator JDR_FMT3

8: Not supported JPEG standard

enum jpeg_dec_isr_type_t

Values:

enumerator DEC_END_OF_FRAME

select jpeg decode a complete frame enter isr callback

enumerator DEC_END_OF_LINE_NUM

select jpeg decode line num enter isr callback, used with api line_en

enumerator DEC_ISR_MAX