comparison snow.c @ 2194:d29037435955 libavcodec

11% faster decode_subband()
author michael
date Fri, 27 Aug 2004 20:33:16 +0000
parents ea7715935e55
children df3079d7806f
comparison
equal deleted inserted replaced
2193:ea7715935e55 2194:d29037435955
1919 run= get_symbol2(&s->c, b->state[1], 3); 1919 run= get_symbol2(&s->c, b->state[1], 3);
1920 for(y=0; y<h; y++){ 1920 for(y=0; y<h; y++){
1921 int v=0; 1921 int v=0;
1922 int lt=0, t=0, rt=0; 1922 int lt=0, t=0, rt=0;
1923 1923
1924 if(y){ 1924 if(y && b->x[prev_index] == 0){
1925 rt= src[(y-1)*stride]; 1925 rt= b->coeff[prev_index];
1926 } 1926 }
1927 for(x=0; x<w; x++){ 1927 for(x=0; x<w; x++){
1928 int p=0; 1928 int p=0;
1929 const int l= v; 1929 const int l= v;
1930 1930
1931 lt= t; t= rt; 1931 lt= t; t= rt;
1932 1932
1933 if(y && x + 1 < w){ 1933 if(y){
1934 rt= src[x + 1 + (y-1)*stride]; 1934 if(b->x[prev_index] <= x) //FIXME if
1935 }else 1935 prev_index++;
1936 rt= 0; 1936 if(b->x[prev_index] == x + 1)
1937 rt= b->coeff[prev_index];
1938 else
1939 rt=0;
1940 }
1937 if(parent){ 1941 if(parent){
1938 int px= x>>1;
1939 int py= y>>1;
1940 if(px<b->parent->width && py<b->parent->height)
1941 p= parent[px + py*2*stride];
1942
1943 if(x>>1 > b->parent->x[parent_index]){ 1942 if(x>>1 > b->parent->x[parent_index]){
1944 parent_index++; 1943 parent_index++;
1944 }
1945 if(x>>1 == b->parent->x[parent_index]){
1946 p= b->parent->coeff[parent_index];
1945 } 1947 }
1946 } 1948 }
1947 if(/*ll|*/l|lt|t|rt|p){ 1949 if(/*ll|*/l|lt|t|rt|p){
1948 int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); 1950 int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p));
1949 1951
1956 run--; 1958 run--;
1957 v=0; 1959 v=0;
1958 1960
1959 if(y && parent){ 1961 if(y && parent){
1960 int max_run; 1962 int max_run;
1961 while(b->x[prev_index] < x)
1962 prev_index++;
1963 1963
1964 max_run= FFMIN(run, b->x[prev_index] - x - 2); 1964 max_run= FFMIN(run, b->x[prev_index] - x - 2);
1965 max_run= FFMIN(max_run, 2*b->parent->x[parent_index] - x - 1); 1965 max_run= FFMIN(max_run, 2*b->parent->x[parent_index] - x - 1);
1966 x+= max_run; 1966 x+= max_run;
1967 run-= max_run; 1967 run-= max_run;
1972 int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); 1972 int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p));
1973 v= get_symbol2(&s->c, b->state[context + 2], context-4) + 1; 1973 v= get_symbol2(&s->c, b->state[context + 2], context-4) + 1;
1974 if(get_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]])) 1974 if(get_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]]))
1975 v= -v; 1975 v= -v;
1976 src[x + y*stride]= v; 1976 src[x + y*stride]= v;
1977 b->x[index++]=x; //FIXME interleave x/coeff 1977 b->x[index]=x; //FIXME interleave x/coeff
1978 // b->coeff[index++]= v; 1978 b->coeff[index++]= v;
1979 } 1979 }
1980 } 1980 }
1981 b->x[index++]= w+1; //end marker 1981 b->x[index++]= w+1; //end marker
1982 prev_index= prev2_index; 1982 prev_index= prev2_index;
1983 prev2_index= index; 1983 prev2_index= index;