iekc64_video.h

来自「TI公司的算法标准 Framework5的源代码」· C头文件 代码 · 共 801 行 · 第 1/3 页

H
801
字号
/*
 *  Copyright 2002 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) RF5_IEK 2.00.02 12-11-02 (swat-c19)" */
/*! \verbatim
==============================================================================
                                  Copyright (C) 2002 A.T.E.M.E.
                          All Rights Reserved
------------------------------------------------------------------------------
 MODULE NAME... IEKC64_VIDEO
 FILENAME...... iekc64_video.h
 PROJECT....... IEK C64x
------------------------------------------------------------------------------
 HISTORY:
 V1.0    09/01/2002  HCO  
         18/01/2002  HCO
         01/02/2002      HCO
------------------------------------------------------------------------------
\endverbatim <P> \file
 
        \brief Header file for the IEK C64 video module.

        This module manage video acquisition / restitution on IEK board

</P>*//*====================================================================*/
#ifndef _VIDEO_H_
#define _VIDEO_H_

#include <csl_stdinc.h>
#include "iekc64_error.h"
#include "iekc64.h"


#ifdef __cplusplus
extern "C" {
#endif



/*=======================================================================*//*!
\defgroup VIDEO VIDEO - Video capture and generation module

        \brief This module is related to capture and generate video.

        The Video module is subdivsed in two sub-modules :
        \li VIN (Video INput) for video capture
        \li VOUT (Video OUTput) for video generation

   The following paragraphs details the working of these two sub-modules

   <h3> Video Input </h3>

        <b> How does it work ?</b>

        The VIN Module capture video into frames.
        Frames are a allocated contiguously in a circular buffer allocated by
        the user before openning the module. This buffer must be large enough
        to allow at least 3 frames to be stored. Using a 3 frames buffer is the
        best way to insure that you won't have any overlapping between the
        background capture and the processing.
        If your process need to work on more than 1 frame (for example when
        working on motion estimation), you don't need to copy frames to another
        buffer, you just have to create a buffer large enough and tell the VIN
        module to always leave the last N frames untouched.
        
        The video input module use the EDMA channel for external event interrupt 4.
        In CIF or QCIF resolution, we also use the first reload table available.
        When we want to update the address for next frame transfert, we update the destination 
        addresse in reload table.
        In FULL resolution mode, as we have frames I and P, we need to use 4 reload tables.
        These tables are dynamicly allocated by CSL.
        The first two reload tables are used for a complete picture (I+P). When we want to 
        update a picture, we first update the destination address in the 2 remaining reload 
        tables and then we link the first P reload table on the I remaing reload table.
        And so on.
        
        For each end of EDMA transfer, the Transfer Complete Code (TCC) used is EDMA_CHA_GPINT1. 
        The EDMA channel used is the channel 4 (which correspond to external interrupt 4)

        <b> Openning the module </b>

        You open the module by calling the VIN_open() function. This function
        initialize the hardware and the software with the parameters given in the
        IEKC64_VIDEOIN structure that you must fill before the call.

        <b> Starting the capture </b>

        A call to VIN_start() will activate the capture process. The video signal
        is digitized. It may be spatialy and temporaly down-sampled if asked.
        Digital value is then stored into the capture buffer using DMA. DMA
        mechanism is hidden to the user by IEKLIB.
        Each new picture is stored into next frame in the buffer.

        <b> Getting next frame </b>

        VIN_getFrame() will give the next frame pointer from the input buffer.
        If no new frame is avalable, depending on the timeout value, you will
        get an error or wait until the timeout ends or a new frame is captured.

        <b> Ending capture </b>

        VIN_stop() allow the capture to be paused. After a VIN_stop, capture can be
        re-started with the same parameters with VIN_start().
        VIN_close() frees all the resources allocated by the VIN Module (DMA, 
        interrupts, ...).
        If you need to change capture parameters, you must close        and re-open
        the module.

   <h3> Video Output </h3>

        <b> How does it work ? </b>

        The VOUT Module generates video from frames provided by the user.
        Frames are allocated by the user. Their memory location is non important,
        as far as each frame start is aligned on a 32 bit word boudary. Frames
        for video generation don't need to be contiguously allocated in the
        same buffer like the ones used for video capture. They even doesn't need
        to be allocated before openning the module. The user can allocate any
        number of frames from 1 to memory limits.
        When using 1 single frame, it is possible to work into the frame while it
        is displayed. Depending on the refresh rate that can cause some
        artifacts.
        
        The video output module use the EDMA channel for external event interrupt 5 
        (COMPOSITE output) or external event interrupt 6 (VGA output) 
        In CIF resolution, we also use the first reload table available available.
        When we want to update the address for next frame transfert, we update the source 
        address in reload table and in the current EDMA transfert
        In FULL resolution mode, as we have frames I and P, we need to use 4 reload tables.
        These tables are dynamicly allocated by CSL.
        The first two reload tables are used for a complete picture (I+P). When we want to 
        update a picture, we first update the source address in the 2 remaining reload tables
        and then we link the first P reload table on the I remaing reload table.
        And so on.
        
        For each end of EDMA transfer, the Transfer Complete Code used is EDMA_CHA_GPINT2 for COMPOSITE
        video output and EDMA_CHA_GPINT3 for VGA output.
        For COMPOSITE, the EDMA channel used is the channel 5 (which correspond to external interrupt 5)
        and for VGA the channel 6 (for external interrupt 6)
        
        <b> Openning the module </b>

        You open the module by calling the VOUT_open() function. This function
        initialize the hardware and the software with the parameters given in the
        IEKC64_VIDEOOUT structure that you must fill before the call.

        <b> Starting the generation </b>

        A call to VOUT_start() will pre-activate the capture process.
        Their will be no video generation until the first call to VOUT_putFrame().

        <b> Outputing a frame </b>

        With VOUT_putFrame() the user provides the pointer to the next frame
        to be generated.
        The frame data will be send to the hardware using DMA. DMA mechanism is
        hidden to the user by IEKLIB.
        If no new VOUT_putFrame() is done before a next frame is required by
        the hardware, the module will keep on generating the same frame.
        An optional timeout allow the call to block until either the given frame 
        effectively became the active frame or the timeout ended.

        <b> Ending generation </b>

        VOUT_stop() allow the generation to be paused. After a VOUT_stop, 
        generation can be re-started with the same parameters with VOUT_start().
        VOUT_close() frees all the resources allocated by the VOUT Module (DMA, 
        interrupts, ...).
        If you need to change generation parameters, you must close and
        re-open the module.

</P>*//*==============================================================*//*@{*/

/*--------------------------------------------------------------------------*/
/*! Defines the video standard used for capture or generation
*/
typedef enum
{
        //! This selects the european standard
        PAL = 0,
        //! This selects the american standard
        NTSC
} IEKC64_VIDEO_STANDARD;



/*--------------------------------------------------------------------------*/
/*! Defines the video resolution used for capture or generation
*/
typedef enum
{
        //! PAL full screen 720x576
        RES_PAL_FULL = 0,
        //! PAL CIF 352x288
        RES_PAL_CIF,
        //! PAL QCIF 176x144 (This value is not allowed for generation (VOUT))
        RES_PAL_QCIF,
        //! PAL full 768x576 screen square pixels
        RES_PAL_FULL_SQUARE_PIXELS,
        //! PAL CIF 384x576 screen square pixels
        RES_PAL_CIF_SQUARE_PIXELS,
        //! PAL QCIF 192x288 screen square pixels (This value is not allowed for generation (VOUT))
        RES_PAL_QCIF_SQUARE_PIXELS,
        //! NTSC full screen 720x480
        RES_NTSC_FULL,
        //! NTSC CIF 352x240
        RES_NTSC_CIF,
        //! NTSC QCIF 176*128 (This value is not allowed for generation (VOUT))
        RES_NTSC_QCIF,
        //! PAL full 640x480 screen square pixels
        RES_NTSC_FULL_SQUARE_PIXELS,
        //! PAL CIF 320x480 screen square pixels
        RES_NTSC_CIF_SQUARE_PIXELS,
        //! PAL QCIF 160x240 screen square pixels (This value is not allowed for generation (VOUT))
        RES_NTSC_QCIF_SQUARE_PIXELS,
        //! This selects PAL FULL video resolution for VGA
        RES_VGA_PAL_720X576,
        //! This selects PAL CIF video resolution for VGA
        RES_VGA_PAL_352X576,
        //! This selects NTSC FULL video resolution for VGA
        RES_VGA_NTSC_720X480,
        //! This selects PAL CIF video resolution for VGA
        RES_VGA_NTSC_352X480,
        //! This selects 800x600 video resolution for VGA
        RES_VGA_800X600,
        //! This selects 1024X768 video resolution for VGA
        RES_VGA_1024X768
} IEKC64_VIDEO_RESOLUTION;

/*--------------------------------------------------------------------------*/
/*! Defines the frame format used for capture or generation.<br>
*/
typedef enum
{
        //! This select storage format in YUV422 pixels (16 bits pixels)
        YUV422PIXEL = 0,
        //! This select storage format in RGB565 pixels (16 bits pixels) for VGA
        RGB565PIXEL
}
IEKC64_VIDEO_FRAME_FORMAT;

/*--------------------------------------------------------------------------*/
/*! Defines the board input or output.
*/
typedef enum
{
        //! This select the CVBS (composite) input or ouput
        COMPOSITE = 0,
        //! This select the Y/C (S-video) input or output
        YC,
        //! This select the VGA output (mode ACE3)
        VGA,
        //! This select the VGA output (mode PDT) (Only available on TMS DSP)
        VGAPDT,
        //! This select all outputs (VOUT only)
        ALL = 255
}
IEKC64_VIDEO_INOUT_SELECT;


/*--------------------------------------------------------------------------*/
/*! Initialization parameters for VIN_open().
         All fields have to be set before the call.

⌨️ 快捷键说明

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