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

Side by Side Diff: content/common/gpu/media/h264_parser.cc

Issue 12593006: Fix GPU overflow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/h264_parser.h" 5 #include "content/common/gpu/media/h264_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 10
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 // See 7.4.2.1.1. 453 // See 7.4.2.1.1.
454 bool seq_scaling_list_present_flag; 454 bool seq_scaling_list_present_flag;
455 bool use_default; 455 bool use_default;
456 Result res; 456 Result res;
457 457
458 // Parse scaling_list4x4. 458 // Parse scaling_list4x4.
459 for (int i = 0; i < 6; ++i) { 459 for (int i = 0; i < 6; ++i) {
460 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag); 460 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
461 461
462 if (seq_scaling_list_present_flag) { 462 if (seq_scaling_list_present_flag) {
463 res = ParseScalingList(sizeof(sps->scaling_list4x4[i]), 463 res = ParseScalingList(arraysize(sps->scaling_list4x4[i]),
464 sps->scaling_list4x4[i], &use_default); 464 sps->scaling_list4x4[i], &use_default);
465 if (res != kOk) 465 if (res != kOk)
466 return res; 466 return res;
467 467
468 if (use_default) 468 if (use_default)
469 DefaultScalingList4x4(i, sps->scaling_list4x4); 469 DefaultScalingList4x4(i, sps->scaling_list4x4);
470 470
471 } else { 471 } else {
472 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, 472 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter,
473 sps->scaling_list4x4); 473 sps->scaling_list4x4);
474 } 474 }
475 } 475 }
476 476
477 // Parse scaling_list8x8. 477 // Parse scaling_list8x8.
478 for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) { 478 for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) {
479 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag); 479 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag);
480 480
481 if (seq_scaling_list_present_flag) { 481 if (seq_scaling_list_present_flag) {
482 res = ParseScalingList(sizeof(sps->scaling_list8x8[i]), 482 res = ParseScalingList(arraysize(sps->scaling_list8x8[i]),
483 sps->scaling_list8x8[i], &use_default); 483 sps->scaling_list8x8[i], &use_default);
484 if (res != kOk) 484 if (res != kOk)
485 return res; 485 return res;
486 486
487 if (use_default) 487 if (use_default)
488 DefaultScalingList8x8(i, sps->scaling_list8x8); 488 DefaultScalingList8x8(i, sps->scaling_list8x8);
489 489
490 } else { 490 } else {
491 FallbackScalingList8x8(i, kDefault8x8Intra, kDefault8x8Inter, 491 FallbackScalingList8x8(i, kDefault8x8Intra, kDefault8x8Inter,
492 sps->scaling_list8x8); 492 sps->scaling_list8x8);
493 } 493 }
494 } 494 }
495 495
496 return kOk; 496 return kOk;
497 } 497 }
498 498
499 H264Parser::Result H264Parser::ParsePPSScalingLists(const H264SPS& sps, 499 H264Parser::Result H264Parser::ParsePPSScalingLists(const H264SPS& sps,
500 H264PPS* pps) { 500 H264PPS* pps) {
501 // See 7.4.2.2. 501 // See 7.4.2.2.
502 bool pic_scaling_list_present_flag; 502 bool pic_scaling_list_present_flag;
503 bool use_default; 503 bool use_default;
504 Result res; 504 Result res;
505 505
506 for (int i = 0; i < 6; ++i) { 506 for (int i = 0; i < 6; ++i) {
507 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); 507 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
508 508
509 if (pic_scaling_list_present_flag) { 509 if (pic_scaling_list_present_flag) {
510 res = ParseScalingList(sizeof(pps->scaling_list4x4[i]), 510 res = ParseScalingList(arraysize(pps->scaling_list4x4[i]),
511 pps->scaling_list4x4[i], &use_default); 511 pps->scaling_list4x4[i], &use_default);
512 if (res != kOk) 512 if (res != kOk)
513 return res; 513 return res;
514 514
515 if (use_default) 515 if (use_default)
516 DefaultScalingList4x4(i, pps->scaling_list4x4); 516 DefaultScalingList4x4(i, pps->scaling_list4x4);
517 517
518 } else { 518 } else {
519 if (sps.seq_scaling_matrix_present_flag) { 519 if (sps.seq_scaling_matrix_present_flag) {
520 // Table 7-2 fallback rule A in spec. 520 // Table 7-2 fallback rule A in spec.
521 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, 521 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter,
522 pps->scaling_list4x4); 522 pps->scaling_list4x4);
523 } else { 523 } else {
524 // Table 7-2 fallback rule B in spec. 524 // Table 7-2 fallback rule B in spec.
525 FallbackScalingList4x4(i, sps.scaling_list4x4[0], 525 FallbackScalingList4x4(i, sps.scaling_list4x4[0],
526 sps.scaling_list4x4[3], pps->scaling_list4x4); 526 sps.scaling_list4x4[3], pps->scaling_list4x4);
527 } 527 }
528 } 528 }
529 } 529 }
530 530
531 if (pps->transform_8x8_mode_flag) { 531 if (pps->transform_8x8_mode_flag) {
532 for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) { 532 for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) {
533 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); 533 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag);
534 534
535 if (pic_scaling_list_present_flag) { 535 if (pic_scaling_list_present_flag) {
536 res = ParseScalingList(sizeof(pps->scaling_list8x8[i]), 536 res = ParseScalingList(arraysize(pps->scaling_list8x8[i]),
537 pps->scaling_list8x8[i], &use_default); 537 pps->scaling_list8x8[i], &use_default);
538 if (res != kOk) 538 if (res != kOk)
539 return res; 539 return res;
540 540
541 if (use_default) 541 if (use_default)
542 DefaultScalingList8x8(i, pps->scaling_list8x8); 542 DefaultScalingList8x8(i, pps->scaling_list8x8);
543 543
544 } else { 544 } else {
545 if (sps.seq_scaling_matrix_present_flag) { 545 if (sps.seq_scaling_matrix_present_flag) {
546 // Table 7-2 fallback rule A in spec. 546 // Table 7-2 fallback rule A in spec.
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 1123
1124 default: 1124 default:
1125 DVLOG(4) << "Unsupported SEI message"; 1125 DVLOG(4) << "Unsupported SEI message";
1126 break; 1126 break;
1127 } 1127 }
1128 1128
1129 return kOk; 1129 return kOk;
1130 } 1130 }
1131 1131
1132 } // namespace content 1132 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698