*/
/**
- * @file cavs.c
+ * @file cavsdec.c
* Chinese AVS video (AVS1-P2, JiZhun profile) decoder
* @author Stefan Gehrer <stefan.gehrer@gmx.de>
*/
h->col_mv[(h->mby*h->mb_width + h->mbx)*4 + 3] = h->mv[MV_FWD_X3];
}
-static inline void mv_pred_direct(AVSContext *h, vector_t *pmv_fw,
- vector_t *col_mv) {
- vector_t *pmv_bw = pmv_fw + MV_BWD_OFFS;
+static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
+ cavs_vector *col_mv) {
+ cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
int den = h->direct_den[col_mv->ref];
int m = col_mv->x >> 31;
pmv_bw->y = m-(((den+(den*col_mv->y*pmv_bw->dist^m)-m-1)>>14)^m);
}
-static inline void mv_pred_sym(AVSContext *h, vector_t *src, enum block_t size) {
- vector_t *dst = src + MV_BWD_OFFS;
+static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block size) {
+ cavs_vector *dst = src + MV_BWD_OFFS;
/* backward mv is the scaled and negated forward mv */
dst->x = -((src->x * h->sym_factor + 256) >> 9);
* @param stride line stride in frame buffer
*/
static int decode_residual_block(AVSContext *h, GetBitContext *gb,
- const dec_2dvlc_t *r, int esc_golomb_order,
+ const struct dec_2dvlc *r, int esc_golomb_order,
int qp, uint8_t *dst, int stride) {
int i, level_code, esc_code, level, run, mask;
- DCTELEM level_buf[64];
- uint8_t run_buf[64];
+ DCTELEM level_buf[65];
+ uint8_t run_buf[65];
DCTELEM *block = h->block;
for(i=0;i<65;i++) {
return 0;
}
-static void decode_mb_p(AVSContext *h, enum mb_t mb_type) {
+static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
GetBitContext *gb = &h->s.gb;
int ref[4];
*h->col_type = mb_type;
}
-static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
+static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
int block;
- enum sub_mb_t sub_type[4];
+ enum cavs_sub_mb sub_type[4];
int flags;
ff_cavs_init_mb(h);
static int decode_pic(AVSContext *h) {
MpegEncContext *s = &h->s;
int skip_count;
- enum mb_t mb_type;
+ enum cavs_mb mb_type;
if (!s->context_initialized) {
s->avctx->idct_algo = FF_IDCT_CAVS;
if(h->pic_type != FF_B_TYPE) {
if(h->DPB[1].data[0])
s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
- memcpy(&h->DPB[1], &h->DPB[0], sizeof(Picture));
- memcpy(&h->DPB[0], &h->picture, sizeof(Picture));
+ h->DPB[1] = h->DPB[0];
+ h->DPB[0] = h->picture;
memset(&h->picture,0,sizeof(Picture));
}
return 0;
}
static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
- uint8_t * buf, int buf_size) {
+ const uint8_t * buf, int buf_size) {
AVSContext *h = avctx->priv_data;
MpegEncContext *s = &h->s;
int input_size;
const uint8_t *buf_end;
const uint8_t *buf_ptr;
AVFrame *picture = data;
- uint32_t stc;
+ uint32_t stc = -1;
s->avctx = avctx;
cavs_decode_frame,
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
.flush= cavs_flush,
+ .long_name= NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile)"),
};