[artoolkit-commits] artoolkit/lib/SRC/VideoLinuxDV video.c, 1.3, 1.4
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Philip L. <phi...@us...> - 2006-09-27 21:47:58
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxDV In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv23061 Modified Files: video.c Log Message: Fix for bugs when using PAL in videoLinuxDV as reported at http://www.hitlabnz.org/forum/showthread.php?t=412. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxDV/video.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** video.c 19 Sep 2006 03:12:35 -0000 1.3 --- video.c 27 Sep 2006 21:47:55 -0000 1.4 *************** *** 8,11 **** --- 8,15 ---- #include <AR/video.h> + #define VIDEO_MODE_PAL 0 + #define VIDEO_MODE_NTSC 1 + #define DEFAULT_VIDEO_MODE VIDEO_MODE_NTSC + #define ARV_BUF_FRAME_DATA 150000 #define ARV_NTSC_FRAME_SIZE 120000 *************** *** 150,158 **** return 0; } ! } ! else if( strncmp( a, "-debug", 6 ) == 0 ) { vid->debug = 1; ! } ! else { ar2VideoDispOption(); free( vid ); --- 154,160 ---- return 0; } ! } else if( strncmp( a, "-debug", 6 ) == 0 ) { vid->debug = 1; ! } else { ar2VideoDispOption(); free( vid ); *************** *** 165,169 **** ! if((vid->handle = raw1394_new_handle()) == NULL) { free( vid ); perror("raw1394 - couldn't get handle"); --- 167,171 ---- ! if ((vid->handle = raw1394_new_handle()) == NULL) { free( vid ); perror("raw1394 - couldn't get handle"); *************** *** 179,183 **** if( vid->debug ) { printf("NUMCARDS = %d\n", numcards); ! for( i = 0; i < numcards; i++ ) { printf("%2d: %s\n", g_pinf[i].nodes, g_pinf[i].name); } --- 181,185 ---- if( vid->debug ) { printf("NUMCARDS = %d\n", numcards); ! for (i = 0; i < numcards; i++) { printf("%2d: %s\n", g_pinf[i].nodes, g_pinf[i].name); } *************** *** 186,199 **** if (raw1394_set_port(vid->handle, 0) < 0) { ! free( vid ); perror("raw1394 - couldn't set port"); return NULL; } ! if( (vid->dv_decoder = dv_decoder_new(TRUE,FALSE,FALSE)) == 0 ) { return NULL; } vid->dv_decoder->quality = 5; ! //dv_init(); arMalloc( vid->buffer, AR2VideoBufferT, 1 ); --- 188,209 ---- if (raw1394_set_port(vid->handle, 0) < 0) { ! free(vid); perror("raw1394 - couldn't set port"); return NULL; } ! if ((vid->dv_decoder = dv_decoder_new((vid->mode == VIDEO_MODE_NTSC), FALSE, FALSE)) == 0) { ! free(vid); return NULL; } vid->dv_decoder->quality = 5; ! if (vid->mode == VIDEO_MODE_NTSC) { ! vid->dv_decoder->height = 480; ! vid->dv_decoder->arg_video_system = 1; // video standard: 0=autoselect [default], 1=525/60 4:1:1 (NTSC), 2=625/50 4:2:0 (PAL,IEC 61834 DV), 3=625/50 4:1:1 (PAL,SMPTE 314M DV). ! } else { // (vid->mode == VIDEO_MODE_PAL) ! vid->dv_decoder->height = 576; ! vid->dv_decoder->arg_video_system = 2; ! } ! dv_init(FALSE, FALSE); arMalloc( vid->buffer, AR2VideoBufferT, 1 ); *************** *** 201,205 **** ar2VideoBufferInit( vid->buffer, ARV_BUF_FRAME_DATA ); ! arMalloc( vid->image, ARUint8, 720*576*4 ); return vid; --- 211,215 ---- ar2VideoBufferInit( vid->buffer, ARV_BUF_FRAME_DATA ); ! arMalloc( vid->image, ARUint8, 720*576*4 ); // Make buffer big enough for PAL BGRA images. return vid; *************** *** 329,333 **** } - ARUint8 *ar2VideoGetImage( AR2VideoParamT *vid ) { --- 339,342 ---- *************** *** 380,388 **** pitches[0] = 720*AR_PIX_SIZE_DEFAULT; pixels[0] = vid->image; ! #ifdef AR_PIXEL_FORMAT_DEFAULT_RGB dv_decode_full_frame(vid->dv_decoder, vid->buffer->buff_out, e_dv_color_rgb, pixels, pitches ); ! #endif ! #ifdef AR_PIXEL_FORMAT_DEFAULT_BGRA dv_decode_full_frame(vid->dv_decoder, vid->buffer->buff_out, e_dv_color_bgr0, pixels, pitches ); #endif --- 389,398 ---- pitches[0] = 720*AR_PIX_SIZE_DEFAULT; pixels[0] = vid->image; ! #if (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGB) dv_decode_full_frame(vid->dv_decoder, vid->buffer->buff_out, e_dv_color_rgb, pixels, pitches ); ! #elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGRA) dv_decode_full_frame(vid->dv_decoder, vid->buffer->buff_out, e_dv_color_bgr0, pixels, pitches ); + #else + # error Unsupported pixel format defined in <AR/config.h>. #endif *************** *** 405,416 **** } - - - - - - - - static int ar2VideoBufferInit(AR2VideoBufferT *buffer, int size) { --- 415,418 ---- |