summaryrefslogtreecommitdiff
path: root/libavcodec/dv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-06-18 10:59:37 +0200
committerAnton Khirnov <anton@khirnov.net>2014-06-20 14:15:31 +0200
commit650dee63c8b1e6693c6cf5983f4a5ed3f571379f (patch)
tree04b514b5fe495363fcd444dc4cb2606f64b249a1 /libavcodec/dv.c
parent778111592bf5f38630858ee6dfcfd097cd6c6da9 (diff)
downloadffmpeg-650dee63c8b1e6693c6cf5983f4a5ed3f571379f.tar.gz
dv: get rid of global non-const tables
Instead, store them in the context and compute on each parameter change.
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r--libavcodec/dv.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 1a54c4efa8..143a5ccebb 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -175,13 +175,12 @@ static const uint8_t dv100_qstep[16] = {
static const uint8_t dv_quant_areas[4] = { 6, 21, 43, 64 };
-int ff_dv_init_dynamic_tables(const DVprofile *d)
+int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const DVprofile *d)
{
int j,i,c,s,p;
uint32_t *factor1, *factor2;
const int *iweight1, *iweight2;
- if (!d->work_chunks[dv_work_pool_size(d)-1].buf_offset) {
p = i = 0;
for (c=0; c<d->n_difchan; c++) {
for (s=0; s<d->difseg_size; s++) {
@@ -190,18 +189,16 @@ int ff_dv_init_dynamic_tables(const DVprofile *d)
p += !(j%3);
if (!(DV_PROFILE_IS_1080i50(d) && c != 0 && s == 11) &&
!(DV_PROFILE_IS_720p50(d) && s > 9)) {
- dv_calc_mb_coordinates(d, c, s, j, &d->work_chunks[i].mb_coordinates[0]);
- d->work_chunks[i++].buf_offset = p;
+ dv_calc_mb_coordinates(d, c, s, j, &ctx->work_chunks[i].mb_coordinates[0]);
+ ctx->work_chunks[i++].buf_offset = p;
}
p += 5;
}
}
}
- }
- if (!d->idct_factor[DV_PROFILE_IS_HD(d)?8191:5631]) {
- factor1 = &d->idct_factor[0];
- factor2 = &d->idct_factor[DV_PROFILE_IS_HD(d)?4096:2816];
+ factor1 = &ctx->idct_factor[0];
+ factor2 = &ctx->idct_factor[DV_PROFILE_IS_HD(d) ? 4096 : 2816];
if (d->height == 720) {
iweight1 = &ff_dv_iweight_720_y[0];
iweight2 = &ff_dv_iweight_720_c[0];
@@ -231,7 +228,6 @@ int ff_dv_init_dynamic_tables(const DVprofile *d)
}
}
}
- }
return 0;
}