From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/svq1enc: Inline constants
Date: Thu, 13 Oct 2022 19:25:58 +0200
Message-ID: <AS8P250MB0744209D343AD3F23E8C8DF78F259@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB07447D47B896E0C97810EADC8F239@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/svq1.h | 7 +++++++
> libavcodec/svq1enc.c | 13 +++++--------
> 2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/svq1.h b/libavcodec/svq1.h
> index 0ebc73a933..af8a7dfa04 100644
> --- a/libavcodec/svq1.h
> +++ b/libavcodec/svq1.h
> @@ -42,6 +42,13 @@
> #define SVQ1_BLOCK_INTER_4V 2
> #define SVQ1_BLOCK_INTRA 3
>
> +#define SVQ1_BLOCK_SKIP_CODE 1
> +#define SVQ1_BLOCK_SKIP_LEN 1
> +#define SVQ1_BLOCK_INTER_CODE 1
> +#define SVQ1_BLOCK_INTER_LEN 2
> +#define SVQ1_BLOCK_INTRA_CODE 0
> +#define SVQ1_BLOCK_INTRA_LEN 3
> +
> extern const int8_t *const ff_svq1_inter_codebooks[6];
> extern const int8_t *const ff_svq1_intra_codebooks[6];
>
> diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
> index ef6655c2f7..79e9e578ac 100644
> --- a/libavcodec/svq1enc.c
> +++ b/libavcodec/svq1enc.c
> @@ -390,9 +390,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
> init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i],
> 7 * 32);
> if (s->pict_type == AV_PICTURE_TYPE_P) {
> - const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
> - put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
> - score[0] = vlc[1] * lambda;
> + put_bits(&s->reorder_pb[5], SVQ1_BLOCK_INTRA_LEN, SVQ1_BLOCK_INTRA_CODE);
> + score[0] = SVQ1_BLOCK_INTRA_LEN * lambda;
> }
> score[0] += encode_block(s, src + 16 * x, NULL, temp, stride,
> 5, 64, lambda, 1);
> @@ -406,7 +405,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
> best = 0;
>
> if (s->pict_type == AV_PICTURE_TYPE_P) {
> - const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER];
> int mx, my, pred_x, pred_y, dxy;
> int16_t *motion_ptr;
>
> @@ -417,7 +415,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
> init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i],
> 7 * 32);
>
> - put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
> + put_bits(&s->reorder_pb[5], SVQ1_BLOCK_INTER_LEN, SVQ1_BLOCK_INTER_CODE);
>
> s->m.pb = s->reorder_pb[5];
> mx = motion_ptr[0];
> @@ -442,14 +440,13 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
> decoded, stride, 5, 64, lambda, 0);
> best = score[1] <= score[0];
>
> - vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
> score[2] = s->mecc.sse[0](NULL, src + 16 * x, ref,
> stride, 16);
> - score[2] += vlc[1] * lambda;
> + score[2] += SVQ1_BLOCK_SKIP_LEN * lambda;
> if (score[2] < score[best] && mx == 0 && my == 0) {
> best = 2;
> s->hdsp.put_pixels_tab[0][0](decoded, ref, stride, 16);
> - put_bits(&s->pb, vlc[1], vlc[0]);
> + put_bits(&s->pb, SVQ1_BLOCK_SKIP_LEN, SVQ1_BLOCK_SKIP_CODE);
> }
> }
>
Will apply this patchset tomorrow unless there are objections.
- Andreas
_______________________________________________
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".
prev parent reply other threads:[~2022-10-13 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 13:13 Andreas Rheinhardt
2022-10-11 13:18 ` [FFmpeg-devel] [PATCH 2/4] avcodec/svq1enc: Add SVQ1EncDSPContext, make codec context private Andreas Rheinhardt
2022-10-11 13:18 ` [FFmpeg-devel] [PATCH 3/4] avcodec/svq1: Set hidden visibility Andreas Rheinhardt
2022-10-11 13:18 ` [FFmpeg-devel] [PATCH 4/4] avcodec/svq1enc: Move PutBitContext from context to stack Andreas Rheinhardt
2022-10-13 17:25 ` Andreas Rheinhardt [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=AS8P250MB0744209D343AD3F23E8C8DF78F259@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/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