⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snow.c

📁 tcpmp播放器的flv插件
💻 C
📖 第 1 页 / 共 5 页
字号:
#define W_BS 12#define W_CM 113#define W_CO 64#define W_CS 7#define W_DM 227#define W_DO 128#define W_DS 9#endifstatic void horizontal_decompose97i(DWTELEM *b, int width){    DWTELEM temp[width];    const int w2= (width+1)>>1;    lift (temp+w2, b    +1, b      , 1, 2, 2, width, -W_AM, W_AO, W_AS, 1, 0);    liftS(temp   , b      , temp+w2, 1, 2, 1, width, -W_BM, W_BO, W_BS, 0, 0);    lift5(b   +w2, temp+w2, temp   , 1, 1, 1, width,  W_CM, W_CO, W_CS, 1, 0);    lift (b      , temp   , b   +w2, 1, 1, 1, width,  W_DM, W_DO, W_DS, 0, 0);}static void vertical_decompose97iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] -= (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;    }}static void vertical_decompose97iH1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){#ifdef lift5        b1[i] += (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;#else        int r= 3*(b0[i] + b2[i]);        r+= r>>4;        r+= r>>8;        b1[i] += (r+W_CO)>>W_CS;#endif    }}static void vertical_decompose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){#ifdef liftS        b1[i] -= (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;#else        b1[i] = (16*4*b1[i] - 4*(b0[i] + b2[i]) + 8*5 + (5<<27)) / (5*16) - (1<<23);#endif    }}static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] += (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;    }}static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int stride){    int y;    DWTELEM *b0= buffer + mirror(-4-1, height-1)*stride;    DWTELEM *b1= buffer + mirror(-4  , height-1)*stride;    DWTELEM *b2= buffer + mirror(-4+1, height-1)*stride;    DWTELEM *b3= buffer + mirror(-4+2, height-1)*stride;      for(y=-4; y<height; y+=2){        DWTELEM *b4= buffer + mirror(y+3, height-1)*stride;        DWTELEM *b5= buffer + mirror(y+4, height-1)*stride;{START_TIMER        if(b3 <= b5)     horizontal_decompose97i(b4, width);        if(y+4 < height) horizontal_decompose97i(b5, width);if(width>400){STOP_TIMER("horizontal_decompose97i")}}        {START_TIMER        if(b3 <= b5) vertical_decompose97iH0(b3, b4, b5, width);        if(b2 <= b4) vertical_decompose97iL0(b2, b3, b4, width);        if(b1 <= b3) vertical_decompose97iH1(b1, b2, b3, width);        if(b0 <= b2) vertical_decompose97iL1(b0, b1, b2, width);if(width>400){STOP_TIMER("vertical_decompose97i")}}                b0=b2;        b1=b3;        b2=b4;        b3=b5;    }}void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){    int level;        for(level=0; level<decomposition_count; level++){        switch(type){        case 0: spatial_decompose97i(buffer, width>>level, height>>level, stride<<level); break;        case 1: spatial_decompose53i(buffer, width>>level, height>>level, stride<<level); break;        case 2: spatial_decomposeX  (buffer, width>>level, height>>level, stride<<level); break;        }    }}static void horizontal_compose53i(DWTELEM *b, int width){    DWTELEM temp[width];    const int width2= width>>1;    const int w2= (width+1)>>1;    int A1,A2,A3,A4, x;#if 0    A2= temp[1       ];    A4= temp[0       ];    A1= temp[0+width2];    A1 -= (A2 + A4)>>1;    A4 += (A1 + 1)>>1;    b[0+width2] = A1;    b[0       ] = A4;    for(x=1; x+1<width2; x+=2){        A3= temp[x+width2];        A4= temp[x+1     ];        A3 -= (A2 + A4)>>1;        A2 += (A1 + A3 + 2)>>2;        b[x+width2] = A3;        b[x       ] = A2;        A1= temp[x+1+width2];        A2= temp[x+2       ];        A1 -= (A2 + A4)>>1;        A4 += (A1 + A3 + 2)>>2;        b[x+1+width2] = A1;        b[x+1       ] = A4;    }    A3= temp[width-1];    A3 -= A2;    A2 += (A1 + A3 + 2)>>2;    b[width -1] = A3;    b[width2-1] = A2;#else       lift(temp   , b   , b+w2, 1, 1, 1, width,  1, 2, 2, 0, 1);    lift(temp+w2, b+w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 1);#endif    for(x=0; x<width2; x++){        b[2*x    ]= temp[x   ];        b[2*x + 1]= temp[x+w2];    }    if(width&1)        b[2*x    ]= temp[x   ];}static void vertical_compose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] += (b0[i] + b2[i])>>1;    }}static void vertical_compose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] -= (b0[i] + b2[i] + 2)>>2;    }}static void spatial_compose53i_buffered_init(dwt_compose_t *cs, slice_buffer * sb, int height, int stride_line){    cs->b0 = slice_buffer_get_line(sb, mirror(-1-1, height-1) * stride_line);    cs->b1 = slice_buffer_get_line(sb, mirror(-1  , height-1) * stride_line);    cs->y = -1;}static void spatial_compose53i_init(dwt_compose_t *cs, DWTELEM *buffer, int height, int stride){    cs->b0 = buffer + mirror(-1-1, height-1)*stride;    cs->b1 = buffer + mirror(-1  , height-1)*stride;    cs->y = -1;}static void spatial_compose53i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb, int width, int height, int stride_line){    int y= cs->y;    int mirror0 = mirror(y-1, height-1);    int mirror1 = mirror(y  , height-1);    int mirror2 = mirror(y+1, height-1);    int mirror3 = mirror(y+2, height-1);        DWTELEM *b0= cs->b0;    DWTELEM *b1= cs->b1;    DWTELEM *b2= slice_buffer_get_line(sb, mirror2 * stride_line);    DWTELEM *b3= slice_buffer_get_line(sb, mirror3 * stride_line);{START_TIMER        if(mirror1 <= mirror3) vertical_compose53iL0(b1, b2, b3, width);        if(mirror0 <= mirror2) vertical_compose53iH0(b0, b1, b2, width);STOP_TIMER("vertical_compose53i*")}{START_TIMER        if(y-1 >= 0) horizontal_compose53i(b0, width);        if(mirror0 <= mirror2) horizontal_compose53i(b1, width);STOP_TIMER("horizontal_compose53i")}    cs->b0 = b2;    cs->b1 = b3;    cs->y += 2;}static void spatial_compose53i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride){    int y= cs->y;    DWTELEM *b0= cs->b0;    DWTELEM *b1= cs->b1;    DWTELEM *b2= buffer + mirror(y+1, height-1)*stride;    DWTELEM *b3= buffer + mirror(y+2, height-1)*stride;{START_TIMER        if(b1 <= b3) vertical_compose53iL0(b1, b2, b3, width);        if(b0 <= b2) vertical_compose53iH0(b0, b1, b2, width);STOP_TIMER("vertical_compose53i*")}{START_TIMER        if(y-1 >= 0) horizontal_compose53i(b0, width);        if(b0 <= b2) horizontal_compose53i(b1, width);STOP_TIMER("horizontal_compose53i")}    cs->b0 = b2;    cs->b1 = b3;    cs->y += 2;}static void spatial_compose53i(DWTELEM *buffer, int width, int height, int stride){    dwt_compose_t cs;    spatial_compose53i_init(&cs, buffer, height, stride);    while(cs.y <= height)        spatial_compose53i_dy(&cs, buffer, width, height, stride);}    static void horizontal_compose97i(DWTELEM *b, int width){    DWTELEM temp[width];    const int w2= (width+1)>>1;    lift (temp   , b      , b   +w2, 1, 1, 1, width,  W_DM, W_DO, W_DS, 0, 1);    lift5(temp+w2, b   +w2, temp   , 1, 1, 1, width,  W_CM, W_CO, W_CS, 1, 1);    liftS(b      , temp   , temp+w2, 2, 1, 1, width, -W_BM, W_BO, W_BS, 0, 1);    lift (b+1    , temp+w2, b      , 2, 1, 2, width, -W_AM, W_AO, W_AS, 1, 1);}static void vertical_compose97iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;    }}static void vertical_compose97iH1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){#ifdef lift5        b1[i] -= (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;#else        int r= 3*(b0[i] + b2[i]);        r+= r>>4;        r+= r>>8;        b1[i] -= (r+W_CO)>>W_CS;#endif    }}static void vertical_compose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){#ifdef liftS        b1[i] += (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;#else        b1[i] += (W_BM*(b0[i] + b2[i])+4*b1[i]+W_BO)>>W_BS;#endif    }}static void vertical_compose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){    int i;        for(i=0; i<width; i++){        b1[i] -= (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;    }}static void vertical_compose97i(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){    int i;        for(i=0; i<width; i++){        int r;        b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;#ifdef lift5        b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;#else        r= 3*(b2[i] + b4[i]);        r+= r>>4;        r+= r>>8;        b3[i] -= (r+W_CO)>>W_CS;#endif#ifdef liftS        b2[i] += (W_BM*(b1[i] + b3[i])+W_BO)>>W_BS;#else        b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;#endif        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;    }}static void spatial_compose97i_buffered_init(dwt_compose_t *cs, slice_buffer * sb, int height, int stride_line){    cs->b0 = slice_buffer_get_line(sb, mirror(-3-1, height-1) * stride_line);    cs->b1 = slice_buffer_get_line(sb, mirror(-3  , height-1) * stride_line);    cs->b2 = slice_buffer_get_line(sb, mirror(-3+1, height-1) * stride_line);    cs->b3 = slice_buffer_get_line(sb, mirror(-3+2, height-1) * stride_line);    cs->y = -3;}static void spatial_compose97i_init(dwt_compose_t *cs, DWTELEM *buffer, int height, int stride){    cs->b0 = buffer + mirror(-3-1, height-1)*stride;    cs->b1 = buffer + mirror(-3  , height-1)*stride;    cs->b2 = buffer + mirror(-3+1, height-1)*stride;    cs->b3 = buffer + mirror(-3+2, height-1)*stride;    cs->y = -3;}static void spatial_compose97i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb, int width, int height, int stride_line){    int y = cs->y;        int mirror0 = mirror(y - 1, height - 1);    int mirror1 = mirror(y + 0, height - 1);    int mirror2 = mirror(y + 1, height - 1);    int mirror3 = mirror(y + 2, height - 1);    int mirror4 = mirror(y + 3, height - 1);    int mirror5 = mirror(y + 4, height - 1);    DWTELEM *b0= cs->b0;    DWTELEM *b1= cs->b1;    DWTELEM *b2= cs->b2;    DWTELEM *b3= cs->b3;    DWTELEM *b4= slice_buffer_get_line(sb, mirror4 * stride_line);    DWTELEM *b5= slice_buffer_get_line(sb, mirror5 * stride_line);        {START_TIMER    if(y>0 && y+4<height){        vertical_compose97i(b0, b1, b2, b3, b4, b5, width);    }else{        if(mirror3 <= mirror5) vertical_compose97iL1(b3, b4, b5, width);        if(mirror2 <= mirror4) vertical_compose97iH1(b2, b3, b4, width);        if(mirror1 <= mirror3) vertical_compose97iL0(b1, b2, b3, width);        if(mirror0 <= mirror2) vertical_compose97iH0(b0, b1, b2, width);    }if(width>400){STOP_TIMER("vertical_compose97i")}}{START_TIMER        if(y-1>=  0) horizontal_compose97i(b0, width);        if(mirror0 <= mirror2) horizontal_compose97i(b1, width);if(width>400 && mirror0 <= mirror2){STOP_TIMER("horizontal_compose97i")}}    cs->b0=b2;    cs->b1=b3;    cs->b2=b4;    cs->b3=b5;    cs->y += 2;}static void spatial_compose97i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride){    int y = cs->y;    DWTELEM *b0= cs->b0;    DWTELEM *b1= cs->b1;    DWTELEM *b2= cs->b2;    DWTELEM *b3= cs->b3;    DWTELEM *b4= buffer + mirror(y+3, height-1)*stride;    DWTELEM *b5= buffer + mirror(y+4, height-1)*stride;        if(stride == width && y+4 < height && 0){ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -