diff mbox series

[FFmpeg-devel] avcodec/mpegvideo_enc: Fix 1 line and one column images

Message ID 20240408164900.7685-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/mpegvideo_enc: Fix 1 line and one column images | 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

Michael Niedermayer April 8, 2024, 4:49 p.m. UTC
Fixes: Ticket10952
Fixes: poc21ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mpegvideo_enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul B Mahol April 8, 2024, 5:57 p.m. UTC | #1
On Mon, Apr 8, 2024 at 6:49 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: Ticket10952
> Fixes: poc21ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mpegvideo_enc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index d1b19178247..40844b2f682 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1199,8 +1199,8 @@ static int load_input_picture(MpegEncContext *s,
> const AVFrame *pic_arg)
>                  ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
>                  int h_shift = i ? s->chroma_x_shift : 0;
>                  int v_shift = i ? s->chroma_y_shift : 0;
> -                int w = s->width  >> h_shift;
> -                int h = s->height >> v_shift;
> +                int w = -((-s->width)  >> h_shift);
> +                int h = -((-s->height) >> v_shift);
>                  const uint8_t *src = pic_arg->data[i];
>                  uint8_t *dst = pic->f->data[i];
>                  int vpad = 16;
>

What that does? Its not same as aligned rshift macro?


> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Andreas Rheinhardt April 8, 2024, 6 p.m. UTC | #2
Paul B Mahol:
> On Mon, Apr 8, 2024 at 6:49 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
>> Fixes: Ticket10952
>> Fixes: poc21ffmpeg
>> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>> ---
>>  libavcodec/mpegvideo_enc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
>> index d1b19178247..40844b2f682 100644
>> --- a/libavcodec/mpegvideo_enc.c
>> +++ b/libavcodec/mpegvideo_enc.c
>> @@ -1199,8 +1199,8 @@ static int load_input_picture(MpegEncContext *s,
>> const AVFrame *pic_arg)
>>                  ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
>>                  int h_shift = i ? s->chroma_x_shift : 0;
>>                  int v_shift = i ? s->chroma_y_shift : 0;
>> -                int w = s->width  >> h_shift;
>> -                int h = s->height >> v_shift;
>> +                int w = -((-s->width)  >> h_shift);
>> +                int h = -((-s->height) >> v_shift);
>>                  const uint8_t *src = pic_arg->data[i];
>>                  uint8_t *dst = pic->f->data[i];
>>                  int vpad = 16;
>>
> 
> What that does? Its not same as aligned rshift macro?
> 

It is the same, just more complicated. And maybe with more instructions.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index d1b19178247..40844b2f682 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1199,8 +1199,8 @@  static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
                 ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
                 int h_shift = i ? s->chroma_x_shift : 0;
                 int v_shift = i ? s->chroma_y_shift : 0;
-                int w = s->width  >> h_shift;
-                int h = s->height >> v_shift;
+                int w = -((-s->width)  >> h_shift);
+                int h = -((-s->height) >> v_shift);
                 const uint8_t *src = pic_arg->data[i];
                 uint8_t *dst = pic->f->data[i];
                 int vpad = 16;