diff mbox series

[FFmpeg-devel,10/35] avcodec/proresenc_kostya: simplify quantization matrix bytestream writing

Message ID 20231211014429.1841681-11-u@pkh.me
State Accepted
Commit d6e0fb7c928cf818d67a0b2af571c0b89d6f6704
Headers show
Series [FFmpeg-devel,01/35] avcodec/proresenc_kostya: remove an unnecessary parenthesis level in MAKE_CODE() macro | expand

Commit Message

Clément Bœsch Dec. 11, 2023, 1:35 a.m. UTC
---
 libavcodec/proresenc_kostya.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Stefano Sabatini Dec. 17, 2023, 6:18 p.m. UTC | #1
On date Monday 2023-12-11 02:35:11 +0100, Clément Bœsch wrote:
> ---
>  libavcodec/proresenc_kostya.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
> index 103051830a..e0aa7cf47a 100644
> --- a/libavcodec/proresenc_kostya.c
> +++ b/libavcodec/proresenc_kostya.c
> @@ -1014,12 +1014,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      bytestream_put_byte  (&buf, 0);             // reserved
>      if (ctx->quant_sel != QUANT_MAT_DEFAULT) {
>          bytestream_put_byte  (&buf, 0x03);      // matrix flags - both matrices are present
> -        // luma quantisation matrix
> -        for (i = 0; i < 64; i++)
> -            bytestream_put_byte(&buf, ctx->quant_mat[i]);
> -        // chroma quantisation matrix
> -        for (i = 0; i < 64; i++)
> -            bytestream_put_byte(&buf, ctx->quant_chroma_mat[i]);
> +        bytestream_put_buffer(&buf, ctx->quant_mat, 64);        // luma quantisation matrix
> +        bytestream_put_buffer(&buf, ctx->quant_chroma_mat, 64); // chroma quantisation matrix
>      } else {
>          bytestream_put_byte  (&buf, 0x00);      // matrix flags - default matrices are used
>      }

LGTM.
diff mbox series

Patch

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 103051830a..e0aa7cf47a 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1014,12 +1014,8 @@  static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     bytestream_put_byte  (&buf, 0);             // reserved
     if (ctx->quant_sel != QUANT_MAT_DEFAULT) {
         bytestream_put_byte  (&buf, 0x03);      // matrix flags - both matrices are present
-        // luma quantisation matrix
-        for (i = 0; i < 64; i++)
-            bytestream_put_byte(&buf, ctx->quant_mat[i]);
-        // chroma quantisation matrix
-        for (i = 0; i < 64; i++)
-            bytestream_put_byte(&buf, ctx->quant_chroma_mat[i]);
+        bytestream_put_buffer(&buf, ctx->quant_mat, 64);        // luma quantisation matrix
+        bytestream_put_buffer(&buf, ctx->quant_chroma_mat, 64); // chroma quantisation matrix
     } else {
         bytestream_put_byte  (&buf, 0x00);      // matrix flags - default matrices are used
     }