diff mbox series

[2/6] coda: Simplify H.264 small buffer padding logic

Message ID 20201006104414.67984-3-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show
Series CODA timeout fix & assorted changes | expand

Commit Message

Ezequiel Garcia Oct. 6, 2020, 10:44 a.m. UTC
The H.264 small buffer padding is done under
the (ctx->qsequence == 0 && payload < 512) condition.

Given this is the exact same condition immediately
above, we can move it right there, making the code
slightly clearer.

This change shouldn't affect functionality as it's just
cosmetics.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/media/platform/coda/coda-bit.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Philipp Zabel Oct. 6, 2020, 2:23 p.m. UTC | #1
On Tue, 2020-10-06 at 07:44 -0300, Ezequiel Garcia wrote:
> The H.264 small buffer padding is done under
> the (ctx->qsequence == 0 && payload < 512) condition.
> 
> Given this is the exact same condition immediately
> above, we can move it right there, making the code
> slightly clearer.
> 
> This change shouldn't affect functionality as it's just
> cosmetics.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/media/platform/coda/coda-bit.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
> index aa0a47c34413..659fcf77b0ed 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -293,12 +293,11 @@ static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
>  			coda_dbg(1, ctx,
>  				 "could not parse header, sequence initialization might fail\n");
>  		}
> -	}
>  
> -	/* Add padding before the first buffer, if it is too small */
> -	if (ctx->qsequence == 0 && payload < 512 &&
> -	    ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
> -		coda_h264_bitstream_pad(ctx, 512 - payload);
> +		/* Add padding before the first buffer, if it is too small */
> +		if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
> +			coda_h264_bitstream_pad(ctx, 512 - payload);
> +	}
>  
>  	ret = coda_bitstream_queue(ctx, vaddr, payload);
>  	if (ret < 0) {

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index aa0a47c34413..659fcf77b0ed 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -293,12 +293,11 @@  static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
 			coda_dbg(1, ctx,
 				 "could not parse header, sequence initialization might fail\n");
 		}
-	}
 
-	/* Add padding before the first buffer, if it is too small */
-	if (ctx->qsequence == 0 && payload < 512 &&
-	    ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
-		coda_h264_bitstream_pad(ctx, 512 - payload);
+		/* Add padding before the first buffer, if it is too small */
+		if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264)
+			coda_h264_bitstream_pad(ctx, 512 - payload);
+	}
 
 	ret = coda_bitstream_queue(ctx, vaddr, payload);
 	if (ret < 0) {