📄 jpeg_enc_interface.h
字号:
/*##############################################################################
Copyright(C) 2001-2002, Motorola India Electronics Pvt Ltd.
Motorola Confidential Proprietary.
All rights reserved.
--------------------------------------------------------------------------------
Filename : interface.h
Description : This file contains all the functions and the data structures
exposed in the API to the application. Application code
just needs to include this header file for calling the
JPEG encoder. The application is not expected to include
any other header file of the codec.
Author(s) : Harsha Deeph G (harshad@miel.mot.com)
Context :
Caution :
**********************************************************************
*
* (C) 2004 MOTOROLA INDIA ELECTRONICS LTD.
*
* CHANGE HISTORY
*
* dd/mm/yy Description Author
* -------- ----------- ------
* 16/03/04 Created. Harsha Deeph G
* 18/03/04 Added other functions and
* parameters in API Harsha Deeph G
* 21/03/04 Added a void pointer
* in jpeg_enc_object
* 21/03/04 Made YUV format as enum Ganesh Kumar C
* 22/03/04 Removed interleaved flag from API Harsha Deeph G
* The necessary inforamtion is anyway
* present in yuv_format
* 28/04/04 Changed MAX_MEMORY_INFO_ENTRIES to 5 Harsha Deeph G
* Added more error codes
***********************************************************************/
#ifndef JPEGINTERFACE_H
#define JPEGINTERFACE_H
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned long U32;
typedef char S8;
typedef short S16;
typedef long S32;
typedef enum
{
YUV_444_NONINTERLEAVED,
YUV_422_NONINTERLEAVED,
YUV_420_NONINTERLEAVED,
YU_YV_422_INTERLEAVED,
YV_YU_422_INTERLEAVED,
UY_VY_422_INTERLEAVED,
VY_UY_422_INTERLEAVED
}YUV_FORMAT;
#define ALIGN_8BIT 0 /* Align start of buffe to 8 bit boundary */
#define ALIGN_16BIT 1 /* Align start of buffer to a 16 bit boundary */
#define ALIGN_32BIT 2 /* Align start of buffer to a 32 bit boundary */
#define FAST_MEMORY 0
#define SLOW_MEMORY 1
#define YUV_444 1
#define YUV_422 2
#define YUV_420 3
#define TRUE 1
#define FALSE 0
#define SEQUENTIAL_MODE 0
#define PROGRESSIVE_MODE 1
/* This dictates the maximum size of the array of jpeg_enc_memory_info.
* The codec is not expected to request more than JPEG_MAX_MEMORY_INFO_ENTRIES
* buffers */
#define JPEG_MAX_MEMORY_INFO_ENTRIES 5
/* Error types. If the returned value from codec is JPEGENC_ERR_NO_ERROR, the
* application does not need to do any corrective action. All the following
* are the error codes are the errors made by the application.
* "JPEGENC_ERR_INSUFFICIENT_MEMORY_REQUESTED_BY_ENC" is the only exception
* and this is an error made by the codec */
enum
{
JPEGENC_ERR_NO_ERROR = 0,
JPEGENC_ERR_INVALID_YUV_FORMAT,
JPEGENC_ERR_INVALID_QUALITY,
JPEGENC_ERR_INVALID_RESTART_MARKERS,
JPEGENC_ERR_INVALID_MODE,
JPEGENC_ERR_INVALID_WIDTH,
JPEGENC_ERR_INVALID_HEIGHT,
JPEGENC_ERR_INSUFFICIENT_MEMORY_REQUESTED_BY_ENC,
JPEGENC_ERR_MEMORY_PTRS_PASSED_TO_ENC_NULL,
JPEGENC_ERR_IMAGE_PTRS_PASSED_TO_ENC_NULL,
JPEGENC_ERR_OUTPUT_PTR_PASSED_TO_ENC_NULL
};
typedef struct
{
U8 alignment; /* ALIGN_8BIT OR 16 or 32 */
U32 size; /* Size in number of bytes */
U16 memory_type; /* FAST_MEMORY, SLOW_MEMORY*/
void * memptr; /* ptr to the memory allocated by application */
}jpeg_enc_memory_info;
typedef struct
{
U8 no_entries;
jpeg_enc_memory_info mem_info[JPEG_MAX_MEMORY_INFO_ENTRIES];
}jpeg_enc_memory_infos;
/* Refer API doc for description of these parameters */
typedef struct
{
YUV_FORMAT yuv_format;
U8 quality;
U8 restart_markers;
U8 mode;
U16 y_height;
U16 u_height;
U16 v_height;
U16 y_width;
U16 u_width;
U16 v_width;
}jpeg_enc_parameters;
typedef struct
{
jpeg_enc_parameters parameters;
jpeg_enc_memory_infos mem_infos;
/* The application should not bother about the object entries below
* and should not modify them */
void * cinfo;
}jpeg_enc_object;
/* This function is not necessary at this time. Only a sophistication
* U8 jpeg_enc_query_size_outbuffer(jpeg_enc_object * enc_obj, U32 * sizeptr);
*/
U8 jpeg_enc_query_mem_req(jpeg_enc_object * enc_obj);
U8 jpeg_enc_init(jpeg_enc_object * enc_obj);
U8 jpeg_enc_encode_frame(jpeg_enc_object * enc_obj, U8 * i_buff,
U8 * y_buff, U8 * u_buff, U8 * v_buff, U8 ** output);
#endif /* JPEGINTERFACE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -