Skip to content

Instantly share code, notes, and snippets.

@SAPikachu
Created May 1, 2011 04:42
Show Gist options
  • Save SAPikachu/950253 to your computer and use it in GitHub Desktop.
Save SAPikachu/950253 to your computer and use it in GitHub Desktop.
void __cdecl filter_impl(int thread_id, int thread_num, FILTER *fp, FILTER_PROC_INFO *fpip)
{
int seed; // ecx@10
signed int counter3; // ebx@13
char *range_lut_1_iter_2; // esi@13
signed int counter2; // ebx@16
char *ditherC_lut_2_iter; // esi@16
int v9; // edx@17
signed int counter4; // ebx@18
char *w_range_map_iter; // esi@18
signed int counter1; // ebx@24
char *h_range_map_iter; // esi@24
PIXEL_YC *src_px; // eax@31
PIXEL_YC *dest_px; // edx@31
unsigned int seed_tmp; // ecx@35
signed int y_diff; // ebx@35
signed int cb_diff; // ebx@38
signed int cr_diff; // ebx@41
unsigned int seed_tmp2; // ecx@50
unsigned int seed_tmp3; // ecx@52
int v22; // esi@52
int v23; // edi@52
unsigned int seed_tmp4; // ecx@66
unsigned int seed_tmp5; // ecx@69
unsigned int seed_tmp6; // ecx@71
int v27; // esi@71
int v28; // edi@71
unsigned int seed_tmp7; // ecx@82
unsigned int seed_tmp8; // ecx@86
unsigned int seed_tmp9; // ecx@88
int ref_ind_x1; // esi@88
int ref_ind_x2; // edi@88
unsigned int seed_tmp10; // ecx@108
unsigned int seed_tmp11; // ecx@111
unsigned int seed_tmp12; // ecx@113
int ref_ind_1; // esi@113
int ref_ind_2; // edi@113
unsigned int seed_tmp13; // ecx@124
char h_range_map[1088]; // [sp+Ch] [bp-DD4h]@24
char w_range_map[1920]; // [sp+44Ch] [bp-994h]@18
char ditherC_lut_2[64]; // [sp+BCCh] [bp-214h]@13
char ditherC_lut_1[64]; // [sp+C0Ch] [bp-1D4h]@13
char ditherY_lut[64]; // [sp+C4Ch] [bp-194h]@13
char range_lut_2[64]; // [sp+C8Ch] [bp-154h]@13
char range_lut_1[64]; // [sp+CCCh] [bp-114h]@13
char *range_lut_1_iter; // [sp+D0Ch] [bp-D4h]@13
char *range_lut_2_iter; // [sp+D10h] [bp-D0h]@13
char *ditherY_lut_iter; // [sp+D14h] [bp-CCh]@13
char *ditherC_lut_1_iter; // [sp+D18h] [bp-C8h]@13
int cr_diff_to_avg; // [sp+D1Ch] [bp-C4h]@119
int cb_diff_to_avg; // [sp+D20h] [bp-C0h]@116
int y_diff_to_avg; // [sp+D24h] [bp-BCh]@113
int cr_diff_ref_p2; // [sp+D28h] [bp-B8h]@103
int cr_diff_ref_n1; // [sp+D2Ch] [bp-B4h]@102
int cr_diff_ref_n2; // [sp+D30h] [bp-B0h]@101
int cr_diff_ref_p1; // [sp+D34h] [bp-ACh]@100
int cb_diff_ref_p2; // [sp+D38h] [bp-A8h]@97
int cb_diff_ref_n1; // [sp+D3Ch] [bp-A4h]@96
int cb_diff_ref_n2; // [sp+D40h] [bp-A0h]@95
int cb_diff_ref_p1; // [sp+D44h] [bp-9Ch]@94
int y_diff_ref_p2; // [sp+D48h] [bp-98h]@91
int y_diff_ref_n1; // [sp+D4Ch] [bp-94h]@90
int y_diff_ref_n2; // [sp+D50h] [bp-90h]@89
int y_diff_ref_p1; // [sp+D54h] [bp-8Ch]@88
int cr_diff_to_ref_n; // [sp+D58h] [bp-88h]@61
int cr_diff_to_ref; // [sp+D5Ch] [bp-84h]@60
int cb_diff_to_ref_n; // [sp+D60h] [bp-80h]@57
int cb_diff_to_ref; // [sp+D64h] [bp-7Ch]@56
int y_diff_to_ref_n; // [sp+D68h] [bp-78h]@53
int y_diff_to_ref; // [sp+D6Ch] [bp-74h]@52
int option_ditherC; // [sp+D70h] [bp-70h]@12
int option_ditherY; // [sp+D74h] [bp-6Ch]@12
int option_range; // [sp+D78h] [bp-68h]@12
int width_range_end; // [sp+D7Ch] [bp-64h]@9
int option_range_raw; // [sp+D80h] [bp-60h]@9
int w; // [sp+D84h] [bp-5Ch]@9
int stride; // [sp+D88h] [bp-58h]@9
char *p_h_ind_mask; // [sp+D8Ch] [bp-54h]@31
char cr_change; // [sp+D94h] [bp-4Ch]@50
char cb_change; // [sp+D95h] [bp-4Bh]@50
char y_change; // [sp+D96h] [bp-4Ah]@50
char option_cr; // [sp+D97h] [bp-49h]@3
char option_cb; // [sp+D98h] [bp-48h]@3
char option_y; // [sp+D99h] [bp-47h]@3
char v86; // [sp+D9Ah] [bp-46h]@50
char v87; // [sp+D9Bh] [bp-45h]@50
char v88; // [sp+D9Ch] [bp-44h]@50
char seed_bits_10_15; // [sp+D9Dh] [bp-43h]@35
char seed_bits_5_10; // [sp+D9Eh] [bp-42h]@35
int cr_diff_to_avg_1; // [sp+DA0h] [bp-40h]@71
int cb_diff_to_avg_1; // [sp+DA4h] [bp-3Ch]@71
int y_diff_to_avg_1; // [sp+DA8h] [bp-38h]@71
int cr_avg; // [sp+DACh] [bp-34h]@71
int cb_avg; // [sp+DB0h] [bp-30h]@71
int y_avg; // [sp+DB4h] [bp-2Ch]@71
int v97; // [sp+DB8h] [bp-28h]@88
int v98; // [sp+DBCh] [bp-24h]@88
int ref_row_2; // [sp+DC0h] [bp-20h]@88
int ref_row; // [sp+DC4h] [bp-1Ch]@35
int process_h_end; // [sp+DC8h] [bp-18h]@30
int process_h_start; // [sp+DCCh] [bp-14h]@30
int i; // [sp+DD0h] [bp-10h]@30
int j; // [sp+DD4h] [bp-Ch]@32
FILTER_PROC_INFO *filter_proc_info; // [sp+DD8h] [bp-8h]@1
FILTER *filter; // [sp+DDCh] [bp-4h]@1
filter = fp;
filter_proc_info = fpip;
if ( !*fp->check )
{
if ( filter->track[6] )
{
option_y = 4 * *((_BYTE *)filter->track + 4);
option_cb = 4 * *((_BYTE *)filter->track + 8);
option_cr = 4 * *((_BYTE *)filter->track + 12);
}
}
if ( *filter->check == 1 )
{
if ( filter->track[6] )
{
option_y = 2 * *((_BYTE *)filter->track + 4);
option_cb = 2 * *((_BYTE *)filter->track + 8);
option_cr = 2 * *((_BYTE *)filter->track + 12);
}
}
if ( !filter->track[6] )
{
option_y = 4 * *((_BYTE *)filter->track + 4);
option_cb = 4 * *((_BYTE *)filter->track + 8);
option_cr = 4 * *((_BYTE *)filter->track + 12);
}
stride = filter_proc_info->max_w;
w = filter_proc_info->w;
option_range_raw = *filter->track;
width_range_end = filter_proc_info->w - *filter->track;
if ( filter->check[1] == 1 )
seed = 0x92D68CA2 - filter_proc_info->frame - filter->track[7];
else
seed = 0x92D68CA2 - filter->track[7];
option_range = 2 * *filter->track + 1;
option_ditherY = 2 * filter->track[4] + 1;
option_ditherC = 2 * filter->track[5] + 1;
if ( filter->check[2] )
{
ditherC_lut_1_iter = ditherC_lut_1;
ditherY_lut_iter = ditherY_lut;
range_lut_2_iter = range_lut_2;
range_lut_1_iter = range_lut_1;
counter2 = 0;
ditherC_lut_2_iter = ditherC_lut_2;
do
{
*range_lut_1_iter = counter2 % option_range - *(_BYTE *)filter->track;
*range_lut_2_iter = 2 * ((counter2 % option_range - *filter->track) >> 1);
*ditherY_lut_iter = counter2 % option_ditherY - *((_BYTE *)filter->track + 16);
*ditherC_lut_1_iter = counter2 % option_ditherC - *((_BYTE *)filter->track + 20);
v9 = counter2++ % option_ditherC;
*ditherC_lut_2_iter++ = v9 - *((_BYTE *)filter->track + 20);
++ditherC_lut_1_iter;
++ditherY_lut_iter;
++range_lut_2_iter;
++range_lut_1_iter;
}
while ( counter2 < 64 );
}
else
{
counter3 = 0;
range_lut_1_iter = ditherC_lut_2;
range_lut_2_iter = ditherC_lut_1;
ditherY_lut_iter = ditherY_lut;
ditherC_lut_1_iter = range_lut_2;
range_lut_1_iter_2 = range_lut_1;
do
{
*range_lut_1_iter_2 = counter3 % option_range - *(_BYTE *)filter->track;
*ditherC_lut_1_iter = counter3 % option_range - *(_BYTE *)filter->track;
*ditherY_lut_iter = counter3 % option_ditherY - *((_BYTE *)filter->track + 16);
*range_lut_2_iter = counter3 % option_ditherC - *((_BYTE *)filter->track + 20);
*range_lut_1_iter++ = counter3++ % option_ditherC - *((_BYTE *)filter->track + 20);
++range_lut_2_iter;
++ditherY_lut_iter;
++ditherC_lut_1_iter;
++range_lut_1_iter_2;
}
while ( counter3 < 64 );
}
counter4 = 0;
w_range_map_iter = w_range_map;
do
{
if ( counter4 >= option_range_raw && filter_proc_info->w - counter4 >= option_range_raw )
*w_range_map_iter = 0xFFu;
else
*w_range_map_iter = 0;
++counter4;
++w_range_map_iter;
}
while ( counter4 < 1920 );
counter1 = 0;
h_range_map_iter = h_range_map;
do
{
if ( counter1 >= option_range_raw && filter_proc_info->h - counter1 >= option_range_raw )
*h_range_map_iter = 0xFFu;
else
*h_range_map_iter = 0;
++counter1;
++h_range_map_iter;
}
while ( counter1 < 1088 );
process_h_start = thread_id * filter_proc_info->h / thread_num;
process_h_end = (thread_id + 1) * filter_proc_info->h / thread_num;
for ( i = process_h_start; i < process_h_end; ++i )
{
src_px = &filter_proc_info->ycp_edit[stride * i];
dest_px = &filter_proc_info->ycp_temp[stride * i];
p_h_ind_mask = &h_range_map[i];
if ( !filter->track[6] )
{
for ( j = 0; j < option_range_raw; ++j )
{
dest_px->y = src_px->y;
dest_px->cb = src_px->cb;
dest_px->cr = src_px->cr;
++src_px;
++dest_px;
}
for ( j = option_range_raw; j < width_range_end; ++dest_px )
{
seed_tmp = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp ^ seed_tmp;
seed_bits_5_10 = ((unsigned int)seed >> 5) & 0x3F;
seed_bits_10_15 = ((unsigned int)seed >> 10) & 0x3F;
ref_row = stride * (*p_h_ind_mask & range_lut_2[(unsigned __int16)((_WORD)seed >> 10)])
+ range_lut_1[((unsigned int)seed >> 5) & 0x3F];
y_diff = src_px[ref_row].y - src_px->y;
if ( (y_diff ^ ((src_px[ref_row].y - src_px->y) >> 31)) - (y_diff >> 31) >= option_y )
dest_px->y = src_px->y;
else
dest_px->y = src_px[ref_row].y;
cb_diff = src_px[ref_row].cb - src_px->cb;
if ( (cb_diff ^ ((src_px[ref_row].cb - src_px->cb) >> 31)) - (cb_diff >> 31) >= option_cb )
dest_px->cb = src_px->cb;
else
dest_px->cb = src_px[ref_row].cb;
cr_diff = src_px[ref_row].cr - src_px->cr;
if ( (cr_diff ^ ((src_px[ref_row].cr - src_px->cr) >> 31)) - (cr_diff >> 31) >= option_cr )
dest_px->cr = src_px->cr;
else
dest_px->cr = src_px[ref_row].cr;
++j;
++src_px;
}
for ( j = width_range_end; j < w; ++j )
{
dest_px->y = src_px->y;
dest_px->cb = src_px->cb;
dest_px->cr = src_px->cr;
++src_px;
++dest_px;
}
}
if ( filter->track[6] == 1 )
{
if ( !*filter->check )
{
for ( j = 0; j < option_range_raw; ++j )
{
seed_tmp2 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp2 ^ seed_tmp2;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
for ( j = option_range_raw; j < width_range_end; ++dest_px )
{
seed_tmp3 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp3 ^ seed_tmp3;
seed_bits_5_10 = ((unsigned int)seed >> 5) & 0x3F;
seed_bits_10_15 = ((unsigned int)seed >> 10) & 0x3F;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
v22 = range_lut_1[((unsigned int)seed >> 5) & 0x3F];
v23 = range_lut_2[(unsigned __int16)((_WORD)seed >> 10)];
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
ref_row = stride * (*p_h_ind_mask & v23) + v22;
y_diff_to_ref = src_px[ref_row].y - src_px->y;
if ( (y_diff_to_ref ^ (y_diff_to_ref >> 31)) - (y_diff_to_ref >> 31) >= option_y
|| (y_diff_to_ref_n = src_px[-ref_row].y - src_px->y,
(y_diff_to_ref_n ^ (y_diff_to_ref_n >> 31)) - (y_diff_to_ref_n >> 31) >= option_y) )
dest_px->y = src_px->y + y_change;
else
dest_px->y = y_change + (unsigned __int16)((src_px[ref_row].y + src_px[-ref_row].y) >> 1);
cb_diff_to_ref = src_px[ref_row].cb - src_px->cb;
if ( (cb_diff_to_ref ^ (cb_diff_to_ref >> 31)) - (cb_diff_to_ref >> 31) >= option_cb
|| (cb_diff_to_ref_n = src_px[-ref_row].cb - src_px->cb,
(cb_diff_to_ref_n ^ (cb_diff_to_ref_n >> 31)) - (cb_diff_to_ref_n >> 31) >= option_cb) )
dest_px->cb = src_px->cb + cb_change;
else
dest_px->cb = cb_change + (unsigned __int16)((src_px[ref_row].cb + src_px[-ref_row].cb) >> 1);
cr_diff_to_ref = src_px[ref_row].cr - src_px->cr;
if ( (cr_diff_to_ref ^ (cr_diff_to_ref >> 31)) - (cr_diff_to_ref >> 31) >= option_cr
|| (cr_diff_to_ref_n = src_px[-ref_row].cr - src_px->cr,
(cr_diff_to_ref_n ^ (cr_diff_to_ref_n >> 31)) - (cr_diff_to_ref_n >> 31) >= option_cr) )
dest_px->cr = src_px->cr + cr_change;
else
dest_px->cr = cr_change + (unsigned __int16)((src_px[ref_row].cr + src_px[-ref_row].cr) >> 1);
++j;
++src_px;
}
for ( j = width_range_end; j < w; ++j )
{
seed_tmp4 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp4 ^ seed_tmp4;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
}
if ( *filter->check == 1 )
{
for ( j = 0; j < option_range_raw; ++j )
{
seed_tmp5 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp5 ^ seed_tmp5;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
for ( j = option_range_raw; j < width_range_end; ++dest_px )
{
seed_tmp6 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp6 ^ seed_tmp6;
seed_bits_5_10 = ((unsigned int)seed >> 5) & 0x3F;
seed_bits_10_15 = ((unsigned int)seed >> 10) & 0x3F;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
v27 = range_lut_1[((unsigned int)seed >> 5) & 0x3F];
v28 = range_lut_2[(unsigned __int16)((_WORD)seed >> 10)];
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
ref_row = stride * (*p_h_ind_mask & v28) + v27;
y_avg = (src_px[ref_row].y + src_px[-ref_row].y) >> 1;
cb_avg = (src_px[ref_row].cb + src_px[-ref_row].cb) >> 1;
cr_avg = (src_px[ref_row].cr + src_px[-ref_row].cr) >> 1;
y_diff_to_avg_1 = y_avg - src_px->y;
cb_diff_to_avg_1 = cb_avg - src_px->cb;
cr_diff_to_avg_1 = cr_avg - src_px->cr;
if ( (y_diff_to_avg_1 ^ (y_diff_to_avg_1 >> 31)) - (y_diff_to_avg_1 >> 31) >= option_y )
dest_px->y = src_px->y + y_change;
else
dest_px->y = y_avg + y_change;
if ( (cb_diff_to_avg_1 ^ (cb_diff_to_avg_1 >> 31)) - (cb_diff_to_avg_1 >> 31) >= option_cb )
dest_px->cb = src_px->cb + cb_change;
else
dest_px->cb = cb_avg + cb_change;
if ( (cr_diff_to_avg_1 ^ (cr_diff_to_avg_1 >> 31)) - (cr_diff_to_avg_1 >> 31) >= option_cr )
dest_px->cr = src_px->cr + cr_change;
else
dest_px->cr = cr_avg + cr_change;
++j;
++src_px;
}
for ( j = width_range_end; j < w; ++j )
{
seed_tmp7 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp7 ^ seed_tmp7;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
}
}
if ( filter->track[6] == 2 )
{
if ( !*filter->check )
{
for ( j = 0; j < option_range_raw; ++j )
{
seed_tmp8 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp8 ^ seed_tmp8;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
for ( j = option_range_raw; j < width_range_end; ++dest_px )
{
seed_tmp9 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp9 ^ seed_tmp9;
seed_bits_5_10 = ((unsigned int)seed >> 5) & 0x3F;
seed_bits_10_15 = ((unsigned int)seed >> 10) & 0x3F;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
ref_ind_x1 = range_lut_1[((unsigned int)seed >> 5) & 0x3F];
ref_ind_x2 = range_lut_2[(unsigned __int16)((_WORD)seed >> 10)];
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
v98 = ref_ind_x2;
v97 = ref_ind_x1;
ref_row = stride * (*p_h_ind_mask & ref_ind_x2) + ref_ind_x1;
ref_row_2 = ref_ind_x2 - stride * (ref_ind_x1 & *p_h_ind_mask);
y_diff_ref_p1 = src_px[ref_row].y - src_px->y;
if ( (y_diff_ref_p1 ^ (y_diff_ref_p1 >> 31)) - (y_diff_ref_p1 >> 31) >= option_y
|| (y_diff_ref_n2 = src_px[-ref_row_2].y - src_px->y,
(y_diff_ref_n2 ^ (y_diff_ref_n2 >> 31)) - (y_diff_ref_n2 >> 31) >= option_y)
|| (y_diff_ref_n1 = src_px[-ref_row].y - src_px->y,
(y_diff_ref_n1 ^ (y_diff_ref_n1 >> 31)) - (y_diff_ref_n1 >> 31) >= option_y)
|| (y_diff_ref_p2 = src_px[ref_row_2].y - src_px->y,
(y_diff_ref_p2 ^ (y_diff_ref_p2 >> 31)) - (y_diff_ref_p2 >> 31) >= option_y) )
dest_px->y = src_px->y + y_change;
else
dest_px->y = y_change
+ (unsigned __int16)((src_px[ref_row_2].y
+ src_px[-ref_row].y
+ src_px[ref_row].y
+ src_px[-ref_row_2].y) >> 2);
cb_diff_ref_p1 = src_px[ref_row].cb - src_px->cb;
if ( (cb_diff_ref_p1 ^ (cb_diff_ref_p1 >> 31)) - (cb_diff_ref_p1 >> 31) >= option_cb
|| (cb_diff_ref_n2 = src_px[-ref_row_2].cb - src_px->cb,
(cb_diff_ref_n2 ^ (cb_diff_ref_n2 >> 31)) - (cb_diff_ref_n2 >> 31) >= option_cb)
|| (cb_diff_ref_n1 = src_px[-ref_row].cb - src_px->cb,
(cb_diff_ref_n1 ^ (cb_diff_ref_n1 >> 31)) - (cb_diff_ref_n1 >> 31) >= option_cb)
|| (cb_diff_ref_p2 = src_px[ref_row_2].cb - src_px->cb,
(cb_diff_ref_p2 ^ (cb_diff_ref_p2 >> 31)) - (cb_diff_ref_p2 >> 31) >= option_cb) )
dest_px->cb = src_px->cb + cb_change;
else
dest_px->cb = cb_change
+ (unsigned __int16)((src_px[ref_row_2].cb
+ src_px[-ref_row].cb
+ src_px[ref_row].cb
+ src_px[-ref_row_2].cb) >> 2);
cr_diff_ref_p1 = src_px[ref_row].cr - src_px->cr;
if ( (cr_diff_ref_p1 ^ (cr_diff_ref_p1 >> 31)) - (cr_diff_ref_p1 >> 31) >= option_cr
|| (cr_diff_ref_n2 = src_px[-ref_row_2].cr - src_px->cr,
(cr_diff_ref_n2 ^ (cr_diff_ref_n2 >> 31)) - (cr_diff_ref_n2 >> 31) >= option_cr)
|| (cr_diff_ref_n1 = src_px[-ref_row].cr - src_px->cr,
(cr_diff_ref_n1 ^ (cr_diff_ref_n1 >> 31)) - (cr_diff_ref_n1 >> 31) >= option_cr)
|| (cr_diff_ref_p2 = src_px[ref_row_2].cr - src_px->cr,
(cr_diff_ref_p2 ^ (cr_diff_ref_p2 >> 31)) - (cr_diff_ref_p2 >> 31) >= option_cr) )
dest_px->cr = src_px->cr + cr_change;
else
dest_px->cr = cr_change
+ (unsigned __int16)((src_px[ref_row_2].cr
+ src_px[-ref_row].cr
+ src_px[ref_row].cr
+ src_px[-ref_row_2].cr) >> 2);
++j;
++src_px;
}
for ( j = width_range_end; j < w; ++j )
{
seed_tmp10 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp10 ^ seed_tmp10;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
}
if ( *filter->check == 1 )
{
for ( j = 0; j < option_range_raw; ++j )
{
seed_tmp11 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp11 ^ seed_tmp11;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
for ( j = option_range_raw; j < width_range_end; ++dest_px )
{
seed_tmp12 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp12 ^ seed_tmp12;
seed_bits_5_10 = ((unsigned int)seed >> 5) & 0x3F;
seed_bits_10_15 = ((unsigned int)seed >> 10) & 0x3F;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
ref_ind_1 = range_lut_1[((unsigned int)seed >> 5) & 0x3F];
ref_ind_2 = range_lut_2[(unsigned __int16)((_WORD)seed >> 10)];
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
v98 = ref_ind_2;
v97 = ref_ind_1;
ref_row = stride * (*p_h_ind_mask & ref_ind_2) + ref_ind_1;
ref_row_2 = ref_ind_2 - stride * (ref_ind_1 & *p_h_ind_mask);
y_avg = (src_px[ref_row_2].y + src_px[-ref_row].y + src_px[ref_row].y + src_px[-ref_row_2].y) >> 2;
cb_avg = (src_px[ref_row_2].cb + src_px[-ref_row].cb + src_px[ref_row].cb + src_px[-ref_row_2].cb) >> 2;
cr_avg = (src_px[ref_row_2].cr + src_px[-ref_row].cr + src_px[ref_row].cr + src_px[-ref_row_2].cr) >> 2;
y_diff_to_avg = y_avg - src_px->y;
if ( (y_diff_to_avg ^ (y_diff_to_avg >> 31)) - (y_diff_to_avg >> 31) >= option_y )
dest_px->y = src_px->y + y_change;
else
dest_px->y = y_avg + y_change;
cb_diff_to_avg = cb_avg - src_px->cb;
if ( (cb_diff_to_avg ^ (cb_diff_to_avg >> 31)) - (cb_diff_to_avg >> 31) >= option_cb )
dest_px->cb = src_px->cb + cb_change;
else
dest_px->cb = cb_avg + cb_change;
cr_diff_to_avg = cr_avg - src_px->cr;
if ( (cr_diff_to_avg ^ (cr_diff_to_avg >> 31)) - (cr_diff_to_avg >> 31) >= option_cr )
dest_px->cr = src_px->cr + cr_change;
else
dest_px->cr = cr_avg + cr_change;
++j;
++src_px;
}
for ( j = width_range_end; j < w; ++j )
{
seed_tmp13 = (((seed << 13) ^ (unsigned int)seed) >> 17) ^ (seed << 13) ^ seed;
seed = 32 * seed_tmp13 ^ seed_tmp13;
v88 = ((unsigned int)seed >> 15) & 0x3F;
v87 = ((unsigned int)seed >> 20) & 0x3F;
v86 = ((unsigned int)seed >> 25) & 0x3F;
y_change = ditherY_lut[((unsigned int)seed >> 15) & 0x3F];
cb_change = ditherC_lut_1[((unsigned int)seed >> 20) & 0x3F];
cr_change = ditherC_lut_1[((unsigned int)seed >> 25) & 0x3F];
dest_px->y = src_px->y + y_change;
dest_px->cb = src_px->cb + cb_change;
dest_px->cr = src_px->cr + cr_change;
++src_px;
++dest_px;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment