|
|
@@ -119,7 +119,7 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f) |
|
|
|
|
|
|
|
|
av_assert0(max_slice_count > 0); |
|
|
av_assert0(max_slice_count > 0); |
|
|
|
|
|
|
|
|
for (i = 0; i < max_slice_count; i++) { |
|
|
|
|
|
|
|
|
for (i = 0; i < max_slice_count;) { |
|
|
int sx = i % f->num_h_slices; |
|
|
int sx = i % f->num_h_slices; |
|
|
int sy = i / f->num_h_slices; |
|
|
int sy = i / f->num_h_slices; |
|
|
int sxs = f->avctx->width * sx / f->num_h_slices; |
|
|
int sxs = f->avctx->width * sx / f->num_h_slices; |
|
|
@@ -131,7 +131,7 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f) |
|
|
if (!fs) |
|
|
if (!fs) |
|
|
goto memfail; |
|
|
goto memfail; |
|
|
|
|
|
|
|
|
f->slice_context[i] = fs; |
|
|
|
|
|
|
|
|
f->slice_context[i++] = fs; |
|
|
memcpy(fs, f, sizeof(*fs)); |
|
|
memcpy(fs, f, sizeof(*fs)); |
|
|
memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2)); |
|
|
memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2)); |
|
|
|
|
|
|
|
|
@@ -144,22 +144,14 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f) |
|
|
sizeof(*fs->sample_buffer)); |
|
|
sizeof(*fs->sample_buffer)); |
|
|
fs->sample_buffer32 = av_malloc_array((fs->width + 6), 3 * MAX_PLANES * |
|
|
fs->sample_buffer32 = av_malloc_array((fs->width + 6), 3 * MAX_PLANES * |
|
|
sizeof(*fs->sample_buffer32)); |
|
|
sizeof(*fs->sample_buffer32)); |
|
|
if (!fs->sample_buffer || !fs->sample_buffer32) { |
|
|
|
|
|
av_freep(&fs->sample_buffer); |
|
|
|
|
|
av_freep(&fs->sample_buffer32); |
|
|
|
|
|
av_freep(&f->slice_context[i]); |
|
|
|
|
|
|
|
|
if (!fs->sample_buffer || !fs->sample_buffer32) |
|
|
goto memfail; |
|
|
goto memfail; |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
f->max_slice_count = max_slice_count; |
|
|
f->max_slice_count = max_slice_count; |
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
|
|
|
memfail: |
|
|
memfail: |
|
|
while(--i >= 0) { |
|
|
|
|
|
av_freep(&f->slice_context[i]->sample_buffer); |
|
|
|
|
|
av_freep(&f->slice_context[i]->sample_buffer32); |
|
|
|
|
|
av_freep(&f->slice_context[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
f->max_slice_count = i; |
|
|
return AVERROR(ENOMEM); |
|
|
return AVERROR(ENOMEM); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|