Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 CHECK_EQ(arraysize(sps->scaling_list4x4[i]), kH264ScalingList4x4Length); |
|
Pawel Osciak
2013/03/08 02:37:53
I don't see how this check would be useful.
| |
| 464 res = ParseScalingList(arraysize(sps->scaling_list4x4[i]), | |
| 464 sps->scaling_list4x4[i], &use_default); | 465 sps->scaling_list4x4[i], &use_default); |
| 465 if (res != kOk) | 466 if (res != kOk) |
| 466 return res; | 467 return res; |
| 467 | 468 |
| 468 if (use_default) | 469 if (use_default) |
| 469 DefaultScalingList4x4(i, sps->scaling_list4x4); | 470 DefaultScalingList4x4(i, sps->scaling_list4x4); |
| 470 | 471 |
| 471 } else { | 472 } else { |
| 472 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, | 473 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, |
| 473 sps->scaling_list4x4); | 474 sps->scaling_list4x4); |
| 474 } | 475 } |
| 475 } | 476 } |
| 476 | 477 |
| 477 // Parse scaling_list8x8. | 478 // Parse scaling_list8x8. |
| 478 for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) { | 479 for (int i = 0; i < ((sps->chroma_format_idc != 3) ? 2 : 6); ++i) { |
| 479 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag); | 480 READ_BOOL_OR_RETURN(&seq_scaling_list_present_flag); |
| 480 | 481 |
| 481 if (seq_scaling_list_present_flag) { | 482 if (seq_scaling_list_present_flag) { |
| 482 res = ParseScalingList(sizeof(sps->scaling_list8x8[i]), | 483 res = ParseScalingList(sizeof(sps->scaling_list8x8[i]), |
|
Pawel Osciak
2013/03/08 02:37:53
Need to fix here too.
| |
| 483 sps->scaling_list8x8[i], &use_default); | 484 sps->scaling_list8x8[i], &use_default); |
| 484 if (res != kOk) | 485 if (res != kOk) |
| 485 return res; | 486 return res; |
| 486 | 487 |
| 487 if (use_default) | 488 if (use_default) |
| 488 DefaultScalingList8x8(i, sps->scaling_list8x8); | 489 DefaultScalingList8x8(i, sps->scaling_list8x8); |
| 489 | 490 |
| 490 } else { | 491 } else { |
| 491 FallbackScalingList8x8(i, kDefault8x8Intra, kDefault8x8Inter, | 492 FallbackScalingList8x8(i, kDefault8x8Intra, kDefault8x8Inter, |
| 492 sps->scaling_list8x8); | 493 sps->scaling_list8x8); |
| 493 } | 494 } |
| 494 } | 495 } |
| 495 | 496 |
| 496 return kOk; | 497 return kOk; |
| 497 } | 498 } |
| 498 | 499 |
| 499 H264Parser::Result H264Parser::ParsePPSScalingLists(const H264SPS& sps, | 500 H264Parser::Result H264Parser::ParsePPSScalingLists(const H264SPS& sps, |
| 500 H264PPS* pps) { | 501 H264PPS* pps) { |
| 501 // See 7.4.2.2. | 502 // See 7.4.2.2. |
| 502 bool pic_scaling_list_present_flag; | 503 bool pic_scaling_list_present_flag; |
| 503 bool use_default; | 504 bool use_default; |
| 504 Result res; | 505 Result res; |
| 505 | 506 |
| 506 for (int i = 0; i < 6; ++i) { | 507 for (int i = 0; i < 6; ++i) { |
| 507 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); | 508 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); |
| 508 | 509 |
| 509 if (pic_scaling_list_present_flag) { | 510 if (pic_scaling_list_present_flag) { |
| 510 res = ParseScalingList(sizeof(pps->scaling_list4x4[i]), | 511 res = ParseScalingList(sizeof(pps->scaling_list4x4[i]), |
|
Pawel Osciak
2013/03/08 02:37:53
And here.
| |
| 511 pps->scaling_list4x4[i], &use_default); | 512 pps->scaling_list4x4[i], &use_default); |
| 512 if (res != kOk) | 513 if (res != kOk) |
| 513 return res; | 514 return res; |
| 514 | 515 |
| 515 if (use_default) | 516 if (use_default) |
| 516 DefaultScalingList4x4(i, pps->scaling_list4x4); | 517 DefaultScalingList4x4(i, pps->scaling_list4x4); |
| 517 | 518 |
| 518 } else { | 519 } else { |
| 519 if (sps.seq_scaling_matrix_present_flag) { | 520 if (sps.seq_scaling_matrix_present_flag) { |
| 520 // Table 7-2 fallback rule A in spec. | 521 // Table 7-2 fallback rule A in spec. |
| 521 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, | 522 FallbackScalingList4x4(i, kDefault4x4Intra, kDefault4x4Inter, |
| 522 pps->scaling_list4x4); | 523 pps->scaling_list4x4); |
| 523 } else { | 524 } else { |
| 524 // Table 7-2 fallback rule B in spec. | 525 // Table 7-2 fallback rule B in spec. |
| 525 FallbackScalingList4x4(i, sps.scaling_list4x4[0], | 526 FallbackScalingList4x4(i, sps.scaling_list4x4[0], |
| 526 sps.scaling_list4x4[3], pps->scaling_list4x4); | 527 sps.scaling_list4x4[3], pps->scaling_list4x4); |
| 527 } | 528 } |
| 528 } | 529 } |
| 529 } | 530 } |
| 530 | 531 |
| 531 if (pps->transform_8x8_mode_flag) { | 532 if (pps->transform_8x8_mode_flag) { |
| 532 for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) { | 533 for (int i = 0; i < ((sps.chroma_format_idc != 3) ? 2 : 6); ++i) { |
| 533 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); | 534 READ_BOOL_OR_RETURN(&pic_scaling_list_present_flag); |
| 534 | 535 |
| 535 if (pic_scaling_list_present_flag) { | 536 if (pic_scaling_list_present_flag) { |
| 536 res = ParseScalingList(sizeof(pps->scaling_list8x8[i]), | 537 res = ParseScalingList(sizeof(pps->scaling_list8x8[i]), |
|
Pawel Osciak
2013/03/08 02:37:53
And here.
| |
| 537 pps->scaling_list8x8[i], &use_default); | 538 pps->scaling_list8x8[i], &use_default); |
| 538 if (res != kOk) | 539 if (res != kOk) |
| 539 return res; | 540 return res; |
| 540 | 541 |
| 541 if (use_default) | 542 if (use_default) |
| 542 DefaultScalingList8x8(i, pps->scaling_list8x8); | 543 DefaultScalingList8x8(i, pps->scaling_list8x8); |
| 543 | 544 |
| 544 } else { | 545 } else { |
| 545 if (sps.seq_scaling_matrix_present_flag) { | 546 if (sps.seq_scaling_matrix_present_flag) { |
| 546 // Table 7-2 fallback rule A in spec. | 547 // Table 7-2 fallback rule A in spec. |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1123 | 1124 |
| 1124 default: | 1125 default: |
| 1125 DVLOG(4) << "Unsupported SEI message"; | 1126 DVLOG(4) << "Unsupported SEI message"; |
| 1126 break; | 1127 break; |
| 1127 } | 1128 } |
| 1128 | 1129 |
| 1129 return kOk; | 1130 return kOk; |
| 1130 } | 1131 } |
| 1131 | 1132 |
| 1132 } // namespace content | 1133 } // namespace content |
| OLD | NEW |