Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Cc: "nowrep@gmail.com" <nowrep@gmail.com>
Subject: Re: [FFmpeg-devel] [PATCH v2] vaapi_encode_h264: Only set pic_order_cnt_type to 0 with B-frames
Date: Mon, 16 Jan 2023 04:19:13 +0000
Message-ID: <b719f734819590bc2254047933f188f230360b36.camel@intel.com> (raw)
In-Reply-To: <20230110081723.83586-1-nowrep@gmail.com>

On Di, 2023-01-10 at 09:17 +0100, David Rosca wrote:
> v2: frame_num steps by 2
> 
> ---
>  libavcodec/vaapi_encode_h264.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
> index 7a6b54ab6f..8093c47179 100644
> --- a/libavcodec/vaapi_encode_h264.c
> +++ b/libavcodec/vaapi_encode_h264.c
> @@ -349,7 +349,7 @@ static int
> vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
>      sps->chroma_format_idc    = 1;
>  
>      sps->log2_max_frame_num_minus4 = 4;
> -    sps->pic_order_cnt_type        = 0;
> +    sps->pic_order_cnt_type        = ctx->max_b_depth ? 0 : 2;
>      sps->log2_max_pic_order_cnt_lsb_minus4 = 4;
>  
>      sps->max_num_ref_frames = priv->dpb_frames;
> @@ -621,7 +621,10 @@ static int
> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
>      } else {
>          av_assert0(prev);
>  
> -        hpic->frame_num = hprev->frame_num + prev->is_reference;
> +        hpic->frame_num = hprev->frame_num;
> +        if (prev->is_reference) {
> +            hpic->frame_num += ctx->max_b_depth ? 1 : 2;
> +        }
>  
>          hpic->last_idr_frame = hprev->last_idr_frame;
>          hpic->idr_pic_id     = hprev->idr_pic_id;

The coded stream is probably corrupted on Intel's Tiger Lake after applying this
change.

$ ffmpeg -y -init_hw_device vaapi=va:/dev/dri/renderD128 -f lavfi -i testsrc -vf
"format=nv12,hwupload" -bf 0 -c:v h264_vaapi -vframes 100 out.h264

$ ffprobe out.h264
......
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one
[h264 @ 0x55cc3d7dc200] mmco: unref short failure
[h264 @ 0x55cc3d7dc200] number of reference frames (0+2) exceeds max (1;
probably corrupt input), discarding one

Thanks
Haihao

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

      reply	other threads:[~2023-01-16  4:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10  8:17 David Rosca
2023-01-16  4:19 ` Xiang, Haihao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b719f734819590bc2254047933f188f230360b36.camel@intel.com \
    --to=haihao.xiang-at-intel.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=nowrep@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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