diff mbox series

[FFmpeg-devel,v2,07/14] avfilter/vf_spp: Add dummy element to array to avoid shift

Message ID AM7PR03MB6660972CD794AAB46863BF598FD99@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit e424d1f557271d506336345b9b3da0a20ef3eaf3
Headers show
Series [FFmpeg-devel,v2,01/14] avfilter/vsrc_testsrc: Deduplicate AVClasses | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 13, 2021, 11:23 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/vf_spp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer Sept. 14, 2021, 4:34 p.m. UTC | #1
On Tue, Sep 14, 2021 at 01:23:32AM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavfilter/vf_spp.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

ok

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 6c15dbaf66..b9b5f7bc78 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -93,7 +93,8 @@  DECLARE_ALIGNED(8, static const uint8_t, ldither)[8][8] = {
     { 42,  26,  38,  22,  41,  25,  37,  21 },
 };
 
-static const uint8_t offset[127][2] = {
+static const uint8_t offset[128][2] = {
+    {0,0},                                                  // unused
     {0,0},
     {0,0}, {4,4},                                           // quality = 1
     {0,0}, {2,2}, {6,4}, {4,6},                             // quality = 2
@@ -283,8 +284,8 @@  static void filter(SPPContext *p, uint8_t *dst, uint8_t *src,
                 qp = FFMAX(1, ff_norm_qscale(qp, p->qscale_type));
             }
             for (i = 0; i < count; i++) {
-                const int x1 = x + offset[i + count - 1][0];
-                const int y1 = y + offset[i + count - 1][1];
+                const int x1 = x + offset[i + count][0];
+                const int y1 = y + offset[i + count][1];
                 const int index = x1 + y1*linesize;
                 p->dct->get_pixels_unaligned(block, p->src + sample_bytes*index, sample_bytes*linesize);
                 p->dct->fdct(block);