Skip to content

Commit

Permalink
2003-10-21
Browse files Browse the repository at this point in the history
  • Loading branch information
makiuchi-d committed Sep 11, 2015
1 parent 9e790bd commit 8c7a5d4
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 40 deletions.
6 changes: 3 additions & 3 deletions delogo.rc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ FONT 9, "
// VERSION INFO
//
VS_VIRSION_INFO VERSIONINFO
FILEVERSION 0,0,7,0
FILEVERSION 0,0,7,1
PRODUCTVERSION 0,0,7
FILEFLAGSMASK 0x3FL
FILEFLAGS 0x0L
Expand All @@ -88,12 +88,12 @@ VS_VIRSION_INFO VERSIONINFO
{
// VALUE "Comments", "���S�T���v���񋟎ҕ�W��\0"
VALUE "FileDescription", "���ߐ����S �t�B���^ Plugin for AviUtl 0.98\0"
VALUE "FileVersion", "0.0.7.0\0"
VALUE "FileVersion", "0.0.7.1\0"
VALUE "InternalName", "deLogo\0"
VALUE "LegalCopyright", "(C) MakKi\0"
VALUE "OriginalFilename", "delogo.aup\0"
VALUE "ProductName", "���ߐ����S �t�B���^\0"
VALUE "ProductVersion", "0.07\0"
VALUE "ProductVersion", "0.07a\0"
}
}
BLOCK "VarFileInfo"
Expand Down
16 changes: 9 additions & 7 deletions filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
* ロゴ名編集で同名にせっていできないようにした。(0.06a)
* 08/01: フェードの不透明度計算式を見直し
* 08/02: 実数演算を止め、無駄な演算を削除して高速化。
* 上に伴い深度のデフォルト値を変更。
* 細かな修正
* 09/05: 細かな修正
* 09/27: filter.hをAviUtl0.99SDKのものに差し替え。(0.07)
* 上に伴い深度のデフォルト値を変更。
* 細かな修正
* 09/05: 細かな修正
* 09/27: filter.hをAviUtl0.99SDKのものに差し替え。(0.07)
* 10/20: SSE2使用のrgb2ycがバグもちなので、自前でRGB->YCbCrするようにした。
* 位置X/Yの最大・最小値を拡張した。(0.07a)
*
*********************************************************************/

Expand Down Expand Up @@ -156,15 +158,15 @@ BOOL func_proc_add_logo(FILTER *fp,FILTER_PROC_INFO *fpip,LOGO_HEADER *lgh,int);
// FILTER_DLL構造体
//----------------------------
char filter_name[] = LOGO_FILTER_NAME;
char filter_info[] = LOGO_FILTER_NAME" ver 0.07 by MakKi";
char filter_info[] = LOGO_FILTER_NAME" ver 0.07a by MakKi";
#define track_N 10
#if track_N
TCHAR *track_name[] = { "位置 X", "位置 Y",
"深度", "Y", "Cb", "Cr",
"開始", "FadeIn", "FadeOut", "終了" }; // トラックバーの名前
int track_default[] = { 0, 0, 128, 0, 0, 0, 0, 0, 0, 0 }; // トラックバーの初期値
int track_s[] = { -200, -200, 0, -100, -100, -100, 0, 0, 0, 0 }; // トラックバーの下限値
int track_e[] = { 200, 200, 256, 100, 100, 100, 256, 256, 256, 256 }; // トラックバーの上限値
int track_s[] = { -500, -500, 0, -100, -100, -100, 0, 0, 0, 0 }; // トラックバーの下限値
int track_e[] = { 500, 500, 256, 100, 100, 100, 256, 256, 256, 256 }; // トラックバーの上限値
#endif
#define check_N 2
#if check_N
Expand Down
27 changes: 21 additions & 6 deletions logoscan/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
* 10/14: キャッシュ幅・高さを元に戻した。
* 10/18: 有効フレームをマーク・ログファイル出力できるようにした。
* VirtualAllocをやめてmallocを使うようにした。(0.06)
* 10/20: VirtualAllocにもどした。
* exfunc->rgb2ycをやめて、自前でRGB->YCbCr
* 有効フレームリストを保存のチェックが入っていない時動かないバグ修正
* ログファイルのデフォルト名をソースファイル名からつくるようにした。(0.06a)
*
*********************************************************************/
/* TODO:
Expand All @@ -52,6 +56,8 @@
*
* ・SSE2処理時に落ちる:get_ycp_filtering_cache_exがぁゃιぃ。とりあえず幅高さを8の倍数に。
* →だめぽ。VirtualAllocかなぁ。とりあえず試してみる。
* AviUtl本家の掲示板にrgb2ycが動かないとの報告が?!こいつだったのか。
* →自前で変換。
*
*/
#include <windows.h>
Expand Down Expand Up @@ -91,7 +97,7 @@ void SetScanPixel(FILTER*,ScanPixel*&,int,int,int,int,void*,char*);
// FILTER_DLL構造体
//----------------------------
char filter_name[] = "ロゴ解析";
char filter_info[] = "ロゴ解析プラグイン ver 0.06 by MakKi";
char filter_info[] = "ロゴ解析プラグイン ver 0.06a by MakKi";

