6, 12, 8, 10, 7, 9, 6, 4, 6, 2, 2, 3, 3, 3, 3, 2,
};
-static inline void bswap_buf(uint32_t *dst, uint32_t *src, int w){
- int i;
-
- for(i=0; i+8<=w; i+=8){
- dst[i+0]= bswap_32(src[i+0]);
- dst[i+1]= bswap_32(src[i+1]);
- dst[i+2]= bswap_32(src[i+2]);
- dst[i+3]= bswap_32(src[i+3]);
- dst[i+4]= bswap_32(src[i+4]);
- dst[i+5]= bswap_32(src[i+5]);
- dst[i+6]= bswap_32(src[i+6]);
- dst[i+7]= bswap_32(src[i+7]);
- }
- for(;i<w; i++){
- dst[i+0]= bswap_32(src[i+0]);
- }
-}
-
static inline int add_left_prediction(uint8_t *dst, uint8_t *src, int w, int acc){
int i;
*left_top= lt;
}
-#ifdef CONFIG_ENCODERS
//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;
*left_top= lt;
}
-#endif //CONFIG_ENCODERS
-
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;
*blue= b;
}
-#ifdef CONFIG_ENCODERS
static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left){
int i;
if(w<32){
return src[w-1];
}
}
-#endif //CONFIG_ENCODERS
+
static void read_len_table(uint8_t *dst, GetBitContext *gb){
int i, val, repeat;
uint32_t bits=0;
for(len=32; len>0; len--){
- int bit= 1<<(32-len);
for(index=0; index<256; index++){
- if(len_table[index]==len){
- if(bits & (bit-1)){
- fprintf(stderr, "Error generating huffman table\n");
- return -1;
- }
- dst[index]= bits>>(32-len);
- bits+= bit;
- }
+ if(len_table[index]==len)
+ dst[index]= bits++;
+ }
+ if(bits & 1){
+ fprintf(stderr, "Error generating huffman table\n");
+ return -1;
}
+ bits >>= 1;
}
return 0;
}
-#ifdef CONFIG_ENCODERS
-
static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){
uint64_t counts[2*size];
int up[2*size];
}
}
-#endif //CONFIG_ENCODERS
-
static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){
GetBitContext gb;
int i;
return 0;
}
-#ifdef CONFIG_ENCODERS
-
static void store_table(HYuvContext *s, uint8_t *len){
int i;
int index= s->avctx->extradata_size;
return 0;
}
-#endif //CONFIG_ENCODERS
-
static void decode_422_bitstream(HYuvContext *s, int count){
int i;
}
}
-#ifdef CONFIG_ENCODERS
-
static void encode_422_bitstream(HYuvContext *s, int count){
int i;
}
}
-#endif //CONFIG_ENCODERS
-
static void decode_bgr_bitstream(HYuvContext *s, int count){
int i;
if (buf_size == 0)
return 0;
- bswap_buf((uint32_t*)s->bitstream_buffer, (uint32_t*)buf, buf_size/4);
+ s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (uint32_t*)buf, buf_size/4);
init_get_bits(&s->gb, s->bitstream_buffer, buf_size*8);
return 0;
}
-#ifdef CONFIG_ENCODERS
-
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
HYuvContext *s = avctx->priv_data;
AVFrame *pict = data;
char *p= avctx->stats_out;
for(i=0; i<3; i++){
for(j=0; j<256; j++){
- sprintf(p, "%Ld ", s->stats[i][j]);
+ sprintf(p, "%llu ", s->stats[i][j]);
p+= strlen(p);
s->stats[i][j]= 0;
}
}
}else{
flush_put_bits(&s->pb);
- bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
+ s->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
}
s->picture_number++;
return 0;
}
-#endif //CONFIG_ENCODERS
-
static const AVOption huffyuv_options[] =
{
AVOPTION_CODEC_INT("prediction_method", "prediction_method", prediction_method, 0, 2, 0),
.options = huffyuv_options,
};
-#endif //CONFIG_ENCODERS
\ No newline at end of file
+#endif //CONFIG_ENCODERS