davinci dm644x resizer calccoef

0804878f <calc_coef>:
 804878f: 55                   push   %ebp
 8048790: 89 e5                 mov    %esp,%ebp
 8048792: 57                   push   %edi
 8048793: 56                   push   %esi
 8048794: 53                   push   %ebx
 8048795: 83 ec 7c             sub    $0x7c,%esp
 8048798: 81 7d 08 00 02 00 00 cmpl   $0x200,0x8(%ebp)
 804879f: 7e 17                 jle    80487b8 <calc_coef+0x29> if(rsz>512){
 80487a1: c7 45 ec 04 00 00 00 movl   $0x4,0xffffffec(%ebp) nphases = 4;
 80487a8: c7 45 e8 07 00 00 00 movl   $0x7,0xffffffe8(%ebp) ntaps = 7;
 80487af: c7 45 e0 08 00 00 00 movl   $0x8,0xffffffe0(%ebp) phase_offset = 8;
 80487b6: eb 15                 jmp    80487cd <calc_coef+0x3e> }else{
 80487b8: c7 45 ec 08 00 00 00 movl   $0x8,0xffffffec(%ebp) nphases = 8;
 80487bf: c7 45 e8 04 00 00 00 movl   $0x4,0xffffffe8(%ebp) ntaps = 4;
 80487c6: c7 45 e0 04 00 00 00 movl   $0x4,0xffffffe0(%ebp) phase_offset = 4;
 80487cd: 8b 45 ec             mov    0xffffffec(%ebp),%eax }
 80487d0: 0f af 45 e8           imul   0xffffffe8(%ebp),%eax
 80487d4: 89 45 e4             mov    %eax,0xffffffe4(%ebp) winlen = nphases*ntaps;
 80487d7: 81 7d 08 ff 00 00 00 cmpl   $0xff,0x8(%ebp)
 80487de: 7f 0c                 jg     80487ec <calc_coef+0x5d> if(rsz<255){
 80487e0: db 45 ec             fildl  0xffffffec(%ebp)
 80487e3: d9 e8                 fld1   
 80487e5: de f1                 fdivp  %st,%st(1)
 80487e7: dd 5d a8             fstpl  0xffffffa8(%ebp) d_FC_div_PI = 1.0/nphases;
 80487ea: eb 1a                 jmp    8048806 <calc_coef+0x77> }else{
 80487ec: 8b 45 08             mov    0x8(%ebp),%eax
 80487ef: 0f af 45 ec           imul   0xffffffec(%ebp),%eax
 80487f3: 50                   push   %eax
 80487f4: db 04 24             fildl  (%esp)
 80487f7: 8d 64 24 04           lea    0x4(%esp),%esp
 80487fb: dd 05 f0 a5 04 08     fldl   0x804a5f0
 8048801: de f1                 fdivp  %st,%st(1) d_FC_div_PI = 256.0/(rsz*nphases);
 8048803: dd 5d a8             fstpl  0xffffffa8(%ebp) }
 8048806: dd 45 a8             fldl   0xffffffa8(%ebp)
 8048809: d9 5d d4             fstps  0xffffffd4(%ebp) float fc = (float)f_FC_div_PI;
 804880c: 8b 45 0c             mov    0xc(%ebp),%eax wintype
 804880f: 89 45 94             mov    %eax,0xffffff94(%ebp) =wintype;
 8048812: 83 7d 94 02           cmpl   $0x2,0xffffff94(%ebp)
 8048816: 0f 84 81 00 00 00     je     804889d <calc_coef+0x10e> 2==wintype
 804881c: 83 7d 94 02           cmpl   $0x2,0xffffff94(%ebp)
 8048820: 77 0b                 ja     804882d <calc_coef+0x9e>
 8048822: 83 7d 94 00           cmpl   $0x0,0xffffff94(%ebp)
 8048826: 74 1e                 je     8048846 <calc_coef+0xb7> 0==wintype
 8048828: e9 2d 01 00 00       jmp    804895a <calc_coef+0x1cb> 1==wintype
 804882d: 83 7d 94 03           cmpl   $0x3,0xffffff94(%ebp)
 8048831: 0f 84 c6 00 00 00     je     80488fd <calc_coef+0x16e> 3==wintype
 8048837: 83 7d 94 04           cmpl   $0x4,0xffffff94(%ebp)
 804883b: 0f 84 e4 00 00 00     je     8048925 <calc_coef+0x196> 4==wintype
 8048841: e9 14 01 00 00       jmp    804895a <calc_coef+0x1cb>
 8048846: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i = 0;i<(winlen+1);){//0==wintype HANN
 804884d: 8b 45 e4             mov    0xffffffe4(%ebp),%eax
 8048850: 40                   inc    %eax
 8048851: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 8048854: 0f 8e 83 01 00 00     jle    80489dd <calc_coef+0x24e>
 804885a: 8b 5d dc             mov    0xffffffdc(%ebp),%ebx i
 804885d: db 45 dc             fildl  0xffffffdc(%ebp) i
 8048860: dd 05 f8 a5 04 08     fldl   0x804a5f8 2*M_PI
 8048866: de c9                 fmulp  %st,%st(1) i*2*M_PI
 8048868: db 45 e4             fildl  0xffffffe4(%ebp) winlen
 804886b: de f9                 fdivrp %st,%st(1) (i*2*M_PI)/winlen
 804886d: 83 ec 08             sub    $0x8,%esp
 8048870: 8d 64 24 f8           lea    0xfffffff8(%esp),%esp
 8048874: dd 1c 24             fstpl  (%esp)
 8048877: e8 c0 fc ff ff       call   804853c <cos@plt> cos((i*2*M_PI)/winlen)
 804887c: 83 c4 10             add    $0x10,%esp
 804887f: dd 05 00 a6 04 08     fldl   0x804a600 0.5
 8048885: de c9                 fmulp  %st,%st(1) 0.5*cos((i*2*M_PI)/winlen)
 8048887: dd 05 00 a6 04 08     fldl   0x804a600 0.5
 804888d: de e1                 fsubp  %st,%st(1) 0.5-0.5*cos((i*2*M_PI)/winlen)
 804888f: d9 1c 9d 60 c4 04 08 fstps  0x804c460(,%ebx,4) windows[i] = 0.5-0.5*cos((i*2*M_PI)/winlen);
 8048896: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048899: ff 00                 incl   (%eax) i++;
 804889b: eb b0                 jmp    804884d <calc_coef+0xbe> }
 804889d: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i = 0;i<(winlen+1);){//2==wintype
 80488a4: 8b 45 e4             mov    0xffffffe4(%ebp),%eax
 80488a7: 40                   inc    %eax
 80488a8: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 80488ab: 0f 8e 2c 01 00 00     jle    80489dd <calc_coef+0x24e>
 80488b1: 8b 45 dc             mov    0xffffffdc(%ebp),%eax i
 80488b4: 89 45 a4             mov    %eax,0xffffffa4(%ebp) t1 = i;
 80488b7: 8b 55 e4             mov    0xffffffe4(%ebp),%edx winlen
 80488ba: 89 d0                 mov    %edx,%eax
 80488bc: c1 f8 1f             sar    $0x1f,%eax
 80488bf: c1 e8 1f             shr    $0x1f,%eax
 80488c2: 8d 04 02             lea    (%edx,%eax,1),%eax
 80488c5: d1 f8                 sar    %eax winlen/2;
 80488c7: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax if(i<winlen/2)
 80488ca: 7f 17                 jg     80488e3 <calc_coef+0x154>
 80488cc: 8b 45 dc             mov    0xffffffdc(%ebp),%eax i
 80488cf: 8b 55 e4             mov    0xffffffe4(%ebp),%edx winlen
 80488d2: 29 c2                 sub    %eax,%edx winlen-i
 80488d4: 89 d0                 mov    %edx,%eax
 80488d6: 50                   push   %eax
 80488d7: db 04 24             fildl  (%esp)
 80488da: 8d 64 24 04           lea    0x4(%esp),%esp
 80488de: d9 5d a0             fstps  0xffffffa0(%ebp) t2 = winlen-i;
 80488e1: eb 06                 jmp    80488e9 <calc_coef+0x15a> }else{
 80488e3: db 45 dc             fildl  0xffffffdc(%ebp) t2 = winlen;
 80488e6: d9 5d a0             fstps  0xffffffa0(%ebp) }
 80488e9: d9 45 a0             flds   0xffffffa0(%ebp)
 80488ec: 8b 45 a4             mov    0xffffffa4(%ebp),%eax
 80488ef: d9 1c 85 60 c4 04 08 fstps  0x804c460(,%eax,4) windows[i] = t2;
 80488f6: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 80488f9: ff 00                 incl   (%eax) i++;
 80488fb: eb a7                 jmp    80488a4 <calc_coef+0x115> }
 80488fd: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i = 0;i<(winlen+1);){//3==wintype
 8048904: 8b 45 e4             mov    0xffffffe4(%ebp),%eax
 8048907: 40                   inc    %eax
 8048908: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 804890b: 0f 8e cc 00 00 00     jle    80489dd <calc_coef+0x24e>
 8048911: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048914: db 45 dc             fildl  0xffffffdc(%ebp)
 8048917: d9 1c 85 60 c4 04 08 fstps  0x804c460(,%eax,4) windows[i] = i;
 804891e: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048921: ff 00                 incl   (%eax) i++;
 8048923: eb df                 jmp    8048904 <calc_coef+0x175> }
 8048925: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<(winlen+1);){//4==wintype CUSTOM
 804892c: 8b 45 e4             mov    0xffffffe4(%ebp),%eax
 804892f: 40                   inc    %eax
 8048930: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 8048933: 0f 8e a4 00 00 00     jle    80489dd <calc_coef+0x24e>
 8048939: 8b 4d dc             mov    0xffffffdc(%ebp),%ecx i
 804893c: 8b 45 dc             mov    0xffffffdc(%ebp),%eax i
 804893f: 8d 14 85 00 00 00 00 lea    0x0(,%eax,4),%edx i*4
 8048946: 8b 45 18             mov    0x18(%ebp),%eax
 8048949: 8b 04 02             mov    (%edx,%eax,1),%eax
 804894c: 89 04 8d 60 c4 04 08 mov    %eax,0x804c460(,%ecx,4) windows[i] = custom_win[i]
 8048953: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048956: ff 00                 incl   (%eax) i++
 8048958: eb d2                 jmp    804892c <calc_coef+0x19d> }
 804895a: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i = 0;i<winlen;){//1==wintype BLACK_MAN
 8048961: 8b 45 e4             mov    0xffffffe4(%ebp),%eax winlen
 8048964: 40                   inc    %eax
 8048965: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 8048968: 7e 73                 jle    80489dd <calc_coef+0x24e>
 804896a: 8b 5d dc             mov    0xffffffdc(%ebp),%ebx i
 804896d: db 45 dc             fildl  0xffffffdc(%ebp) i
 8048970: dd 05 f8 a5 04 08     fldl   0x804a5f8 2*M_PI
 8048976: de c9                 fmulp  %st,%st(1)
 8048978: db 45 e4             fildl  0xffffffe4(%ebp)
 804897b: de f9                 fdivrp %st,%st(1) i*2*M_PI/winlen
 804897d: 83 ec 08             sub    $0x8,%esp
 8048980: 8d 64 24 f8           lea    0xfffffff8(%esp),%esp
 8048984: dd 1c 24             fstpl  (%esp)
 8048987: e8 b0 fb ff ff       call   804853c <cos@plt> cos(i*2*M_PI/winlen)
 804898c: 83 c4 10             add    $0x10,%esp
 804898f: dd 05 00 a6 04 08     fldl   0x804a600 0.5
 8048995: de c9                 fmulp  %st,%st(1) 0.5*cos(i*2*M_PI/winlen)
 8048997: dd 05 08 a6 04 08     fldl   0x804a608 0.42
 804899d: de e1                 fsubp  %st,%st(1) 0.42-0.5*cos(i*2*M_PI/winlen)
 804899f: dd 5d 98             fstpl  0xffffff98(%ebp)
 80489a2: db 45 dc             fildl  0xffffffdc(%ebp) i
 80489a5: dd 05 10 a6 04 08     fldl   0x804a610 4*M_PI
 80489ab: de c9                 fmulp  %st,%st(1) i*4*M_PI
 80489ad: db 45 e4             fildl  0xffffffe4(%ebp) winlen
 80489b0: de f9                 fdivrp %st,%st(1) (i*4*M_PI)/winlen
 80489b2: 83 ec 08             sub    $0x8,%esp
 80489b5: 8d 64 24 f8           lea    0xfffffff8(%esp),%esp
 80489b9: dd 1c 24             fstpl  (%esp)
 80489bc: e8 7b fb ff ff       call   804853c <cos@plt> cos((i*4*M_PI)/winlen)
 80489c1: 83 c4 10             add    $0x10,%esp
 80489c4: dd 05 18 a6 04 08     fldl   0x804a618 0.08000000000000000167
 80489ca: de c9                 fmulp  %st,%st(1) 0.08000000000000000167*cos((i*4*M_PI)/winlen)
 80489cc: dc 45 98             faddl  0xffffff98(%ebp) 0.42-0.5*cos(i*2*M_PI/winlen)+0.08000000000000000167*cos((i*4*M_PI)/winlen)
 80489cf: d9 1c 9d 60 c4 04 08 fstps  0x804c460(,%ebx,4) windows[i] = 0.42-0.5*cos(i*2*M_PI/winlen)+0.08000000000000000167*cos((i*4*M_PI)/winlen);
 80489d6: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 80489d9: ff 00                 incl   (%eax) i++
 80489db: eb 84                 jmp    8048961 <calc_coef+0x1d2> }
 80489dd: 83 7d 10 02           cmpl   $0x2,0x10(%ebp) if(2==filtype){//LOWPASS
 80489e1: 0f 85 1f 01 00 00     jne    8048b06 <calc_coef+0x377>
 80489e7: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp)  for(i=0;i<winlen;){
 80489ee: 8b 45 e4             mov    0xffffffe4(%ebp),%eax
 80489f1: 40                   inc    %eax
 80489f2: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 80489f5: 0f 8e a5 00 00 00     jle    8048aa0 <calc_coef+0x311>
 80489fb: db 45 dc             fildl  0xffffffdc(%ebp)              i
 80489fe: 8b 55 e4             mov    0xffffffe4(%ebp),%edx winlen
 8048a01: 89 d0                 mov    %edx,%eax
 8048a03: c1 f8 1f             sar    $0x1f,%eax
 8048a06: c1 e8 1f             shr    $0x1f,%eax
 8048a09: 8d 04 02             lea    (%edx,%eax,1),%eax
 8048a0c: d1 f8                 sar    %eax winlen/2
 8048a0e: 50                   push   %eax
 8048a0f: db 04 24             fildl  (%esp)
 8048a12: 8d 64 24 04           lea    0x4(%esp),%esp
 8048a16: de e9                 fsubrp %st,%st(1)
 8048a18: d9 5d cc             fstps  0xffffffcc(%ebp) i-winlen/2;
 8048a1b: 8b 55 e4             mov    0xffffffe4(%ebp),%edx winlen
 8048a1e: 89 d0                 mov    %edx,%eax
 8048a20: c1 f8 1f             sar    $0x1f,%eax
 8048a23: c1 e8 1f             shr    $0x1f,%eax
 8048a26: 8d 04 02             lea    (%edx,%eax,1),%eax
 8048a29: d1 f8                 sar    %eax winlen/2
 8048a2b: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax if(i==winlen/2)
 8048a2e: 75 16                 jne    8048a46 <calc_coef+0x2b7>
 8048a30: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048a33: 8b 55 dc             mov    0xffffffdc(%ebp),%edx
 8048a36: 8b 14 95 60 c4 04 08 mov    0x804c460(,%edx,4),%edx
 8048a3d: 89 14 85 00 c5 04 08 mov    %edx,0x804c500(,%eax,4) interleave_coef[i] = windows[i];
 8048a44: eb 50                 jmp    8048a96 <calc_coef+0x307> }else{
 8048a46: 8b 5d dc             mov    0xffffffdc(%ebp),%ebx
 8048a49: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048a4c: d9 04 85 60 c4 04 08 flds   0x804c460(,%eax,4) windows[i];
 8048a53: dd 5d 88             fstpl  0xffffff88(%ebp) =windows[i];
 8048a56: d9 45 d4             flds   0xffffffd4(%ebp) f_FC_div_PI
 8048a59: dd 05 20 a6 04 08     fldl   0x804a620 M_PI
 8048a5f: de c9                 fmulp  %st,%st(1) f_FC_div_PI*M_PI
 8048a61: d9 45 cc             flds   0xffffffcc(%ebp)
 8048a64: de c9                 fmulp  %st,%st(1) f_FC_div_PI*M_PI*(i-winlen/2)
 8048a66: 83 ec 08             sub    $0x8,%esp
 8048a69: 8d 64 24 f8           lea    0xfffffff8(%esp),%esp
 8048a6d: dd 1c 24             fstpl  (%esp)
 8048a70: e8 87 fb ff ff       call   80485fc <sin@plt> sin(f_FC_div_PI*M_PI*(i-winlen/2));
 8048a75: 83 c4 10             add    $0x10,%esp
 8048a78: dd 45 88             fldl   0xffffff88(%ebp)
 8048a7b: de c9                 fmulp  %st,%st(1) sin(f_FC_div_PI*M_PI*(i-winlen/2))*windows[i]
 8048a7d: d9 45 d4             flds   0xffffffd4(%ebp) f_FC_div_PI
 8048a80: dd 05 20 a6 04 08     fldl   0x804a620 M_PI
 8048a86: de c9                 fmulp  %st,%st(1) M_PI*f_FC_div_PI
 8048a88: d9 45 cc             flds   0xffffffcc(%ebp) i-winlen/2
 8048a8b: de c9                 fmulp  %st,%st(1) (i-winlen/2)*M_PI*f_FC_div_PI
 8048a8d: de f9                 fdivrp %st,%st(1) interleave_coef[i] = window[i] * sin(f_FC_div_PI*M_PI*(i-winlen/2))/((i-winlen/2)*M_PI*f_FC_div_PI);
 8048a8f: d9 1c 9d 00 c5 04 08 fstps  0x804c500(,%ebx,4) }
 8048a96: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048a99: ff 00                 incl   (%eax) i++;
 8048a9b: e9 4e ff ff ff       jmp    80489ee <calc_coef+0x25f> }//end for(i=0;i<winlen;)
 8048aa0: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp)   for(i=0;i<nphase;){
 8048aa7: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048aaa: 3b 45 ec             cmp    0xffffffec(%ebp),%eax
 8048aad: 0f 8d db 01 00 00     jge    8048c8e <calc_coef+0x4ff>
 8048ab3: b8 00 00 00 00       mov    $0x0,%eax
 8048ab8: 89 45 cc             mov    %eax,0xffffffcc(%ebp) =0;
 8048abb: c7 45 d8 00 00 00 00 movl   $0x0,0xffffffd8(%ebp) for(j=0;j<ntaps;){
 8048ac2: 8b 45 d8             mov    0xffffffd8(%ebp),%eax
 8048ac5: 3b 45 e8             cmp    0xffffffe8(%ebp),%eax
 8048ac8: 7d 35                 jge    8048aff <calc_coef+0x370>
 8048aca: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048acd: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048ad1: 89 c1                 mov    %eax,%ecx
 8048ad3: 03 4d d8             add    0xffffffd8(%ebp),%ecx ecx = i*phase_offset+j
 8048ad6: 8b 55 dc             mov    0xffffffdc(%ebp),%edx
 8048ad9: 8b 45 ec             mov    0xffffffec(%ebp),%eax
 8048adc: 29 d0                 sub    %edx,%eax
 8048ade: 89 c2                 mov    %eax,%edx edx = nphases-i
 8048ae0: 8b 45 ec             mov    0xffffffec(%ebp),%eax
 8048ae3: 0f af 45 d8           imul   0xffffffd8(%ebp),%eax eax = j*nphases;
 8048ae7: 8d 04 02             lea    (%edx,%eax,1),%eax eax = (nphases-i)+j*nphases;
 8048aea: 8b 04 85 00 c5 04 08 mov    0x804c500(,%eax,4),%eax
 8048af1: 89 04 8d a0 c5 04 08 mov    %eax,0x804c5a0(,%ecx,4) deinterleave_coef[j+i*phase_offset] = interleave_coef[nphases-i+j*nphases];
 8048af8: 8d 45 d8             lea    0xffffffd8(%ebp),%eax
 8048afb: ff 00                 incl   (%eax) j++;
 8048afd: eb c3                 jmp    8048ac2 <calc_coef+0x333> }
 8048aff: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048b02: ff 00                 incl   (%eax) i++;
 8048b04: eb a1                 jmp    8048aa7 <calc_coef+0x318>  }
 8048b06: 83 7d 10 01           cmpl   $0x1,0x10(%ebp) }else if(1==filtype){
 8048b0a: 0f 85 ca 00 00 00     jne    8048bda <calc_coef+0x44b>
 8048b10: c7 45 ec 08 00 00 00 movl   $0x8,0xffffffec(%ebp) nphases = 8;
 8048b17: c7 45 e8 04 00 00 00 movl   $0x4,0xffffffe8(%ebp) ntaps = 4;
 8048b1e: c7 45 e0 04 00 00 00 movl   $0x4,0xffffffe0(%ebp) phase_offset = 4;
 8048b25: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<nphases;i++){
 8048b2c: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048b2f: 3b 45 ec             cmp    0xffffffec(%ebp),%eax
 8048b32: 0f 8d 56 01 00 00     jge    8048c8e <calc_coef+0x4ff>
 8048b38: db 45 dc             fildl  0xffffffdc(%ebp)
 8048b3b: db 45 ec             fildl  0xffffffec(%ebp)
 8048b3e: de f9                 fdivrp %st,%st(1)
 8048b40: d9 5d cc             fstps  0xffffffcc(%ebp) i/nphases
 8048b43: 8b 45 e0             mov    0xffffffe0(%ebp),%eax eax = phase_offset
 8048b46: 89 c3                 mov    %eax,%ebx ebx = eax
 8048b48: 0f af 5d dc           imul   0xffffffdc(%ebp),%ebx ebx = phase_offset*i
 8048b4c: d9 45 cc             flds   0xffffffcc(%ebp)
 8048b4f: d9 e8                 fld1   
 8048b51: de c1                 faddp  %st,%st(1)
 8048b53: 8d 64 24 fc           lea    0xfffffffc(%esp),%esp
 8048b57: d9 1c 24             fstps  (%esp)
 8048b5a: e8 65 fb ff ff       call   80486c4 <bicubic_core>             bicubic_core(1+i/nphases)
 8048b5f: 83 c4 04             add    $0x4,%esp
 8048b62: d9 1c 9d a0 c5 04 08 fstps  0x804c5a0(,%ebx,4) deinterleave_coef[phase_offset*i] = bicubic_core(1+i/nphases);
 8048b69: 8b 45 e0             mov    0xffffffe0(%ebp),%eax eax = phase_offset
 8048b6c: 89 c3                 mov    %eax,%ebx ebx = eax
 8048b6e: 0f af 5d dc           imul   0xffffffdc(%ebp),%ebx ebx = phase_offset*i
 8048b72: ff 75 cc             pushl  0xffffffcc(%ebp)
 8048b75: e8 4a fb ff ff       call   80486c4 <bicubic_core>
 8048b7a: 83 c4 04             add    $0x4,%esp
 8048b7d: d9 1c 9d a4 c5 04 08 fstps  0x804c5a4(,%ebx,4) deinterleave_coef[phase_offset*i+1] = bicubic_core(i/nphases);
 8048b84: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048b87: 89 c3                 mov    %eax,%ebx
 8048b89: 0f af 5d dc           imul   0xffffffdc(%ebp),%ebx
 8048b8d: d9 e8                 fld1   
 8048b8f: d8 65 cc             fsubs  0xffffffcc(%ebp)
 8048b92: 8d 64 24 fc           lea    0xfffffffc(%esp),%esp
 8048b96: d9 1c 24             fstps  (%esp)
 8048b99: e8 26 fb ff ff       call   80486c4 <bicubic_core> deinterleave_coef[phase_offset*i+2] = bicubic_core(1-i/nphases);
 8048b9e: 83 c4 04             add    $0x4,%esp
 8048ba1: d9 1c 9d a8 c5 04 08 fstps  0x804c5a8(,%ebx,4)
 8048ba8: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048bab: 89 c3                 mov    %eax,%ebx
 8048bad: 0f af 5d dc           imul   0xffffffdc(%ebp),%ebx
 8048bb1: d9 05 28 a6 04 08     flds   0x804a628
 8048bb7: d8 65 cc             fsubs  0xffffffcc(%ebp)
 8048bba: 8d 64 24 fc           lea    0xfffffffc(%esp),%esp
 8048bbe: d9 1c 24             fstps  (%esp)
 8048bc1: e8 fe fa ff ff       call   80486c4 <bicubic_core>
 8048bc6: 83 c4 04             add    $0x4,%esp
 8048bc9: d9 1c 9d ac c5 04 08 fstps  0x804c5ac(,%ebx,4) deinterleave_coef[phase_offset*i+2] = bicubic_core(2-i/nphases);
 8048bd0: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048bd3: ff 00                 incl   (%eax) i++;
 8048bd5: e9 52 ff ff ff       jmp    8048b2c <calc_coef+0x39d> }
 8048bda: 83 7d 10 00           cmpl   $0x0,0x10(%ebp) }else if(0==filtype){
 8048bde: 0f 85 8a 00 00 00     jne    8048c6e <calc_coef+0x4df>
 8048be4: c7 45 ec 08 00 00 00 movl   $0x8,0xffffffec(%ebp) nphases=8;
 8048beb: c7 45 e8 04 00 00 00 movl   $0x4,0xffffffe8(%ebp) ntaps=4;
 8048bf2: c7 45 e0 04 00 00 00 movl   $0x4,0xffffffe0(%ebp) phase_offset=4;
 8048bf9: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<nphases;){
 8048c00: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048c03: 3b 45 ec             cmp    0xffffffec(%ebp),%eax
 8048c06: 0f 8d 82 00 00 00     jge    8048c8e <calc_coef+0x4ff>
 8048c0c: db 45 dc             fildl  0xffffffdc(%ebp)
 8048c0f: db 45 ec             fildl  0xffffffec(%ebp)
 8048c12: de f9                 fdivrp %st,%st(1)
 8048c14: d9 5d cc             fstps  0xffffffcc(%ebp)
 8048c17: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048c1a: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048c1e: d9 e8                 fld1   
 8048c20: d8 65 cc             fsubs  0xffffffcc(%ebp)
 8048c23: d9 1c 85 a0 c5 04 08 fstps  0x804c5a0(,%eax,4) deinterleave_coef[] = ;
 8048c2a: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048c2d: 89 c2                 mov    %eax,%edx
 8048c2f: 0f af 55 dc           imul   0xffffffdc(%ebp),%edx
 8048c33: 8b 45 cc             mov    0xffffffcc(%ebp),%eax
 8048c36: 89 04 95 a4 c5 04 08 mov    %eax,0x804c5a4(,%edx,4)
 8048c3d: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048c40: 89 c2                 mov    %eax,%edx
 8048c42: 0f af 55 dc           imul   0xffffffdc(%ebp),%edx
 8048c46: b8 00 00 00 00       mov    $0x0,%eax
 8048c4b: 89 04 95 a8 c5 04 08 mov    %eax,0x804c5a8(,%edx,4)
 8048c52: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048c55: 89 c2                 mov    %eax,%edx
 8048c57: 0f af 55 dc           imul   0xffffffdc(%ebp),%edx
 8048c5b: b8 00 00 00 00       mov    $0x0,%eax
 8048c60: 89 04 95 ac c5 04 08 mov    %eax,0x804c5ac(,%edx,4)
 8048c67: 8d 45 dc             lea    0xffffffdc(%ebp),%eax
 8048c6a: ff 00                 incl   (%eax) i++;
 8048c6c: eb 92                 jmp    8048c00 <calc_coef+0x471> }else{
 8048c6e: 83 ec 08             sub    $0x8,%esp
 8048c71: 68 d8 a5 04 08       push   $0x804a5d8 0x000025d8@calccoef.bin
 8048c76: ff 35 44 c4 04 08     pushl  0x804c444
 8048c7c: e8 db f8 ff ff       call   804855c <fprintf@plt> fprintf(,"invalid filter type.\n");
 8048c81: 83 c4 10             add    $0x10,%esp
 8048c84: 83 ec 0c             sub    $0xc,%esp
 8048c87: 6a ff                 push   $0xffffffff exit(-1);
 8048c89: e8 2e f9 ff ff       call   80485bc <exit@plt> }
 8048c8e: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<nphases;){
 8048c95: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048c98: 3b 45 ec             cmp    0xffffffec(%ebp),%eax
 8048c9b: 0f 8d b9 00 00 00     jge    8048d5a <calc_coef+0x5cb>
 8048ca1: b8 00 00 00 00       mov    $0x0,%eax
 8048ca6: 89 45 cc             mov    %eax,0xffffffcc(%ebp) tmp = 0;
 8048ca9: c7 45 d8 00 00 00 00 movl   $0x0,0xffffffd8(%ebp) for(j=0;j<ntaps;){
 8048cb0: 8b 45 d8             mov    0xffffffd8(%ebp),%eax j
 8048cb3: 3b 45 e8             cmp    0xffffffe8(%ebp),%eax j<ntaps
 8048cb6: 7d 1e                 jge    8048cd6 <calc_coef+0x547>
 8048cb8: 8b 45 e0             mov    0xffffffe0(%ebp),%eax phase_offset
 8048cbb: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax phase_offset*i
 8048cbf: 03 45 d8             add    0xffffffd8(%ebp),%eax phase_offset*i+j
 8048cc2: d9 45 cc             flds   0xffffffcc(%ebp)
 8048cc5: d8 04 85 a0 c5 04 08 fadds  0x804c5a0(,%eax,4)
 8048ccc: d9 5d cc             fstps  0xffffffcc(%ebp) tmp += deinterleave_coef[phase_offset*i+j];
 8048ccf: 8d 45 d8             lea    0xffffffd8(%ebp),%eax
 8048cd2: ff 00                 incl   (%eax) j++;
 8048cd4: eb da                 jmp    8048cb0 <calc_coef+0x521> }
 8048cd6: c7 45 d8 00 00 00 00 movl   $0x0,0xffffffd8(%ebp) for(j=0;j<ntaps;){
 8048cdd: 8b 45 d8             mov    0xffffffd8(%ebp),%eax
 8048ce0: 3b 45 e8             cmp    0xffffffe8(%ebp),%eax
 8048ce3: 7d 51                 jge    8048d36 <calc_coef+0x5a7>
 8048ce5: 8b 45 e0             mov    0xffffffe0(%ebp),%eax phase_offset
 8048ce8: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax phase_offset*i
 8048cec: 03 45 d8             add    0xffffffd8(%ebp),%eax phase_offset*i+j
 8048cef: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048cf2: 8b 4d 14             mov    0x14(%ebp),%ecx
 8048cf5: 8b 45 e0             mov    0xffffffe0(%ebp),%eax phase_offset
 8048cf8: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax phase_offset*i
 8048cfc: 03 45 d8             add    0xffffffd8(%ebp),%eax phase_offset*i+j
 8048cff: d9 04 85 a0 c5 04 08 flds   0x804c5a0(,%eax,4) deinterleave_coef[phase_offset*i+j]
 8048d06: d9 05 2c a6 04 08     flds   0x804a62c 256.0
 8048d0c: de c9                 fmulp  %st,%st(1) deinterleave_coef[phase_offset*i+j]*256
 8048d0e: d8 75 cc             fdivs  0xffffffcc(%ebp) deinterleave_coef[phase_offset*i+j]*256/tmp
 8048d11: dd 05 00 a6 04 08     fldl   0x804a600 0.5
 8048d17: de c1                 faddp  %st,%st(1)
 8048d19: d9 7d b2             fnstcw 0xffffffb2(%ebp)
 8048d1c: 66 8b 45 b2           mov    0xffffffb2(%ebp),%ax
 8048d20: b4 0c                 mov    $0xc,%ah
 8048d22: 66 89 45 b0           mov    %ax,0xffffffb0(%ebp)
 8048d26: d9 6d b0             fldcw  0xffffffb0(%ebp)
 8048d29: df 1c 0a             fistp  (%edx,%ecx,1) coef[phase_offset*i+j] = deinterleave_coef[phase_offset*i+j]*256/tmp+0.5;
 8048d2c: d9 6d b2             fldcw  0xffffffb2(%ebp)
 8048d2f: 8d 45 d8             lea    0xffffffd8(%ebp),%eax
 8048d32: ff 00                 incl   (%eax) j++;
 8048d34: eb a7                 jmp    8048cdd <calc_coef+0x54e> }
 8048d36: 83 7d e8 07           cmpl   $0x7,0xffffffe8(%ebp) if(7==ntaps){
 8048d3a: 75 14                 jne    8048d50 <calc_coef+0x5c1>
 8048d3c: 8b 45 e0             mov    0xffffffe0(%ebp),%eax phase_offset
 8048d3f: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax phase_offset*i
 8048d43: d1 e0                 shl    %eax
 8048d45: 03 45 14             add    0x14(%ebp),%eax
 8048d48: 83 c0 0e             add    $0xe,%eax
 8048d4b: 66 c7 00 00 00       movw   $0x0,(%eax) coef[phase_offset*i+7] = 0;
 8048d50: 8d 45 dc             lea    0xffffffdc(%ebp),%eax }
 8048d53: ff 00                 incl   (%eax) i++;
 8048d55: e9 3b ff ff ff       jmp    8048c95 <calc_coef+0x506> }
 8048d5a: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<nphases;){
 8048d61: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048d64: 3b 45 ec             cmp    0xffffffec(%ebp),%eax
 8048d67: 0f 8d 76 01 00 00     jge    8048ee3 <calc_coef+0x754>
 8048d6d: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048d70: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048d74: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048d77: 8b 45 14             mov    0x14(%ebp),%eax
 8048d7a: 0f bf 04 02           movswl (%edx,%eax,1),%eax
 8048d7e: 89 45 c8             mov    %eax,0xffffffc8(%ebp) max = coef[phase_offset*i]
 8048d81: c7 45 c4 00 00 00 00 movl   $0x0,0xffffffc4(%ebp) max2 = 0;
 8048d88: c7 45 c0 00 00 00 00 movl   $0x0,0xffffffc0(%ebp) index = 0;
 8048d8f: c7 45 bc 00 00 00 00 movl   $0x0,0xffffffbc(%ebp) index2 = 0;
 8048d96: 8b 45 c8             mov    0xffffffc8(%ebp),%eax
 8048d99: 89 45 b8             mov    %eax,0xffffffb8(%ebp) total_gain = max;
 8048d9c: c7 45 d8 01 00 00 00 movl   $0x1,0xffffffd8(%ebp) for(j=1;j<ntaps;){
 8048da3: 8b 45 d8             mov    0xffffffd8(%ebp),%eax
 8048da6: 3b 45 e8             cmp    0xffffffe8(%ebp),%eax
 8048da9: 0f 8d 83 00 00 00     jge    8048e32 <calc_coef+0x6a3>
 8048daf: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048db2: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048db6: 03 45 d8             add    0xffffffd8(%ebp),%eax
 8048db9: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048dbc: 8b 45 14             mov    0x14(%ebp),%eax
 8048dbf: 0f bf 14 02           movswl (%edx,%eax,1),%edx
 8048dc3: 8d 45 b8             lea    0xffffffb8(%ebp),%eax
 8048dc6: 01 10                 add    %edx,(%eax) total_gain += coef[phase_offset*i+j];
 8048dc8: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048dcb: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048dcf: 03 45 d8             add    0xffffffd8(%ebp),%eax
 8048dd2: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048dd5: 8b 45 14             mov    0x14(%ebp),%eax
 8048dd8: 0f bf 04 02           movswl (%edx,%eax,1),%eax
 8048ddc: 89 45 84             mov    %eax,0xffffff84(%ebp)
 8048ddf: 83 7d 84 00           cmpl   $0x0,0xffffff84(%ebp)
 8048de3: 79 03                 jns    8048de8 <calc_coef+0x659>
 8048de5: f7 5d 84             negl   0xffffff84(%ebp)
 8048de8: 8b 45 84             mov    0xffffff84(%ebp),%eax
 8048deb: 3b 45 c8             cmp    0xffffffc8(%ebp),%eax if(max <= abs(coef[phase_offset*i+j])){
 8048dee: 7c 38                 jl     8048e28 <calc_coef+0x699>
 8048df0: 8b 45 c8             mov    0xffffffc8(%ebp),%eax
 8048df3: 89 45 c4             mov    %eax,0xffffffc4(%ebp) max2 = max;
 8048df6: 8b 45 c0             mov    0xffffffc0(%ebp),%eax
 8048df9: 89 45 bc             mov    %eax,0xffffffbc(%ebp) index2 = index;
 8048dfc: 8b 45 d8             mov    0xffffffd8(%ebp),%eax
 8048dff: 89 45 c0             mov    %eax,0xffffffc0(%ebp) index = j;
 8048e02: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048e05: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048e09: 03 45 d8             add    0xffffffd8(%ebp),%eax
 8048e0c: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048e0f: 8b 45 14             mov    0x14(%ebp),%eax
 8048e12: 0f bf 04 02           movswl (%edx,%eax,1),%eax
 8048e16: 89 45 80             mov    %eax,0xffffff80(%ebp)
 8048e19: 83 7d 80 00           cmpl   $0x0,0xffffff80(%ebp)
 8048e1d: 79 03                 jns    8048e22 <calc_coef+0x693>
 8048e1f: f7 5d 80             negl   0xffffff80(%ebp)
 8048e22: 8b 45 80             mov    0xffffff80(%ebp),%eax
 8048e25: 89 45 c8             mov    %eax,0xffffffc8(%ebp) max = abs(coef[phase_offset*i+j]);
 8048e28: 8d 45 d8             lea    0xffffffd8(%ebp),%eax }
 8048e2b: ff 00                 incl   (%eax) j++;
 8048e2d: e9 71 ff ff ff       jmp    8048da3 <calc_coef+0x614> }
 8048e32: b8 00 01 00 00       mov    $0x100,%eax
 8048e37: 2b 45 b8             sub    0xffffffb8(%ebp),%eax
 8048e3a: 89 45 b4             mov    %eax,0xffffffb4(%ebp)       delta = 256-total_gain;
 8048e3d: 8b 55 c4             mov    0xffffffc4(%ebp),%edx
 8048e40: 8b 45 c8             mov    0xffffffc8(%ebp),%eax
 8048e43: 29 d0                 sub    %edx,%eax
 8048e45: 83 f8 09             cmp    $0x9,%eax
 8048e48: 7f 64                 jg     8048eae <calc_coef+0x71f> if(max-max2<9){
 8048e4a: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048e4d: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048e51: 03 45 bc             add    0xffffffbc(%ebp),%eax
 8048e54: 8d 34 00             lea    (%eax,%eax,1),%esi
 8048e57: 8b 5d 14             mov    0x14(%ebp),%ebx
 8048e5a: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048e5d: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048e61: 03 45 bc             add    0xffffffbc(%ebp),%eax
 8048e64: 8d 0c 00             lea    (%eax,%eax,1),%ecx
 8048e67: 8b 55 14             mov    0x14(%ebp),%edx
 8048e6a: 8b 45 b4             mov    0xffffffb4(%ebp),%eax
 8048e6d: d1 f8                 sar    %eax delta/2
 8048e6f: 66 03 04 11           add    (%ecx,%edx,1),%ax coef[phase_offset*i+t4] += delta/2;
 8048e73: 66 89 04 1e           mov    %ax,(%esi,%ebx,1)
 8048e77: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048e7a: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048e7e: 03 45 c0             add    0xffffffc0(%ebp),%eax
 8048e81: 8d 34 00             lea    (%eax,%eax,1),%esi
 8048e84: 8b 7d 14             mov    0x14(%ebp),%edi
 8048e87: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048e8a: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048e8e: 03 45 c0             add    0xffffffc0(%ebp),%eax
 8048e91: 8d 1c 00             lea    (%eax,%eax,1),%ebx
 8048e94: 8b 4d 14             mov    0x14(%ebp),%ecx
 8048e97: 8b 55 b4             mov    0xffffffb4(%ebp),%edx
 8048e9a: 8b 45 b4             mov    0xffffffb4(%ebp),%eax
 8048e9d: d1 f8                 sar    %eax
 8048e9f: 66 29 c2             sub    %ax,%dx t7-t7/2
 8048ea2: 89 d0                 mov    %edx,%eax
 8048ea4: 66 03 04 0b           add    (%ebx,%ecx,1),%ax coef[phase_offset*i+t3] += delta-delta/2;
 8048ea8: 66 89 04 3e           mov    %ax,(%esi,%edi,1)
 8048eac: eb 2b                 jmp    8048ed9 <calc_coef+0x74a> }else{
 8048eae: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048eb1: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048eb5: 03 45 c0             add    0xffffffc0(%ebp),%eax
 8048eb8: 8d 1c 00             lea    (%eax,%eax,1),%ebx
 8048ebb: 8b 75 14             mov    0x14(%ebp),%esi
 8048ebe: 8b 45 e0             mov    0xffffffe0(%ebp),%eax
 8048ec1: 0f af 45 dc           imul   0xffffffdc(%ebp),%eax
 8048ec5: 03 45 c0             add    0xffffffc0(%ebp),%eax
 8048ec8: 8d 0c 00             lea    (%eax,%eax,1),%ecx
 8048ecb: 8b 55 14             mov    0x14(%ebp),%edx
 8048ece: 8b 45 b4             mov    0xffffffb4(%ebp),%eax
 8048ed1: 66 03 04 11           add    (%ecx,%edx,1),%ax
 8048ed5: 66 89 04 33           mov    %ax,(%ebx,%esi,1)                coef[phase_offset*i+t3] += delta;
 8048ed9: 8d 45 dc             lea    0xffffffdc(%ebp),%eax }//end if
 8048edc: ff 00                 incl   (%eax) i++;
 8048ede: e9 7e fe ff ff       jmp    8048d61 <calc_coef+0x5d2>      }
 8048ee3: 81 7d 08 00 01 00 00 cmpl   $0x100,0x8(%ebp) if(256==rsz){
 8048eea: 75 5a                 jne    8048f46 <calc_coef+0x7b7>
 8048eec: c7 45 dc 00 00 00 00 movl   $0x0,0xffffffdc(%ebp) for(i=0;i<nphase*ntaps;){
 8048ef3: 8b 45 ec             mov    0xffffffec(%ebp),%eax
 8048ef6: 0f af 45 e8           imul   0xffffffe8(%ebp),%eax
 8048efa: 3b 45 dc             cmp    0xffffffdc(%ebp),%eax
 8048efd: 7e 47                 jle    8048f46 <calc_coef+0x7b7>
 8048eff: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048f02: 8d 14 00             lea    (%eax,%eax,1),%edx
 8048f05: 8b 45 14             mov    0x14(%ebp),%eax
 8048f08: 66 c7 04 02 00 01     movw   $0x100,(%edx,%eax,1) coef[i] = 256;
 8048f0e: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048f11: d1 e0                 shl    %eax
 8048f13: 03 45 14             add    0x14(%ebp),%eax
 8048f16: 8d 48 02             lea    0x2(%eax),%ecx &coef[i+1] = 0
 8048f19: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048f1c: d1 e0                 shl    %eax
 8048f1e: 03 45 14             add    0x14(%ebp),%eax
 8048f21: 8d 50 04             lea    0x4(%eax),%edx &coef[i+2] = 0
 8048f24: 8b 45 dc             mov    0xffffffdc(%ebp),%eax
 8048f27: d1 e0                 shl    %eax
 8048f29: 03 45 14             add    0x14(%ebp),%eax
 8048f2c: 83 c0 06             add    $0x6,%eax &coef[i+3] = 0;
 8048f2f: 66 c7 00 00 00       movw   $0x0,(%eax)
 8048f34: 66 c7 02 00 00       movw   $0x0,(%edx)
 8048f39: 66 c7 01 00 00       movw   $0x0,(%ecx)
 8048f3e: 8d 45 dc             lea    0xffffffdc(%ebp),%eax             i+=4;
 8048f41: 83 00 04             addl   $0x4,(%eax)  }
 8048f44: eb ad                 jmp    8048ef3 <calc_coef+0x764> }
 8048f46: 8d 65 f4             lea    0xfffffff4(%ebp),%esp return;
 8048f49: 5b                   pop    %ebx
 8048f4a: 5e                   pop    %esi
 8048f4b: 5f                   pop    %edi
 8048f4c: c9                   leave  

 8048f4d: c3                   ret    


