aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cavs.h
diff options
context:
space:
mode:
authorStefan Gehrer <stefan.gehrer@gmx.de>2007-07-07 07:14:58 +0000
committerStefan Gehrer <stefan.gehrer@gmx.de>2007-07-07 07:14:58 +0000
commit218b3ae970ee79dbd1d35a479c7fc83effb543d5 (patch)
tree2dbebd71edcafd2a7e377c6c1a12917f8399d7ae /libavcodec/cavs.h
parentce7088b9a8aa259daf75264ecd163025e74b94d2 (diff)
downloadffmpeg-218b3ae970ee79dbd1d35a479c7fc83effb543d5.tar.gz
move dequantization into its own inline function
Originally committed as revision 9518 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cavs.h')
-rw-r--r--libavcodec/cavs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index b98ffd7799..71a0aba71f 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -441,4 +441,24 @@ static inline int next_mb(AVSContext *h) {
return 1;
}
+static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
+ DCTELEM *dst, int mul, int shift, int coeff_num) {
+ int round = 1 << (shift - 1);
+ int pos = -1;
+ const uint8_t *scantab = h->scantable.permutated;
+
+ /* inverse scan and dequantization */
+ while(--coeff_num >= 0){
+ pos += run_buf[coeff_num];
+ if(pos > 63) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "position out of block bounds at pic %d MB(%d,%d)\n",
+ h->picture.poc, h->mbx, h->mby);
+ return -1;
+ }
+ dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
+ }
+ return 0;
+}
+
#endif /* CAVS_H */