#define ALT_BITSTREAM_READER
#include "avcodec.h"
#include "dsputil.h"
-#include "mpegvideo.h"
+#include "bitstream.h"
#include "simple_idct.h"
#include "dvdata.h"
}
}
-static int dvvideo_init(AVCodecContext *avctx)
+static av_cold int dvvideo_init(AVCodecContext *avctx)
{
DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
/* 248DCT setup */
s->fdct[1] = dsp.fdct248;
- s->idct_put[1] = simple_idct248_put; // FIXME: need to add it to DSP
+ s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP
if(avctx->lowres){
for (i=0; i<64; i++){
int j= ff_zigzag248_direct[i];
return s->size_in_bits - get_bits_count(s);
}
-static inline int get_bits_size(GetBitContext *s)
-{
- return s->size_in_bits;
-}
-
static inline int put_bits_left(PutBitContext* s)
{
return (s->buf_end - s->buf) * 8 - put_bits_count(s);
/* decode ac coefs */
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
{
- int last_index = get_bits_size(gb);
+ int last_index = gb->size_in_bits;
const uint8_t *scan_table = mb->scan_table;
const uint8_t *shift_table = mb->shift_table;
const int *iweight_table = mb->iweight_table;
/* mb_x and mb_y are in units of 8 pixels */
static inline void dv_decode_video_segment(DVVideoContext *s,
- uint8_t *buf_ptr1,
+ const uint8_t *buf_ptr1,
const uint16_t *mb_pos_ptr)
{
int quant, dc, dct_mode, class1, j;
int c_offset;
uint8_t *y_ptr;
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
- uint8_t *buf_ptr;
+ const uint8_t *buf_ptr;
PutBitContext pb, vs_pb;
GetBitContext gb;
BlockInfo mb_data[5 * 6], *mb, *mb1;
- DECLARE_ALIGNED_8(DCTELEM, sblock[5*6][64]);
+ DECLARE_ALIGNED_16(DCTELEM, sblock[5*6][64]);
DECLARE_ALIGNED_8(uint8_t, mb_bit_buffer[80 + 4]); /* allow some slack */
DECLARE_ALIGNED_8(uint8_t, vs_bit_buffer[5 * 80 + 4]); /* allow some slack */
const int log2_blocksize= 3-s->avctx->lowres;
144000 bytes for PAL - or twice those for 50Mbps) */
static int dvvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVVideoContext *s = avctx->priv_data;
s->picture.key_frame = 1;
s->picture.pict_type = FF_I_TYPE;
avctx->pix_fmt = s->sys->pix_fmt;
+ avctx->time_base = (AVRational){s->sys->frame_rate_base, s->sys->frame_rate};
avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
if(avctx->get_buffer(avctx, &s->picture) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
sizeof(DVVideoContext),
dvvideo_init,
dvvideo_encode_frame,
- .pix_fmts = (enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, -1},
+ .pix_fmts = (enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
#endif // CONFIG_DVVIDEO_ENCODER
dvvideo_close,
dvvideo_decode_frame,
CODEC_CAP_DR1,
- NULL
+ NULL,
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
#endif