/**
 * 
 * dasm from davinci resizer utility calccoef
 * create by z20091022@w.9.259.w3.w.h.z.c
 * V0.1 z200910261913@w.9.259.w3.w.h.z.c
 * 
 */


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>


#define DEBUG_COEF
#define ASIZEOF(x) (sizeof(x)/sizeof(x[0]))


const char filtypestring[3][10]=
{
    "BILINEAR",
    "BICUBIC",
    "LOWPASS"
};


const char wintypestring[6][12]=
{
    "HANN",
    "BLACKMAN",
    "TRANGULAR",
    "RECTANGULAR",
    "CUSTOM"
};


static float deinterleave_coef[32];
static float interleave_coef[33];
static const struct option long_options[20]={
    {"help",0,0,'h'},
    {"insize",1,0,'i'},
    {"outsize",1,0,'o'},
    {"rsz",1,0,'r'},
    {"sph",1,0,'j'},
    {"spv",1,0,'k'},
    {"horz_filter",1,0,'z'},
    {"vert_filter",1,0,'f'},
    {"window",1,0,'w'},
    {"filename",1,0,'n'},
    {"print_param",0,0,'p'},
    {"in_pitch",1,0,'s'},
    {"out_pitch",1,0,'y'},
    {"hstart",1,0,'t'},
    {"vstart",1,0,'v'},
    {"cbilin",0,0,'c'},
    {"grayscale",0,0,'g'},
    {"pixel_format",1,0,'x'},
    {"no_array",0,0,'a'},
    {NULL,0,0,0},
};
static const char pix_fmt_strings[2][20]={"RSZ_PIX_FMT_YUYV","RSZ_PIX_FMT_UYVY"};
static const char short_options[34]="hi:o:r:j:k:w:z:f:m:ps:y:t:v:cgx:a";
static float windows[33];


