/**
* @file ffv1.c
- * FF Video Codec 1 (a experimental lossless codec)
+ * FF Video Codec 1 (an experimental lossless codec)
*/
#include "common.h"
const int LT= last[-1];
const int T= last[ 0];
const int L = src[-1];
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- const int gradient= cm[L + T - LT];
- return mid_pred(L, gradient, T);
+ return mid_pred(L, L + T - LT, T);
}
static inline int get_context(FFV1Context *f, uint8_t *src, uint8_t *last, uint8_t *last2){
k++;
i += i;
}
+
+ assert(k<=8);
+
#if 0 // JPEG LS
if(k==0 && 2*state->drift <= - state->count) code= v ^ (-1);
else code= v;
code = -2*code-1;
code^= (code>>31);
//printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k);
- set_ur_golomb(pb, code, k, 8, 8);
+ set_ur_golomb(pb, code, k, 12, 8);
update_vlc_state(state, v);
}
k++;
i += i;
}
-
- v= get_ur_golomb(gb, k, 8, 8);
+
+ assert(k<=8);
+
+ v= get_ur_golomb(gb, k, 12, 8);
//printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k);
-
+
v++;
if(v&1) v= (v>>1);
else v= -(v>>1);
s->version=0;
s->ac= avctx->coder_type;
- s->plane_count=3;
+ s->plane_count=2;
for(i=0; i<256; i++){
s->quant_table[0][i]= quant11[i];
s->quant_table[1][i]= 11*quant11[i];
if(!f->ac){
used_count += put_cabac_terminate(c, 1);
//printf("pos=%d\n", used_count);
- init_put_bits(&f->pb, buf + used_count, buf_size - used_count, NULL, NULL);
+ init_put_bits(&f->pb, buf + used_count, buf_size - used_count);
}
if(1){
encode_plane(f, p->data[0], width, height, p->linesize[0], 0);
encode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
- encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 2);
+ encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
}
emms_c();
f->chroma_h_shift= get_symbol(c, state, 0, 7);
f->chroma_v_shift= get_symbol(c, state, 0, 7);
get_cabac(c, state); //transparency plane
- f->plane_count= 3;
+ f->plane_count= 2;
switch(16*f->chroma_h_shift + f->chroma_v_shift){
case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break;
if(bytes_read ==0) printf("error at end of AC stream\n");
//printf("pos=%d\n", bytes_read);
init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);
+ } else {
+ bytes_read = 0; /* avoid warning */
}
if(1){
decode_plane(f, p->data[0], width, height, p->linesize[0], 0);
decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
- decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 2);
+ decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
}
emms_c();