*
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
DSPContext dsp;
}FFV1Context;
-static always_inline int fold(int diff, int bits){
+static av_always_inline int fold(int diff, int bits){
if(bits==8)
diff= (int8_t)diff;
else{
int i;
if(v){
- const int a= ABS(v);
+ const int a= FFABS(v);
const int e= av_log2(a);
put_rac(c, state+0, 0);
static inline void update_vlc_state(VlcState * const state, const int v){
int drift= state->drift;
int count= state->count;
- state->error_sum += ABS(v);
+ state->error_sum += FFABS(v);
drift += v;
if(count == 128){ //FIXME variable
return ret;
}
+#ifdef CONFIG_ENCODERS
static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
PlaneContext * const p= &s->plane[plane_index];
RangeCoder * const c= &s->c;
for(i=0; i<5; i++)
write_quant_table(c, f->quant_table[i]);
}
+#endif /* CONFIG_ENCODERS */
static int common_init(AVCodecContext *avctx){
FFV1Context *s = avctx->priv_data;
return 0;
}
+#ifdef CONFIG_ENCODERS
static int encode_init(AVCodecContext *avctx)
{
FFV1Context *s = avctx->priv_data;
int i;
- if(avctx->strict_std_compliance >FF_COMPLIANCE_EXPERIMENTAL){
- av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it may not be decodeable with future versions!!!\n"
- "use vstrict=-2 / -strict -2 to use it anyway\n");
- return -1;
- }
-
common_init(avctx);
s->version=0;
case PIX_FMT_YUV410P:
s->colorspace= 0;
break;
- case PIX_FMT_RGBA32:
+ case PIX_FMT_RGB32:
s->colorspace= 1;
break;
default:
return 0;
}
+#endif /* CONFIG_ENCODERS */
static void clear_state(FFV1Context *f){
}
}
+#ifdef CONFIG_ENCODERS
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
FFV1Context *f = avctx->priv_data;
RangeCoder * const c= &f->c;
return used_count + (put_bits_count(&f->pb)+7)/8;
}
}
+#endif /* CONFIG_ENCODERS */
-static void common_end(FFV1Context *s){
+static int common_end(AVCodecContext *avctx){
+ FFV1Context *s = avctx->priv_data;
int i;
for(i=0; i<s->plane_count; i++){
av_freep(&p->state);
}
-}
-
-static int encode_end(AVCodecContext *avctx)
-{
- FFV1Context *s = avctx->priv_data;
-
- common_end(s);
return 0;
}
av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
return -1;
}
- f->avctx->pix_fmt= PIX_FMT_RGBA32;
+ f->avctx->pix_fmt= PIX_FMT_RGB32;
}else{
av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
return -1;
sizeof(FFV1Context),
decode_init,
NULL,
- NULL,
+ common_end,
decode_frame,
CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
NULL
sizeof(FFV1Context),
encode_init,
encode_frame,
- encode_end,
+ common_end,
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, -1},
};
#endif