diff mbox series

[FFmpeg-devel] lead: support unaligned blocks

Message ID d5fa98d7b16f69f132077ba8ec48471f2a1bc4ca.1699749612.git.pross@xvid.org
State New
Headers show
Series [FFmpeg-devel] lead: support unaligned blocks | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Peter Ross Nov. 12, 2023, 12:40 a.m. UTC
Fixed ticket #10656.
---
 libavcodec/leaddec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Peter Ross Feb. 15, 2024, 8:17 a.m. UTC | #1
On Sun, Nov 12, 2023 at 11:40:26AM +1100, Peter Ross wrote:
> Fixed ticket #10656.
> ---
>  libavcodec/leaddec.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c
> index ede52fba5a..fd2018256d 100644
> --- a/libavcodec/leaddec.c
> +++ b/libavcodec/leaddec.c
> @@ -192,8 +192,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
>      init_get_bits8(&gb, s->bitstream_buf, size);
>  
>      if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
> -        for (int mb_y = 0; mb_y < avctx->height / 16; mb_y++)
> -            for (int mb_x = 0; mb_x < avctx->width / 16; mb_x++)
> +        for (int mb_y = 0; mb_y < (avctx->height + 15) / 16; mb_y++)
> +            for (int mb_x = 0; mb_x < (avctx->width + 15) / 16; mb_x++)
>                  for (int b = 0; b < (yuv20p_half ? 4 : 6); b++) {
>                      int luma_block = yuv20p_half ? 2 : 4;
>                      const VLCElem * dc_vlc = b < luma_block ? luma_dc_vlc.table : chroma_dc_vlc.table;
> @@ -225,8 +225,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
>                  }
>      } else {
>          for (int f = 0; f < fields; f++)
> -            for (int j = 0; j < avctx->height / fields / 8; j++)
> -                for (int i = 0; i < avctx->width / 8; i++)
> +            for (int j = 0; j < (avctx->height + 7) / fields / 8; j++)
> +                for (int i = 0; i < (avctx->width + 7) / 8; i++)
>                      for (int plane = 0; plane < 3; plane++) {
>                          const VLCElem * dc_vlc = !plane ? luma_dc_vlc.table : chroma_dc_vlc.table;
>                          int dc_bits            = !plane ? LUMA_DC_BITS : CHROMA_DC_BITS;
> -- 
> 2.42.0

clearing out my patch queue.

posted to ml nov 2023.

will apply in a few days.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
diff mbox series

Patch

diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c
index ede52fba5a..fd2018256d 100644
--- a/libavcodec/leaddec.c
+++ b/libavcodec/leaddec.c
@@ -192,8 +192,8 @@  static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
     init_get_bits8(&gb, s->bitstream_buf, size);
 
     if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
-        for (int mb_y = 0; mb_y < avctx->height / 16; mb_y++)
-            for (int mb_x = 0; mb_x < avctx->width / 16; mb_x++)
+        for (int mb_y = 0; mb_y < (avctx->height + 15) / 16; mb_y++)
+            for (int mb_x = 0; mb_x < (avctx->width + 15) / 16; mb_x++)
                 for (int b = 0; b < (yuv20p_half ? 4 : 6); b++) {
                     int luma_block = yuv20p_half ? 2 : 4;
                     const VLCElem * dc_vlc = b < luma_block ? luma_dc_vlc.table : chroma_dc_vlc.table;
@@ -225,8 +225,8 @@  static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
                 }
     } else {
         for (int f = 0; f < fields; f++)
-            for (int j = 0; j < avctx->height / fields / 8; j++)
-                for (int i = 0; i < avctx->width / 8; i++)
+            for (int j = 0; j < (avctx->height + 7) / fields / 8; j++)
+                for (int i = 0; i < (avctx->width + 7) / 8; i++)
                     for (int plane = 0; plane < 3; plane++) {
                         const VLCElem * dc_vlc = !plane ? luma_dc_vlc.table : chroma_dc_vlc.table;
                         int dc_bits            = !plane ? LUMA_DC_BITS : CHROMA_DC_BITS;