[FFmpeg-devel] [PATCH] DNxHD 10-bit support v5
Michael Niedermayer
michaelni at gmx.at
Sat Jun 11 01:57:01 CEST 2011
On Thu, Jun 09, 2011 at 02:18:29PM +0000, Joseph Artsimovich wrote:
> Hi,
>
> After being distracted by other things for a while, I am back trying to get my 10-bit DNxHD patches accepted.
> I've prepared a new version of my patches. This one is much less intrusive than the previous ones. In particular, it touches neither MpegEncContext nor DSPContext. Please review.
>
> Apply the renaming patch first, then the other one.
[...]
> +static int dnxhd_10bit_dct_quantize(struct DNXHDEncContext *ctx, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow)
> +{
> + const uint8_t *scantable= ctx->m.intra_scantable.scantable;
> + const int *qmat = ctx->m.q_intra_matrix[qscale];
> + int last_non_zero = 0;
> +
> + ff_faandct_10bit_safe(block);
> +
> + // Divide by 4 with rounding, to compensate scaling of DCT coefficients done by ff_faandct_10bit_safe().
> + block[0] = (block[0] + 2) >> 2;
> +
> + for (int i = 1; i < 64; ++i) {
> + int j = scantable[i];
> + int unquantized = block[j];
> + int quantized = abs(unquantized * qmat[j]) >> DNX10BIT_QMAT_SHIFT;
> + if (unquantized < 0) {
> + quantized = -quantized;
> + }
it might make sense to do the abs first then check against a threshold
so the multiply & shift is only done when the value isnt going to be
0 anyway. 0 is the most common value
so this may be faster
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is not what we do, but why we do it that matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110611/121fc280/attachment.asc>
More information about the ffmpeg-devel
mailing list