int flags;
int picture_number;
int last_slice_end;
- uint8_t __align8 temp[3][2500];
+ uint8_t __align8 temp[3][2560];
uint64_t stats[3][256];
uint8_t len[3][256];
uint32_t bits[3][256];
*left_top= lt;
}
-//FIXME optimize
-static inline void sub_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
- int i;
- uint8_t l, lt;
-
- l= *left;
- lt= *left_top;
-
- for(i=0; i<w; i++){
- const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF);
- lt= src1[i];
- l= src2[i];
- dst[i]= l - pred;
- }
-
- *left= l;
- *left_top= lt;
-}
-
static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){
int i;
int r,g,b;
dst[index]= bits++;
}
if(bits & 1){
- fprintf(stderr, "Error generating huffman table\n");
+ av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1;
}
bits >>= 1;
int index= s->avctx->extradata_size;
for(i=0; i<256;){
- int cur=i;
int val= len[i];
- int repeat;
-
- for(; i<256 && len[i]==val; i++);
+ int repeat=0;
- repeat= i - cur;
+ for(; i<256 && len[i]==val && repeat<255; i++)
+ repeat++;
+ assert(val < 32 && val >0 && repeat<256 && repeat>0);
if(repeat>7){
((uint8_t*)s->avctx->extradata)[index++]= val;
((uint8_t*)s->avctx->extradata)[index++]= repeat;
switch(avctx->pix_fmt){
case PIX_FMT_YUV420P:
if(avctx->strict_std_compliance>=0){
- fprintf(stderr, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n");
+ av_log(avctx, AV_LOG_ERROR, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n");
return -1;
}
s->bitstream_bpp= 12;
s->bitstream_bpp= 16;
break;
default:
- fprintf(stderr, "format not supported\n");
+ av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
avctx->bits_per_sample= s->bitstream_bpp;
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
- fprintf(stderr, "get_buffer() failed\n");
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->data[0][1]= get_bits(&s->gb, 8);
p->data[0][0]= get_bits(&s->gb, 8);
- fprintf(stderr, "YUY2 output isnt implemenetd yet\n");
+ av_log(avctx, AV_LOG_ERROR, "YUY2 output isnt implemenetd yet\n");
return -1;
}else{
draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order
break;
default:
- fprintf(stderr, "prediction type not supported!\n");
+ av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n");
}
}else{
- fprintf(stderr, "BGR24 output isnt implemenetd yet\n");
+ av_log(avctx, AV_LOG_ERROR, "BGR24 output isnt implemenetd yet\n");
return -1;
}
}
lefttopy= p->data[0][3];
lefttopu= p->data[1][1];
lefttopv= p->data[2][1];
- sub_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
- sub_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
- sub_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
+ s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
+ s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
encode_422_bitstream(s, width-4);
y++; cy++;
if(s->bitstream_bpp==12){
while(2*cy > y){
ydst= p->data[0] + p->linesize[0]*y;
- sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
encode_gray_bitstream(s, width);
y++;
}
udst= p->data[1] + p->linesize[1]*cy;
vdst= p->data[2] + p->linesize[2]*cy;
- sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
- sub_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
- sub_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
+ s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
+ s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
encode_422_bitstream(s, width);
}
}
}
}else{
- fprintf(stderr, "Format not supported!\n");
+ av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
}
emms_c();