Skip to content

Commit

Permalink
2003-10-18
Browse files Browse the repository at this point in the history
  • Loading branch information
makiuchi-d committed Sep 11, 2015
1 parent a38c520 commit 9e790bd
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 25 deletions.
11 changes: 11 additions & 0 deletions logoscan/abort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ BOOL CALLBACK AbortDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
// 単一背景のときサンプルをセットする
useable++;
SendMessage(p->fp->hwnd,WM_SP_DRAWFRAME,0,p->s+examine);

if(p->mark){ // 有効フレームをマーク
FRAME_STATUS fs;
p->fp->exfunc->get_frame_status(p->editp,p->s+examine,&fs);
fs.edit_flag |= EDIT_FRAME_EDIT_FLAG_MARKFRAME;
p->fp->exfunc->set_frame_status(p->editp,p->s+examine,&fs);
}
if(p->list){
fprintf(p->list,"%d\n",p->s+examine+1);
}

// ロゴサンプルセット
for(int i=0;i<xywh.h;i++){
for(int j=0;j<xywh.w;j++){
Expand Down
3 changes: 3 additions & 0 deletions logoscan/abort.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <windows.h>
#include "..\filter.h"
#include "scanpix.h"
#include <stdio.h>


// 独自ウィンドウメッセージ
Expand All @@ -26,6 +27,8 @@ struct AbortDlgParam {
int x,y,w,h,t;
void** data;
const char* errstr;
int mark;
FILE* list;
};

#endif
49 changes: 35 additions & 14 deletions logoscan/filter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*********************************************************************
* ロゴ解析プラグイン ver 0.05
* ロゴ解析プラグイン ver 0.06
*
* 2003
* 04/06: とりあえず完成。
Expand Down Expand Up @@ -35,6 +35,9 @@
* 細かな修正、解析完了時にビープを鳴らすようにした。
* 09/22: キャッシュの幅と高さを8の倍数にした。(SSE2対策になったかな?)
* 09/27: filter.hをAviUtl0.99SDKのものに差し替え。(0.05)
* 10/14: キャッシュ幅・高さを元に戻した。
* 10/18: 有効フレームをマーク・ログファイル出力できるようにした。
* VirtualAllocをやめてmallocを使うようにした。(0.06)
*
*********************************************************************/
/* TODO:
Expand All @@ -48,6 +51,7 @@
* →最大と最小の差が閾値以上のとき単一でないと判断のほうがよさそう。
*
* ・SSE2処理時に落ちる:get_ycp_filtering_cache_exがぁゃιぃ。とりあえず幅高さを8の倍数に。
* →だめぽ。VirtualAllocかなぁ。とりあえず試してみる。
*
*/
#include <windows.h>
Expand All @@ -70,6 +74,9 @@ static short _x,_y,_w,_h,_thy;

void *logodata = NULL; // ロゴデータ(解析結果)

#define LIST_FILTER "フレームリスト (*.txt)\0*.txt\0"\
"全てのファイル (*.*)\0*.*\0"

//----------------------------
// プロトタイプ宣言
//----------------------------
Expand All @@ -78,13 +85,13 @@ inline void SetXYWH(FILTER* fp,void* editp);
inline void SetRange(FILTER* fp,void* editp);
inline void FixXYWH(FILTER* fp,void* editp);
void ScanLogoData(FILTER* fp,void* editp);
void SetScanPixel(FILTER*,ScanPixel*&,int,int,int,int,void*);
void SetScanPixel(FILTER*,ScanPixel*&,int,int,int,int,void*,char*);

//----------------------------
// FILTER_DLL構造体
//----------------------------
char filter_name[] = "ロゴ解析";
char filter_info[] = "ロゴ解析プラグイン ver 0.05 by MakKi";
char filter_info[] = "ロゴ解析プラグイン ver 0.06 by MakKi";

#define track_N 5
#if track_N
Expand All @@ -94,25 +101,27 @@ void SetScanPixel(FILTER*,ScanPixel*&,int,int,int,int,void*);
int track_e[] = { 1, 1, 1, 1, 255 }; // トラックバーの上限値
#endif

#define check_N 0
#define check_N 2
#if check_N
TCHAR *check_name[] = { 0 }; // チェックボックス
int check_default[] = { 0 }; // デフォルト
TCHAR *check_name[] = { "有効フレームをマーク", "有効フレームリストを保存" }; // チェックボックス
int check_default[] = { 0,0 }; // デフォルト
#endif

#define tLOGOX 0
#define tLOGOY 1
#define tLOGOW 2
#define tLOGOH 3
#define tTHY 4
#define cMARK 0
#define cLIST 1

// 設定ウィンドウの高さ
#define WND_Y (60+24*track_N+20*check_N)


FILTER_DLL filter = {
FILTER_FLAG_WINDOW_SIZE | // 設定ウィンドウのサイズを指定出来るようにします
FILTER_FLAG_MAIN_MESSAGE | // func_WndProc()にWM_FILTER_MAIN_???のメッセージを送るようにします
FILTER_FLAG_WINDOW_SIZE | // 設定ウィンドウのサイズを指定出来るようにします
FILTER_FLAG_MAIN_MESSAGE | // func_WndProc()にWM_FILTER_MAIN_???のメッセージを送るようにします
FILTER_FLAG_EX_INFORMATION,
#ifdef WND_Y
320,WND_Y, // 設定ウインドウのサイズ
Expand Down Expand Up @@ -229,8 +238,7 @@ BOOL func_WndProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, void *
FixXYWH(fp,editp);
return TRUE;
}
else
SetRange(fp,editp);
SetRange(fp,editp);
return FALSE;

//--------------------------------------------マウスメッセージ
Expand Down Expand Up @@ -402,6 +410,7 @@ void ScanLogoData(FILTER* fp,void* editp)
int w,h; // 幅,高さ
int start,end; // 選択開始・終了フレーム
int frame; // 現在の表示フレーム
char list[MAX_PATH] = "\0"; // フレームリストファイル名

ScanPixel* sp = NULL;
LOGO_HEADER lgh;
Expand Down Expand Up @@ -434,12 +443,14 @@ void ScanLogoData(FILTER* fp,void* editp)
wsprintf(defname,"%s %dx%d",defname,w,h); // デフォルトロゴ名作成

// キャッシュサイズ設定
w += w % 8;
h += h % 8;
fp->exfunc->set_ycp_filtering_cache_size(fp,w,h,1,NULL);

if(fp->check[cLIST]){ // リスト保存時ファイル名取得
fp->exfunc->dlg_get_save_name(list,LIST_FILTER,"*.txt");
}

// ScanPixelを設定する+解析・ロゴデータ作成
SetScanPixel(fp,sp,w,h,start,end,editp);
SetScanPixel(fp,sp,w,h,start,end,editp,list);
}
catch(const char* str){
MessageBox(fp->hwnd,str,filter_name,MB_OK|MB_ICONERROR);
Expand Down Expand Up @@ -476,7 +487,7 @@ void ScanLogoData(FILTER* fp,void* editp)
/*--------------------------------------------------------------------
* ScanPixelを設定する
*-------------------------------------------------------------------*/
void SetScanPixel(FILTER* fp,ScanPixel*& sp,int w,int h,int s,int e,void* editp)
void SetScanPixel(FILTER* fp,ScanPixel*& sp,int w,int h,int s,int e,void* editp,char* list)
{
// 範囲チェック
if(fp->track[tLOGOW]<=0 || fp->track[tLOGOH]<=0)
Expand Down Expand Up @@ -507,9 +518,19 @@ void SetScanPixel(FILTER* fp,ScanPixel*& sp,int w,int h,int s,int e,void* editp)
param.t = fp->track[tTHY];
param.data = &logodata;
param.errstr = NULL;
param.mark = fp->check[cMARK];

param.list = fopen(list,"w");
if(param.list==NULL){
throw "フレームリストファイルの作成に失敗しました";
}
fprintf(param.list,"<Frame List>\n");

DialogBoxParam(fp->dll_hinst,"ABORT_DLG",GetWindow(fp->hwnd,GW_OWNER),AbortDlgProc,(LPARAM)&param);

if(param.list) fclose(param.list);
param.list = NULL;

if(param.errstr)
throw param.errstr;
}
Expand Down
8 changes: 4 additions & 4 deletions logoscan/logoscan.rc
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ FONT 9, "
// VERSION INFO
//
VS_VIRSION_INFO VERSIONINFO
FILEVERSION 0,0,5,0
PRODUCTVERSION 0,0,5
FILEVERSION 0,0,6,0
PRODUCTVERSION 0,0,6
FILEFLAGSMASK 0x3FL
FILEFLAGS 0x0L
FILEOS VOS__WINDOWS32
Expand All @@ -91,12 +91,12 @@ VS_VIRSION_INFO VERSIONINFO
{
// VALUE "Comments", "beta version\0"
VALUE "FileDescription", "���S��� Plugin for AviUtl 0.98d\0"
VALUE "FileVersion", "0.05\0"
VALUE "FileVersion", "0.06\0"
VALUE "InternalName", "LogoScan\0"
VALUE "LegalCopyright", "(C) MakKi\0"
VALUE "OriginalFilename", "logoscan.aup\0"
VALUE "ProductName", "���S��� �v���O�C��\0"
VALUE "ProductVersion", "0.05\0"
VALUE "ProductVersion", "0.06\0"
}
}
BLOCK "VarFileInfo"
Expand Down
15 changes: 10 additions & 5 deletions logoscan/readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-----------------------------------------------------------------------
���S��� �v���O�C�� ver 0.05 by MakKi
���S��� �v���O�C�� ver 0.06 by MakKi
-----------------------------------------------------------------------

�y�@�\�z
Expand All @@ -20,16 +20,20 @@

���p�����[�^
�E�ʒuX : ���S�͈͂̉E��̍��W
�E�ʒuY : ���S�͈͂̍���̍��W
�E�� : ���S�͈͂̕�
�E���� : ���S�͈͂̍���
�E臒l : �w�i���P��F���𔻒肷�邽�߂�臒l�B�����ق������肪�Â��Ȃ�
�E�ʒuY : ���S�͈͂̍���̍��W
�E�� : ���S�͈͂̕�
�E���� : ���S�͈͂̍���
�E臒l : �w�i���P��F���𔻒肷�邽�߂�臒l�B�����ق������肪�Â��Ȃ�

�E�L���t���[�����}�[�N : �L���t���[�����}�[�N����
�E�L���t���[�����X�g��ۑ� : �L���t���[�����X�g���e�L�X�g�t�@�C���Ƃ��ĕۑ�����

����͎菇
�@ ���S�̊܂܂��摜��AviUtl�ɓǂݍ��݂܂��B
���S���t�F�[�h���Ă����ʂ́u�I��͈͂��폜�v���ŏ����Ă�������
�A �t�B���^��L���ɂ���Ɛݒ�E�B���h�E�̃X���C�_�[����у}�E�X�ʼn摜�͈̔͂�I���ł���悤�ɂȂ�܂��B
�B ���S�����S�Ɏ��܂�悤�ɔ͈͂�I�����āA���S��� �{�^���������܂��B
�L���t���[�����X�g��ۑ��Ƀ`�F�b�N�����Ă���ƁA�����ŏo�̓t�@�C�����𕷂��Ă��܂��B
�C ��͂���������ƁA���S��͌��ʃ_�C�A���O���\������܂��B
�D �v���r���[���m�F���A���S�̖��̂���͂��܂��B
�E ���M �{�^���������ƃ��S�f�[�^�𒼐� ���ߐ����S �t�B���^�ɓn���܂��B
Expand All @@ -49,6 +53,7 @@

�y�X�V�����z

2003/10/19 ver 0.06 �E�L���t���[�����}�[�N����O�t�@�C���o�͂ł���悤�ɂ����B
2003/10/01 ver 0.05 �E��͏I�����Ƀr�[�v��‚炷�悤�ɂ����B
�E���̑��ׂ��ȏC���Ƃ�����Ƃ����������B
2003/07/03 ver 0.04 �E�����Ō��J
Expand Down
6 changes: 4 additions & 2 deletions logoscan/resultdlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* 2003
* 06/18: 背景色の指定をRGBに変更
* 10/18: VirtualAllocをやめてみた(SSE2対策)
*
*===================================================================*/
#include <windows.h>
Expand Down Expand Up @@ -60,7 +61,7 @@ BOOL CALLBACK ResultDlgProc(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
switch(LOWORD(wParam)){
case IDCANCEL:
case IDC_CLOSE: // 閉じるボタン
if(pix) VirtualFree(pix,0,MEM_RELEASE);
if(pix) free(pix); // VirtualFree(pix,0,MEM_RELEASE);
pix = NULL;
EndDialog(hdlg,LOWORD(wParam));
break;
Expand Down Expand Up @@ -155,7 +156,8 @@ static void DispLogo(HWND hdlg)
bmi.bmiHeader.biCompression = BI_RGB;

// メモリ再確保
pix = VirtualAlloc(pix,bmi.bmiHeader.biWidth*bmi.bmiHeader.biHeight*sizeof(PIXEL),MEM_COMMIT,PAGE_READWRITE);
// pix = VirtualAlloc(pix,bmi.bmiHeader.biWidth*bmi.bmiHeader.biHeight*sizeof(PIXEL),MEM_COMMIT,PAGE_READWRITE);
pix = realloc(pix,bmi.bmiHeader.biWidth*bmi.bmiHeader.biHeight*sizeof(PIXEL));
if(pix==NULL){
MessageBox(hdlg,"メモリが確保できませんでした\nDispLogo()",filter_name,MB_OK|MB_ICONERROR);
return; // 何もしない
Expand Down

0 comments on commit 9e790bd

Please sign in to comment.