avcodec/ffv1: Store and reuse sx/sy

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7151081e33)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2023-10-07 01:43:42 +02:00
parent 811fce437e
commit 76ddc3f1e1
3 changed files with 5 additions and 2 deletions

View File

@@ -144,6 +144,8 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
sc->slice_height = sye - sys;
sc->slice_x = sxs;
sc->slice_y = sys;
sc->sx = sx;
sc->sy = sy;
sc->sample_buffer = av_malloc_array((f->width + 6), 3 * MAX_PLANES *
sizeof(*sc->sample_buffer));

View File

@@ -75,6 +75,7 @@ typedef struct FFV1SliceContext {
int slice_height;
int slice_x;
int slice_y;
int sx, sy;
int run_index;
int slice_coding_mode;

View File

@@ -923,8 +923,8 @@ static void encode_slice_header(FFV1Context *f, FFV1SliceContext *sc)
int j;
memset(state, 128, sizeof(state));
put_symbol(c, state, (sc->slice_x +1)*f->num_h_slices / f->width , 0);
put_symbol(c, state, (sc->slice_y +1)*f->num_v_slices / f->height , 0);
put_symbol(c, state, sc->sx, 0);
put_symbol(c, state, sc->sy, 0);
put_symbol(c, state, 0, 0);
put_symbol(c, state, 0, 0);
for (j=0; j<f->plane_count; j++) {