HPM SDK
HPMicro Software Development Kit
hpm_jpeg_drv.c File Reference
#include "hpm_jpeg_drv.h"

Macros

#define HPM_JPEG_DEFAULT_MAX_OT   (2)
 
#define JPEG_HY(x)   ((x)->hy)
 
#define JPEG_VY(x)   ((x)->vy)
 
#define JPEG_HC(x)   ((x)->hc)
 
#define JPEG_VC(x)   ((x)->vc)
 
#define JPEG_TABLE_WIDTH(x)   (((x) & 0xF00000UL) >> 20)
 
#define JPEG_TABLE_LENGTH(x)   (((x) & 0xFFFF0UL) >> 4)
 
#define JPEG_TABLE_TYPE(x)   (((x) & 0xFUL))
 
#define JPEG_TABLE_VALUE_MASK(x)   (((x) == 4) ? (0xFFFFFFFFUL) : (uint32_t) ((1 << ((x) << 3)) - 1))
 

Functions

void jpeg_disable_irq (JPEG_Type *ptr, uint32_t mask)
 jpeg disable interrupt More...
 
void jpeg_enable_irq (JPEG_Type *ptr, uint32_t mask)
 jpeg enable interrupt More...
 
void jpeg_reset (JPEG_Type *ptr)
 stop a encoder/decoder conversion and Software Reset More...
 
void jpeg_init (JPEG_Type *ptr)
 stop a encoder/decoder conversion and Software Reset More...
 
static bool jpeg_need_csc (jpeg_pixel_format_t format)
 
static bool jpeg_is_valid_size (uint8_t format, uint32_t width, uint32_t height)
 
static uint32_t jpeg_calculate_macro_block_count (uint32_t width, uint32_t height, jpeg_sampling_t *sampling)
 
static void jpeg_config_interal_regs (JPEG_Type *ptr, bool decoding, uint32_t macro_block_count, uint8_t format)
 
hpm_stat_t jpeg_start_encode (JPEG_Type *ptr, jpeg_job_config_t *config)
 
  • it will start encoding, and the process status needs to be checked by querying JPEG_EVENT
More...
 
hpm_stat_t jpeg_start_decode (JPEG_Type *ptr, jpeg_job_config_t *config, uint32_t length)
 it will start decoding, and the process status needs to be checked by querying JPEG_EVENT More...
 
hpm_stat_t jpeg_fill_table (JPEG_Type *ptr, jpeg_table_t table, uint8_t *data, uint32_t count)
 fill tables for jpeg controller More...
 

Variables

const jpeg_sampling_t jpeg_supported_sampling [5]
 
const jpeg_pixel_t jpeg_supported_pixel_format [6]
 

Macro Definition Documentation

◆ HPM_JPEG_DEFAULT_MAX_OT

#define HPM_JPEG_DEFAULT_MAX_OT   (2)

◆ JPEG_HC

#define JPEG_HC (   x)    ((x)->hc)

◆ JPEG_HY

#define JPEG_HY (   x)    ((x)->hy)

◆ JPEG_TABLE_LENGTH

#define JPEG_TABLE_LENGTH (   x)    (((x) & 0xFFFF0UL) >> 4)

◆ JPEG_TABLE_TYPE

#define JPEG_TABLE_TYPE (   x)    (((x) & 0xFUL))

◆ JPEG_TABLE_VALUE_MASK

#define JPEG_TABLE_VALUE_MASK (   x)    (((x) == 4) ? (0xFFFFFFFFUL) : (uint32_t) ((1 << ((x) << 3)) - 1))

◆ JPEG_TABLE_WIDTH

#define JPEG_TABLE_WIDTH (   x)    (((x) & 0xF00000UL) >> 20)

◆ JPEG_VC

#define JPEG_VC (   x)    ((x)->vc)

◆ JPEG_VY

#define JPEG_VY (   x)    ((x)->vy)

Function Documentation

◆ jpeg_calculate_macro_block_count()

static uint32_t jpeg_calculate_macro_block_count ( uint32_t  width,
uint32_t  height,
jpeg_sampling_t sampling 
)
static

◆ jpeg_config_interal_regs()

static void jpeg_config_interal_regs ( JPEG_Type ptr,
bool  decoding,
uint32_t  macro_block_count,
uint8_t  format 
)
static

◆ jpeg_is_valid_size()

static bool jpeg_is_valid_size ( uint8_t  format,
uint32_t  width,
uint32_t  height 
)
static

◆ jpeg_need_csc()

static bool jpeg_need_csc ( jpeg_pixel_format_t  format)
static

Variable Documentation

◆ jpeg_supported_pixel_format

const jpeg_pixel_t jpeg_supported_pixel_format[6]
Initial value:
= {
{4, 1, 1, true},
{2, 2, 2, true},
{2, 3, 3, false},
{1, 0, 0, false},
}

◆ jpeg_supported_sampling

const jpeg_sampling_t jpeg_supported_sampling[5]
Initial value:
= {
{2, 2, 1, 1},
{2, 1, 1, 1},
{1, 2, 1, 1},
{1, 1, 1, 1},
{1, 1, 0, 0},
}