- uint8_t *temp_src= src + x + stride*y;
- int diff, context, sign;
-
- context= get_context(s, pred_diff[3] + x, pred_diff[2] + x, pred_diff[1] + x);
- if(context < 0){
- context= -context;
- sign=1;
- }else
- sign=0;
-
-
- if(s->ac)
- diff= get_symbol(c, p->state[context], 1);
- else{
- if(context == 0 && run_mode==0) run_mode=1;
-
- if(run_mode){
- if(run_count==0 && run_mode==1){
- if(get_bits1(&s->gb)){
- run_count = 1<<log2_run[run_index];
- if(x + run_count <= w) run_index++;
- }else{
- if(log2_run[run_index]) run_count = get_bits(&s->gb, log2_run[run_index]);
- else run_count=0;
- if(run_index) run_index--;
- run_mode=2;
- }
- }
- run_count--;
- if(run_count < 0){
- run_mode=0;
- run_count=0;
- diff= get_vlc_symbol(&s->gb, &p->vlc_state[context]);
- if(diff>=0) diff++;
- }else
- diff=0;
- }else
- diff= get_vlc_symbol(&s->gb, &p->vlc_state[context]);
-
-// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb));
- }
+ src[x + stride*y]= sample[1][x];
+ }
+//STOP_TIMER("decode-line")}
+ }
+}
+
+static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
+ int x, y, p;
+ int_fast16_t sample_buffer[3][2][w+6];
+ int_fast16_t *sample[3][2]= {
+ {sample_buffer[0][0]+3, sample_buffer[0][1]+3},
+ {sample_buffer[1][0]+3, sample_buffer[1][1]+3},
+ {sample_buffer[2][0]+3, sample_buffer[2][1]+3}};
+
+ s->run_index=0;
+
+ memset(sample_buffer, 0, sizeof(sample_buffer));
+
+ for(y=0; y<h; y++){
+ for(p=0; p<3; p++){
+ int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer