codec.c

来自「快速开发基于Blackfin处理器的视频应用」· C语言 代码 · 共 120 行

C
120
字号
/*****************************************************************************
Copyright(c) 2005 Analog Devices, Inc.  All Rights Reserved. This software is 
proprietary and confidential to Analog Devices, Inc. and its licensors.
******************************************************************************

$RCSfile: codec.c,v $
$Revision: 1.1 $
$Date: 2005/10/28 02:05:31 $

Project:	Developer Kit
Title:		codec
Author(s):	ku
Revised by: 

Description:
			Functions and definitions for generic codec use.

References:
			None

******************************************************************************
Tab Setting:			4

Target Processor:		ADSP-BF5xx
Target Tools Revision:	ADSP VisualDSP++ v4.0
******************************************************************************

Modification History:
====================
$Log: codec.c,v $
Revision 1.1  2005/10/28 02:05:31  dwu
Added error checking code for JPEG/MJPEG routines



*****************************************************************************/

#include    <stdio.h>
#include    "MJPEG_AVI_Common.h"
#include    "IMG_common.h"

// Function to check JPEG error codes
int JPEG_ProcessErrorCode(int ReturnCode, char *FunctionName)
{
    switch(ReturnCode)
    {
        case E_SUCCESS :
            break;
        case E_INVALIDPARAMETERITEM :
            printf("%s: an incorrect parameter is specified\n", FunctionName);
            break;
        case E_CANNOTINITIALIZE :
            printf("%s: parameters could not be initialized\n", FunctionName);
            break;
        case E_CANNOTPARSE :
            printf("%s: the JPEG structure could not be parsed\n", FunctionName);
            break;
        case E_OUT_OF_MEMORY :
            printf("%s: memory could not be allocated\n", FunctionName);
            break;
        case E_EVALUATIONLIMITREACHED :
            printf("%s: an evaluation package limit is reached\n", FunctionName);
            break;
        case E_CANNOTDECODESEQUENTIAL :
            printf("%s: a sequentially encoded image could not be decoded\n", FunctionName);
            break;
        case E_CANNOTDECODEPROGRESSIVE :
            printf("%s: a progressively encoded image could not be decoded\n", FunctionName);
            break;
        case E_MODENOTSUPPORTED :
            printf("%s: the image is in an unsupported format\n", FunctionName);
            break;
        case E_FAILURE :
            printf("%s: other error\n", FunctionName);
            break;
        default : ;
    }

    return(0);
}

// Function to check MJPEG error codes
int MJPEG_ProcessErrorCode(int ReturnCode, char *FunctionName)
{
    switch(ReturnCode)
    {
        case MJPEG_AVI_RETURN_OUTOFMEMORY :
            printf("%s: memory could not be allocated when opening the file\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_STREAMINVALID :
            printf("%s: the supplied stream handle is invalid\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_FILEOPENFAIL :
            printf("%s: input file could not be opened\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_FILEREADFAIL :
            printf("%s: input file could not be read\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_FILEINCORRECTFORMAT :
            printf("%s: input file was not in MJPEG AVI format\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_FILESEEKFAIL :
            printf("%s: seek operation on the input file failed\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_NOMORESAMPLES :
            //printf("%s: no more frames are available to be read\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_EVALUATIONLIMITREACHED :
            printf("%s: evaluation package has reached its limit\n", FunctionName);
            break;
        case MJPEG_AVI_RETURN_ERROR :
            printf("%s: unknown error\n", FunctionName);
            break;
        default : ;
    }

    return(0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?