Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes
@ 2022-03-08 13:55 James Almer
  2022-03-15  8:53 ` Anton Khirnov
  0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2022-03-08 13:55 UTC (permalink / raw)
  To: ffmpeg-devel

Use the actual plane sizes instead.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/hevc_refs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 35b8e5e696..fe18ca2b1d 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -401,9 +401,9 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
 
     if (!s->avctx->hwaccel) {
         if (!s->ps.sps->pixel_shift) {
-            for (i = 0; frame->frame->buf[i]; i++)
-                memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1),
-                       frame->frame->buf[i]->size);
+            for (i = 0; frame->frame->data[i]; i++)
+                memset(frame->frame->data[i], 1 << (s->ps.sps->bit_depth - 1),
+                       frame->frame->linesize[i] * AV_CEIL_RSHIFT(s->ps.sps->height, s->ps.sps->vshift[i]));
         } else {
             for (i = 0; frame->frame->data[i]; i++)
                 for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++) {
-- 
2.35.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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes
  2022-03-08 13:55 [FFmpeg-devel] [PATCH v2] avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes James Almer
@ 2022-03-15  8:53 ` Anton Khirnov
  2022-03-15 21:18   ` James Almer
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Khirnov @ 2022-03-15  8:53 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting James Almer (2022-03-08 14:55:00)
> Use the actual plane sizes instead.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/hevc_refs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
> index 35b8e5e696..fe18ca2b1d 100644
> --- a/libavcodec/hevc_refs.c
> +++ b/libavcodec/hevc_refs.c
> @@ -401,9 +401,9 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
>  
>      if (!s->avctx->hwaccel) {
>          if (!s->ps.sps->pixel_shift) {
> -            for (i = 0; frame->frame->buf[i]; i++)
> -                memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1),
> -                       frame->frame->buf[i]->size);
> +            for (i = 0; frame->frame->data[i]; i++)
> +                memset(frame->frame->data[i], 1 << (s->ps.sps->bit_depth - 1),
> +                       frame->frame->linesize[i] * AV_CEIL_RSHIFT(s->ps.sps->height, s->ps.sps->vshift[i]));

Looks good.

-- 
Anton Khirnov
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes
  2022-03-15  8:53 ` Anton Khirnov
@ 2022-03-15 21:18   ` James Almer
  0 siblings, 0 replies; 3+ messages in thread
From: James Almer @ 2022-03-15 21:18 UTC (permalink / raw)
  To: ffmpeg-devel

On 3/15/2022 5:53 AM, Anton Khirnov wrote:
> Quoting James Almer (2022-03-08 14:55:00)
>> Use the actual plane sizes instead.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/hevc_refs.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
>> index 35b8e5e696..fe18ca2b1d 100644
>> --- a/libavcodec/hevc_refs.c
>> +++ b/libavcodec/hevc_refs.c
>> @@ -401,9 +401,9 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
>>   
>>       if (!s->avctx->hwaccel) {
>>           if (!s->ps.sps->pixel_shift) {
>> -            for (i = 0; frame->frame->buf[i]; i++)
>> -                memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1),
>> -                       frame->frame->buf[i]->size);
>> +            for (i = 0; frame->frame->data[i]; i++)
>> +                memset(frame->frame->data[i], 1 << (s->ps.sps->bit_depth - 1),
>> +                       frame->frame->linesize[i] * AV_CEIL_RSHIFT(s->ps.sps->height, s->ps.sps->vshift[i]));
> 
> Looks good.

Applied, thanks.
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-15 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 13:55 [FFmpeg-devel] [PATCH v2] avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing planes James Almer
2022-03-15  8:53 ` Anton Khirnov
2022-03-15 21:18   ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git