typedef enum
{
    WTYPE_HANN=0,
    WTYPE_BLACKMAN,
    WTYPE_TRANGULAR,
    WTYPE_RECTANGULAR,
    WTYPE_CUSTOM
}WIN_TYPE;


typedef enum
{
    FTYPE_BILINEAR,
    FTYPE_BICUBIC,
    FTYPE_LOWPASS
}FILTER_TYPE;


const float mul = 256.0f;
const double d_4PI = 4*M_PI;


WIN_TYPE str2win_type(const char *str)
{
    int i = 0;
    for (i=0;i<ASIZEOF(wintypestring);i++)
    {
        if (0==strcmp(str, wintypestring[i]))
        {
            return(WIN_TYPE)i;
        }
    }
    return WTYPE_BLACKMAN;
}


FILTER_TYPE str2filt_type(const char *str)
{
    int i = 0;
    for (i=0;i<ASIZEOF(filtypestring);i++)
    {
        if (0==strcmp(str, filtypestring[i]))
        {
            return(FILTER_TYPE)i;
        }
    }
    return FTYPE_LOWPASS;
}


float bicubic_core(float s)
{
    /*200910261900*/
    float w;
    float u;


    if (s<0) w = -s;
    else w = s;


    if ( 0. <= w && w <= 1. )
        u = 3./2.*w*w*w-5./2.*w*w+1.;
    else if ( w <= 2. )
        u = -1./2.*w*w*w+5./2.*w*w-4.*w+2.;
    else
        u = 0.;


    return u;
}


