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

Side by Side Diff: trunk/src/media/filters/h264_parser.cc

Issue 357903003: Revert 279958 "Revert "Revert 279650 "Add VaapiVideoEncodeAccele..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 | « trunk/src/media/filters/h264_parser.h ('k') | trunk/src/media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 8
9 #include "media/filters/h264_parser.h" 9 #include "media/filters/h264_parser.h"
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } while (0) 99 } while (0)
100 100
101 #define TRUE_OR_RETURN(a) \ 101 #define TRUE_OR_RETURN(a) \
102 do { \ 102 do { \
103 if (!(a)) { \ 103 if (!(a)) { \
104 DVLOG(1) << "Error in stream: invalid value, expected " << #a; \ 104 DVLOG(1) << "Error in stream: invalid value, expected " << #a; \
105 return kInvalidStream; \ 105 return kInvalidStream; \
106 } \ 106 } \
107 } while (0) 107 } while (0)
108 108
109 enum AspectRatioIdc {
110 kExtendedSar = 255,
111 };
112
109 // ISO 14496 part 10 113 // ISO 14496 part 10
110 // VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator" 114 // VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator"
111 static const int kTableSarWidth[] = { 115 static const int kTableSarWidth[] = {
112 0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2 116 0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2
113 }; 117 };
114 static const int kTableSarHeight[] = { 118 static const int kTableSarHeight[] = {
115 0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1 119 0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1
116 }; 120 };
117 COMPILE_ASSERT(arraysize(kTableSarWidth) == arraysize(kTableSarHeight), 121 COMPILE_ASSERT(arraysize(kTableSarWidth) == arraysize(kTableSarHeight),
118 sar_tables_must_have_same_size); 122 sar_tables_must_have_same_size);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 601
598 return kOk; 602 return kOk;
599 } 603 }
600 604
601 H264Parser::Result H264Parser::ParseVUIParameters(H264SPS* sps) { 605 H264Parser::Result H264Parser::ParseVUIParameters(H264SPS* sps) {
602 bool aspect_ratio_info_present_flag; 606 bool aspect_ratio_info_present_flag;
603 READ_BOOL_OR_RETURN(&aspect_ratio_info_present_flag); 607 READ_BOOL_OR_RETURN(&aspect_ratio_info_present_flag);
604 if (aspect_ratio_info_present_flag) { 608 if (aspect_ratio_info_present_flag) {
605 int aspect_ratio_idc; 609 int aspect_ratio_idc;
606 READ_BITS_OR_RETURN(8, &aspect_ratio_idc); 610 READ_BITS_OR_RETURN(8, &aspect_ratio_idc);
607 if (aspect_ratio_idc == H264SPS::kExtendedSar) { 611 if (aspect_ratio_idc == kExtendedSar) {
608 READ_BITS_OR_RETURN(16, &sps->sar_width); 612 READ_BITS_OR_RETURN(16, &sps->sar_width);
609 READ_BITS_OR_RETURN(16, &sps->sar_height); 613 READ_BITS_OR_RETURN(16, &sps->sar_height);
610 } else { 614 } else {
611 const int max_aspect_ratio_idc = arraysize(kTableSarWidth) - 1; 615 const int max_aspect_ratio_idc = arraysize(kTableSarWidth) - 1;
612 IN_RANGE_OR_RETURN(aspect_ratio_idc, 0, max_aspect_ratio_idc); 616 IN_RANGE_OR_RETURN(aspect_ratio_idc, 0, max_aspect_ratio_idc);
613 sps->sar_width = kTableSarWidth[aspect_ratio_idc]; 617 sps->sar_width = kTableSarWidth[aspect_ratio_idc];
614 sps->sar_height = kTableSarHeight[aspect_ratio_idc]; 618 sps->sar_height = kTableSarHeight[aspect_ratio_idc];
615 } 619 }
616 } 620 }
617 621
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1255
1252 default: 1256 default:
1253 DVLOG(4) << "Unsupported SEI message"; 1257 DVLOG(4) << "Unsupported SEI message";
1254 break; 1258 break;
1255 } 1259 }
1256 1260
1257 return kOk; 1261 return kOk;
1258 } 1262 }
1259 1263
1260 } // namespace media 1264 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/filters/h264_parser.h ('k') | trunk/src/media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698