#define track_N 5
#if track_N
Expand Down Expand Up @@ -446,7 +452,14 @@ void ScanLogoData(FILTER* fp,void* editp)
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");
// ロゴ名の初期値
GetWindowText(GetWindow(fp->hwnd,GW_OWNER),list,MAX_PATH); // タイトルバー文字列取得
for(int i=1;list[i];i++)
if(list[i]=='.') list[i] = '\0'; // 2文字目以降の'.'を終端にする(拡張子を削除)
wsprintf(list,"%s_scan.txt",list); // デフォルトロゴ名作成

if(!fp->exfunc->dlg_get_save_name(list,LIST_FILTER,list))
*list = '\0'; // キャンセル時
}

// ScanPixelを設定する+解析・ロゴデータ作成
Expand Down Expand Up @@ -520,11 +533,13 @@ void SetScanPixel(FILTER* fp,ScanPixel*& sp,int w,int h,int s,int e,void* editp,
param.errstr = NULL;
param.mark = fp->check[cMARK];

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

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

Expand Down
6 changes: 3 additions & 3 deletions logoscan/logoscan.rc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ FONT 9, "
// VERSION INFO
//
VS_VIRSION_INFO VERSIONINFO
FILEVERSION 0,0,6,0
FILEVERSION 0,0,6,1
PRODUCTVERSION 0,0,6
FILEFLAGSMASK 0x3FL
FILEFLAGS 0x0L
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.06\0"
VALUE "FileVersion", "0.06a\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.06\0"
VALUE "ProductVersion", "0.06a\0"
}
}
BLOCK "VarFileInfo"
Expand Down
3 changes: 3 additions & 0 deletions logoscan/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@

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

