[FFmpeg-cvslog] avcodec/ffv1: Store and reuse sx/sy

Michael Niedermayer git at videolan.org
Tue Oct 1 22:27:48 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Oct  7 01:43:42 2023 +0200| [7151081e33425010a53c7573e84b274c68ad8087] | committer: Michael Niedermayer

avcodec/ffv1: Store and reuse sx/sy

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7151081e33425010a53c7573e84b274c68ad8087
---

 libavcodec/ffv1.c    | 2 ++
 libavcodec/ffv1.h    | 1 +
 libavcodec/ffv1enc.c | 4 ++--
 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++) {



More information about the ffmpeg-cvslog mailing list