Commit 5e20f836 authored by Michael Niedermayer's avatar Michael Niedermayer

FFV1 codec (our very simple lossless intra only codec, compresses much better then huffyuv)

Originally committed as revision 1939 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cd394651
...@@ -17,7 +17,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \ ...@@ -17,7 +17,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \ mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \ ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \ fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
vp3.o asv1.o 4xm.o cabac.o vp3.o asv1.o 4xm.o cabac.o ffv1.o
ifeq ($(AMR_NB),yes) ifeq ($(AMR_NB),yes)
ifeq ($(AMR_NB_FIXED),yes) ifeq ($(AMR_NB_FIXED),yes)
......
...@@ -65,6 +65,7 @@ void avcodec_register_all(void) ...@@ -65,6 +65,7 @@ void avcodec_register_all(void)
register_avcodec(&mjpeg_encoder); register_avcodec(&mjpeg_encoder);
register_avcodec(&huffyuv_encoder); register_avcodec(&huffyuv_encoder);
register_avcodec(&asv1_encoder); register_avcodec(&asv1_encoder);
register_avcodec(&ffv1_encoder);
#endif /* CONFIG_ENCODERS */ #endif /* CONFIG_ENCODERS */
register_avcodec(&rawvideo_encoder); register_avcodec(&rawvideo_encoder);
register_avcodec(&rawvideo_decoder); register_avcodec(&rawvideo_decoder);
...@@ -101,6 +102,7 @@ void avcodec_register_all(void) ...@@ -101,6 +102,7 @@ void avcodec_register_all(void)
register_avcodec(&mace3_decoder); register_avcodec(&mace3_decoder);
register_avcodec(&mace6_decoder); register_avcodec(&mace6_decoder);
register_avcodec(&huffyuv_decoder); register_avcodec(&huffyuv_decoder);
register_avcodec(&ffv1_decoder);
register_avcodec(&cyuv_decoder); register_avcodec(&cyuv_decoder);
register_avcodec(&h264_decoder); register_avcodec(&h264_decoder);
register_avcodec(&vp3_decoder); register_avcodec(&vp3_decoder);
......
...@@ -56,6 +56,7 @@ enum CodecID { ...@@ -56,6 +56,7 @@ enum CodecID {
CODEC_ID_AAC, CODEC_ID_AAC,
CODEC_ID_MPEG4AAC, CODEC_ID_MPEG4AAC,
CODEC_ID_ASV1, CODEC_ID_ASV1,
CODEC_ID_FFV1,
CODEC_ID_4XM, CODEC_ID_4XM,
/* various pcm "codecs" */ /* various pcm "codecs" */
...@@ -1215,6 +1216,7 @@ extern AVCodec wmv2_encoder; ...@@ -1215,6 +1216,7 @@ extern AVCodec wmv2_encoder;
extern AVCodec huffyuv_encoder; extern AVCodec huffyuv_encoder;
extern AVCodec h264_encoder; extern AVCodec h264_encoder;
extern AVCodec asv1_encoder; extern AVCodec asv1_encoder;
extern AVCodec ffv1_encoder;
extern AVCodec h263_decoder; extern AVCodec h263_decoder;
extern AVCodec mpeg4_decoder; extern AVCodec mpeg4_decoder;
...@@ -1249,6 +1251,7 @@ extern AVCodec amr_nb_encoder; ...@@ -1249,6 +1251,7 @@ extern AVCodec amr_nb_encoder;
extern AVCodec aac_decoder; extern AVCodec aac_decoder;
extern AVCodec mpeg4aac_decoder; extern AVCodec mpeg4aac_decoder;
extern AVCodec asv1_decoder; extern AVCodec asv1_decoder;
extern AVCodec ffv1_decoder;
extern AVCodec fourxm_decoder; extern AVCodec fourxm_decoder;
/* pcm codecs */ /* pcm codecs */
......
...@@ -91,6 +91,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){ ...@@ -91,6 +91,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
* @param buf_size size of buf in bits * @param buf_size size of buf in bits
*/ */
void ff_init_cabac_decoder(CABACContext *c, uint8_t *buf, int buf_size){ void ff_init_cabac_decoder(CABACContext *c, uint8_t *buf, int buf_size){
c->bytestream_start=
c->bytestream= buf; c->bytestream= buf;
c->low= *c->bytestream++; c->low= *c->bytestream++;
......
...@@ -37,6 +37,7 @@ typedef struct CABACContext{ ...@@ -37,6 +37,7 @@ typedef struct CABACContext{
uint8_t lps_range[2*64][4]; ///< rangeTabLPS uint8_t lps_range[2*64][4]; ///< rangeTabLPS
uint8_t lps_state[2*64]; ///< transIdxLPS uint8_t lps_state[2*64]; ///< transIdxLPS
uint8_t mps_state[2*64]; ///< transIdxMPS uint8_t mps_state[2*64]; ///< transIdxMPS
uint8_t *bytestream_start;
uint8_t *bytestream; uint8_t *bytestream;
int bits_left; ///< int bits_left; ///<
PutBitContext pb; PutBitContext pb;
...@@ -138,7 +139,11 @@ static inline void put_cabac_bypass(CABACContext *c, int bit){ ...@@ -138,7 +139,11 @@ static inline void put_cabac_bypass(CABACContext *c, int bit){
#endif #endif
} }
static inline void put_cabac_terminate(CABACContext *c, int bit){ /**
*
* @return the number of bytes written
*/
static inline int put_cabac_terminate(CABACContext *c, int bit){
c->range -= 2; c->range -= 2;
if(!bit){ if(!bit){
...@@ -159,6 +164,8 @@ static inline void put_cabac_terminate(CABACContext *c, int bit){ ...@@ -159,6 +164,8 @@ static inline void put_cabac_terminate(CABACContext *c, int bit){
#ifdef STRICT_LIMITS #ifdef STRICT_LIMITS
c->symCount++; c->symCount++;
#endif #endif
return (get_bit_count(&c->pb)+7)>>3;
} }
/** /**
...@@ -303,13 +310,17 @@ static inline int get_cabac_bypass(CABACContext *c){ ...@@ -303,13 +310,17 @@ static inline int get_cabac_bypass(CABACContext *c){
} }
} }
/**
*
* @return the number of bytes read or 0 if no end
*/
static inline int get_cabac_terminate(CABACContext *c){ static inline int get_cabac_terminate(CABACContext *c){
c->range -= 2<<8; c->range -= 2<<8;
if(c->low < c->range){ if(c->low < c->range){
renorm_cabac_decoder(c); renorm_cabac_decoder(c);
return 0; return 0;
}else{ }else{
return 1; return c->bytestream - c->bytestream_start;
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment