*/
/**
- * @file libavcodec/svq1.c
+ * @file
* Sorenson Vector Quantizer #1 (SVQ1) video codec.
* For more information of the SVQ1 algorithm, visit:
* http://www.pcisys.net/~melanson/codecs/
uint8_t *current, *previous;
int result, i, x, y, width, height;
AVFrame *pict = data;
+ svq1_pmv *pmv;
/* initialize bit buffer */
init_get_bits(&s->gb,buf,buf_size*8);
//this should be removed after libavcodec can handle more flexible picture types & ordering
if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
- if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
if(MPV_frame_start(s, avctx) < 0)
return -1;
+ pmv = av_malloc((FFALIGN(s->width, 16)/8 + 3) * sizeof(*pmv));
+ if (!pmv)
+ return -1;
+
/* decode y, u and v components */
for (i=0; i < 3; i++) {
int linesize;
//#ifdef DEBUG_SVQ1
av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
//#endif
- return result;
+ goto err;
}
}
current += 16*linesize;
}
} else {
- svq1_pmv pmv[width/8+3];
/* delta frame */
memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
#ifdef DEBUG_SVQ1
av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
#endif
- return result;
+ goto err;
}
}
MPV_frame_end(s);
*data_size=sizeof(AVFrame);
- return buf_size;
+ result = buf_size;
+err:
+ av_free(pmv);
+ return result;
}
static av_cold int svq1_decode_init(AVCodecContext *avctx)
}
-AVCodec svq1_decoder = {
+AVCodec ff_svq1_decoder = {
"svq1",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_SVQ1,