Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 176 → Rev 177

/shark/trunk/drivers/bttv/fgman-it.txt
28,7 → 28,7
#include <driver/bttv.h>
 
//Istruzione di inizializzazione semplificata
FG_init(period,wcet,width,height);
FG_init(period,wcet,width,height,color);
 
---
period: periodo del grabbing, ovvero quanti microsecondi passano
42,10 → 42,12
 
height: altezza finestra di campionamento
 
color: puo' essere FG_MONO o FG_RGB24
 
Esempio:
---
 
FG_init(50000,15000,400,300);
FG_init(50000,15000,400,300,FG_MONO);
 
---
 
102,16 → 104,15
 
void nome_funzione(void *imageptr);
 
L'inizializzazione di default imposta il grabbing in modalita' GREY8
ovvero 8 bpp e a toni di grigio. Non ho ancora sperimentato completamente
la modalita' a colori, per cui se volete fare dei test andate a cambiare
"fg.c" provando a modificare i diversi tipi di palette a seconda di cosa
permette il vostro frame grabber. Teoricamente settando la modalita' a
colori e usando una telecamera a colori tutto dovrebbe funzionare bene.
Tenete conto che con FG_RGB24 invece di 1 byte per pixel nel buffer
passate ad una modalita' RGB.
 
Tenete conto che invece di 1 byte per pixel nel buffer passate ad
una modalita' RGB.
Dopo averlo inizializzato chiamate
 
FG_start_grabbing();
 
per farlo partire.
 
-------------------------------------------------------------------------------
Consigli per il Frame Grabber in generale.
-------------------------------------------------------------------------------
136,4 → 137,3
Programma di esempio: BTTVDEMO
-------------------------------------------------------------------------------
 
 
/shark/trunk/drivers/bttv/include/drivers/fg.h
1,7 → 1,12
#ifndef __FG_H__
#define __FG_H__
 
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height);
#define FG_MONO 0
#define FG_RGB24 1
 
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height, unsigned int color);
void FG_start_grabbing(void);
void FG_stop_grabbing(void);
void FG_close(void);
void * FG_getbuffer(void);
void FG_set_hook(void *funptr);
/shark/trunk/drivers/bttv/fg.c
6,6 → 6,7
*/
 
#include <drivers/bttv.h>
#include <drivers/fg.h>
#include <kernel/kern.h>
#include <unistd.h>
 
19,6 → 20,9
static struct video_mmap vmm;
static void * fbuf_pointer;
 
PID refresh_PID;
HARD_TASK_MODEL ht_refresh;
 
static void (*elaborate_frame_hook)(void * ptrframe);
 
void dummy_elaborate_frame(void * ptrframe)
33,9 → 37,13
if (vmm.frame == 0) {
vmm.frame = 1;
fbuf_pointer = btv.fbuffer;
*(BYTE *)fbuf_pointer = 255;
*(BYTE *)(fbuf_pointer+1) = 0;
} else {
vmm.frame = 0;
fbuf_pointer = btv.fbuffer+gbufsize;
*(BYTE *)fbuf_pointer = 0;
*(BYTE *)(fbuf_pointer+1) = 255;
}
bttv_ioctl(&btv, VIDIOCMCAPTURE, &vmm);
48,11 → 56,8
 
}
 
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height) {
int FG_init(unsigned int period, unsigned int wcet, unsigned int width, unsigned int height, unsigned int color) {
HARD_TASK_MODEL ht_refresh;
PID refresh_PID;
 
struct video_window vw;
struct video_picture p;
struct video_channel ch;
77,8 → 82,14
bttv_ioctl(&btv, VIDIOCSWIN, &vw);
bttv_ioctl(&btv, VIDIOCGPICT, &p);
p.palette = VIDEO_PALETTE_GREY; //GREY mode 8 bpp
p.depth = 8;
if (color == FG_RGB24) {
p.palette = VIDEO_PALETTE_RGB24;
p.depth = 24;
}
if (color == FG_MONO) {
p.palette = VIDEO_PALETTE_GREY;
p.depth = 8;
}
bttv_ioctl(&btv, VIDIOCSPICT, &p);
 
bttv_ioctl(&btv, VIDIOCGCHAN, &ch);
96,12 → 107,23
sleep(1);
task_activate(refresh_PID);
 
return 0;
}
 
void FG_start_grabbing(void)
{
 
task_activate(refresh_PID);
}
 
void FG_stop_grabbing(void)
{
 
task_kill(refresh_PID);
 
}
 
void FG_close(void)
{
 
/shark/trunk/drivers/bttv/readme
26,20 → 26,21
 
- BTTV linux-like driver interface (bttv_open, bttv_ioctl, ecc)
 
For a fast use of this driver (GRAY8 mode):
For a fast use of this driver:
 
makefile symbol: __BTTV__
 
#include <drivers/fg.h>
 
FG_init(<grabbing period>,<grabbing wcet>,<grabbing width>,<grabbing height>); //Initialize FG
FG_init(<grabbing period>,<grabbing wcet>,<grabbing width>,<grabbing height>,<color mode>); //Initialize FG
 
<color mode> could be FG_MONO or FG_RGB24
 
fgptr = FG_getbuffer(); //Get the image pointer
 
Now fgptr is a pointer to the grabbed image (GRAY8 type);
Now fgptr is a pointer to the grabbed image, but to elaborate an
image is better to define a function like
 
But to elaborate an image is better to define a function like
 
elaborate_image(void *imageptr);
 
and with
50,5 → 51,9
image is ready. A Double Buffer is implemented so the elaborated
image is always complete and consistent. See fg.c for the code details.
 
FG_close(); //Close the FG
FG_start_grabbing(); to start the frame grabber
 
FG_close(); To close the FG
 
For an example see BTTVDEMO