[FFmpeg-devel] FW: [PATCH] 10-bit DNxHD decoding and encoding
Michael Niedermayer
michaelni at gmx.at
Sat Jun 11 01:39:16 CEST 2011
On Thu, Mar 31, 2011 at 01:37:09PM +0000, Joseph Artsimovich wrote:
> Michael Niedermayer wrote:
>
> > the current SCALE() macro seems fine to me with
> >
> > av_always_inline void ff_faandct_impl(DCTELEM* data, float const*
> > postscale)
>
> Done. My updated patch set is attached. The renaming patch didn't change.
thx, a few comments below, also ive attached 2 patches that make 2
much faster idcts 10bit capable.
if you could change them into proper 2x compiled #included files
instead of hardcoding 10 then i could apply them
also are you planing to work on/maintain this after its in git ?
[...]
> @@ -166,10 +211,22 @@ static int dnxhd_init_rc(DNXHDEncContext *ctx)
> static int dnxhd_encode_init(AVCodecContext *avctx)
> {
> DNXHDEncContext *ctx = avctx->priv_data;
> - int i, index;
> + int i, index, bit_depth;
> +
> + switch (avctx->pix_fmt) {
> + case PIX_FMT_YUV422P:
> + bit_depth = 8;
> + break;
> + case PIX_FMT_YUV422P16:
> + bit_depth = 10;
the indention here is bad its unreadable
[...]
> + if (ctx->cid_table->bit_depth == 8) {
> + uint8_t *pix = ctx->thread[0]->src[0] + ((mb_y<<4) * ctx->m.linesize);
> + for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x, pix += 16) {
> + unsigned mb = mb_y * ctx->m.mb_width + mb_x;
> + int sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
> + int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)(sum*sum))>>8)+128)>>8;
> + ctx->mb_cmp[mb].value = varc;
> + ctx->mb_cmp[mb].mb = mb;
> + }
> + } else { // 10-bit
> + int const linesize = (ctx->m.linesize >> 1);
> + for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x) {
> + uint16_t *pix = (uint16_t*)ctx->thread[0]->src[0] + ((mb_y<<4) * linesize) + (mb_x << 4);
> + unsigned mb = mb_y * ctx->m.mb_width + mb_x;
> + int sum = 0;
> + int sqsum = 0;
> + int mean, sqmean;
> + // Macroblocks are 16x16 pixels, unlike DCT blocks which are 8x8.
> + for (int i = 0; i < 16; ++i) {
putting the int in there like this fails on gcc 2.95 IIRC
[...]
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 9255fa8..3f46033 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -3725,9 +3725,14 @@ int dct_quantize_c(MpegEncContext *s,
> else
> q = s->c_dc_scale;
> q = q << 3;
> - } else
> + } else {
> /* For AIC we skip quant/dequant of INTRADC */
> - q = 1 << 3;
> + if (s->dsp.fdct == ff_faandct_10bit_safe) {
it would be cleaner if there was some field that simply contained the
number of bits
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-simple_idct_mmx-10bit-support.patch
Type: text/x-patch
Size: 10636 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110611/bd18ff57/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-idct_sse2_xvid-10bit-support.patch
Type: text/x-patch
Size: 4943 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110611/bd18ff57/attachment-0001.bin>
-------------- 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/bd18ff57/attachment.asc>
More information about the ffmpeg-devel
mailing list