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

Side by Side Diff: source/libvpx/vpxenc.c

Issue 554673004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 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
« no previous file with comments | « source/libvpx/vpxdec.c ('k') | source/libvpx/y4minput.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 static const arg_def_t disable_warnings = 193 static const arg_def_t disable_warnings =
194 ARG_DEF(NULL, "disable-warnings", 0, 194 ARG_DEF(NULL, "disable-warnings", 0,
195 "Disable warnings about potentially incorrect encode settings."); 195 "Disable warnings about potentially incorrect encode settings.");
196 static const arg_def_t disable_warning_prompt = 196 static const arg_def_t disable_warning_prompt =
197 ARG_DEF("y", "disable-warning-prompt", 0, 197 ARG_DEF("y", "disable-warning-prompt", 0,
198 "Display warnings, but do not prompt user to continue."); 198 "Display warnings, but do not prompt user to continue.");
199 static const arg_def_t experimental_bitstream = 199 static const arg_def_t experimental_bitstream =
200 ARG_DEF(NULL, "experimental-bitstream", 0, 200 ARG_DEF(NULL, "experimental-bitstream", 0,
201 "Allow experimental bitstream features."); 201 "Allow experimental bitstream features.");
202 202
203 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
204 static const arg_def_t test16bitinternalarg = ARG_DEF(
205 NULL, "test-16bit-internal", 0, "Force use of 16 bit internal buffer");
206 #endif
203 207
204 static const arg_def_t *main_args[] = { 208 static const arg_def_t *main_args[] = {
205 &debugmode, 209 &debugmode,
206 &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &skip, 210 &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &skip,
207 &deadline, &best_dl, &good_dl, &rt_dl, 211 &deadline, &best_dl, &good_dl, &rt_dl,
208 &quietarg, &verbosearg, &psnrarg, &use_ivf, &out_part, &q_hist_n, 212 &quietarg, &verbosearg, &psnrarg, &use_ivf, &out_part, &q_hist_n,
209 &rate_hist_n, &disable_warnings, &disable_warning_prompt, 213 &rate_hist_n, &disable_warnings, &disable_warning_prompt,
210 NULL 214 NULL
211 }; 215 };
212 216
(...skipping 28 matching lines...) Expand all
241 245
242 static const arg_def_t *global_args[] = { 246 static const arg_def_t *global_args[] = {
243 &use_yv12, &use_i420, &use_i422, &use_i444, 247 &use_yv12, &use_i420, &use_i422, &use_i444,
244 &usage, &threads, &profile, 248 &usage, &threads, &profile,
245 &width, &height, 249 &width, &height,
246 #if CONFIG_WEBM_IO 250 #if CONFIG_WEBM_IO
247 &stereo_mode, 251 &stereo_mode,
248 #endif 252 #endif
249 &timebase, &framerate, 253 &timebase, &framerate,
250 &error_resilient, 254 &error_resilient,
255 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
256 &test16bitinternalarg,
257 #endif
251 &lag_in_frames, NULL 258 &lag_in_frames, NULL
252 }; 259 };
253 260
254 static const arg_def_t dropframe_thresh = ARG_DEF(NULL, "drop-frame", 1, 261 static const arg_def_t dropframe_thresh = ARG_DEF(NULL, "drop-frame", 1,
255 "Temporal resampling thresho ld (buf %)"); 262 "Temporal resampling thresho ld (buf %)");
256 static const arg_def_t resize_allowed = ARG_DEF(NULL, "resize-allowed", 1, 263 static const arg_def_t resize_allowed = ARG_DEF(NULL, "resize-allowed", 1,
257 "Spatial resampling enabled (bool)"); 264 "Spatial resampling enabled (bool)");
258 static const arg_def_t resize_width = ARG_DEF(NULL, "resize-width", 1, 265 static const arg_def_t resize_width = ARG_DEF(NULL, "resize-width", 1,
259 "Width of encoded frame"); 266 "Width of encoded frame");
260 static const arg_def_t resize_height = ARG_DEF(NULL, "resize-height", 1, 267 static const arg_def_t resize_height = ARG_DEF(NULL, "resize-height", 1,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 static const arg_def_t kf_disabled = ARG_DEF(NULL, "disable-kf", 0, 321 static const arg_def_t kf_disabled = ARG_DEF(NULL, "disable-kf", 0,
315 "Disable keyframe placement"); 322 "Disable keyframe placement");
316 static const arg_def_t *kf_args[] = { 323 static const arg_def_t *kf_args[] = {
317 &kf_min_dist, &kf_max_dist, &kf_disabled, NULL 324 &kf_min_dist, &kf_max_dist, &kf_disabled, NULL
318 }; 325 };
319 326
320 327
321 static const arg_def_t noise_sens = ARG_DEF(NULL, "noise-sensitivity", 1, 328 static const arg_def_t noise_sens = ARG_DEF(NULL, "noise-sensitivity", 1,
322 "Noise sensitivity (frames to blur)" ); 329 "Noise sensitivity (frames to blur)" );
323 static const arg_def_t sharpness = ARG_DEF(NULL, "sharpness", 1, 330 static const arg_def_t sharpness = ARG_DEF(NULL, "sharpness", 1,
324 "Filter sharpness (0-7)"); 331 "Loop filter sharpness (0..7)");
325 static const arg_def_t static_thresh = ARG_DEF(NULL, "static-thresh", 1, 332 static const arg_def_t static_thresh = ARG_DEF(NULL, "static-thresh", 1,
326 "Motion detection threshold"); 333 "Motion detection threshold");
327 static const arg_def_t cpu_used = ARG_DEF(NULL, "cpu-used", 1, 334 static const arg_def_t cpu_used = ARG_DEF(NULL, "cpu-used", 1,
328 "CPU Used (-16..16)"); 335 "CPU Used (-16..16)");
329 static const arg_def_t auto_altref = ARG_DEF(NULL, "auto-alt-ref", 1, 336 static const arg_def_t auto_altref = ARG_DEF(NULL, "auto-alt-ref", 1,
330 "Enable automatic alt reference fra mes"); 337 "Enable automatic alt reference fra mes");
331 static const arg_def_t arnr_maxframes = ARG_DEF(NULL, "arnr-maxframes", 1, 338 static const arg_def_t arnr_maxframes = ARG_DEF(NULL, "arnr-maxframes", 1,
332 "AltRef Max Frames"); 339 "AltRef max frames (0..15)");
333 static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1, 340 static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1,
334 "AltRef Strength"); 341 "AltRef filter strength (0..6)");
335 static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1, 342 static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1,
336 "AltRef Type"); 343 "AltRef type");
337 static const struct arg_enum_list tuning_enum[] = { 344 static const struct arg_enum_list tuning_enum[] = {
338 {"psnr", VP8_TUNE_PSNR}, 345 {"psnr", VP8_TUNE_PSNR},
339 {"ssim", VP8_TUNE_SSIM}, 346 {"ssim", VP8_TUNE_SSIM},
340 {NULL, 0} 347 {NULL, 0}
341 }; 348 };
342 static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1, 349 static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1,
343 "Material to favor", tuning_enum ); 350 "Material to favor", tuning_enum );
344 static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1, 351 static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1,
345 "Constant/Constrained Quality level"); 352 "Constant/Constrained Quality level");
346 static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1, 353 static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1,
(...skipping 24 matching lines...) Expand all
371 static const arg_def_t tile_rows = 378 static const arg_def_t tile_rows =
372 ARG_DEF(NULL, "tile-rows", 1, "Number of tile rows to use, log2"); 379 ARG_DEF(NULL, "tile-rows", 1, "Number of tile rows to use, log2");
373 static const arg_def_t lossless = ARG_DEF(NULL, "lossless", 1, "Lossless mode"); 380 static const arg_def_t lossless = ARG_DEF(NULL, "lossless", 1, "Lossless mode");
374 static const arg_def_t frame_parallel_decoding = ARG_DEF( 381 static const arg_def_t frame_parallel_decoding = ARG_DEF(
375 NULL, "frame-parallel", 1, "Enable frame parallel decodability features"); 382 NULL, "frame-parallel", 1, "Enable frame parallel decodability features");
376 static const arg_def_t aq_mode = ARG_DEF( 383 static const arg_def_t aq_mode = ARG_DEF(
377 NULL, "aq-mode", 1, 384 NULL, "aq-mode", 1,
378 "Adaptive quantization mode (0: off (default), 1: variance 2: complexity, " 385 "Adaptive quantization mode (0: off (default), 1: variance 2: complexity, "
379 "3: cyclic refresh)"); 386 "3: cyclic refresh)");
380 static const arg_def_t frame_periodic_boost = ARG_DEF( 387 static const arg_def_t frame_periodic_boost = ARG_DEF(
381 NULL, "frame_boost", 1, 388 NULL, "frame-boost", 1,
382 "Enable frame periodic boost (0: off (default), 1: on)"); 389 "Enable frame periodic boost (0: off (default), 1: on)");
383 390
391 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
392 static const struct arg_enum_list bitdepth_enum[] = {
393 {"8", VPX_BITS_8},
394 {"10", VPX_BITS_10},
395 {"12", VPX_BITS_12},
396 {NULL, 0}
397 };
398
399 static const arg_def_t bitdeptharg = ARG_DEF_ENUM("b", "bit-depth", 1,
400 "Bit depth for codec "
401 "(8 for version <=1, "
402 "10 or 12 for version 2)",
403 bitdepth_enum);
404 static const arg_def_t inbitdeptharg = ARG_DEF(NULL, "input-bit-depth", 1,
405 "Bit depth of input");
406 #endif
407
384 static const struct arg_enum_list tune_content_enum[] = { 408 static const struct arg_enum_list tune_content_enum[] = {
385 {"default", VP9E_CONTENT_DEFAULT}, 409 {"default", VP9E_CONTENT_DEFAULT},
386 {"screen", VP9E_CONTENT_SCREEN}, 410 {"screen", VP9E_CONTENT_SCREEN},
387 {NULL, 0} 411 {NULL, 0}
388 }; 412 };
389 413
390 static const arg_def_t tune_content = ARG_DEF_ENUM( 414 static const arg_def_t tune_content = ARG_DEF_ENUM(
391 NULL, "tune-content", 1, "Tune content type", tune_content_enum); 415 NULL, "tune-content", 1, "Tune content type", tune_content_enum);
392 416
393 static const arg_def_t *vp9_args[] = { 417 static const arg_def_t *vp9_args[] = {
394 &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh, 418 &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
395 &tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type, 419 &tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type,
396 &tune_ssim, &cq_level, &max_intra_rate_pct, &lossless, 420 &tune_ssim, &cq_level, &max_intra_rate_pct, &lossless,
397 &frame_parallel_decoding, &aq_mode, &frame_periodic_boost, &tune_content, 421 &frame_parallel_decoding, &aq_mode, &frame_periodic_boost, &tune_content,
422 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
423 &bitdeptharg, &inbitdeptharg,
424 #endif
398 NULL 425 NULL
399 }; 426 };
400 static const int vp9_arg_ctrl_map[] = { 427 static const int vp9_arg_ctrl_map[] = {
401 VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF, 428 VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF,
402 VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD, 429 VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
403 VP9E_SET_TILE_COLUMNS, VP9E_SET_TILE_ROWS, 430 VP9E_SET_TILE_COLUMNS, VP9E_SET_TILE_ROWS,
404 VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE, 431 VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
405 VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT, 432 VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
406 VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE, 433 VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE,
407 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_TUNE_CONTENT, 434 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_TUNE_CONTENT,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 for (i = 0; i < get_vpx_encoder_count(); ++i) { 470 for (i = 0; i < get_vpx_encoder_count(); ++i) {
444 const VpxInterface *const encoder = get_vpx_encoder_by_index(i); 471 const VpxInterface *const encoder = get_vpx_encoder_by_index(i);
445 fprintf(stderr, " %-6s - %s\n", 472 fprintf(stderr, " %-6s - %s\n",
446 encoder->name, vpx_codec_iface_name(encoder->codec_interface())); 473 encoder->name, vpx_codec_iface_name(encoder->codec_interface()));
447 } 474 }
448 475
449 exit(EXIT_FAILURE); 476 exit(EXIT_FAILURE);
450 } 477 }
451 478
452 #define mmin(a, b) ((a) < (b) ? (a) : (b)) 479 #define mmin(a, b) ((a) < (b) ? (a) : (b))
480
481 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
482 static void find_mismatch_high(const vpx_image_t *const img1,
483 const vpx_image_t *const img2,
484 int yloc[4], int uloc[4], int vloc[4]) {
485 uint16_t *plane1, *plane2;
486 uint32_t stride1, stride2;
487 const uint32_t bsize = 64;
488 const uint32_t bsizey = bsize >> img1->y_chroma_shift;
489 const uint32_t bsizex = bsize >> img1->x_chroma_shift;
490 const uint32_t c_w =
491 (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
492 const uint32_t c_h =
493 (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift;
494 int match = 1;
495 uint32_t i, j;
496 yloc[0] = yloc[1] = yloc[2] = yloc[3] = -1;
497 plane1 = (uint16_t*)img1->planes[VPX_PLANE_Y];
498 plane2 = (uint16_t*)img2->planes[VPX_PLANE_Y];
499 stride1 = img1->stride[VPX_PLANE_Y]/2;
500 stride2 = img2->stride[VPX_PLANE_Y]/2;
501 for (i = 0, match = 1; match && i < img1->d_h; i += bsize) {
502 for (j = 0; match && j < img1->d_w; j += bsize) {
503 int k, l;
504 const int si = mmin(i + bsize, img1->d_h) - i;
505 const int sj = mmin(j + bsize, img1->d_w) - j;
506 for (k = 0; match && k < si; ++k) {
507 for (l = 0; match && l < sj; ++l) {
508 if (*(plane1 + (i + k) * stride1 + j + l) !=
509 *(plane2 + (i + k) * stride2 + j + l)) {
510 yloc[0] = i + k;
511 yloc[1] = j + l;
512 yloc[2] = *(plane1 + (i + k) * stride1 + j + l);
513 yloc[3] = *(plane2 + (i + k) * stride2 + j + l);
514 match = 0;
515 break;
516 }
517 }
518 }
519 }
520 }
521
522 uloc[0] = uloc[1] = uloc[2] = uloc[3] = -1;
523 plane1 = (uint16_t*)img1->planes[VPX_PLANE_U];
524 plane2 = (uint16_t*)img2->planes[VPX_PLANE_U];
525 stride1 = img1->stride[VPX_PLANE_U]/2;
526 stride2 = img2->stride[VPX_PLANE_U]/2;
527 for (i = 0, match = 1; match && i < c_h; i += bsizey) {
528 for (j = 0; match && j < c_w; j += bsizex) {
529 int k, l;
530 const int si = mmin(i + bsizey, c_h - i);
531 const int sj = mmin(j + bsizex, c_w - j);
532 for (k = 0; match && k < si; ++k) {
533 for (l = 0; match && l < sj; ++l) {
534 if (*(plane1 + (i + k) * stride1 + j + l) !=
535 *(plane2 + (i + k) * stride2 + j + l)) {
536 uloc[0] = i + k;
537 uloc[1] = j + l;
538 uloc[2] = *(plane1 + (i + k) * stride1 + j + l);
539 uloc[3] = *(plane2 + (i + k) * stride2 + j + l);
540 match = 0;
541 break;
542 }
543 }
544 }
545 }
546 }
547
548 vloc[0] = vloc[1] = vloc[2] = vloc[3] = -1;
549 plane1 = (uint16_t*)img1->planes[VPX_PLANE_V];
550 plane2 = (uint16_t*)img2->planes[VPX_PLANE_V];
551 stride1 = img1->stride[VPX_PLANE_V]/2;
552 stride2 = img2->stride[VPX_PLANE_V]/2;
553 for (i = 0, match = 1; match && i < c_h; i += bsizey) {
554 for (j = 0; match && j < c_w; j += bsizex) {
555 int k, l;
556 const int si = mmin(i + bsizey, c_h - i);
557 const int sj = mmin(j + bsizex, c_w - j);
558 for (k = 0; match && k < si; ++k) {
559 for (l = 0; match && l < sj; ++l) {
560 if (*(plane1 + (i + k) * stride1 + j + l) !=
561 *(plane2 + (i + k) * stride2 + j + l)) {
562 vloc[0] = i + k;
563 vloc[1] = j + l;
564 vloc[2] = *(plane1 + (i + k) * stride1 + j + l);
565 vloc[3] = *(plane2 + (i + k) * stride2 + j + l);
566 match = 0;
567 break;
568 }
569 }
570 }
571 }
572 }
573 }
574 #endif
575
453 static void find_mismatch(const vpx_image_t *const img1, 576 static void find_mismatch(const vpx_image_t *const img1,
454 const vpx_image_t *const img2, 577 const vpx_image_t *const img2,
455 int yloc[4], int uloc[4], int vloc[4]) { 578 int yloc[4], int uloc[4], int vloc[4]) {
456 const uint32_t bsize = 64; 579 const uint32_t bsize = 64;
457 const uint32_t bsizey = bsize >> img1->y_chroma_shift; 580 const uint32_t bsizey = bsize >> img1->y_chroma_shift;
458 const uint32_t bsizex = bsize >> img1->x_chroma_shift; 581 const uint32_t bsizex = bsize >> img1->x_chroma_shift;
459 const uint32_t c_w = 582 const uint32_t c_w =
460 (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift; 583 (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
461 const uint32_t c_h = 584 const uint32_t c_h =
462 (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift; 585 (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 break; 658 break;
536 } 659 }
537 } 660 }
538 } 661 }
539 } 662 }
540 } 663 }
541 } 664 }
542 665
543 static int compare_img(const vpx_image_t *const img1, 666 static int compare_img(const vpx_image_t *const img1,
544 const vpx_image_t *const img2) { 667 const vpx_image_t *const img2) {
545 const uint32_t c_w = 668 uint32_t l_w = img1->d_w;
669 uint32_t c_w =
546 (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift; 670 (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
547 const uint32_t c_h = 671 const uint32_t c_h =
548 (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift; 672 (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift;
549 uint32_t i; 673 uint32_t i;
550 int match = 1; 674 int match = 1;
551 675
552 match &= (img1->fmt == img2->fmt); 676 match &= (img1->fmt == img2->fmt);
553 match &= (img1->d_w == img2->d_w); 677 match &= (img1->d_w == img2->d_w);
554 match &= (img1->d_h == img2->d_h); 678 match &= (img1->d_h == img2->d_h);
679 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
680 if (img1->fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
681 l_w *= 2;
682 c_w *= 2;
683 }
684 #endif
555 685
556 for (i = 0; i < img1->d_h; ++i) 686 for (i = 0; i < img1->d_h; ++i)
557 match &= (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y], 687 match &= (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
558 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y], 688 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
559 img1->d_w) == 0); 689 l_w) == 0);
560 690
561 for (i = 0; i < c_h; ++i) 691 for (i = 0; i < c_h; ++i)
562 match &= (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U], 692 match &= (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
563 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U], 693 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
564 c_w) == 0); 694 c_w) == 0);
565 695
566 for (i = 0; i < c_h; ++i) 696 for (i = 0; i < c_h; ++i)
567 match &= (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V], 697 match &= (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
568 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V], 698 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
569 c_w) == 0); 699 c_w) == 0);
(...skipping 24 matching lines...) Expand all
594 const char *out_fn; 724 const char *out_fn;
595 const char *stats_fn; 725 const char *stats_fn;
596 #if CONFIG_FP_MB_STATS 726 #if CONFIG_FP_MB_STATS
597 const char *fpmb_stats_fn; 727 const char *fpmb_stats_fn;
598 #endif 728 #endif
599 stereo_format_t stereo_fmt; 729 stereo_format_t stereo_fmt;
600 int arg_ctrls[ARG_CTRL_CNT_MAX][2]; 730 int arg_ctrls[ARG_CTRL_CNT_MAX][2];
601 int arg_ctrl_cnt; 731 int arg_ctrl_cnt;
602 int write_webm; 732 int write_webm;
603 int have_kf_max_dist; 733 int have_kf_max_dist;
734 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
735 // whether to use 16bit internal buffers
736 int use_16bit_internal;
737 #endif
604 }; 738 };
605 739
606 740
607 struct stream_state { 741 struct stream_state {
608 int index; 742 int index;
609 struct stream_state *next; 743 struct stream_state *next;
610 struct stream_config config; 744 struct stream_config config;
611 FILE *file; 745 FILE *file;
612 struct rate_hist *rate_hist; 746 struct rate_hist *rate_hist;
613 struct EbmlGlobal ebml; 747 struct EbmlGlobal ebml;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 warn("Assuming --pass=%d implies --passes=%d\n", 867 warn("Assuming --pass=%d implies --passes=%d\n",
734 global->pass, global->pass); 868 global->pass, global->pass);
735 global->passes = global->pass; 869 global->passes = global->pass;
736 } 870 }
737 } 871 }
738 /* Validate global config */ 872 /* Validate global config */
739 if (global->passes == 0) { 873 if (global->passes == 0) {
740 #if CONFIG_VP9_ENCODER 874 #if CONFIG_VP9_ENCODER
741 // Make default VP9 passes = 2 until there is a better quality 1-pass 875 // Make default VP9 passes = 2 until there is a better quality 1-pass
742 // encoder 876 // encoder
743 global->passes = (strcmp(global->codec->name, "vp9") == 0 && 877 if (global->codec != NULL && global->codec->name != NULL)
744 global->deadline != VPX_DL_REALTIME) ? 2 : 1; 878 global->passes = (strcmp(global->codec->name, "vp9") == 0 &&
879 global->deadline != VPX_DL_REALTIME) ? 2 : 1;
745 #else 880 #else
746 global->passes = 1; 881 global->passes = 1;
747 #endif 882 #endif
748 } 883 }
749 884
750 if (global->deadline == VPX_DL_REALTIME && 885 if (global->deadline == VPX_DL_REALTIME &&
751 global->passes > 1) { 886 global->passes > 1) {
752 warn("Enforcing one-pass encoding in realtime mode\n"); 887 warn("Enforcing one-pass encoding in realtime mode\n");
753 global->passes = 1; 888 global->passes = 1;
754 } 889 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 fclose(input->file); 937 fclose(input->file);
803 if (input->file_type == FILE_TYPE_Y4M) 938 if (input->file_type == FILE_TYPE_Y4M)
804 y4m_input_close(&input->y4m); 939 y4m_input_close(&input->y4m);
805 } 940 }
806 941
807 static struct stream_state *new_stream(struct VpxEncoderConfig *global, 942 static struct stream_state *new_stream(struct VpxEncoderConfig *global,
808 struct stream_state *prev) { 943 struct stream_state *prev) {
809 struct stream_state *stream; 944 struct stream_state *stream;
810 945
811 stream = calloc(1, sizeof(*stream)); 946 stream = calloc(1, sizeof(*stream));
812 if (!stream) 947 if (stream == NULL) {
813 fatal("Failed to allocate new stream."); 948 fatal("Failed to allocate new stream.");
949 }
950
814 if (prev) { 951 if (prev) {
815 memcpy(stream, prev, sizeof(*stream)); 952 memcpy(stream, prev, sizeof(*stream));
816 stream->index++; 953 stream->index++;
817 prev->next = stream; 954 prev->next = stream;
818 } else { 955 } else {
819 vpx_codec_err_t res; 956 vpx_codec_err_t res;
820 957
821 /* Populate encoder configuration */ 958 /* Populate encoder configuration */
822 res = vpx_codec_enc_config_default(global->codec->codec_interface(), 959 res = vpx_codec_enc_config_default(global->codec->codec_interface(),
823 &stream->config.cfg, 960 &stream->config.cfg,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 1000
864 static int parse_stream_params(struct VpxEncoderConfig *global, 1001 static int parse_stream_params(struct VpxEncoderConfig *global,
865 struct stream_state *stream, 1002 struct stream_state *stream,
866 char **argv) { 1003 char **argv) {
867 char **argi, **argj; 1004 char **argi, **argj;
868 struct arg arg; 1005 struct arg arg;
869 static const arg_def_t **ctrl_args = no_args; 1006 static const arg_def_t **ctrl_args = no_args;
870 static const int *ctrl_args_map = NULL; 1007 static const int *ctrl_args_map = NULL;
871 struct stream_config *config = &stream->config; 1008 struct stream_config *config = &stream->config;
872 int eos_mark_found = 0; 1009 int eos_mark_found = 0;
1010 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1011 int test_16bit_internal = 0;
1012 #endif
873 1013
874 // Handle codec specific options 1014 // Handle codec specific options
875 if (0) { 1015 if (0) {
876 #if CONFIG_VP8_ENCODER 1016 #if CONFIG_VP8_ENCODER
877 } else if (strcmp(global->codec->name, "vp8") == 0) { 1017 } else if (strcmp(global->codec->name, "vp8") == 0) {
878 ctrl_args = vp8_args; 1018 ctrl_args = vp8_args;
879 ctrl_args_map = vp8_arg_ctrl_map; 1019 ctrl_args_map = vp8_arg_ctrl_map;
880 #endif 1020 #endif
881 #if CONFIG_VP9_ENCODER 1021 #if CONFIG_VP9_ENCODER
882 } else if (strcmp(global->codec->name, "vp9") == 0) { 1022 } else if (strcmp(global->codec->name, "vp9") == 0) {
(...skipping 28 matching lines...) Expand all
911 } else if (arg_match(&arg, &use_ivf, argi)) { 1051 } else if (arg_match(&arg, &use_ivf, argi)) {
912 config->write_webm = 0; 1052 config->write_webm = 0;
913 } else if (arg_match(&arg, &threads, argi)) { 1053 } else if (arg_match(&arg, &threads, argi)) {
914 config->cfg.g_threads = arg_parse_uint(&arg); 1054 config->cfg.g_threads = arg_parse_uint(&arg);
915 } else if (arg_match(&arg, &profile, argi)) { 1055 } else if (arg_match(&arg, &profile, argi)) {
916 config->cfg.g_profile = arg_parse_uint(&arg); 1056 config->cfg.g_profile = arg_parse_uint(&arg);
917 } else if (arg_match(&arg, &width, argi)) { 1057 } else if (arg_match(&arg, &width, argi)) {
918 config->cfg.g_w = arg_parse_uint(&arg); 1058 config->cfg.g_w = arg_parse_uint(&arg);
919 } else if (arg_match(&arg, &height, argi)) { 1059 } else if (arg_match(&arg, &height, argi)) {
920 config->cfg.g_h = arg_parse_uint(&arg); 1060 config->cfg.g_h = arg_parse_uint(&arg);
1061 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1062 } else if (arg_match(&arg, &bitdeptharg, argi)) {
1063 config->cfg.g_bit_depth = arg_parse_enum_or_int(&arg);
1064 } else if (arg_match(&arg, &inbitdeptharg, argi)) {
1065 config->cfg.g_input_bit_depth = arg_parse_uint(&arg);
1066 #endif
921 #if CONFIG_WEBM_IO 1067 #if CONFIG_WEBM_IO
922 } else if (arg_match(&arg, &stereo_mode, argi)) { 1068 } else if (arg_match(&arg, &stereo_mode, argi)) {
923 config->stereo_fmt = arg_parse_enum_or_int(&arg); 1069 config->stereo_fmt = arg_parse_enum_or_int(&arg);
924 #endif 1070 #endif
925 } else if (arg_match(&arg, &timebase, argi)) { 1071 } else if (arg_match(&arg, &timebase, argi)) {
926 config->cfg.g_timebase = arg_parse_rational(&arg); 1072 config->cfg.g_timebase = arg_parse_rational(&arg);
927 validate_positive_rational(arg.name, &config->cfg.g_timebase); 1073 validate_positive_rational(arg.name, &config->cfg.g_timebase);
928 } else if (arg_match(&arg, &error_resilient, argi)) { 1074 } else if (arg_match(&arg, &error_resilient, argi)) {
929 config->cfg.g_error_resilient = arg_parse_uint(&arg); 1075 config->cfg.g_error_resilient = arg_parse_uint(&arg);
930 } else if (arg_match(&arg, &lag_in_frames, argi)) { 1076 } else if (arg_match(&arg, &lag_in_frames, argi)) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 1124
979 if (global->passes < 2) 1125 if (global->passes < 2)
980 warn("option %s ignored in one-pass mode.\n", arg.name); 1126 warn("option %s ignored in one-pass mode.\n", arg.name);
981 } else if (arg_match(&arg, &kf_min_dist, argi)) { 1127 } else if (arg_match(&arg, &kf_min_dist, argi)) {
982 config->cfg.kf_min_dist = arg_parse_uint(&arg); 1128 config->cfg.kf_min_dist = arg_parse_uint(&arg);
983 } else if (arg_match(&arg, &kf_max_dist, argi)) { 1129 } else if (arg_match(&arg, &kf_max_dist, argi)) {
984 config->cfg.kf_max_dist = arg_parse_uint(&arg); 1130 config->cfg.kf_max_dist = arg_parse_uint(&arg);
985 config->have_kf_max_dist = 1; 1131 config->have_kf_max_dist = 1;
986 } else if (arg_match(&arg, &kf_disabled, argi)) { 1132 } else if (arg_match(&arg, &kf_disabled, argi)) {
987 config->cfg.kf_mode = VPX_KF_DISABLED; 1133 config->cfg.kf_mode = VPX_KF_DISABLED;
1134 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1135 } else if (arg_match(&arg, &test16bitinternalarg, argi)) {
1136 if (strcmp(global->codec->name, "vp9") == 0) {
1137 test_16bit_internal = 1;
1138 }
1139 #endif
988 } else { 1140 } else {
989 int i, match = 0; 1141 int i, match = 0;
990 for (i = 0; ctrl_args[i]; i++) { 1142 for (i = 0; ctrl_args[i]; i++) {
991 if (arg_match(&arg, ctrl_args[i], argi)) { 1143 if (arg_match(&arg, ctrl_args[i], argi)) {
992 int j; 1144 int j;
993 match = 1; 1145 match = 1;
994 1146
995 /* Point either to the next free element or the first 1147 /* Point either to the next free element or the first
996 * instance of this control. 1148 * instance of this control.
997 */ 1149 */
998 for (j = 0; j < config->arg_ctrl_cnt; j++) 1150 for (j = 0; j < config->arg_ctrl_cnt; j++)
999 if (config->arg_ctrls[j][0] == ctrl_args_map[i]) 1151 if (ctrl_args_map != NULL &&
1152 config->arg_ctrls[j][0] == ctrl_args_map[i])
1000 break; 1153 break;
1001 1154
1002 /* Update/insert */ 1155 /* Update/insert */
1003 assert(j < (int)ARG_CTRL_CNT_MAX); 1156 assert(j < (int)ARG_CTRL_CNT_MAX);
1004 if (j < (int)ARG_CTRL_CNT_MAX) { 1157 if (ctrl_args_map != NULL && j < (int)ARG_CTRL_CNT_MAX) {
1005 config->arg_ctrls[j][0] = ctrl_args_map[i]; 1158 config->arg_ctrls[j][0] = ctrl_args_map[i];
1006 config->arg_ctrls[j][1] = arg_parse_enum_or_int(&arg); 1159 config->arg_ctrls[j][1] = arg_parse_enum_or_int(&arg);
1007 if (j == config->arg_ctrl_cnt) 1160 if (j == config->arg_ctrl_cnt)
1008 config->arg_ctrl_cnt++; 1161 config->arg_ctrl_cnt++;
1009 } 1162 }
1010 1163
1011 } 1164 }
1012 } 1165 }
1013 if (!match) 1166 if (!match)
1014 argj++; 1167 argj++;
1015 } 1168 }
1016 } 1169 }
1170 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1171 if (strcmp(global->codec->name, "vp9") == 0) {
1172 config->use_16bit_internal = test_16bit_internal |
1173 (config->cfg.g_profile > 1);
1174 }
1175 #endif
1017 return eos_mark_found; 1176 return eos_mark_found;
1018 } 1177 }
1019 1178
1020 1179
1021 #define FOREACH_STREAM(func) \ 1180 #define FOREACH_STREAM(func) \
1022 do { \ 1181 do { \
1023 struct stream_state *stream; \ 1182 struct stream_state *stream; \
1024 for (stream = streams; stream; stream = stream->next) { \ 1183 for (stream = streams; stream; stream = stream->next) { \
1025 func; \ 1184 func; \
1026 } \ 1185 } \
1027 } while (0) 1186 } while (0)
1028 1187
1029 1188
1030 static void validate_stream_config(const struct stream_state *stream, 1189 static void validate_stream_config(const struct stream_state *stream,
1031 const struct VpxEncoderConfig *global) { 1190 const struct VpxEncoderConfig *global) {
1032 const struct stream_state *streami; 1191 const struct stream_state *streami;
1033 1192
1034 if (!stream->config.cfg.g_w || !stream->config.cfg.g_h) 1193 if (!stream->config.cfg.g_w || !stream->config.cfg.g_h)
1035 fatal("Stream %d: Specify stream dimensions with --width (-w) " 1194 fatal("Stream %d: Specify stream dimensions with --width (-w) "
1036 " and --height (-h)", stream->index); 1195 " and --height (-h)", stream->index);
1037 1196
1038 if (stream->config.cfg.g_profile != 0 && !global->experimental_bitstream) { 1197 if (stream->config.cfg.g_profile != 0 && !global->experimental_bitstream) {
1039 fatal("Stream %d: profile %d is experimental and requires the --%s flag", 1198 fatal("Stream %d: profile %d is experimental and requires the --%s flag",
1040 stream->index, stream->config.cfg.g_profile, 1199 stream->index, stream->config.cfg.g_profile,
1041 experimental_bitstream.long_name); 1200 experimental_bitstream.long_name);
1042 } 1201 }
1043 1202
1203 // Check that the codec bit depth is greater than the input bit depth.
1204 if (stream->config.cfg.g_input_bit_depth >
1205 (unsigned int)stream->config.cfg.g_bit_depth) {
1206 fatal("Stream %d: codec bit depth (%d) less than input bit depth (%d)",
1207 stream->index, (int)stream->config.cfg.g_bit_depth,
1208 stream->config.cfg.g_input_bit_depth);
1209 }
1210
1044 for (streami = stream; streami; streami = streami->next) { 1211 for (streami = stream; streami; streami = streami->next) {
1045 /* All streams require output files */ 1212 /* All streams require output files */
1046 if (!streami->config.out_fn) 1213 if (!streami->config.out_fn)
1047 fatal("Stream %d: Output file is required (specify with -o)", 1214 fatal("Stream %d: Output file is required (specify with -o)",
1048 streami->index); 1215 streami->index);
1049 1216
1050 /* Check for two streams outputting to the same file */ 1217 /* Check for two streams outputting to the same file */
1051 if (streami != stream) { 1218 if (streami != stream) {
1052 const char *a = stream->config.out_fn; 1219 const char *a = stream->config.out_fn;
1053 const char *b = streami->config.out_fn; 1220 const char *b = streami->config.out_fn;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 if (stream->next || stream->index) 1309 if (stream->next || stream->index)
1143 fprintf(stderr, "\nStream Index: %d\n", stream->index); 1310 fprintf(stderr, "\nStream Index: %d\n", stream->index);
1144 fprintf(stderr, "Destination file: %s\n", stream->config.out_fn); 1311 fprintf(stderr, "Destination file: %s\n", stream->config.out_fn);
1145 fprintf(stderr, "Encoder parameters:\n"); 1312 fprintf(stderr, "Encoder parameters:\n");
1146 1313
1147 SHOW(g_usage); 1314 SHOW(g_usage);
1148 SHOW(g_threads); 1315 SHOW(g_threads);
1149 SHOW(g_profile); 1316 SHOW(g_profile);
1150 SHOW(g_w); 1317 SHOW(g_w);
1151 SHOW(g_h); 1318 SHOW(g_h);
1319 SHOW(g_bit_depth);
1320 SHOW(g_input_bit_depth);
1152 SHOW(g_timebase.num); 1321 SHOW(g_timebase.num);
1153 SHOW(g_timebase.den); 1322 SHOW(g_timebase.den);
1154 SHOW(g_error_resilient); 1323 SHOW(g_error_resilient);
1155 SHOW(g_pass); 1324 SHOW(g_pass);
1156 SHOW(g_lag_in_frames); 1325 SHOW(g_lag_in_frames);
1157 SHOW(rc_dropframe_thresh); 1326 SHOW(rc_dropframe_thresh);
1158 SHOW(rc_resize_allowed); 1327 SHOW(rc_resize_allowed);
1159 SHOW(rc_scaled_width); 1328 SHOW(rc_scaled_width);
1160 SHOW(rc_scaled_height); 1329 SHOW(rc_scaled_height);
1161 SHOW(rc_resize_up_thresh); 1330 SHOW(rc_resize_up_thresh);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 } 1443 }
1275 1444
1276 1445
1277 static void initialize_encoder(struct stream_state *stream, 1446 static void initialize_encoder(struct stream_state *stream,
1278 struct VpxEncoderConfig *global) { 1447 struct VpxEncoderConfig *global) {
1279 int i; 1448 int i;
1280 int flags = 0; 1449 int flags = 0;
1281 1450
1282 flags |= global->show_psnr ? VPX_CODEC_USE_PSNR : 0; 1451 flags |= global->show_psnr ? VPX_CODEC_USE_PSNR : 0;
1283 flags |= global->out_part ? VPX_CODEC_USE_OUTPUT_PARTITION : 0; 1452 flags |= global->out_part ? VPX_CODEC_USE_OUTPUT_PARTITION : 0;
1453 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1454 flags |= stream->config.use_16bit_internal ? VPX_CODEC_USE_HIGHBITDEPTH : 0;
1455 #endif
1284 1456
1285 /* Construct Encoder Context */ 1457 /* Construct Encoder Context */
1286 vpx_codec_enc_init(&stream->encoder, global->codec->codec_interface(), 1458 vpx_codec_enc_init(&stream->encoder, global->codec->codec_interface(),
1287 &stream->config.cfg, flags); 1459 &stream->config.cfg, flags);
1288 ctx_exit_on_error(&stream->encoder, "Failed to initialize encoder"); 1460 ctx_exit_on_error(&stream->encoder, "Failed to initialize encoder");
1289 1461
1290 /* Note that we bypass the vpx_codec_control wrapper macro because 1462 /* Note that we bypass the vpx_codec_control wrapper macro because
1291 * we're being clever to store the control IDs in an array. Real 1463 * we're being clever to store the control IDs in an array. Real
1292 * applications will want to make use of the enumerations directly 1464 * applications will want to make use of the enumerations directly
1293 */ 1465 */
(...skipping 25 matching lines...) Expand all
1319 struct vpx_usec_timer timer; 1491 struct vpx_usec_timer timer;
1320 1492
1321 frame_start = (cfg->g_timebase.den * (int64_t)(frames_in - 1) 1493 frame_start = (cfg->g_timebase.den * (int64_t)(frames_in - 1)
1322 * global->framerate.den) 1494 * global->framerate.den)
1323 / cfg->g_timebase.num / global->framerate.num; 1495 / cfg->g_timebase.num / global->framerate.num;
1324 next_frame_start = (cfg->g_timebase.den * (int64_t)(frames_in) 1496 next_frame_start = (cfg->g_timebase.den * (int64_t)(frames_in)
1325 * global->framerate.den) 1497 * global->framerate.den)
1326 / cfg->g_timebase.num / global->framerate.num; 1498 / cfg->g_timebase.num / global->framerate.num;
1327 1499
1328 /* Scale if necessary */ 1500 /* Scale if necessary */
1501 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1502 if (img) {
1503 if ((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) &&
1504 (img->d_w != cfg->g_w || img->d_h != cfg->g_h)) {
1505 if (img->fmt != VPX_IMG_FMT_I42016) {
1506 fprintf(stderr, "%s can only scale 4:2:0 inputs\n", exec_name);
1507 exit(EXIT_FAILURE);
1508 }
1509 #if CONFIG_LIBYUV
1510 if (!stream->img) {
1511 stream->img = vpx_img_alloc(NULL, VPX_IMG_FMT_I42016,
1512 cfg->g_w, cfg->g_h, 16);
1513 }
1514 I420Scale_16((uint16*)img->planes[VPX_PLANE_Y],
1515 img->stride[VPX_PLANE_Y]/2,
1516 (uint16*)img->planes[VPX_PLANE_U],
1517 img->stride[VPX_PLANE_U]/2,
1518 (uint16*)img->planes[VPX_PLANE_V],
1519 img->stride[VPX_PLANE_V]/2,
1520 img->d_w, img->d_h,
1521 (uint16*)stream->img->planes[VPX_PLANE_Y],
1522 stream->img->stride[VPX_PLANE_Y]/2,
1523 (uint16*)stream->img->planes[VPX_PLANE_U],
1524 stream->img->stride[VPX_PLANE_U]/2,
1525 (uint16*)stream->img->planes[VPX_PLANE_V],
1526 stream->img->stride[VPX_PLANE_V]/2,
1527 stream->img->d_w, stream->img->d_h,
1528 kFilterBox);
1529 img = stream->img;
1530 #else
1531 stream->encoder.err = 1;
1532 ctx_exit_on_error(&stream->encoder,
1533 "Stream %d: Failed to encode frame.\n"
1534 "Scaling disabled in this configuration. \n"
1535 "To enable, configure with --enable-libyuv\n",
1536 stream->index);
1537 #endif
1538 }
1539 }
1540 #endif
1329 if (img && (img->d_w != cfg->g_w || img->d_h != cfg->g_h)) { 1541 if (img && (img->d_w != cfg->g_w || img->d_h != cfg->g_h)) {
1330 if (img->fmt != VPX_IMG_FMT_I420 && img->fmt != VPX_IMG_FMT_YV12) { 1542 if (img->fmt != VPX_IMG_FMT_I420 && img->fmt != VPX_IMG_FMT_YV12) {
1331 fprintf(stderr, "%s can only scale 4:2:0 8bpp inputs\n", exec_name); 1543 fprintf(stderr, "%s can only scale 4:2:0 8bpp inputs\n", exec_name);
1332 exit(EXIT_FAILURE); 1544 exit(EXIT_FAILURE);
1333 } 1545 }
1334 #if CONFIG_LIBYUV 1546 #if CONFIG_LIBYUV
1335 if (!stream->img) 1547 if (!stream->img)
1336 stream->img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, 1548 stream->img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420,
1337 cfg->g_w, cfg->g_h, 16); 1549 cfg->g_w, cfg->g_h, 16);
1338 I420Scale(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y], 1550 I420Scale(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y],
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 fprintf(stderr, " %.3f", stream->psnr_totals[i] / stream->psnr_count); 1709 fprintf(stderr, " %.3f", stream->psnr_totals[i] / stream->psnr_count);
1498 } 1710 }
1499 fprintf(stderr, "\n"); 1711 fprintf(stderr, "\n");
1500 } 1712 }
1501 1713
1502 1714
1503 static float usec_to_fps(uint64_t usec, unsigned int frames) { 1715 static float usec_to_fps(uint64_t usec, unsigned int frames) {
1504 return (float)(usec > 0 ? frames * 1000000.0 / (float)usec : 0); 1716 return (float)(usec > 0 ? frames * 1000000.0 / (float)usec : 0);
1505 } 1717 }
1506 1718
1719 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1720 static void high_img_upshift(vpx_image_t *dst, vpx_image_t *src,
1721 int input_shift) {
1722 // Note the offset is 1 less than half
1723 const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0;
1724 int plane;
1725 if (dst->w != src->w || dst->h != src->h ||
1726 dst->x_chroma_shift != src->x_chroma_shift ||
1727 dst->y_chroma_shift != src->y_chroma_shift ||
1728 dst->fmt != src->fmt || input_shift < 0) {
1729 fatal("Unsupported image conversion");
1730 }
1731 switch (src->fmt) {
1732 case VPX_IMG_FMT_I42016:
1733 case VPX_IMG_FMT_I42216:
1734 case VPX_IMG_FMT_I44416:
1735 break;
1736 default:
1737 fatal("Unsupported image conversion");
1738 break;
1739 }
1740 for (plane = 0; plane < 3; plane++) {
1741 int w = src->w;
1742 int h = src->h;
1743 int x, y;
1744 if (plane) {
1745 w >>= src->x_chroma_shift;
1746 h >>= src->y_chroma_shift;
1747 }
1748 for (y = 0; y < h; y++) {
1749 uint16_t *p_src = (uint16_t *)(src->planes[plane] +
1750 y * src->stride[plane]);
1751 uint16_t *p_dst = (uint16_t *)(dst->planes[plane] +
1752 y * dst->stride[plane]);
1753 for (x = 0; x < w; x++)
1754 *p_dst++ = (*p_src++ << input_shift) + offset;
1755 }
1756 }
1757 }
1758
1759 static void low_img_upshift(vpx_image_t *dst, vpx_image_t *src,
1760 int input_shift) {
1761 // Note the offset is 1 less than half
1762 const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0;
1763 int plane;
1764 if (dst->w != src->w || dst->h != src->h ||
1765 dst->x_chroma_shift != src->x_chroma_shift ||
1766 dst->y_chroma_shift != src->y_chroma_shift ||
1767 dst->fmt != src->fmt + VPX_IMG_FMT_HIGHBITDEPTH ||
1768 input_shift < 0) {
1769 fatal("Unsupported image conversion");
1770 }
1771 switch (src->fmt) {
1772 case VPX_IMG_FMT_I420:
1773 case VPX_IMG_FMT_I422:
1774 case VPX_IMG_FMT_I444:
1775 break;
1776 default:
1777 fatal("Unsupported image conversion");
1778 break;
1779 }
1780 for (plane = 0; plane < 3; plane++) {
1781 int w = src->w;
1782 int h = src->h;
1783 int x, y;
1784 if (plane) {
1785 w >>= src->x_chroma_shift;
1786 h >>= src->y_chroma_shift;
1787 }
1788 for (y = 0; y < h; y++) {
1789 uint8_t *p_src = src->planes[plane] + y * src->stride[plane];
1790 uint16_t *p_dst = (uint16_t *)(dst->planes[plane] +
1791 y * dst->stride[plane]);
1792 for (x = 0; x < w; x++) {
1793 *p_dst++ = (*p_src++ << input_shift) + offset;
1794 }
1795 }
1796 }
1797 }
1798
1799 static void img_upshift(vpx_image_t *dst, vpx_image_t *src,
1800 int input_shift) {
1801 if (src->fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
1802 high_img_upshift(dst, src, input_shift);
1803 } else {
1804 low_img_upshift(dst, src, input_shift);
1805 }
1806 }
1807
1808 static void img_cast_16_to_8(vpx_image_t *dst, vpx_image_t *src) {
1809 int plane;
1810 if (dst->fmt + VPX_IMG_FMT_HIGHBITDEPTH != src->fmt ||
1811 dst->d_w != src->d_w || dst->d_h != src->d_h ||
1812 dst->x_chroma_shift != src->x_chroma_shift ||
1813 dst->y_chroma_shift != src->y_chroma_shift) {
1814 fatal("Unsupported image conversion");
1815 }
1816 switch (dst->fmt) {
1817 case VPX_IMG_FMT_I420:
1818 case VPX_IMG_FMT_I422:
1819 case VPX_IMG_FMT_I444:
1820 break;
1821 default:
1822 fatal("Unsupported image conversion");
1823 break;
1824 }
1825 for (plane = 0; plane < 3; plane++) {
1826 int w = src->d_w;
1827 int h = src->d_h;
1828 int x, y;
1829 if (plane) {
1830 w >>= src->x_chroma_shift;
1831 h >>= src->y_chroma_shift;
1832 }
1833 for (y = 0; y < h; y++) {
1834 uint16_t *p_src = (uint16_t *)(src->planes[plane] +
1835 y * src->stride[plane]);
1836 uint8_t *p_dst = dst->planes[plane] + y * dst->stride[plane];
1837 for (x = 0; x < w; x++) {
1838 *p_dst++ = *p_src++;
1839 }
1840 }
1841 }
1842 }
1843 #endif
1507 1844
1508 static void test_decode(struct stream_state *stream, 1845 static void test_decode(struct stream_state *stream,
1509 enum TestDecodeFatality fatal, 1846 enum TestDecodeFatality fatal,
1510 const VpxInterface *codec) { 1847 const VpxInterface *codec) {
1511 vpx_image_t enc_img, dec_img; 1848 vpx_image_t enc_img, dec_img;
1512 1849
1513 if (stream->mismatch_seen) 1850 if (stream->mismatch_seen)
1514 return; 1851 return;
1515 1852
1516 /* Get the internal reference frame */ 1853 /* Get the internal reference frame */
1517 if (strcmp(codec->name, "vp8") == 0) { 1854 if (strcmp(codec->name, "vp8") == 0) {
1518 struct vpx_ref_frame ref_enc, ref_dec; 1855 struct vpx_ref_frame ref_enc, ref_dec;
1519 int width, height; 1856 int width, height;
1520 1857
1521 width = (stream->config.cfg.g_w + 15) & ~15; 1858 width = (stream->config.cfg.g_w + 15) & ~15;
1522 height = (stream->config.cfg.g_h + 15) & ~15; 1859 height = (stream->config.cfg.g_h + 15) & ~15;
1523 vpx_img_alloc(&ref_enc.img, VPX_IMG_FMT_I420, width, height, 1); 1860 vpx_img_alloc(&ref_enc.img, VPX_IMG_FMT_I420, width, height, 1);
1524 enc_img = ref_enc.img; 1861 enc_img = ref_enc.img;
1525 vpx_img_alloc(&ref_dec.img, VPX_IMG_FMT_I420, width, height, 1); 1862 vpx_img_alloc(&ref_dec.img, VPX_IMG_FMT_I420, width, height, 1);
1526 dec_img = ref_dec.img; 1863 dec_img = ref_dec.img;
1527 1864
1528 ref_enc.frame_type = VP8_LAST_FRAME; 1865 ref_enc.frame_type = VP8_LAST_FRAME;
1529 ref_dec.frame_type = VP8_LAST_FRAME; 1866 ref_dec.frame_type = VP8_LAST_FRAME;
1530 vpx_codec_control(&stream->encoder, VP8_COPY_REFERENCE, &ref_enc); 1867 vpx_codec_control(&stream->encoder, VP8_COPY_REFERENCE, &ref_enc);
1531 vpx_codec_control(&stream->decoder, VP8_COPY_REFERENCE, &ref_dec); 1868 vpx_codec_control(&stream->decoder, VP8_COPY_REFERENCE, &ref_dec);
1532 } else { 1869 } else {
1533 struct vp9_ref_frame ref; 1870 struct vp9_ref_frame ref_enc, ref_dec;
1534 1871
1535 ref.idx = 0; 1872 ref_enc.idx = 0;
1536 vpx_codec_control(&stream->encoder, VP9_GET_REFERENCE, &ref); 1873 ref_dec.idx = 0;
1537 enc_img = ref.img; 1874 vpx_codec_control(&stream->encoder, VP9_GET_REFERENCE, &ref_enc);
1538 vpx_codec_control(&stream->decoder, VP9_GET_REFERENCE, &ref); 1875 enc_img = ref_enc.img;
1539 dec_img = ref.img; 1876 vpx_codec_control(&stream->decoder, VP9_GET_REFERENCE, &ref_dec);
1877 dec_img = ref_dec.img;
1878 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1879 if ((enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) !=
1880 (dec_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH)) {
1881 if (enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
1882 vpx_img_alloc(&enc_img, enc_img.fmt - VPX_IMG_FMT_HIGHBITDEPTH,
1883 enc_img.d_w, enc_img.d_h, 16);
1884 img_cast_16_to_8(&enc_img, &ref_enc.img);
1885 }
1886 if (dec_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
1887 vpx_img_alloc(&dec_img, dec_img.fmt - VPX_IMG_FMT_HIGHBITDEPTH,
1888 dec_img.d_w, dec_img.d_h, 16);
1889 img_cast_16_to_8(&dec_img, &ref_dec.img);
1890 }
1891 }
1892 #endif
1540 } 1893 }
1541 ctx_exit_on_error(&stream->encoder, "Failed to get encoder reference frame"); 1894 ctx_exit_on_error(&stream->encoder, "Failed to get encoder reference frame");
1542 ctx_exit_on_error(&stream->decoder, "Failed to get decoder reference frame"); 1895 ctx_exit_on_error(&stream->decoder, "Failed to get decoder reference frame");
1543 1896
1544 if (!compare_img(&enc_img, &dec_img)) { 1897 if (!compare_img(&enc_img, &dec_img)) {
1545 int y[4], u[4], v[4]; 1898 int y[4], u[4], v[4];
1899 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1900 if (enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
1901 find_mismatch_high(&enc_img, &dec_img, y, u, v);
1902 } else {
1903 find_mismatch(&enc_img, &dec_img, y, u, v);
1904 }
1905 #else
1546 find_mismatch(&enc_img, &dec_img, y, u, v); 1906 find_mismatch(&enc_img, &dec_img, y, u, v);
1907 #endif
1547 stream->decoder.err = 1; 1908 stream->decoder.err = 1;
1548 warn_or_exit_on_error(&stream->decoder, fatal == TEST_DECODE_FATAL, 1909 warn_or_exit_on_error(&stream->decoder, fatal == TEST_DECODE_FATAL,
1549 "Stream %d: Encode/decode mismatch on frame %d at" 1910 "Stream %d: Encode/decode mismatch on frame %d at"
1550 " Y[%d, %d] {%d/%d}," 1911 " Y[%d, %d] {%d/%d},"
1551 " U[%d, %d] {%d/%d}," 1912 " U[%d, %d] {%d/%d},"
1552 " V[%d, %d] {%d/%d}", 1913 " V[%d, %d] {%d/%d}",
1553 stream->index, stream->frames_out, 1914 stream->index, stream->frames_out,
1554 y[0], y[1], y[2], y[3], 1915 y[0], y[1], y[2], y[3],
1555 u[0], u[1], u[2], u[3], 1916 u[0], u[1], u[2], u[3],
1556 v[0], v[1], v[2], v[3]); 1917 v[0], v[1], v[2], v[3]);
(...skipping 21 matching lines...) Expand all
1578 label, hours, mins, secs); 1939 label, hours, mins, secs);
1579 } else { 1940 } else {
1580 fprintf(stderr, "[%3s unknown] ", label); 1941 fprintf(stderr, "[%3s unknown] ", label);
1581 } 1942 }
1582 } 1943 }
1583 1944
1584 1945
1585 int main(int argc, const char **argv_) { 1946 int main(int argc, const char **argv_) {
1586 int pass; 1947 int pass;
1587 vpx_image_t raw; 1948 vpx_image_t raw;
1949 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
1950 vpx_image_t raw_shift;
1951 int allocated_raw_shift = 0;
1952 int use_16bit_internal = 0;
1953 int input_shift = 0;
1954 #endif
1588 int frame_avail, got_data; 1955 int frame_avail, got_data;
1589 1956
1590 struct VpxInputContext input; 1957 struct VpxInputContext input;
1591 struct VpxEncoderConfig global; 1958 struct VpxEncoderConfig global;
1592 struct stream_state *streams = NULL; 1959 struct stream_state *streams = NULL;
1593 char **argv, **argi; 1960 char **argv, **argi;
1594 uint64_t cx_time = 0; 1961 uint64_t cx_time = 0;
1595 int stream_cnt = 0; 1962 int stream_cnt = 0;
1596 int res = 0; 1963 int res = 0;
1597 1964
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 input.width = stream->config.cfg.g_w; 2046 input.width = stream->config.cfg.g_w;
1680 input.height = stream->config.cfg.g_h; 2047 input.height = stream->config.cfg.g_h;
1681 break; 2048 break;
1682 } 2049 }
1683 }); 2050 });
1684 2051
1685 /* Update stream configurations from the input file's parameters */ 2052 /* Update stream configurations from the input file's parameters */
1686 if (!input.width || !input.height) 2053 if (!input.width || !input.height)
1687 fatal("Specify stream dimensions with --width (-w) " 2054 fatal("Specify stream dimensions with --width (-w) "
1688 " and --height (-h)"); 2055 " and --height (-h)");
2056
2057 /* If input file does not specify bit-depth but input-bit-depth parameter
2058 * exists, assume that to be the input bit-depth. However, if the
2059 * input-bit-depth paramter does not exist, assume the input bit-depth
2060 * to be the same as the codec bit-depth.
2061 */
2062 if (!input.bit_depth) {
2063 FOREACH_STREAM({
2064 if (stream->config.cfg.g_input_bit_depth)
2065 input.bit_depth = stream->config.cfg.g_input_bit_depth;
2066 else
2067 input.bit_depth = stream->config.cfg.g_input_bit_depth =
2068 (int)stream->config.cfg.g_bit_depth;
2069 });
2070 if (input.bit_depth > 8) input.fmt |= VPX_IMG_FMT_HIGHBITDEPTH;
2071 } else {
2072 FOREACH_STREAM({
2073 stream->config.cfg.g_input_bit_depth = input.bit_depth;
2074 });
2075 }
2076
1689 FOREACH_STREAM(set_stream_dimensions(stream, input.width, input.height)); 2077 FOREACH_STREAM(set_stream_dimensions(stream, input.width, input.height));
1690 FOREACH_STREAM(validate_stream_config(stream, &global)); 2078 FOREACH_STREAM(validate_stream_config(stream, &global));
1691 2079
1692 /* Ensure that --passes and --pass are consistent. If --pass is set and 2080 /* Ensure that --passes and --pass are consistent. If --pass is set and
1693 * --passes=2, ensure --fpf was set. 2081 * --passes=2, ensure --fpf was set.
1694 */ 2082 */
1695 if (global.pass && global.passes == 2) 2083 if (global.pass && global.passes == 2)
1696 FOREACH_STREAM( { 2084 FOREACH_STREAM( {
1697 if (!stream->config.stats_fn) 2085 if (!stream->config.stats_fn)
1698 die("Stream %d: Must specify --fpf when --pass=%d" 2086 die("Stream %d: Must specify --fpf when --pass=%d"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 2120
1733 FOREACH_STREAM(stream->rate_hist = 2121 FOREACH_STREAM(stream->rate_hist =
1734 init_rate_histogram(&stream->config.cfg, 2122 init_rate_histogram(&stream->config.cfg,
1735 &global.framerate)); 2123 &global.framerate));
1736 } 2124 }
1737 2125
1738 FOREACH_STREAM(setup_pass(stream, &global, pass)); 2126 FOREACH_STREAM(setup_pass(stream, &global, pass));
1739 FOREACH_STREAM(open_output_file(stream, &global)); 2127 FOREACH_STREAM(open_output_file(stream, &global));
1740 FOREACH_STREAM(initialize_encoder(stream, &global)); 2128 FOREACH_STREAM(initialize_encoder(stream, &global));
1741 2129
2130 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
2131 if (strcmp(global.codec->name, "vp9") == 0) {
2132 // Check to see if at least one stream uses 16 bit internal.
2133 // Currently assume that the bit_depths for all streams using
2134 // highbitdepth are the same.
2135 FOREACH_STREAM({
2136 if (stream->config.use_16bit_internal) {
2137 use_16bit_internal = 1;
2138 }
2139 if (stream->config.cfg.g_profile == 0) {
2140 input_shift = 0;
2141 } else {
2142 input_shift = (int)stream->config.cfg.g_bit_depth -
2143 stream->config.cfg.g_input_bit_depth;
2144 }
2145 });
2146 }
2147 #endif
2148
1742 frame_avail = 1; 2149 frame_avail = 1;
1743 got_data = 0; 2150 got_data = 0;
1744 2151
1745 while (frame_avail || got_data) { 2152 while (frame_avail || got_data) {
1746 struct vpx_usec_timer timer; 2153 struct vpx_usec_timer timer;
1747 2154
1748 if (!global.limit || frames_in < global.limit) { 2155 if (!global.limit || frames_in < global.limit) {
1749 frame_avail = read_frame(&input, &raw); 2156 frame_avail = read_frame(&input, &raw);
1750 2157
1751 if (frame_avail) 2158 if (frame_avail)
(...skipping 17 matching lines...) Expand all
1769 cx_time > 9999999 ? "ms" : "us", 2176 cx_time > 9999999 ? "ms" : "us",
1770 fps >= 1.0 ? fps : fps * 60, 2177 fps >= 1.0 ? fps : fps * 60,
1771 fps >= 1.0 ? "fps" : "fpm"); 2178 fps >= 1.0 ? "fps" : "fpm");
1772 print_time("ETA", estimated_time_left); 2179 print_time("ETA", estimated_time_left);
1773 } 2180 }
1774 2181
1775 } else 2182 } else
1776 frame_avail = 0; 2183 frame_avail = 0;
1777 2184
1778 if (frames_in > global.skip_frames) { 2185 if (frames_in > global.skip_frames) {
2186 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
2187 vpx_image_t *frame_to_encode;
2188 if (input_shift || (use_16bit_internal && input.bit_depth == 8)) {
2189 assert(use_16bit_internal);
2190 // Input bit depth and stream bit depth do not match, so up
2191 // shift frame to stream bit depth
2192 if (!allocated_raw_shift) {
2193 vpx_img_alloc(&raw_shift, raw.fmt | VPX_IMG_FMT_HIGHBITDEPTH,
2194 input.width, input.height, 32);
2195 allocated_raw_shift = 1;
2196 }
2197 img_upshift(&raw_shift, &raw, input_shift);
2198 frame_to_encode = &raw_shift;
2199 } else {
2200 frame_to_encode = &raw;
2201 }
2202 vpx_usec_timer_start(&timer);
2203 if (use_16bit_internal) {
2204 assert(frame_to_encode->fmt & VPX_IMG_FMT_HIGHBITDEPTH);
2205 FOREACH_STREAM({
2206 if (stream->config.use_16bit_internal)
2207 encode_frame(stream, &global,
2208 frame_avail ? frame_to_encode : NULL,
2209 frames_in);
2210 else
2211 assert(0);
2212 });
2213 } else {
2214 assert((frame_to_encode->fmt & VPX_IMG_FMT_HIGHBITDEPTH) == 0);
2215 FOREACH_STREAM(encode_frame(stream, &global,
2216 frame_avail ? frame_to_encode : NULL,
2217 frames_in));
2218 }
2219 #else
1779 vpx_usec_timer_start(&timer); 2220 vpx_usec_timer_start(&timer);
1780 FOREACH_STREAM(encode_frame(stream, &global, 2221 FOREACH_STREAM(encode_frame(stream, &global,
1781 frame_avail ? &raw : NULL, 2222 frame_avail ? &raw : NULL,
1782 frames_in)); 2223 frames_in));
2224 #endif
1783 vpx_usec_timer_mark(&timer); 2225 vpx_usec_timer_mark(&timer);
1784 cx_time += vpx_usec_timer_elapsed(&timer); 2226 cx_time += vpx_usec_timer_elapsed(&timer);
1785 2227
1786 FOREACH_STREAM(update_quantizer_histogram(stream)); 2228 FOREACH_STREAM(update_quantizer_histogram(stream));
1787 2229
1788 got_data = 0; 2230 got_data = 0;
1789 FOREACH_STREAM(get_cx_data(stream, &global, &got_data)); 2231 FOREACH_STREAM(get_cx_data(stream, &global, &got_data));
1790 2232
1791 if (!got_data && input.length && !streams->frames_out) { 2233 if (!got_data && input.length && streams != NULL &&
2234 !streams->frames_out) {
1792 lagged_count = global.limit ? seen_frames : ftello(input.file); 2235 lagged_count = global.limit ? seen_frames : ftello(input.file);
1793 } else if (input.length) { 2236 } else if (input.length) {
1794 int64_t remaining; 2237 int64_t remaining;
1795 int64_t rate; 2238 int64_t rate;
1796 2239
1797 if (global.limit) { 2240 if (global.limit) {
1798 const int64_t frame_in_lagged = (seen_frames - lagged_count) * 1000; 2241 const int64_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
1799 2242
1800 rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0; 2243 rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
1801 remaining = 1000 * (global.limit - global.skip_frames 2244 remaining = 1000 * (global.limit - global.skip_frames
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 if (stream->mismatch_seen) { 2332 if (stream->mismatch_seen) {
1890 fprintf(f, "First mismatch occurred in frame %d\n", 2333 fprintf(f, "First mismatch occurred in frame %d\n",
1891 stream->mismatch_seen); 2334 stream->mismatch_seen);
1892 } else { 2335 } else {
1893 fprintf(f, "No mismatch detected in recon buffers\n"); 2336 fprintf(f, "No mismatch detected in recon buffers\n");
1894 } 2337 }
1895 fclose(f); 2338 fclose(f);
1896 }); 2339 });
1897 #endif 2340 #endif
1898 2341
2342 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
2343 if (allocated_raw_shift)
2344 vpx_img_free(&raw_shift);
2345 #endif
1899 vpx_img_free(&raw); 2346 vpx_img_free(&raw);
1900 free(argv); 2347 free(argv);
1901 free(streams); 2348 free(streams);
1902 return res ? EXIT_FAILURE : EXIT_SUCCESS; 2349 return res ? EXIT_FAILURE : EXIT_SUCCESS;
1903 } 2350 }
OLDNEW
« no previous file with comments | « source/libvpx/vpxdec.c ('k') | source/libvpx/y4minput.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698