2003/10/21 ver 0.06a �E���O��RGB->YCbCr����悤�ɂ����B(SSE2�ł̕s��΍�)
�E�L���t���[�����X�g��ۑ��̃`�F�b�N�������Ă��Ȃ��������Ȃ��o�O�C���B
�E���O�t�@�C���̃f�t�H���g�����\�[�X�t�@�C��������‚���悤�ɂ����B
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
Expand Down
20 changes: 16 additions & 4 deletions logoscan/resultdlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static void idc_save(HWND hdlg);
static void ExportLogoData(char *fname,void *data,HWND hdlg);
static void SendLogoData(HWND hdlg);
static PIXEL_YC* get_bgyc(HWND hdlg);
static void RGBtoYCbCr(PIXEL_YC *ycp,const PIXEL *rgb);


/*====================================================================
Expand All @@ -61,7 +62,7 @@ BOOL CALLBACK ResultDlgProc(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam)
switch(LOWORD(wParam)){
case IDCANCEL:
case IDC_CLOSE: // 閉じるボタン
if(pix) free(pix); // VirtualFree(pix,0,MEM_RELEASE);
if(pix) VirtualFree(pix,0,MEM_RELEASE);
pix = NULL;
EndDialog(hdlg,LOWORD(wParam));
break;
Expand Down Expand Up @@ -156,8 +157,7 @@ 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 = realloc(pix,bmi.bmiHeader.biWidth*bmi.bmiHeader.biHeight*sizeof(PIXEL));
pix = VirtualAlloc(pix,bmi.bmiHeader.biWidth*bmi.bmiHeader.biHeight*sizeof(PIXEL),MEM_COMMIT,PAGE_READWRITE);
if(pix==NULL){
MessageBox(hdlg,"メモリが確保できませんでした\nDispLogo()",filter_name,MB_OK|MB_ICONERROR);
return; // 何もしない
Expand Down Expand Up @@ -358,7 +358,19 @@ static PIXEL_YC* get_bgyc(HWND hdlg)
SetDlgItemInt(hdlg,IDC_RED ,p.r,FALSE);

// RGB -> YCbCr
dlgfp->exfunc->rgb2yc(&bgyc,&p,1);
RGBtoYCbCr(&bgyc,&p);

return &bgyc;
}

/*--------------------------------------------------------------------
* RGBtoYCbCr()
*-------------------------------------------------------------------*/
static void RGBtoYCbCr(PIXEL_YC *ycp,const PIXEL *rgb)
{
ycp->y = 0.2989*4096/256*rgb->r + 0.5866*4096/256*rgb->g + 0.1145*4096/256*rgb->b +0.5;
ycp->cb = -0.1687*4096/256*rgb->r - 0.3312*4096/256*rgb->g + 0.5000*4096/256*rgb->b +0.5;
ycp->cr = 0.5000*4096/256*rgb->r - 0.4183*4096/256*rgb->g - 0.0816*4096/256*rgb->b +0.5;
}


40 changes: 27 additions & 13 deletions optdlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static void CopyLBtoCB(HWND list,HWND combo);
static void CopyCBtoLB(HWND combo,HWND list);
static void DispLogo(HWND hdlg);
static void set_bgyc(HWND hdlg);
static void RGBtoYCbCr(PIXEL_YC *ycp,const PIXEL *rgb);


//----------------------------
Expand All @@ -49,10 +50,10 @@ HWND hoptdlg;
PIXEL_YC bgyc; // 背景色

const PIXEL_YC yc_black = { 0, 0, 0 }; // 黒
const PIXEL_YC yc_white = { 4080, 0, 0 }; // 白
const PIXEL_YC yc_red = { 1220, -688, 2040 }; // 赤
const PIXEL_YC yc_green = { 2393,-1351,-1707 }; // 緑
const PIXEL_YC yc_blue = { 467, 2040, -333 }; // 青
//const PIXEL_YC yc_white = { 4080, 0, 0 }; // 白
//const PIXEL_YC yc_red = { 1220, -688, 2040 }; // 赤
//const PIXEL_YC yc_green = { 2393,-1351,-1707 }; // 緑
//const PIXEL_YC yc_blue = { 467, 2040, -333 }; // 青

void **add_list;
void **del_list;
Expand Down Expand Up @@ -152,21 +153,24 @@ static void Wm_initdialog(HWND hdlg)

// コンボボックスからアイテムをコピー
CopyCBtoLB(hdlg,hcb_logo);

// 背景色に黒を選択
SendDlgItemMessage(hdlg,IDC_BLACK,BM_SETCHECK,(WPARAM)BST_CHECKED,0);
bgyc = yc_black;

// 一番上のリストアイテムを選択
SendDlgItemMessage(hdlg,IDC_LIST,LB_SETCURSEL,0,0);

// RGBエディット・スピンのレンジ設定
SendDlgItemMessage(hdlg,IDC_RED, EM_SETLIMITTEXT, 3,0);
SendDlgItemMessage(hdlg,IDC_GREEN, EM_SETLIMITTEXT, 3,0);
SendDlgItemMessage(hdlg,IDC_BLUE, EM_SETLIMITTEXT, 3,0);
SendDlgItemMessage(hdlg,IDC_SPINR, UDM_SETRANGE, 0, 255);
SendDlgItemMessage(hdlg,IDC_SPING, UDM_SETRANGE, 0, 255);
SendDlgItemMessage(hdlg,IDC_SPINB, UDM_SETRANGE, 0, 255);

// 背景色に黒を選択
// SendDlgItemMessage(hdlg,IDC_BLACK,BM_SETCHECK,(WPARAM)BST_CHECKED,0);
SetDlgItemInt(hdlg,IDC_RED, 0,FALSE);
SetDlgItemInt(hdlg,IDC_GREEN,0,FALSE);
SetDlgItemInt(hdlg,IDC_BLUE, 0,FALSE);
bgyc = yc_black;

// 一番上のリストアイテムを選択
SendDlgItemMessage(hdlg,IDC_LIST,LB_SETCURSEL,0,0);

}


Expand Down Expand Up @@ -765,7 +769,17 @@ static void set_bgyc(HWND hdlg)
SetDlgItemInt(hdlg,IDC_RED ,p.r,FALSE);

// RGB -> YCbCr
optfp->exfunc->rgb2yc(&bgyc,&p,1);
RGBtoYCbCr(&bgyc,&p);
}

/*--------------------------------------------------------------------
* RGBtoYCbCr()
*-------------------------------------------------------------------*/
static void RGBtoYCbCr(PIXEL_YC *ycp,const PIXEL *rgb)
{
ycp->y = 0.2989*4096/256*rgb->r + 0.5866*4096/256*rgb->g + 0.1145*4096/256*rgb->b +0.5;
ycp->cb = -0.1687*4096/256*rgb->r - 0.3312*4096/256*rgb->g + 0.5000*4096/256*rgb->b +0.5;
ycp->cr = 0.5000*4096/256*rgb->r - 0.4183*4096/256*rgb->g - 0.0816*4096/256*rgb->b +0.5;
}

//*/
8 changes: 5 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@

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

2003/10/01 ver 0.07 �E�t�F�[�h�̕s�����x�v�Z���̌������B
�E������ƍ������A�ׂ��ȏC���B
2003/10/21 ver 0.07a�E���O��RGB->YCbCr����悤�ɂ����B(SSE2�ł̕s��΍�)
�E�ʒuX/Y�̍ő奍ŏ��l���g�������B
2003/10/01 ver 0.07 �E�t�F�[�h�̕s�����x�v�Z���̌�����
�E������ƍ������A�ׂ��ȏC��
2003/07/03 ver 0.06a�E���S�f�[�^����M�ł��Ȃ��ꍇ���������̂��C��
�E���S���ҏW�œ����ɐݒ�ł��Ȃ��悤�ɂ���
2003/06/30 ver 0.06 �E�t�F�[�h�C��/�A�E�g�ł���悤�ɂ���
2003/06/12 ver 0.05 �E����������������
�E�v���r���[�̔w�i�F��RGB�Ŏw��ł���悤�ɂ���
�E�v���r���[�̔w�i�F��RGB�Ŏw��ł���悤�ɂ���
2003/05/17 ver 0.04 �E���S�̖��̂�ҏW�ł���悤�ɂ���
2003/05/10 ver 0.03 �E���S��̓v���O�C������̃f�[�^����M�ł��Ă��Ȃ������o�O���C��
2003/05/08 ver 0.02 �E���S�f�[�^���v���t�@�C��,�v���W�F�N�g�Ɋ֘A�t�����Ă��Ȃ������o�O���C��
Expand Down
2 changes: 1 addition & 1 deletion resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define IDC_DOWN 4108
#define IDC_PANEL 4109
#define IDC_GROUP 4110
#define IDC_BLACK 4111
//#define IDC_BLACK 4111
#define IDC_RED 4112
#define IDC_GREEN 4113
#define IDC_BLUE 4114
Expand Down

0 comments on commit 8c7a5d4

Please sign in to comment.