aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-10-07 01:43:42 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-10-01 19:22:35 +0200
commit7151081e33425010a53c7573e84b274c68ad8087 (patch)
treedf0ee22a8ec98e838c5ce54a3911e2864e9540c1
parent7d514655bfa47c6e5cc1b81fbba8e750e368036e (diff)
downloadffmpeg-7151081e33425010a53c7573e84b274c68ad8087.tar.gz
avcodec/ffv1: Store and reuse sx/sy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffv1.c2
-rw-r--r--libavcodec/ffv1.h1
-rw-r--r--libavcodec/ffv1enc.c4
3 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 333fb3d79b..56a36e479f 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -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));
diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 9aa0452922..a35197964e 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -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;
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index a216fb04c7..266ef13b24 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -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++) {