/*


|           |
|-----------|
| local var |
|-----------|
| ....      |
|-----------|
| arg1      | 0x0000000c(%ebp)
|-----------|
| arg0      | 0x00000008(%ebp)
|-----------|
| ret addr  | 0x00000004(%ebp)
|-----------|
| ori ebp   | (%ebp)
|-----------|
| edi       | 0xfffffffc(%ebp)
|-----------|
| esi       | 0xfffffff8(%ebp)
|-----------|
| ebx       | 0xfffffff4(%ebp)
|-----------|
|           | 0xfffffff0(%ebp)
|-----------|
| local var | 0xffffffec(%ebp)
|-----------|
| ...       |
|-----------|
| local var | (%esp)
|-----------|


*/
int calc_coef(int rsz, WIN_TYPE wintype, FILTER_TYPE filtype, short coef[32], float custom_win[32])
{
    int nphases;/*0xffffffec(%ebp)*/
    int ntaps;
    int winlen;
    int phase_offset;


    int i;/*0xffffffdc(%ebp)*/
    int j;
    float fc;


    if (rsz>512)
    {
        /*1/4x-1/2x*/
        nphases = 4;
        ntaps = 7;
        phase_offset = 8;
    }
    else
    {
        /*1/2x-4x*/
        nphases = 8;
        ntaps = 4;
        phase_offset = 4;
    }


    winlen = nphases*ntaps;
    if (rsz<=255)
    {
        fc = 1.0/nphases;/*up-sampling*/
    }
    else
    {
        fc = ((double)256.0f)/(rsz*nphases);/*down-sampling*/
    }


    if (WTYPE_TRANGULAR==wintype)
    {
        for (i=0;i<(winlen+1);i++)
        {
            if (i<=winlen/2)
            {
                windows[i] = winlen-i;
            }
            else
            {
                windows[i] = winlen;
            }
        }
    }
    else if (wintype<WTYPE_TRANGULAR)
    {
        if (WTYPE_HANN==wintype)
        {
            for (i=0;i<(winlen+1);i++)
            {
                windows[i] = 0.5-0.5*cos((i*2*M_PI)/winlen);
            }
        }
        else
        {
            for (i = 0;i<(winlen+1);i++)
            {
                windows[i] = 0.42-0.5*cos(i*2*M_PI/winlen)+0.08*cos((i*4*M_PI)/winlen);
            }
        }
    }
    else
    {
        if (WTYPE_RECTANGULAR==wintype)
        {
            for (i=0;i<(winlen+1);i++)
            {
                windows[i] = i;
            }
        }
        else
        {
            for (i=0;i<(winlen+1);i++)
            {
                windows[i] = custom_win[i];
            }
        }
    }


    if (FTYPE_LOWPASS==filtype)//LOW_PASS 2
    {
        for (i=0;i<(winlen+1);i++)
        {
            if (i==winlen/2)
            {
                interleave_coef[i] = windows[i];
            }
            else
            {
                interleave_coef[i] = windows[i] * sin(fc*M_PI*(i-winlen/2))/((i-winlen/2)*fc*M_PI);
            }
        }




        for (i=0;i<nphases;i++)
        {
            for (j=0;j<ntaps;j++)
            {
                deinterleave_coef[i*phase_offset+j] = interleave_coef[nphases-i+j*nphases];
            }
        }
    }
    else if (FTYPE_BILINEAR==filtype)
    {
        nphases = 8;
        ntaps = 4;
        phase_offset = 4;
        for (i=0;i<nphases;i++)
        {
            deinterleave_coef[phase_offset*i] = 1-(float)i/nphases;
            deinterleave_coef[phase_offset*i+1] = (float)i/nphases;
            deinterleave_coef[phase_offset*i+2] = 0.;
            deinterleave_coef[phase_offset*i+3] = 0.;
        }
    }
    else if (FTYPE_BICUBIC==filtype)
    {
        nphases = 8;
        ntaps = 4;
        phase_offset = 4;
        for (i=0;i<nphases;i++)
        {
            deinterleave_coef[phase_offset*i] = bicubic_core(1.+(float)i/nphases);
            deinterleave_coef[phase_offset*i+1] = bicubic_core((float)i/nphases);
            deinterleave_coef[phase_offset*i+2] = bicubic_core(1.-(float)i/nphases);
            deinterleave_coef[phase_offset*i+3] = bicubic_core(2.-(float)i/nphases);
        }
    }
    else
    {
        fprintf(stdout, "invalid filter type\n");
        exit(-1);
    }


#ifdef DEBUG_COEF
    printf("windows:\n");
    for (i=0;i<(winlen+1);i++)
    {
        printf("\t%.20f", windows[i]);
        if (3==(i&0x3)) printf("\n");
    }
    printf("\n");


    printf("interleave_coef:\n");
    for (i=0;i<(winlen+1);i++)
    {
        printf("\t%.20f", interleave_coef[i]);
        if (3==(i&0x3)) printf("\n");
    }
    printf("\n");


    printf("deinterleave_coef:\n");
    for (i=0;i<(winlen+1);i++)
    {
        printf("\t%.20f", deinterleave_coef[i]);
        if (3==(i&0x3)) printf("\n");
    }
    printf("\n");
#endif


    /*8048c8e*/
    for (i=0;i<nphases;i++)
    {
        float gain;/*0xffffffcc(%ebp)*/
        gain = 0;
        for (j=0;j<ntaps;j++)
        {
            gain += deinterleave_coef[phase_offset*i+j];
        }


        for (j=0;j<ntaps;j++)
        {
            coef[phase_offset*i+j] = deinterleave_coef[phase_offset*i+j]/gain*256.0+0.5;
        }
        if (7==ntaps)
        {
            coef[phase_offset*i+7] = 0;
        }
    }


    /*8048d5a*/
    /*200910251956?*/
    /*200910261715*/
    for (i=0;i<nphases;i++)
    {
        int max;/*0xffffffc8(%ebp)*/
        int max2;/*0xffffffc4(%ebp)*/
        int index;/*0xffffffc0(%ebp)*/
        int index2;/*0xffffffbc(%ebp)*/
        int total_gain;/*0xffffffb8(%ebp)*/
        int delta=0;/*0xffffffb4(%ebp)*/


        max = coef[phase_offset*i];
        max2 = 0;
        index = 0;
        index2 = 0;
        total_gain = coef[phase_offset*i];
        for (j=1;j<ntaps;j++)
        {
            total_gain += coef[phase_offset*i+j];
            if (max <= abs(coef[phase_offset*i+j]))
            {
                max2 = max;     
                index2 = index;
                index = j;
                max = abs(coef[phase_offset*i+j]);
            }
        }


        delta = 256-total_gain;
        if (max-max2<9)
        {
            coef[phase_offset*i+index2] += delta/2;
            coef[phase_offset*i+index] += delta-delta/2;
        }
        else
        {
            coef[phase_offset*i+index] += delta;    
        }
    }


    /*8048ee3*/
    if (256==rsz)
    {
        for (i=0;i<nphases*ntaps;i+=4)
        {
            coef[i] = 256;
            coef[i+1] = 0;
            coef[i+2] = 0;
            coef[i+3] = 0;
        }
    }


    return 0;
}


