# HG changeset patch
# User reimar
# Date 1264792307 0
# Node ID c57e72227d7df0a30cbcdf30e15b5fd3475d21ca
# Parent  00fcecde822b742abc23e5d1e544d00c2e706490
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.

diff -r 00fcecde822b -r c57e72227d7d avcodec.h
--- a/avcodec.h	Fri Jan 29 16:49:06 2010 +0000
+++ b/avcodec.h	Fri Jan 29 19:11:47 2010 +0000
@@ -913,6 +913,7 @@
 #define FF_QSCALE_TYPE_MPEG1 0
 #define FF_QSCALE_TYPE_MPEG2 1
 #define FF_QSCALE_TYPE_H264  2
+#define FF_QSCALE_TYPE_VP56  3
 
 #define FF_BUFFER_TYPE_INTERNAL 1
 #define FF_BUFFER_TYPE_USER     2 ///< direct rendering buffers (image is (de)allocated by user)
diff -r 00fcecde822b -r c57e72227d7d vp56.c
--- a/vp56.c	Fri Jan 29 16:49:06 2010 +0000
+++ b/vp56.c	Fri Jan 29 19:11:47 2010 +0000
@@ -33,6 +33,7 @@
     s->quantizer = quantizer;
     s->dequant_dc = vp56_dc_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,
@@ -481,6 +482,7 @@
         return -1;
     }
 
+    s->qscale_table = av_realloc(s->qscale_table, s->mb_width);
     s->above_blocks = av_realloc(s->above_blocks,
                                  (4*s->mb_width+6) * sizeof(*s->above_blocks));
     s->macroblocks = av_realloc(s->macroblocks,
@@ -643,6 +645,9 @@
     FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
                       s->framep[VP56_FRAME_PREVIOUS]);
 
+    p->qstride = 0;
+    p->qscale_table = s->qscale_table;
+    p->qscale_type = FF_QSCALE_TYPE_VP56;
     *(AVFrame*)data = *p;
     *data_size = sizeof(AVFrame);
 
@@ -691,6 +696,7 @@
 {
     VP56Context *s = avctx->priv_data;
 
+    av_freep(&s->qscale_table);
     av_freep(&s->above_blocks);
     av_freep(&s->macroblocks);
     av_freep(&s->edge_emu_buffer_alloc);
diff -r 00fcecde822b -r c57e72227d7d vp56.h
--- a/vp56.h	Fri Jan 29 16:49:06 2010 +0000
+++ b/vp56.h	Fri Jan 29 19:11:47 2010 +0000
@@ -110,6 +110,7 @@
     int quantizer;
     uint16_t dequant_dc;
     uint16_t dequant_ac;
+    int8_t *qscale_table;
 
     /* DC predictors management */
     VP56RefDc *above_blocks;