@@ -39,15 +39,16 @@ extern AVSValue __cdecl Create_AddLOGO(AVSValue args, void *user_data, IScriptEn
39
39
40
40
inline void Init_EraseLOGO (IScriptEnvironment* env)
41
41
{
42
- env->AddFunction (" EraseLOGO" ," c[logofile]s[logoname]s[pos_x]i[pos_y]i[depth]i[start]i[fadein]i[fadeout]i[end]i" ,Create_EraseLOGO, 0 );
42
+ env->AddFunction (" EraseLOGO" ," c[logofile]s[logoname]s[pos_x]i[pos_y]i[depth]i[yc_y]i[yc_u]i[yc_v]i[ start]i[fadein]i[fadeout]i[end]i" ,Create_EraseLOGO, 0 );
43
43
}
44
44
inline void Init_AddLOGO (IScriptEnvironment* env)
45
45
{
46
- env->AddFunction (" AddLOGO" ," c[logofile]s[logoname]s[pos_x]i[pos_y]i[depth]i[start]i[fadein]i[fadeout]i[end]i" ,Create_AddLOGO, 0 );
46
+ env->AddFunction (" AddLOGO" ," c[logofile]s[logoname]s[pos_x]i[pos_y]i[depth]i[yc_y]i[yc_u]i[yc_v]i[ start]i[fadein]i[fadeout]i[end]i" ,Create_AddLOGO, 0 );
47
47
}
48
48
enum {
49
49
LOGOFILE =1 , LOGONAME,
50
50
POS_X, POS_Y, DEPTH,
51
+ YC_Y , YC_U , YC_V ,
51
52
START, F_IN , F_OUT, END
52
53
};
53
54
@@ -64,7 +65,7 @@ class deLOGO_Base : public GenericVideoFilter {
64
65
LOGO_HEADER* lgh;
65
66
66
67
deLOGO_Base (const PClip& clip,const char * logofile,const char * logoname,int pos_x,int pos_y,
67
- int depth,int start,int fadein,int fadeout,int end, IScriptEnvironment *env,const char * filtername) : GenericVideoFilter(clip)
68
+ int depth,int y, int u, int v, int start,int fadein,int fadeout,int end, IScriptEnvironment *env,const char * filtername) : GenericVideoFilter(clip)
68
69
{
69
70
const VideoInfo& vi = clip->GetVideoInfo ();
70
71
@@ -80,13 +81,29 @@ class deLOGO_Base : public GenericVideoFilter {
80
81
ReadLogoData (logofile,logoname);
81
82
if (pos_x!=0 || pos_y!=0 || depth!=LOGO_DEFAULT_DEPTH)
82
83
AdjustLogo (pos_x,pos_y,depth);
84
+ if (y!=0 || u!=0 || v!= 0 )
85
+ ColorTuning (y*16 ,u*16 ,v*16 );
83
86
}
84
87
catch (char * err){
85
88
env->ThrowError (" %s: %s" ,filtername,err);
86
89
}
87
90
}
88
91
void ReadLogoData (const char * logofile,const char * logoname);
89
- void AdjustLogo (int x,int y,int depth); // AviUtlオリジナルの色空間
92
+ void AdjustLogo (int x,int y,int depth); // AviUtlオリジナル色空間のまま
93
+ void ColorTuning (int y,int u,int v) // 色調整
94
+ {
95
+ int i,j;
96
+ LOGO_PIXEL* lgp = (LOGO_PIXEL*)(lgh +1 );
97
+
98
+ for (i=lgh->h ;i;--i){
99
+ for (j=lgh->w ;j;--j){
100
+ lgp->y += y;
101
+ lgp->cb += u;
102
+ lgp->cr += v;
103
+ ++lgp;
104
+ }
105
+ }
106
+ }
90
107
void Logo_YUY2 ();
91
108
void Logo_YV420 (){};
92
109
@@ -112,7 +129,7 @@ class deLOGO_Base : public GenericVideoFilter {
112
129
int Clamp (int n, int l, int h)
113
130
{ return (n < l) ? l : (n > h) ? h : n; }
114
131
115
- // ITU-R TB.601に沿ってAviUtlのYCから変換
132
+ // ITU-R TB.601に合うようにAviUtlのYCを圧縮
116
133
int TB601_Y (int y)
117
134
{ return ((y +(16 <<4 )) * 220 +128 )/ 256 ; }
118
135
int TB601_C (int c)
@@ -130,8 +147,8 @@ class EraseLOGO_YUY2 : public deLOGO_Base {
130
147
131
148
public:
132
149
EraseLOGO_YUY2 (const PClip& clip,const char * logofile,const char * logoname,
133
- int pos_x,int pos_y,int depth,int start,int fadein,int fadeout,int end,IScriptEnvironment *env)
134
- : deLOGO_Base(clip,logofile,logoname,pos_x,pos_y,depth,start,fadein,fadeout,end,env,GetName())
150
+ int pos_x,int pos_y,int depth,int y, int u, int v, int start,int fadein,int fadeout,int end,IScriptEnvironment *env)
151
+ : deLOGO_Base(clip,logofile,logoname,pos_x,pos_y,depth,y,u,v, start,fadein,fadeout,end,env,GetName())
135
152
{ Logo_YUY2 (); }
136
153
137
154
static const char * GetName (){ return " EraseLOGO" ; }
@@ -147,8 +164,8 @@ class AddLOGO_YUY2 : public deLOGO_Base {
147
164
148
165
public:
149
166
AddLOGO_YUY2 (const PClip& clip,const char * logofile,const char * logoname,
150
- int pos_x,int pos_y,int depth,int start,int fadein,int fadeout,int end,IScriptEnvironment *env)
151
- : deLOGO_Base(clip,logofile,logoname,pos_x,pos_y,depth,start,fadein,fadeout,end,env,GetName())
167
+ int pos_x,int pos_y,int depth,int y, int u, int v, int start,int fadein,int fadeout,int end,IScriptEnvironment *env)
168
+ : deLOGO_Base(clip,logofile,logoname,pos_x,pos_y,depth,y,u,v, start,fadein,fadeout,end,env,GetName())
152
169
{ Logo_YUY2 (); }
153
170
154
171
static const char * GetName (){ return " AddLOGO" ; }
0 commit comments