[FFmpeg-devel] [PATCH 2/3] avcodec/vc2enc: assign some slice struct members init
James Darnley
jdarnley at obe.tv
Mon Jul 31 14:50:15 EEST 2017
---
libavcodec/vc2enc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 7e0cb03eff..5dec88c81b 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -700,9 +700,6 @@ static int calc_slice_sizes(VC2EncContext *s)
for (slice_y = 0; slice_y < s->num_y; slice_y++) {
for (slice_x = 0; slice_x < s->num_x; slice_x++) {
SliceArgs *args = &enc_args[s->num_x*slice_y + slice_x];
- args->ctx = s;
- args->x = slice_x;
- args->y = slice_y;
args->bits_ceil = s->slice_max_bytes << 3;
args->bits_floor = s->slice_min_bytes << 3;
memset(args->cache, 0, s->q_ceil*sizeof(*args->cache));
@@ -1201,6 +1198,17 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
s->slice_args = av_calloc(s->num_x*s->num_y, sizeof(SliceArgs));
if (!s->slice_args)
goto alloc_fail;
+ else {
+ int x, y;
+ for (y = 0; y < s->num_y; y++) {
+ for (x = 0; x < s->num_x; x++) {
+ SliceArgs *args = &s->slice_args[s->num_x * y + x];
+ args->ctx = s;
+ args->x = x;
+ args->y = y;
+ }
+ }
+ }
/* Lookup tables */
s->coef_lut_len = av_malloc(COEF_LUT_TAB*(s->q_ceil+1)*sizeof(*s->coef_lut_len));
--
2.13.3
More information about the ffmpeg-devel
mailing list