diff mbox series

[v2,04/23] media: h264: Avoid wrapping long_term_frame_idx

Message ID 20220331193726.289559-5-nicolas.dufresne@collabora.com (mailing list archive)
State New, archived
Headers show
Series [v2,01/23] media: doc: Document dual use of H.264 pic_num/frame_num | expand

Commit Message

Nicolas Dufresne March 31, 2022, 7:37 p.m. UTC
For long term references, frame_num is set to long_term_frame_idx which
does not require wrapping. This is fixed by observation, no directly
related issue have been found yet.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>
---
 drivers/media/v4l2-core/v4l2-h264.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ezequiel Garcia April 2, 2022, 11:01 a.m. UTC | #1
On Thu, Mar 31, 2022 at 03:37:06PM -0400, Nicolas Dufresne wrote:
> For long term references, frame_num is set to long_term_frame_idx which
> does not require wrapping. This is fixed by observation, no directly
> related issue have been found yet.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>

Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

> ---
>  drivers/media/v4l2-core/v4l2-h264.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
> index 5633a242520a..ac47519a9fbe 100644
> --- a/drivers/media/v4l2-core/v4l2-h264.c
> +++ b/drivers/media/v4l2-core/v4l2-h264.c
> @@ -57,8 +57,10 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b,
>  		 * '8.2.4.1 Decoding process for picture numbers' of the spec.
>  		 * TODO: This logic will have to be adjusted when we start
>  		 * supporting interlaced content.
> +		 * For long term references, frame_num is set to
> +		 * long_term_frame_idx which requires no wrapping.
>  		 */
> -		if (dpb[i].frame_num > cur_frame_num)
> +		if (!b->refs[i].longterm && dpb[i].frame_num > cur_frame_num)
>  			b->refs[i].frame_num = (int)dpb[i].frame_num -
>  					       max_frame_num;
>  		else
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
index 5633a242520a..ac47519a9fbe 100644
--- a/drivers/media/v4l2-core/v4l2-h264.c
+++ b/drivers/media/v4l2-core/v4l2-h264.c
@@ -57,8 +57,10 @@  v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b,
 		 * '8.2.4.1 Decoding process for picture numbers' of the spec.
 		 * TODO: This logic will have to be adjusted when we start
 		 * supporting interlaced content.
+		 * For long term references, frame_num is set to
+		 * long_term_frame_idx which requires no wrapping.
 		 */
-		if (dpb[i].frame_num > cur_frame_num)
+		if (!b->refs[i].longterm && dpb[i].frame_num > cur_frame_num)
 			b->refs[i].frame_num = (int)dpb[i].frame_num -
 					       max_frame_num;
 		else