Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/dnxhdenc.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * VC3/DNxHD encoder 2 * VC3/DNxHD encoder
3 * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com> 3 * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
4 * 4 *
5 * VC-3 encoder funded by the British Broadcasting Corporation 5 * VC-3 encoder funded by the British Broadcasting Corporation
6 * 6 *
7 * This file is part of FFmpeg. 7 * This file is part of FFmpeg.
8 * 8 *
9 * FFmpeg is free software; you can redistribute it and/or 9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ctx->m.q_intra_matrix = ctx->qmatrix_l; 391 ctx->m.q_intra_matrix = ctx->qmatrix_l;
392 return 0; 392 return 0;
393 } 393 }
394 } 394 }
395 395
396 static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i nt threadnr) 396 static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i nt threadnr)
397 { 397 {
398 DNXHDEncContext *ctx = avctx->priv_data; 398 DNXHDEncContext *ctx = avctx->priv_data;
399 int mb_y = jobnr, mb_x; 399 int mb_y = jobnr, mb_x;
400 int qscale = ctx->qscale; 400 int qscale = ctx->qscale;
401 LOCAL_ALIGNED_16(DCTELEM, block, [64]);
401 ctx = ctx->thread[threadnr]; 402 ctx = ctx->thread[threadnr];
402 403
403 ctx->m.last_dc[0] = 404 ctx->m.last_dc[0] =
404 ctx->m.last_dc[1] = 405 ctx->m.last_dc[1] =
405 ctx->m.last_dc[2] = 1024; 406 ctx->m.last_dc[2] = 1024;
406 407
407 for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) { 408 for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
408 unsigned mb = mb_y * ctx->m.mb_width + mb_x; 409 unsigned mb = mb_y * ctx->m.mb_width + mb_x;
409 int ssd = 0; 410 int ssd = 0;
410 int ac_bits = 0; 411 int ac_bits = 0;
411 int dc_bits = 0; 412 int dc_bits = 0;
412 int i; 413 int i;
413 414
414 dnxhd_get_blocks(ctx, mb_x, mb_y); 415 dnxhd_get_blocks(ctx, mb_x, mb_y);
415 416
416 for (i = 0; i < 8; i++) { 417 for (i = 0; i < 8; i++) {
417 DECLARE_ALIGNED_16(DCTELEM, block)[64];
418 DCTELEM *src_block = ctx->blocks[i]; 418 DCTELEM *src_block = ctx->blocks[i];
419 int overflow, nbits, diff, last_index; 419 int overflow, nbits, diff, last_index;
420 int n = dnxhd_switch_matrix(ctx, i); 420 int n = dnxhd_switch_matrix(ctx, i);
421 421
422 memcpy(block, src_block, sizeof(block)); 422 memcpy(block, src_block, 64*sizeof(*block));
423 last_index = ctx->m.dct_quantize((MpegEncContext*)ctx, block, i, qsc ale, &overflow); 423 last_index = ctx->m.dct_quantize((MpegEncContext*)ctx, block, i, qsc ale, &overflow);
424 ac_bits += dnxhd_calc_ac_bits(ctx, block, last_index); 424 ac_bits += dnxhd_calc_ac_bits(ctx, block, last_index);
425 425
426 diff = block[0] - ctx->m.last_dc[n]; 426 diff = block[0] - ctx->m.last_dc[n];
427 if (diff < 0) nbits = av_log2_16bit(-2*diff); 427 if (diff < 0) nbits = av_log2_16bit(-2*diff);
428 else nbits = av_log2_16bit( 2*diff); 428 else nbits = av_log2_16bit( 2*diff);
429 dc_bits += ctx->cid_table->dc_bits[nbits] + nbits; 429 dc_bits += ctx->cid_table->dc_bits[nbits] + nbits;
430 430
431 ctx->m.last_dc[n] = block[0]; 431 ctx->m.last_dc[n] = block[0];
432 432
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 "dnxhd", 852 "dnxhd",
853 CODEC_TYPE_VIDEO, 853 CODEC_TYPE_VIDEO,
854 CODEC_ID_DNXHD, 854 CODEC_ID_DNXHD,
855 sizeof(DNXHDEncContext), 855 sizeof(DNXHDEncContext),
856 dnxhd_encode_init, 856 dnxhd_encode_init,
857 dnxhd_encode_picture, 857 dnxhd_encode_picture,
858 dnxhd_encode_end, 858 dnxhd_encode_end,
859 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE}, 859 .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
860 .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), 860 .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
861 }; 861 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698