int usage(char *name)
{
    printf("Usage: %s [options]\n\
\n\
Options:\n\
-h | --help Print  this message\n\
-i | --insize input  image size(eg. 720x240, -1 for ignore)\n\
-o | --outsize output image size(eg. 352x288)\n\
-r | --rsz resizing factor: hrsz x vrsz(eg. 512x512, -1 for ignore)\n"
           ,name);
    return 0;
}


int main(int argc, char *argv[])
{
    int in_hsize;
    int in_vsize;
    int out_hsize;
    int out_vsize;


    int hrsz = 256;
    int vrsz = 256;
    int sph = 0;
    int spv = 0;
    int win_type = WTYPE_BLACKMAN;
    int h_filt_type = FTYPE_LOWPASS;
    int v_filt_type = FTYPE_LOWPASS;


    int i;
    float cust_win[32];
    char filename[128];
    FILE *custfp = NULL;


    short v_coef[32];
    short h_coef[32];
    int calculated;
    int output_params;


    int in_pitch = 0;
    int out_pitch = 0;
    int hstart = 0;
    int vstart = 0;
    int cbilin = 0;
    int in_type = 0;
    int pix_fmt = 0;
    int no_array =0;
    int count = 0;


    while (-1!=(i = getopt_long(argc, argv, short_options, long_options, NULL)))
    {
        switch (i)
        {
        case 'h':
            return usage(argv[0]);
        case 'i':
            sscanf(optarg, "%dx%d", &in_hsize, &in_vsize);
            break;
        case 'o':
            sscanf(optarg, "%dx%d", &out_hsize, &out_vsize);
            break;
        case 'r':
            sscanf(optarg, "%dx%d", &hrsz, &vrsz);
            break;
        case 'z':
            h_filt_type = str2filt_type(optarg);
            break;
        case 'f':
            v_filt_type = str2filt_type(optarg);
            break;
        case 'w':
            win_type = str2win_type(optarg);
            break;
        default:
            break;
        }
    }


    printf("   win_type: %d\n", win_type);
    printf("h_filt_type: %d\n", h_filt_type);
    printf("v_filt_type: %d\n", v_filt_type);
    printf("       hrsz: %d\n", hrsz);
    printf("       vrsz: %d\n", vrsz);


    calc_coef(hrsz, win_type, h_filt_type, h_coef, cust_win);
    printf("const short horz_coefs[] =\n");
    printf("{\n");
    for (i=0;i<32;i++)
    {
        printf("\t%d,\n", h_coef[i]);
    }
    printf("}\n");


    calc_coef(vrsz, win_type, v_filt_type, v_coef, cust_win);
    printf("const short vert_coefs[] =\n");
    printf("{\n");
    for (i=0;i<32;i++)
    {
        printf("\t%d,\n", v_coef[i]);
    }
    printf("}\n");
    return 0;
}


# define M_PI 3.14159265358979323846 /* pi */


struct option
{
  const char *name;
  int has_arg;
  int *flag;
  int val;
};


0x804a5F0 double 256.0
0x804a5F8 double 6.28318530717958623200 = 2*M_PI
0x804a600 double 0.5
0x804a608 double 0.42
0x804a610 double 12.56637061435917246399 = 4*M_PI
0x804a618 double 0.08000000000000000167
0x804a620 double 3.1415926535897931 = M_PI
0x804a628 float 2.0
0x804a62c float 256.0




0x804c5a0 static float deinterleave_coef[32];
0x804c500 static float interleave_coef[33];
0x804a400 static const struct option long_options[20];
0x804aae0 static const char pix_fmt_strings[2][20];
0x804a340 static const char short_options[34];
0x804c460 static float windows[33];

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值