📄 app_yuv_to_jpeg.c
字号:
//////////////////////////////////////////////////////////////////////////////////////////////////////// app_yuv_to_jpeg.c //// Notice: COPYRIGHT (C) STREAM PROCESSORS, INC. 2005-2007// THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE SPI// END-USER LICENSE AGREEMENT (EULA). THE PROGRAM MAY ONLY// BE USED IN A MANNER EXPLICITLY SPECIFIED IN THE EULA,// WHICH INCLUDES LIMITATIONS ON COPYING, MODIFYING,// REDISTRIBUTION AND WARANTIES. UNAUTHORIZED USE OF THIS// PROGRAM IS STRICTLY PROHIBITED. YOU MAY OBTAIN A COPY OF// THE EULA FROM WWW.STREAMPROCESSORS.COM. // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #includes ////////////////////////////////////////////////////////////////////////////////#include <stdio.h>#include <string.h>#include <stdlib.h>#include "spi_fw_client.h"#include "spi_sys_mips_interface.h"#include "spi_macros.h"#include "app_config.h"#include "task_context.h"/* Configure the channel parameters*/int configure_channel(CHANNEL_CONFIG_T *p_channel_config, CHANNEL_CONTEXT_T *p_channel_context);/* Configure the channel dpam, pin and file handle*/int get_handles(CHANNEL_CONTEXT_T *p_channel_context);/* Connect dpam pins and activate*/int connect_dpams(CHANNEL_CONTEXT_T *p_channel_context);int handle_input(CHANNEL_CONTEXT_T *p_channel_context);int encode_frame(CHANNEL_CONTEXT_T *p_channel_context);int handle_output(CHANNEL_CONTEXT_T *p_channel_context);int close_handles(CHANNEL_CONTEXT_T *p_channel_context);// Example application that uses the SPI JPEG encoder library.int main (int argc, char *argv[]){ APP_CONFIG_T *p_app_config; CHANNEL_CONTEXT_T *p_channel_context; /*********************************************** * Configure the application ***********************************************/ p_app_config = malloc(sizeof(APP_CONFIG_T)); if (p_app_config == NULL) { RAISE_ERR(("Err: Failed to allocate APP_CONFIG_T. \n")); } if (configure_application(argc, argv, p_app_config) == ERROR) return ERROR; /*********************************************** * Load DSP MIPS image and start the DSP MIPS execution ***********************************************/ printf("\nLoading DSP MIPS image :%s:....\n", p_app_config->dsp_mips_filename); ERR_HANDLE(spi_start_dsp_mips(p_app_config->dsp_mips_filename)); /*********************************************** * Configure the task_context ***********************************************/ p_channel_context = malloc(sizeof(CHANNEL_CONTEXT_T)); if (p_channel_context == NULL) { RAISE_ERR(("Err: Failed to allocate CHANNEL_CONTEXT_T. \n")); } /* Configure the channel parameters*/ if (configure_channel(&p_app_config->channel_config, p_channel_context) == ERROR) return ERROR; /* Configure the channel dpam, pin and file handle*/ if (get_handles(p_channel_context) == ERROR) return ERROR; /* Connect dpam pins and activate*/ if (connect_dpams(p_channel_context) == ERROR) return ERROR; while(1) { printf ("\t Frame being encoded - %d\n", p_channel_context->frame_number); if (handle_input(p_channel_context) == ERROR) return ERROR; if (p_channel_context->status == E_RUN) { if (encode_frame(p_channel_context) == ERROR) return ERROR; if (handle_output(p_channel_context) == ERROR) return ERROR; } else { break; } if (p_channel_context->total_frames > 0) { if (p_channel_context->frame_number >= p_channel_context->total_frames) { break; } } } /* Configure the channel dpam, pin and file handle*/ close_handles(p_channel_context); free(p_app_config); free(p_channel_context); return SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -