libctr1474.h File Reference

#include "ethjpg2k.h"
#include "adv202_hdr.h"
#include "twa2835.h"

Go to the source code of this file.

Data Structures

struct  ctr1474_ch
 ctr1474 instance More...

Defines

#define _LIBCTR1474_H_   1
#define TWA(p)   ( (void *) p->ctrl_fd )
 returns the twa2835 handler for the given ctr1474 instance

Typedefs

typedef int(*) ctr1474_frame_cb (struct ethjpg2k_linux_hdr *hdr, unsigned char *data, unsigned long len)
 callback for the jpeg2000 encoder
typedef void(*) ctr1474_frame_in_cb (unsigned char *data, unsigned long len, int *field)
 callback for the jpeg2000 decoder
typedef int(*) ctr1474_len_cb (void)
 callback for the jpeg2000 decoder

Functions

ctr1474_chsimple_ctr1474 (char *dev, char *cdev)
 creates an jpeg2000 encoder/decoder instance
int simple_ctr1474_board_init (struct ctr1474_ch *e, int isNtsc, char *b, ETHJPG2K_FIRMWARE_DATA *fwdata, ETHJPG2K_FIRMWARE_PARAMS *fwparams)
 initializes the ctr1474
void simple_ctr1474_board_noinit (struct ctr1474_ch *e, int isNtsc)
 setup the ctr1474 instance pointer without actually initializing the hardware
int simple_ctr1474_encoder_run (struct ctr1474_ch *e, ctr1474_frame_cb cb)
 starts the encoding process
int simple_ctr1474_encoder_quality (struct ctr1474_ch *e, int q)
 set the quality of output stream for a running encoder
int simple_ctr1474_decoder_run (struct ctr1474_ch *e, ctr1474_len_cb cbl, ctr1474_frame_in_cb cbf, int ad_hdr)
 starts the decoding process
void simple_ctr1474_free (struct ctr1474_ch *e)
 frees the resources asociated with an ctr1474 instance
void simple_ctr1474_force_stop (struct ctr1474_ch *e)
 forces the stop of currently running encoding/decoding process
int simple_ctr1474_hipi (struct ctr1474_ch *enc, struct ctr1474_ch *dec, char *fw, ETHJPG2K_FIRMWARE_DATA *fwdata, ETHJPG2K_FIRMWARE_PARAMS *fwparams, int n, char **in, int *ins, char **out, int *outs)
 encodes/decodes a bunch of images using HIPI
int simple_ctr1474_gpio_read (struct ctr1474_ch *e)
 returns the status of the input GPIO
int simple_ctr1474_pb (struct ctr1474_ch *e, int enable)
 returns the status of the input GPIO
int simple_ctr1474_gpio_write (struct ctr1474_ch *e, int data)
 writes to the output GPIO
int simple_ctr1474_led (struct ctr1474_ch *e, int data)
 set the status of the 2 LEDS on the board
int adv212_read_reg (struct ctr1474_ch *e, int addr)
 reads the value of a ADV212 register
void adv212_write_reg (struct ctr1474_ch *e, int addr, int data)
 writes to a ADV212 register


Define Documentation

#define _LIBCTR1474_H_   1

Definition at line 10 of file libctr1474.h.

#define TWA (  )     ( (void *) p->ctrl_fd )

returns the twa2835 handler for the given ctr1474 instance

Definition at line 37 of file libctr1474.h.


Typedef Documentation

typedef int(*) ctr1474_frame_cb(struct ethjpg2k_linux_hdr *hdr, unsigned char *data, unsigned long len)

callback for the jpeg2000 encoder

User should provide an implementation of a function with this signature. Every time the ctr1474 acquires a frame the provided function will be called.

Parameters:
hdr the header that describes the captured image
data the pointer to the image bits (jpeg2000 encoded)
len the length (in bytes) of the image
Returns:
0 to continue acquiring, 1 to stop it

Definition at line 54 of file libctr1474.h.

typedef void(*) ctr1474_frame_in_cb(unsigned char *data, unsigned long len, int *field)

callback for the jpeg2000 decoder

User should provide an implementation of a function with this signature. Every time the ctr1474 needs another image to decode this function is called.

Parameters:
data where the user should but the image bits
len the maximum length for the image
field 0/1 for even/odd field when deinterlacing
Returns:
0 to continue decoding, 1 to stop it

Definition at line 71 of file libctr1474.h.

typedef int(*) ctr1474_len_cb(void)

callback for the jpeg2000 decoder

User should provide an implementation of a function with this signature. Every time the ctr1474 needs to know how much space is needed for the next image to be docede this function is called.

Returns:
length, in bytes, of the next jpeg2000 image to be decoded

Definition at line 82 of file libctr1474.h.


Function Documentation

int adv212_read_reg ( struct ctr1474_ch e,
int  addr 
)

reads the value of a ADV212 register

Parameters:
e pointer to the ADV212 instance
addr address of register to read
Returns:
value read from register

void adv212_write_reg ( struct ctr1474_ch e,
int  addr,
int  data 
)

writes to a ADV212 register

Parameters:
e pointer to the ADV212 instance
addr address of register to write
data value to write

struct ctr1474_ch* simple_ctr1474 ( char *  dev,
char *  cdev 
)

creates an jpeg2000 encoder/decoder instance

This is the first function called by the application when accessing the ctr1474. It connects to the device driver.

Parameters:
dev the encoding or decoding /dev entry
cdev the control /dev entry
Returns:
the ctr1474 instance, NULL on error

int simple_ctr1474_board_init ( struct ctr1474_ch e,
int  isNtsc,
char *  b,
ETHJPG2K_FIRMWARE_DATA fwdata,
ETHJPG2K_FIRMWARE_PARAMS fwparams 
)

initializes the ctr1474

Parameters:
e the ctr1474 instance
isNtsc if non-zero sets NTSC mode.
b filename of the firmware for the ADV212
fwdata firmware description
fwparams parameters for the firmware
Returns:
0 on success, otherwise non-zero

void simple_ctr1474_board_noinit ( struct ctr1474_ch e,
int  isNtsc 
)

setup the ctr1474 instance pointer without actually initializing the hardware

This function should be called before starting the encoding/decoding process if we don't want to alter the setting of the video front-end.

Parameters:
e the ctr1474 instance
isNtsc if non-zero sets NTSC mode
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_decoder_run ( struct ctr1474_ch e,
ctr1474_len_cb  cbl,
ctr1474_frame_in_cb  cbf,
int  ad_hdr 
)

starts the decoding process

Parameters:
e the ctr1474 instance
cbl the user supplied callback which is called to get the size of the next image to be decoded
cbf the user supplied callback which is called to get the bits for the next image to be decoded
ad_hdr if 1 an image header needed for the ADV212 is automatically generated, otherwise it must be supplied by the user before the bits of the actual image
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_encoder_quality ( struct ctr1474_ch e,
int  q 
)

set the quality of output stream for a running encoder

Parameters:
e the ctr1474 instance
q the quality parameter (RCVAL)
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_encoder_run ( struct ctr1474_ch e,
ctr1474_frame_cb  cb 
)

starts the encoding process

Parameters:
e the ctr1474 instance
cb the user supplied callback which is called ater every acquired image
Returns:
0 on success, otherwise non-zero

void simple_ctr1474_force_stop ( struct ctr1474_ch e  ) 

forces the stop of currently running encoding/decoding process

Normally the encoding/decoding process should be stopped by using the return value of the user callback function. This function should be used only when that option is not possibile.

Parameters:
e the ctr1474 instance

void simple_ctr1474_free ( struct ctr1474_ch e  ) 

frees the resources asociated with an ctr1474 instance

Parameters:
e the ctr1474 instance

int simple_ctr1474_gpio_read ( struct ctr1474_ch e  ) 

returns the status of the input GPIO

Parameters:
e the ctr1474 instance
Returns:
the value of the input GPIO bits

int simple_ctr1474_gpio_write ( struct ctr1474_ch e,
int  data 
)

writes to the output GPIO

Parameters:
e the ctr1474 instance
data the bits to be set on the output GPIO lines
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_hipi ( struct ctr1474_ch enc,
struct ctr1474_ch dec,
char *  fw,
ETHJPG2K_FIRMWARE_DATA fwdata,
ETHJPG2K_FIRMWARE_PARAMS fwparams,
int  n,
char **  in,
int *  ins,
char **  out,
int *  outs 
)

encodes/decodes a bunch of images using HIPI

This function is not meant for interactive encoding/decoding of a video stream but for batch use like in a jpeg2000 hardware acceleration application.

Parameters:
enc the ctr1474 instance for the encoder
dec the ctr1474 instance for the decoder
fw the firmware to load to the ADV212
fwdata firmware description
fwparams parameters for the firmware
n the number of images to encode/decode
in the array of pointers to source image bits
ins the array with length of source images
out the array of pointers to image bits created by the routine. The memory for these is allocated by this routine and should be deallocated by the user
outs the array with length of images created by the routine
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_led ( struct ctr1474_ch e,
int  data 
)

set the status of the 2 LEDS on the board

Parameters:
e the ctr1474 instance
data the bits or the 2 LEDS present on the CTR1474 board
Returns:
0 on success, otherwise non-zero

int simple_ctr1474_pb ( struct ctr1474_ch e,
int  enable 
)

returns the status of the input GPIO

Parameters:
e the ctr1474 instance
enable non-zero enables the play-back path
Returns:
0 on success, otherwise non-zero


Generated on Sat Dec 20 08:27:54 2008 for CTR1474 by  doxygen 1.5.1