/* * ***************************************************************** * * * * * Copyright (c) Fast Corporation, 1999 * * * * * * All Rights Reserved. Unpublished rights reserved under * * * the copyright laws of the Japan. * * * * * * The software contained on this media is proprietary to * * * and embodies the confidential technology of Fast * * * Corporation. Possession, use, duplication or * * * dissemination of the software and media is authorized only * * * pursuant to a valid written license from Fast Corporation. * * * * * ***************************************************************** */ /* CSC90X 連続フレーム入力(902(RICE) or903専用) CHAINX.C */ /*[作成者]H.Yagi */ /* 目的: 関数: 履歴: Ver 1.0 97/08/27 Ver 2.0 99/04/01 902(RICE) or 903用へ移植 E.Ishiyama 注記:m_menu.hをインクルードして下さい。 m_menu.c及びm_note.cをリンクして下さい。 */ /* * Include compiler runtime library */ #include #include /* * Include CSC90X library */ #include "f_stdlib.h" #include "f_time.h" #include "f_gui.h" #include "f_stdio.h" #include "f_graph.h" #include "f_image.h" #include "f_pinf.h" #include "f_video.h" #include "f_system.h" /* * Include CSC90X common local */ #include "m_menu.h" /* * プロトタイプ宣言 */ void main( void ); static void main_menu_disp( void ); static void disp_help( void ); static int frame_su_set( void ); static void rec_gray( void ); static void play_gray( void ); extern int message_note( void ); /* * メニュー項目 */ #define LANG_N 2 #define MAIN_MENU_N 4 static const char *str_main_menu[MAIN_MENU_N][LANG_N] = { { " SET ", " 設 定 " }, { " REC ", " 録 画 " }, { " PLAY ", " 再 生 " }, { " PROC4 ", " 処理4 " } }; #define INIT_CUR_POS_X 255 #define INIT_CUR_POS_Y 239 static int frame_su; static char *gray_address; static int alloc_flg; static int input_flg; /* * メイン */ void main( void ) { int sts; int xpos; int ypos; int s_xpos; int s_ypos; /* 初期メッセージ表示 */ if( NORMAL_RETURN != message_note() ) return; /* パラメタ初期化 */ xpos = INIT_CUR_POS_X; ypos = INIT_CUR_POS_Y; alloc_flg = OFF; input_flg = OFF; frame_su = 20; /* 入力ビデオ制御 */ Lib_input_video_control( GRAY_PLANE ); /* ビデオ出力表示項目制御 */ Lib_display_control( GRAY_PLANE | LINE_PLANE | CHAR_PLANE ); /* ビデオ表示項目クリア */ Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); /* カーソル初期化 */ Lib_init_cursor(); /* メインメニューの表示 */ main_menu_disp(); /* マウスカーソルの表示 */ Lib_draw_cursor( INIT_CUR_POS_X, INIT_CUR_POS_Y ); /* フレーム数の設定 */ frame_su_set( ); /* メニュー制御 */ for (;;) { sts = 0; /* マウス位置読みとり */ Lib_look_current_position( &xpos, &ypos ); sts = Lib_see_current_position( &xpos, &ypos ); if ( s_xpos != xpos || s_ypos != ypos ) { /* マウス表示位置移動 */ Lib_move_cursor( xpos, ypos ); s_xpos = xpos; s_ypos = ypos; } /* 処理振り分け */ if( CURSOR_EXECUTE == sts ) { if ( xpos > MENU_1_XS && xpos < MENU_1_XE && ypos > MENU_1_YS && ypos < MENU_1_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); frame_su_set(); /*設定*/ main_menu_disp(); } else if ( xpos > MENU_2_XS && xpos < MENU_2_XE && ypos > MENU_2_YS && ypos < MENU_2_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); rec_gray(); /*録画*/ main_menu_disp(); } else if ( xpos > MENU_3_XS && xpos < MENU_3_XE && ypos > MENU_3_YS && ypos < MENU_3_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); play_gray( ); /*再生*/ main_menu_disp(); } else if ( xpos > MENU_H_XS && xpos < MENU_H_XE && ypos > MENU_H_YS && ypos < MENU_H_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); disp_help(); /* ヘルプ */ main_menu_disp(); } else if ( xpos > MENU_E_XS && xpos < MENU_E_XE && ypos > MENU_E_YS && ypos < MENU_E_YE ) { break; /* 終了 */ } } } /* メモリの解放 */ if ( ON == alloc_flg ) { Lib_lfree( gray_address ); } } /* * メインメニュー表示 */ static void main_menu_disp( void ) { int iLanguage; /* 日本語/英語表示文字列切替情報取得 */ iLanguage = Lib_get_disp_language(); /* 整列キー表示 -> ( m_menu.c ) */ SUB_menu_disp4he( (char *)str_main_menu[0][iLanguage], (char *)str_main_menu[1][iLanguage], (char *)str_main_menu[2][iLanguage], (char *)NULL ); } /* * ヘルプ表示 */ static void disp_help( void ) { int fx_size, fy_size; int column, line; fx_size = Lib_get_fx_size(); fy_size = Lib_get_fy_size(); Lib_view( 0, 0, fx_size-1, fy_size-1, GRAPH_ERAS ); column = 8; line = 6; Lib_chrdisp( column-1,line, "【機能\概要】連続フレーム入力 CHAINX " ); line++; line++; Lib_chrdisp( column, line, "カレントチャネルの連続画像の取込・表\示を行います。 " ); line++; line++;line++;line++; Lib_chrdisp( column, line, "[設 定] 取り込むフレーム枚数を設定します。" ); line++; Lib_chrdisp( column, line, " 設定した枚数分のメモリを確保します。" ); line++; line++; Lib_chrdisp( column, line, "[録 画] 連続画像の取込を実行します。 " ); line++; line++; Lib_chrdisp( column, line, "[再 生] 取込済みの連続画像を表\示します。 " ); line++; Lib_display_keyinput( 410, 410, "確 認" ); Lib_memory_clear( CHAR_PLANE ); Lib_view( 0, 0, fx_size-1, fy_size-1, GRAPH_DRAW ); } /*********************************************************************/ /*  フレーム数セット                        */ /*********************************************************************/ static int frame_su_set( ) { int status; int data_size, num; status = ERROR_RETURN; if ( ON == alloc_flg ) { Lib_lfree( gray_address ); } alloc_flg = OFF; num = frame_su; /* パッドによる取込枚数の取得 */ Lib_chrdisp( 1, 30, "取り込みフレーム数を指定してください" ); num = ( int )Lib_get_value_by_ten_keyboad( 50, 200, num, 2, 1000 ); Lib_chrdisp( 1, 30, "                  " ); /* データサイズの算出 */ data_size = Lib_get_fx_size() * Lib_get_fy_size() * num; if( (char *)NULL != ( gray_address = (void *)Lib_mlalloc( data_size ) ) ) { frame_su = num; alloc_flg = ON; status = NORMAL_RETURN; } else { num = frame_su; /* フレーム数を変更前に戻す */ data_size = Lib_get_fx_size() * Lib_get_fy_size() * num; if( (char *)NULL != ( gray_address = (void *)Lib_mlalloc( data_size ) ) ) { alloc_flg = ON; } else { frame_su = 0; } } /* 警告メッセージの表示 */ if ( ERROR_RETURN == status ) { Lib_display_message( 100, 200, "メモリ不足", "フレーム数を減らしてください" ); } return( status ); } /************************************************************************/ /* 録画(連続フレーム取込み) */ /************************************************************************/ static void rec_gray() { int rtn, x_pos, y_pos; if ( OFF == alloc_flg ) { Lib_display_message( 70, 200, "エラー", "フレーム数が未設定です" ); return; } Lib_chrdisp( 1, 30, "録画中..." ); Lib_look_current_position( &x_pos, &y_pos ); Lib_erase_cursor(); /* Lib_set_field_squence( SET_ANY_FIELD ); ←CSC902(RICE)の場合のみ */ /* ↑解説 */ /* CSC902(RICE)の場合フィールドシーケンスは SET_ANY_FIELDですが、 */ /* SET_ANY_FIELDの設定はディフォルトなので変更していない限り設定の必要はありません */ /* CSC903の場合は、全画素取込固定なのでフィールドシーケンスの設定はありません */ /*(設定できません) */ rtn = Lib_xframe_chain_freeze( gray_address, NULL, frame_su ); /* 連続フレームBUFF取込み用フリーズ */ Lib_draw_cursor( x_pos, y_pos ); if ( ERROR_RETURN != rtn ) { input_flg = ON; } else { Lib_chrdisp( 1, 30, "ERR! Lib_frame_chain_freeze" ); } Lib_freerun(); Lib_chrdisp( 1, 30, "      " ); } /*********************************************************************/ /* 再生                          */ /*********************************************************************/ static void play_gray( ) { int x_pos, y_pos, i; char ss[70]; if ( OFF == input_flg ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); Lib_display_message( 100, 200, "エラー", "画像を取り込んでください" ); } else { Lib_chrdisp( 1, 30, "再生中..." ); Lib_look_current_position( &x_pos, &y_pos ); Lib_erase_cursor( ); Lib_freeze( NOT_TRANSMIT ); for ( i=0; i