Commit 2c4f95c1 authored by reimar's avatar reimar

Make VP5 and VP6 decoders output a qscale table to allow for more automatic

post-processing, and add a new FF_QSCALE_TYPE_VP56 for this.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21529 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9a9929e2
...@@ -913,6 +913,7 @@ typedef struct AVPanScan{ ...@@ -913,6 +913,7 @@ typedef struct AVPanScan{
#define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG1 0
#define FF_QSCALE_TYPE_MPEG2 1 #define FF_QSCALE_TYPE_MPEG2 1
#define FF_QSCALE_TYPE_H264 2 #define FF_QSCALE_TYPE_H264 2
#define FF_QSCALE_TYPE_VP56 3
#define FF_BUFFER_TYPE_INTERNAL 1 #define FF_BUFFER_TYPE_INTERNAL 1
#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
......
...@@ -33,6 +33,7 @@ void vp56_init_dequant(VP56Context *s, int quantizer) ...@@ -33,6 +33,7 @@ void vp56_init_dequant(VP56Context *s, int quantizer)
s->quantizer = quantizer; s->quantizer = quantizer;
s->dequant_dc = vp56_dc_dequant[quantizer] << 2; s->dequant_dc = vp56_dc_dequant[quantizer] << 2;
s->dequant_ac = vp56_ac_dequant[quantizer] << 2; s->dequant_ac = vp56_ac_dequant[quantizer] << 2;
memset(s->qscale_table, quantizer, s->mb_width);
} }
static int vp56_get_vectors_predictors(VP56Context *s, int row, int col, static int vp56_get_vectors_predictors(VP56Context *s, int row, int col,
...@@ -481,6 +482,7 @@ static int vp56_size_changed(AVCodecContext *avctx) ...@@ -481,6 +482,7 @@ static int vp56_size_changed(AVCodecContext *avctx)
return -1; return -1;
} }
s->qscale_table = av_realloc(s->qscale_table, s->mb_width);
s->above_blocks = av_realloc(s->above_blocks, s->above_blocks = av_realloc(s->above_blocks,
(4*s->mb_width+6) * sizeof(*s->above_blocks)); (4*s->mb_width+6) * sizeof(*s->above_blocks));
s->macroblocks = av_realloc(s->macroblocks, s->macroblocks = av_realloc(s->macroblocks,
...@@ -643,6 +645,9 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -643,6 +645,9 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT], FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
s->framep[VP56_FRAME_PREVIOUS]); s->framep[VP56_FRAME_PREVIOUS]);
p->qstride = 0;
p->qscale_table = s->qscale_table;
p->qscale_type = FF_QSCALE_TYPE_VP56;
*(AVFrame*)data = *p; *(AVFrame*)data = *p;
*data_size = sizeof(AVFrame); *data_size = sizeof(AVFrame);
...@@ -691,6 +696,7 @@ av_cold int vp56_free(AVCodecContext *avctx) ...@@ -691,6 +696,7 @@ av_cold int vp56_free(AVCodecContext *avctx)
{ {
VP56Context *s = avctx->priv_data; VP56Context *s = avctx->priv_data;
av_freep(&s->qscale_table);
av_freep(&s->above_blocks); av_freep(&s->above_blocks);
av_freep(&s->macroblocks); av_freep(&s->macroblocks);
av_freep(&s->edge_emu_buffer_alloc); av_freep(&s->edge_emu_buffer_alloc);
......
...@@ -110,6 +110,7 @@ struct vp56_context { ...@@ -110,6 +110,7 @@ struct vp56_context {
int quantizer; int quantizer;
uint16_t dequant_dc; uint16_t dequant_dc;
uint16_t dequant_ac; uint16_t dequant_ac;
int8_t *qscale_table;
/* DC predictors management */ /* DC predictors management */
VP56RefDc *above_blocks; VP56RefDc *above_blocks;
......
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