-
Notifications
You must be signed in to change notification settings - Fork 175
/
File_Avc.cpp
4960 lines (4633 loc) · 227 KB
/
File_Avc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//---------------------------------------------------------------------------
// Pre-compilation
#include "MediaInfo/PreComp.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Setup.h"
#include "MediaInfo/TimeCode.h" // For bitset8
#include "ZenLib/Conf.h"
#include <algorithm>
#include <iterator>
#include <limits>
using namespace ZenLib;
using namespace std;
//---------------------------------------------------------------------------
//***************************************************************************
// Constants
//***************************************************************************
//---------------------------------------------------------------------------
#if defined(MEDIAINFO_AVC_YES) || defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_MPEG7_YES)
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//---------------------------------------------------------------------------
static constexpr const char* Avc_profile_idc_Names[]= // Time sorted list
{
"Baseline", // 2003
"Main",
"Extended",
"High", // 2005
"High 10",
"High 4:2:2",
"High 4:4:4",
"High 10 Intra", // 2007
"High 4:2:2 Intra",
"High 4:4:4 Intra",
"CAVLC 4:4:4 Intra",
"High 4:4:4 Predictive",
"Scalable Baseline", // 2007-11
"Scalable High",
"Scalable High Intra",
"Constrained Baseline", // 2009
"Multiview High",
"Stereo High", // 2010
"Progressive High", // 2011
"Constrained High", // 2012
"Scalable Constrained Baseline",
"Scalable Constrained High",
"Multiview Depth High", // 2013
"MFC High", // 2014
"Enhanced Multiview Depth High",
"MFC Depth High", // 2016
"Progressive High 10", // 2017
};
const char* Avc_profile_idc_Name(size_t Index)
{
return Avc_profile_idc_Names[Index];
}
static constexpr int8u Avc_profile_idc_Mapping[][2]= // profile_idc sorted list
{
{ 44, 10 }, // 44, CAVLC 4:4:4 Intra (2007)
{ 66, 0 }, // 66, Baseline (2003)
{ 77, 1 }, // 77, Main (2003)
{ 83, 12 }, // 83, Scalable Baseline (2007-11)
{ 86, 13 }, // 86, Scalable High (2007-11)
{ 88, 2 }, // 88, Extended (2003)
{ 100, 3 }, // 100, High (2005)
{ 110, 4 }, // 110, High 10 (2005)
{ 118, 16 }, // 118, Multiview High (2009)
{ 122, 5 }, // 122, High 4:2:2 (2005)
{ 128, 17 }, // 128, Stereo High (2010)
{ 134, 23 }, // 134, MFC High (2014)
{ 135, 25 }, // 135, MFC Depth High (2016)
{ 138, 22 }, // 138, Multiview Depth High (2013)
{ 139, 24 }, // 139, Enhanced Multiview Depth High (2014)
{ 144, 16 }, // 144, High 4:4:4 (2005)
{ 244, 11 }, // 244, High 4:4:4 Predictive (2007)
};
static inline constexpr bool Avc_profile_idc_Names_Size_Cmp(const int8u first[2], const int8u second)
{
return first[0]<second;
}
static constexpr const int8u Avc_level_idc_Names[]= // Time sorted list
{
0x10,
0x11,
0x12,
0x13,
0x20,
0x21,
0x22,
0x30,
0x31,
0x32,
0x40,
0x41,
0x42,
0x50,
0x51,
0x09,
0x52,
0x60,
0x61,
0x62,
};
string Avc_level_idc_Name(size_t Index)
{
auto Level=Avc_level_idc_Names[Index];
if (Level==9)
return "1b";
string LevelS;
LevelS+='0'+(Level>>4);
Level&=0xF;
if (Level)
{
LevelS+='.';
LevelS+='0'+Level;
}
return LevelS;
}
string Avc_profile_level_string(int8u profile_idc, int8u level_idc=0, int8u constraint_set_flags=0)
{
string Profile;
bitset8 constraint_setsB(constraint_set_flags);
//Profile
if (profile_idc)
{
size_t Profile_Pos=(size_t)-1;
if (constraint_setsB[6]) // constraint_set1_flag
switch (profile_idc)
{
case 66 : Profile_Pos= 15; break; // Constrained Baseline (2009)
}
if (constraint_setsB[4]) // constraint_set3_flag
switch (profile_idc)
{
case 86 : Profile_Pos= 14; break; // Scalable High Intra (2007-11)
case 110 : Profile_Pos= 7; break; // High 10 Intra (2007)
case 122 : Profile_Pos= 8; break; // High 4:2:2 Intra (2007)
case 244 : Profile_Pos= 9; break; // High 4:4:4 Intra (2007)
}
if (constraint_setsB[3]) // constraint_set4_flag
{
if (constraint_setsB[2]) // constraint_set5_flag
switch (profile_idc)
{
case 83 : Profile_Pos= 20; break; // Scalable Constrained Baseline (2012)
case 86 : Profile_Pos= 21; break; // Scalable Constrained High (2012)
case 100 : Profile_Pos= 19; break; // Constrained High (2012)
}
else
switch (profile_idc)
{
case 100 : Profile_Pos= 18; break; // Progressive High (2011)
case 110 : Profile_Pos= 26; break; // Progressive High 10 (2017)
}
}
if (Profile_Pos==(size_t)-1)
{
auto Pos=lower_bound(begin(Avc_profile_idc_Mapping), end(Avc_profile_idc_Mapping), profile_idc, Avc_profile_idc_Names_Size_Cmp);
if (Pos!=end(Avc_profile_idc_Mapping))
Profile_Pos=(*Pos)[1];
}
if (Profile_Pos==(size_t)-1)
Profile=to_string(profile_idc);
else
Profile=Avc_profile_idc_Names[Profile_Pos];
}
//Level
if (level_idc)
{
auto level_idc_level=level_idc/10;
auto level_idc_sub=level_idc%10;
if (!Profile.empty())
Profile+='@';
Profile+='L';
bool Is1b=false;
switch (level_idc)
{
case 9:
Is1b=true;
break;
case 11:
if (constraint_setsB[4]) // constraint_set3_flag
switch (profile_idc)
{
case 66 : // Baseline
case 77 : // Main
case 88 : // Extended
Is1b=true;
break;
}
break;
}
if (Is1b)
Profile+="1b";
else
{
if (level_idc_level>=10)
{
auto level_idc_level_10=level_idc_level/10;
auto level_idc_level_01=level_idc_level%10;
level_idc_level=level_idc_level_01;
Profile+='0'+level_idc_level_10;
}
Profile+='0'+level_idc_level;
if (level_idc_sub && level_idc_sub<10)
{
Profile+='.';
Profile+='0'+level_idc_sub;
}
}
}
return Profile;
}
size_t Avc_profile_level_Indexes(const string& ProfileLevelS) // Note: 1-based, 0 means not found, 0xPPLL form
{
auto LevelPos=ProfileLevelS.find('@');
size_t ProfileLevel;
string ProfileS;
// Level
if (LevelPos!=string::npos)
{
if (ProfileLevelS.size()-LevelPos>2 && ProfileLevelS[LevelPos+1]=='L' && ProfileLevelS[LevelPos+2]>='0' && ProfileLevelS[LevelPos+2]<='9')
{
int8u Level=ProfileLevelS[LevelPos+2];
if (Level=='1' && ProfileLevelS.size()-LevelPos==3 && ProfileLevelS[LevelPos+3]=='b')
Level=9;
else
{
Level-='0';
Level<<=4;
if (ProfileLevelS.size()-LevelPos>4 && ProfileLevelS[LevelPos+3]=='.' && ProfileLevelS[LevelPos+4]>='0' && ProfileLevelS[LevelPos+4]<='9')
Level+=ProfileLevelS[LevelPos+4]-'0';
}
auto Pos=find(begin(Avc_level_idc_Names), end(Avc_level_idc_Names), Level);
if (Pos==end(Avc_level_idc_Names))
ProfileLevel=0;
else
ProfileLevel=distance(begin(Avc_level_idc_Names), Pos)+1;
}
else
{
ProfileLevel=0;
}
ProfileS=ProfileLevelS.substr(0, LevelPos);
}
else
{
ProfileLevel=0;
ProfileS=ProfileLevelS;
}
// Profile
auto Pos=find(begin(Avc_profile_idc_Names), end(Avc_profile_idc_Names), ProfileS);
if (Pos!=end(Avc_profile_idc_Names))
ProfileLevel|=(distance(begin(Avc_profile_idc_Names), Pos)+1)<<8;
return ProfileLevel;
}
//---------------------------------------------------------------------------
} //NameSpace
//---------------------------------------------------------------------------
#endif //...
//---------------------------------------------------------------------------
//***************************************************************************
//
//***************************************************************************
//---------------------------------------------------------------------------
#if defined(MEDIAINFO_AVC_YES)
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Video/File_Avc.h"
#if defined(MEDIAINFO_AFDBARDATA_YES)
#include "MediaInfo/Video/File_AfdBarData.h"
#endif //defined(MEDIAINFO_AFDBARDATA_YES)
#if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
#include "MediaInfo/Text/File_DtvccTransport.h"
#endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
#if MEDIAINFO_ADVANCED2
#include "ThirdParty/base64/base64.h"
#endif //MEDIAINFO_ADVANCED2
#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
#if MEDIAINFO_EVENTS
#include "MediaInfo/MediaInfo_Config_PerPackage.h"
#include "MediaInfo/MediaInfo_Events.h"
#include "MediaInfo/MediaInfo_Events_Internal.h"
#endif //MEDIAINFO_EVENTS
#include <cstring>
#include <algorithm>
using namespace std;
using namespace ZenLib;
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Infos
//***************************************************************************
//---------------------------------------------------------------------------
const size_t Avc_Errors_MaxCount=32;
//---------------------------------------------------------------------------
extern const int8u Avc_PixelAspectRatio_Size=17;
extern const float32 Avc_PixelAspectRatio[Avc_PixelAspectRatio_Size]=
{
(float32)1, //Reserved
(float32)1,
(float32)12/(float32)11,
(float32)10/(float32)11,
(float32)16/(float32)11,
(float32)40/(float32)33,
(float32)24/(float32)11,
(float32)20/(float32)11,
(float32)32/(float32)11,
(float32)80/(float32)33,
(float32)18/(float32)11,
(float32)15/(float32)11,
(float32)64/(float32)33,
(float32)160/(float32)99,
(float32)4/(float32)3,
(float32)3/(float32)2,
(float32)2,
};
//---------------------------------------------------------------------------
const char* Avc_video_format[]=
{
"Component",
"PAL",
"NTSC",
"SECAM",
"MAC",
"",
"Reserved",
"Reserved",
};
//---------------------------------------------------------------------------
const char* Avc_video_full_range[]=
{
"Limited",
"Full",
};
//---------------------------------------------------------------------------
static const char* Avc_primary_pic_type[]=
{
"I",
"I, P",
"I, P, B",
"SI",
"SI, SP",
"I, SI",
"I, SI, P, SP",
"I, SI, P, SP, B",
};
//---------------------------------------------------------------------------
static const char* Avc_slice_type[]=
{
"P",
"B",
"I",
"SP",
"SI",
"P",
"B",
"I",
"SP",
"SI",
};
//---------------------------------------------------------------------------
const int8u Avc_pic_struct_Size=9;
static const char* Avc_pic_struct[]=
{
"frame",
"top field",
"bottom field",
"top field, bottom field",
"bottom field, top field",
"top field, bottom field, top field repeated",
"bottom field, top field, bottom field repeated",
"frame doubling",
"frame tripling",
};
//---------------------------------------------------------------------------
static const int8u Avc_NumClockTS[]=
{
1,
1,
1,
2,
2,
3,
3,
2,
3,
};
//---------------------------------------------------------------------------
static const char* Avc_ct_type[]=
{
"Progressive",
"Interlaced",
"Unknown",
"Reserved",
};
//---------------------------------------------------------------------------
static const int8u Avc_SubWidthC[]=
{
1,
2,
2,
1,
};
//---------------------------------------------------------------------------
static const int8u Avc_SubHeightC[]=
{
1,
2,
1,
1,
};
//---------------------------------------------------------------------------
const char* Mpegv_colour_primaries(int8u colour_primaries);
const char* Mpegv_transfer_characteristics(int8u transfer_characteristics);
const char* Mpegv_matrix_coefficients(int8u matrix_coefficients);
const char* Mpegv_matrix_coefficients_ColorSpace(int8u matrix_coefficients);
//---------------------------------------------------------------------------
static const char* Avc_ChromaSubsampling_format_idc(int8u chroma_format_idc)
{
switch (chroma_format_idc)
{
case 1: return "4:2:0";
case 2: return "4:2:2";
case 3: return "4:4:4";
default: return "";
}
}
//---------------------------------------------------------------------------
static const char* Avc_ChromaSubsampling_format_idc_ColorSpace(int8u chroma_format_idc)
{
switch (chroma_format_idc)
{
case 0: return "Y";
case 1: return "YUV";
case 2: return "YUV";
default: return "";
}
}
//---------------------------------------------------------------------------
const char* Avc_user_data_GA94_cc_type(int8u cc_type)
{
switch (cc_type)
{
case 0 : return "CEA-608 line 21 field 1 closed captions"; //closed caption 3 if this is second field
case 1 : return "CEA-608 line 21 field 2 closed captions"; //closed caption 4 if this is second field
case 2 : return "DTVCC Channel Packet Data";
case 3 : return "DTVCC Channel Packet Start";
default : return "";
}
}
//---------------------------------------------------------------------------
int32u Avc_MaxDpbMbs(int8u level)
{
switch (level)
{
case 10 : return 1485;
case 11 : return 3000;
case 12 : return 6000;
case 13 :
case 20 : return 11880;
case 21 : return 19800;
case 22 : return 20250;
case 30 : return 40500;
case 31 : return 108000;
case 32 : return 216000;
case 40 :
case 41 : return 245760;
case 42 : return 522240;
case 50 : return 589824;
case 51 : return 983040;
default : return 0;
}
}
//---------------------------------------------------------------------------
namespace AVC_Intra_Headers
{
//720p50
static const size_t __720p50__50_Size = 4 * 0x10 + 0xA;
static const int8u __720p50__50[__720p50__50_Size] = { 0x00, 0x00, 0x01, 0x67, 0x6E, 0x10, 0x20, 0xA6, 0xD4, 0x20, 0x32, 0x33, 0x0C, 0x71, 0x18, 0x88,
0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8C, 0x44, 0x30, 0x21, 0x02, 0x56, 0x4E, 0x6F, 0x37, 0xCD,
0xF9, 0xBF, 0x81, 0x6B, 0xF3, 0x7C, 0xDE, 0x6E, 0x6C, 0xD3, 0x3C, 0x0F, 0x01, 0x6E, 0xFF, 0xC0,
0x00, 0xC0, 0x01, 0x38, 0xC0, 0x40, 0x40, 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x06,
0x48, 0x40, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x31, 0x12, 0x11 };
static const size_t __720p50_100_Size = 5 * 0x10 + 0x2;
static const int8u __720p50_100[__720p50_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x29, 0xB6, 0xD4, 0x20, 0x2A, 0x33, 0x1D, 0xC7, 0x62, 0xA1,
0x08, 0x40, 0x54, 0x66, 0x3B, 0x8E, 0xC5, 0x42, 0x02, 0x10, 0x25, 0x64, 0x2C, 0x89, 0xE8, 0x85,
0xE4, 0x21, 0x4B, 0x90, 0x83, 0x06, 0x95, 0xD1, 0x06, 0x46, 0x97, 0x20, 0xC8, 0xD7, 0x43, 0x08,
0x11, 0xC2, 0x1E, 0x4C, 0x91, 0x0F, 0x01, 0x40, 0x16, 0xEC, 0x07, 0x8C, 0x04, 0x04, 0x05, 0x00,
0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x64, 0x84, 0x00, 0x00, 0x01, 0x68, 0xCE, 0x31,
0x12, 0x11 };
//720p60
static const size_t __720p60__50_Size = 4 * 0x10 + 0xB;
static const int8u __720p60__50[__720p60__50_Size] = { 0x00, 0x00, 0x01, 0x67, 0x6E, 0x10, 0x20, 0xA6, 0xD4, 0x20, 0x32, 0x33, 0x0C, 0x71, 0x18, 0x88,
0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8C, 0x44, 0x30, 0x21, 0x02, 0x56, 0x4E, 0x6F, 0x37, 0xCD,
0xF9, 0xBF, 0x81, 0x6B, 0xF3, 0x7C, 0xDE, 0x6E, 0x6C, 0xD3, 0x3C, 0x0F, 0x01, 0x6E, 0xFF, 0xC0,
0x00, 0xC0, 0x01, 0x38, 0xC0, 0x40, 0x40, 0x50, 0x00, 0x00, 0x3E, 0x90, 0x00, 0x1D, 0x4C, 0x08,
0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x31, 0x12, 0x11 };
static const size_t __720p60_100_Size = 5 * 0x10 + 0x1;
static const int8u __720p60_100[__720p60_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x29, 0xB6, 0xD4, 0x20, 0x2A, 0x33, 0x1D, 0xC7, 0x62, 0xA1,
0x08, 0x40, 0x54, 0x66, 0x3B, 0x8E, 0xC5, 0x42, 0x02, 0x10, 0x25, 0x64, 0x2C, 0x89, 0xE8, 0x85,
0xE4, 0x21, 0x4B, 0x90, 0x83, 0x06, 0x95, 0xD1, 0x06, 0x46, 0x97, 0x20, 0xC8, 0xD7, 0x43, 0x08,
0x11, 0xC2, 0x1E, 0x4C, 0x91, 0x0F, 0x01, 0x40, 0x16, 0xEC, 0x07, 0x8C, 0x04, 0x04, 0x05, 0x00,
0x00, 0x03, 0x03, 0xE9, 0x00, 0x01, 0xD4, 0xC0, 0x84, 0x00, 0x00, 0x01, 0x68, 0xCE, 0x31, 0x12,
0x11 };
//1080i50
static const size_t _1080i50__50_Size = 5 * 0x10 + 0xE;
static const int8u _1080i50__50[_1080i50__50_Size] = { 0x00, 0x00, 0x01, 0x67, 0x6E, 0x10, 0x28, 0xA6, 0xD4, 0x20, 0x32, 0x33, 0x0C, 0x71, 0x18, 0x88,
0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8C, 0x44, 0x30, 0x21, 0x02, 0x56, 0x4E, 0x6E, 0x61, 0x87,
0x3E, 0x73, 0x4D, 0x98, 0x0C, 0x03, 0x06, 0x9C, 0x0B, 0x73, 0xE6, 0xC0, 0xB5, 0x18, 0x63, 0x0D,
0x39, 0xE0, 0x5B, 0x02, 0xD4, 0xC6, 0x19, 0x1A, 0x79, 0x8C, 0x32, 0x34, 0x24, 0xF0, 0x16, 0x81,
0x13, 0xF7, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x71, 0x80, 0x80, 0x80, 0xA0, 0x00, 0x00, 0x03, 0x00,
0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x31, 0x12, 0x11 };
static const size_t _1080i50_100_Size = 5 * 0x10 + 0xF;
static const int8u _1080i50_100[_1080i50_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x29, 0xB6, 0xD4, 0x20, 0x22, 0x33, 0x19, 0xC6, 0x63, 0x23,
0x21, 0x01, 0x11, 0x98, 0xCE, 0x33, 0x19, 0x18, 0x21, 0x03, 0x3A, 0x46, 0x65, 0x6A, 0x65, 0x24,
0xAD, 0xE9, 0x12, 0x32, 0x14, 0x1A, 0x26, 0x34, 0xAD, 0xA4, 0x41, 0x82, 0x23, 0x01, 0x50, 0x2B,
0x1A, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2E, 0x11, 0x12, 0x08, 0xC6, 0x8C, 0x04, 0x41, 0x28, 0x4C,
0x34, 0xF0, 0x1E, 0x01, 0x13, 0xF2, 0xE0, 0x3C, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03, 0x00,
0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20, 0x00, 0x00, 0x01, 0x68, 0xCE, 0x33, 0x48, 0xD0 };
//1080i60
static const size_t _1080i60__50_Size = 5 * 0x10 + 0xD;
static const int8u _1080i60__50[_1080i60__50_Size] = { 0x00, 0x00, 0x01, 0x67, 0x6E, 0x10, 0x28, 0xA6, 0xD4, 0x20, 0x32, 0x33, 0x0C, 0x71, 0x18, 0x88,
0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8C, 0x44, 0x30, 0x21, 0x02, 0x56, 0x4E, 0x6E, 0x61, 0x87,
0x3E, 0x73, 0x4D, 0x98, 0x0C, 0x03, 0x06, 0x9C, 0x0B, 0x73, 0xE6, 0xC0, 0xB5, 0x18, 0x63, 0x0D,
0x39, 0xE0, 0x5B, 0x02, 0xD4, 0xC6, 0x19, 0x1A, 0x79, 0x8C, 0x32, 0x34, 0x24, 0xF0, 0x16, 0x81,
0x13, 0xF7, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x71, 0x80, 0x80, 0x80, 0xA0, 0x00, 0x00, 0x7D, 0x20,
0x00, 0x1D, 0x4C, 0x10, 0x80, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x31, 0x12, 0x11 };
static const size_t _1080i60_100_Size = 5 * 0x10 + 0xD;
static const int8u _1080i60_100[_1080i60_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x29, 0xB6, 0xD4, 0x20, 0x22, 0x33, 0x19, 0xC6, 0x63, 0x23,
0x21, 0x01, 0x11, 0x98, 0xCE, 0x33, 0x19, 0x18, 0x21, 0x03, 0x3A, 0x46, 0x65, 0x6A, 0x65, 0x24,
0xAD, 0xE9, 0x12, 0x32, 0x14, 0x1A, 0x26, 0x34, 0xAD, 0xA4, 0x41, 0x82, 0x23, 0x01, 0x50, 0x2B,
0x1A, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2E, 0x11, 0x12, 0x08, 0xC6, 0x8C, 0x04, 0x41, 0x28, 0x4C,
0x34, 0xF0, 0x1E, 0x01, 0x13, 0xF2, 0xE0, 0x3C, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x1F, 0x48,
0x00, 0x07, 0x53, 0x04, 0x20, 0x00, 0x00, 0x01, 0x68, 0xCE, 0x33, 0x48, 0xD0 };
//1080p50
static const size_t _1080p50_100_Size = 4 * 0x10 + 0xA;
static const int8u _1080p50_100[_1080p50_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x2A, 0xB6, 0xD4, 0x20, 0x22, 0x33, 0x19, 0xC6, 0x63, 0x23,
0x21, 0x01, 0x11, 0x98, 0xCE, 0x33, 0x19, 0x18, 0x21, 0x02, 0x56, 0xB9, 0x3D, 0x7D, 0x7E, 0x4F,
0xE3, 0x3F, 0x11, 0xF1, 0x9E, 0x08, 0xB8, 0x8C, 0x54, 0x43, 0xC0, 0x78, 0x02, 0x27, 0xE2, 0x70,
0x1E, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x01, 0x92, 0x10,
0x00, 0x00, 0x00, 0x00, 0x01, 0x68, 0xCE, 0x33, 0x48, 0xD0 };
//1080p60
static const size_t _1080p60_100_Size = 4 * 0x10 + 0x8;
static const int8u _1080p60_100[_1080p60_100_Size] = { 0x00, 0x00, 0x01, 0x67, 0x7A, 0x10, 0x2A, 0xB6, 0xD4, 0x20, 0x22, 0x33, 0x19, 0xC6, 0x63, 0x23,
0x21, 0x01, 0x11, 0x98, 0xCE, 0x33, 0x19, 0x18, 0x21, 0x02, 0x56, 0xB9, 0x3D, 0x7D, 0x7E, 0x4F,
0xE3, 0x3F, 0x11, 0xF1, 0x9E, 0x08, 0xB8, 0x8C, 0x54, 0x43, 0xC0, 0x78, 0x02, 0x27, 0xE2, 0x70,
0x1E, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00, 0x0F, 0xA4, 0x00, 0x07, 0x53, 0x02, 0x10, 0x00, 0x00,
0x00, 0x00, 0x01, 0x68, 0xCE, 0x33, 0x48, 0xD0 };
};
//---------------------------------------------------------------------------
// Some DV Metadata info: http://www.freepatentsonline.com/20050076039.pdf
static const char* MDPM(int8u ID)
{
switch (ID)
{
case 0x18: return "Date/Time"; // Is "Text header" in doc?
case 0x19: return "Date/Time (continue 1)"; // Is "Text" in doc?
case 0x70: return "Consumer Camera 1";
case 0x71: return "Consumer Camera 2";
case 0x73: return "Lens";
case 0x7F: return "Camera shutter";
case 0xA1: return "Iris (F)";
case 0xE0: return "Make Model";
case 0xE1: return "Rec Info";
case 0xE4: return "Model Name";
case 0xE5: return "Model Name (continue 1)";
case 0xE6: return "Model Name (continue 1)";
default : return "";
}
}
//---------------------------------------------------------------------------
static const char* MDPM_MakeName(int16u Value)
{
switch (Value)
{
case 0x0103: return "Panasonic";
case 0x0108: return "Sony";
case 0x1011: return "Canon";
case 0x1104: return "JVC";
default : return "";
}
}
//---------------------------------------------------------------------------
// From DV
extern const char* Dv_consumer_camera_1_ae_mode[];
extern const char* Dv_consumer_camera_1_wb_mode[];
extern const char* Dv_consumer_camera_1_white_balance(int8u white_balance);
extern const char* Dv_consumer_camera_1_fcm[];
//***************************************************************************
// Constructor/Destructor
//***************************************************************************
//---------------------------------------------------------------------------
File_Avc::File_Avc()
#if MEDIAINFO_DUPLICATE
:File__Duplicate()
#endif //MEDIAINFO_DUPLICATE
{
//Config
#if MEDIAINFO_EVENTS
ParserIDs[0]=MediaInfo_Parser_Avc;
StreamIDs_Width[0]=0;
#endif //MEDIAINFO_EVENTS
#if MEDIAINFO_TRACE
Trace_Layers_Update(8); //Stream
#endif //MEDIAINFO_TRACE
MustSynchronize=true;
PTS_DTS_Needed=true;
StreamSource=IsStream;
Frame_Count_NotParsedIncluded=0;
//In
Frame_Count_Valid=0;
FrameIsAlwaysComplete=false;
MustParse_SPS_PPS=false;
SizedBlocks=false;
//Temporal references
TemporalReferences_DelayedElement=NULL;
//Temp
preferred_transfer_characteristics=2;
//Text
#if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
GA94_03_Parser=NULL;
#endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
}
//---------------------------------------------------------------------------
File_Avc::~File_Avc()
{
Clean_Temp_References();
#if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
delete GA94_03_Parser; //GA94_03_Parser=NULL;
#endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
Clean_Seq_Parameter();
}
//---------------------------------------------------------------------------
void File_Avc::Clean_Temp_References()
{
for (size_t Pos = 0; Pos<TemporalReferences.size(); Pos++)
delete TemporalReferences[Pos]; //TemporalReferences[Pos]=NULL;
TemporalReferences.clear();
}
//---------------------------------------------------------------------------
void File_Avc::Clean_Seq_Parameter()
{
for (size_t Pos = 0; Pos<seq_parameter_sets.size(); Pos++)
delete seq_parameter_sets[Pos]; //TemporalReferences[Pos]=NULL;
seq_parameter_sets.clear();
for (size_t Pos = 0; Pos<subset_seq_parameter_sets.size(); Pos++)
delete subset_seq_parameter_sets[Pos]; //subset_seq_parameter_sets[Pos]=NULL;
subset_seq_parameter_sets.clear();
for (size_t Pos = 0; Pos<pic_parameter_sets.size(); Pos++)
delete pic_parameter_sets[Pos]; //pic_parameter_sets[Pos]=NULL;
pic_parameter_sets.clear();
}
//***************************************************************************
// AVC-Intra hardcoded headers
//***************************************************************************
//---------------------------------------------------------------------------
File_Avc::avcintra_header File_Avc::AVC_Intra_Headers_Data(int32u CodecID)
{
switch (CodecID)
{
case 0x61693132: //ai12
case 0x61693232: //ai22
return avcintra_header(AVC_Intra_Headers::_1080p50_100, AVC_Intra_Headers::_1080p50_100_Size); // AVC-Intra 1080p50 class 100/200
case 0x61693133: //ai13
case 0x61693233: //ai23
return avcintra_header(AVC_Intra_Headers::_1080p60_100, AVC_Intra_Headers::_1080p60_100_Size); // AVC-Intra 1080p60 class 100/200
case 0x61693135: //ai15
case 0x61693235: //ai25
return avcintra_header(AVC_Intra_Headers::_1080i50_100, AVC_Intra_Headers::_1080i50_100_Size); // AVC-Intra 1080i50 class 100/200
case 0x61693136: //ai16
case 0x61693236: //ai26
return avcintra_header(AVC_Intra_Headers::_1080i60_100, AVC_Intra_Headers::_1080i60_100_Size); // AVC-Intra 1080i60 class 100/200
case 0x61693170: //ai1p
case 0x61693270: //ai2p
return avcintra_header(AVC_Intra_Headers::__720p60_100, AVC_Intra_Headers::__720p60_100_Size); // AVC-Intra 720p60 class 100/200
case 0x61693171: //ai1q
case 0x61693271: //ai2q
return avcintra_header(AVC_Intra_Headers::__720p50_100, AVC_Intra_Headers::__720p50_100_Size); // AVC-Intra 720p50 class 100/200
//case 0x61693532: //ai52
// return avcintra_header(NULL, 0); // AVC-Intra 1080p25 class 50 (not supported)
//case 0x61693533: //ai53
// return avcintra_header(NULL, 0); // AVC-Intra 1080p30 class 50 (not supported)
case 0x61693535: //ai55
return avcintra_header(AVC_Intra_Headers::_1080i50__50, AVC_Intra_Headers::_1080i50__50_Size); // AVC-Intra 1080i50 class 50
case 0x61693536: //ai56
return avcintra_header(AVC_Intra_Headers::_1080i60__50, AVC_Intra_Headers::_1080i60__50_Size); // AVC-Intra 1080i60 class 50
case 0x61693570: //ai5p
return avcintra_header(AVC_Intra_Headers::__720p60__50, AVC_Intra_Headers::__720p60__50_Size); // AVC-Intra 720p60 class 50
case 0x61693571: //ai5q
return avcintra_header(AVC_Intra_Headers::__720p50__50, AVC_Intra_Headers::__720p50__50_Size); // AVC-Intra 720p50 class 50
default :
return avcintra_header(NULL, 0);
}
}
//---------------------------------------------------------------------------
int32u File_Avc::AVC_Intra_CodecID_FromMeta(int32u Width, int32u Height, int32u Fields, int32u SampleDuration, int32u TimeScale, int32u SizePerFrame)
{
// Computing bitrate
int64u BitRate=SampleDuration?(((int64u)SizePerFrame)*8*TimeScale/SampleDuration):0;
int64u SampleRate=SampleDuration?(float64_int64s(((float64)TimeScale)/SampleDuration)):0;
int32u Class;
switch (Width)
{
case 1920:
Class=100;
break;
case 1440:
case 1280:
case 960:
Class=50;
break;
default:
if (!BitRate)
return 0x4156696E; //AVin (neutral)
Class=BitRate<=75000000?50:100; //Arbitrary choosen. TODO: check real maximumm bitrate, check class 200
break;
}
switch (Class)
{
case 100 :
switch (Height)
{
case 1088 :
case 1080 :
switch (Fields)
{
case 1:
switch (SampleRate)
{
case 50: return 0x61693132; //ai12
case 60: return 0x61693133; //ai13
default: return 0x4156696E; //AVin (neutral)
}
case 2:
switch (SampleRate)
{
case 25: return 0x61693135; //ai15 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 30: return 0x61693136; //ai16 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 50: return 0x61693135; //ai15 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 60: return 0x61693136; //ai16 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
default: return 0x4156696E; //AVin (neutral)
}
default: return 0x4156696E; //AVin (neutral)
}
case 720 :
switch (Fields)
{
case 1:
switch (SampleRate)
{
case 50: return 0x61693170; //ai1p
case 60: return 0x61693171; //ai1q
default: return 0x4156696E; //AVin (neutral)
}
default: return 0x4156696E; //AVin (neutral)
}
default : return 0x4156696E; //AVin (neutral)
}
case 50 :
switch (Height)
{
case 1088 :
case 1080 :
switch (Fields)
{
case 1:
switch (SampleRate)
{
case 25: return 0x61693532; //ai52
case 30: return 0x61693533; //ai53
default: return 0x4156696E; //AVin (neutral)
}
case 2:
switch (SampleRate)
{
case 25: return 0x61693535; //ai55 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 30: return 0x61693536; //ai56 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 50: return 0x61693535; //ai55 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
case 60: return 0x61693536; //ai56 //TODO: check more files in order to know if it should be 1 or 2 fields per sample
default: return 0x4156696E; //AVin (neutral)
}
default: return 0x4156696E; //AVin (neutral)
}
case 720 :
switch (Fields)
{
case 1:
switch (SampleRate)
{
case 50: return 0x61693570; //ai5p
case 60: return 0x61693571; //ai5q
default: return 0x4156696E; //AVin (neutral)
}
default: return 0x4156696E; //AVin (neutral)
}
default : return 0x4156696E; //AVin (neutral)
}
default: return 0x4156696E; //AVin (neutral)
}
}
//***************************************************************************
// Streams management
//***************************************************************************
//---------------------------------------------------------------------------
void File_Avc::Streams_Fill()
{
for (std::vector<seq_parameter_set_struct*>::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item)
if ((*seq_parameter_set_Item))
Streams_Fill(seq_parameter_set_Item);
for (std::vector<seq_parameter_set_struct*>::iterator subset_seq_parameter_set_Item=subset_seq_parameter_sets.begin(); subset_seq_parameter_set_Item!=subset_seq_parameter_sets.end(); ++subset_seq_parameter_set_Item)
if ((*subset_seq_parameter_set_Item))
{
if (seq_parameter_sets.empty())
Streams_Fill(subset_seq_parameter_set_Item);
else
Streams_Fill_subset(subset_seq_parameter_set_Item);
Fill(Stream_Video, 0, Video_MultiView_Count, (*subset_seq_parameter_set_Item)->num_views_minus1+1);
}
#if MEDIAINFO_ADVANCED2
for (size_t Pos = 0; Pos<Dump_SPS.size(); Pos++)
Fill(Stream_Video, 0, "Dump_seq_parameter_set", Dump_SPS[Pos].c_str());
for (size_t Pos = 0; Pos<Dump_PPS.size(); Pos++)
Fill(Stream_Video, 0, "Dump_pic_parameter_set", Dump_PPS[Pos].c_str());
#endif //MEDIAINFO_ADVANCED2
}
//---------------------------------------------------------------------------
void File_Avc::Streams_Fill(std::vector<seq_parameter_set_struct*>::iterator seq_parameter_set_Item)
{
if (Count_Get(Stream_Video) && !Retrieve_Const(Stream_Video, 0, Video_Format).empty())
return;
if (!Count_Get(Stream_Video))
Stream_Prepare(Stream_Video);
Fill(Stream_Video, 0, Video_Format, "AVC");
Fill(Stream_Video, 0, Video_Codec, "AVC");
//Calculating - Pixels
int32u Width =((*seq_parameter_set_Item)->pic_width_in_mbs_minus1 +1)*16;
int32u Height=((*seq_parameter_set_Item)->pic_height_in_map_units_minus1+1)*16*(2-(*seq_parameter_set_Item)->frame_mbs_only_flag);
int8u chromaArrayType = (*seq_parameter_set_Item)->ChromaArrayType();
if (chromaArrayType >= 4)
chromaArrayType = 0;
int32u CropUnitX=Avc_SubWidthC [chromaArrayType];
int32u CropUnitY=Avc_SubHeightC[chromaArrayType]*(2-(*seq_parameter_set_Item)->frame_mbs_only_flag);
Width -=((*seq_parameter_set_Item)->frame_crop_left_offset+(*seq_parameter_set_Item)->frame_crop_right_offset )*CropUnitX;
Height-=((*seq_parameter_set_Item)->frame_crop_top_offset +(*seq_parameter_set_Item)->frame_crop_bottom_offset)*CropUnitY;
//From vui_parameters
float64 PixelAspectRatio=1;
float64 FrameRate=0;
if ((*seq_parameter_set_Item)->vui_parameters)
{
if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_info_present_flag)
{
if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idc<Avc_PixelAspectRatio_Size)
PixelAspectRatio=Avc_PixelAspectRatio[(*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idc];
else if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idc==0xFF && (*seq_parameter_set_Item)->vui_parameters->sar_height)
PixelAspectRatio=((float64)(*seq_parameter_set_Item)->vui_parameters->sar_width)/(*seq_parameter_set_Item)->vui_parameters->sar_height;
}
if ((*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag)
{
if (!(*seq_parameter_set_Item)->vui_parameters->fixed_frame_rate_flag)
Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR");
else if ((*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag && (*seq_parameter_set_Item)->vui_parameters->time_scale && (*seq_parameter_set_Item)->vui_parameters->num_units_in_tick)
{
FrameRate=(float64)(*seq_parameter_set_Item)->vui_parameters->time_scale/(*seq_parameter_set_Item)->vui_parameters->num_units_in_tick/((*seq_parameter_set_Item)->frame_mbs_only_flag?2:(((*seq_parameter_set_Item)->pic_order_cnt_type==2 && Structure_Frame/2>Structure_Field)?1:2))/FrameRate_Divider;
Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate);
}
}
//Colour description
if (preferred_transfer_characteristics!=2)
Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics(preferred_transfer_characteristics));
if ((*seq_parameter_set_Item)->vui_parameters->video_signal_type_present_flag)
{
Fill(Stream_Video, 0, Video_Standard, Avc_video_format[(*seq_parameter_set_Item)->vui_parameters->video_format]);
Fill(Stream_Video, 0, Video_colour_range, Avc_video_full_range[(*seq_parameter_set_Item)->vui_parameters->video_full_range_flag]);
if ((*seq_parameter_set_Item)->vui_parameters->colour_description_present_flag)
{
Fill(Stream_Video, 0, Video_colour_description_present, "Yes");
Fill(Stream_Video, 0, Video_colour_primaries, Mpegv_colour_primaries((*seq_parameter_set_Item)->vui_parameters->colour_primaries));
Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics((*seq_parameter_set_Item)->vui_parameters->transfer_characteristics));
Fill(Stream_Video, 0, Video_matrix_coefficients, Mpegv_matrix_coefficients((*seq_parameter_set_Item)->vui_parameters->matrix_coefficients));
if ((*seq_parameter_set_Item)->vui_parameters->matrix_coefficients!=2)
Fill(Stream_Video, 0, Video_ColorSpace, Mpegv_matrix_coefficients_ColorSpace((*seq_parameter_set_Item)->vui_parameters->matrix_coefficients), Unlimited, true, true);
}
}
//hrd_parameter_sets
int64u bit_rate_value=(int64u)-1;
bool bit_rate_value_IsValid=true;
bool cbr_flag=false;
bool cbr_flag_IsSet=false;
bool cbr_flag_IsValid=true;
seq_parameter_set_struct::vui_parameters_struct::xxl* NAL=(*seq_parameter_set_Item)->vui_parameters->NAL;
if (NAL)
for (size_t Pos=0; Pos<NAL->SchedSel.size(); Pos++)
{
if (NAL->SchedSel[Pos].cpb_size_value!=(int32u)-1)
Fill(Stream_Video, 0, Video_BufferSize, NAL->SchedSel[Pos].cpb_size_value);
if (bit_rate_value!=(int64u)-1 && bit_rate_value!=NAL->SchedSel[Pos].bit_rate_value)
bit_rate_value_IsValid=false;
if (bit_rate_value==(int64u)-1)
bit_rate_value=NAL->SchedSel[Pos].bit_rate_value;
if (cbr_flag_IsSet==true && cbr_flag!=NAL->SchedSel[Pos].cbr_flag)
cbr_flag_IsValid=false;
if (cbr_flag_IsSet==0)
{
cbr_flag=NAL->SchedSel[Pos].cbr_flag;
cbr_flag_IsSet=true;
}
}
seq_parameter_set_struct::vui_parameters_struct::xxl* VCL=(*seq_parameter_set_Item)->vui_parameters->VCL;
if (VCL)
for (size_t Pos=0; Pos<VCL->SchedSel.size(); Pos++)
{
Fill(Stream_Video, 0, Video_BufferSize, VCL->SchedSel[Pos].cpb_size_value);
if (bit_rate_value!=(int64u)-1 && bit_rate_value!=VCL->SchedSel[Pos].bit_rate_value)
bit_rate_value_IsValid=false;
if (bit_rate_value==(int64u)-1)
bit_rate_value=VCL->SchedSel[Pos].bit_rate_value;
if (cbr_flag_IsSet==true && cbr_flag!=VCL->SchedSel[Pos].cbr_flag)
cbr_flag_IsValid=false;
if (cbr_flag_IsSet==0)
{
cbr_flag=VCL->SchedSel[Pos].cbr_flag;
cbr_flag_IsSet=true;
}
}
if (cbr_flag_IsSet && cbr_flag_IsValid)
{
Fill(Stream_Video, 0, Video_BitRate_Mode, cbr_flag?"CBR":"VBR");
if (bit_rate_value!=(int64u)-1 && bit_rate_value_IsValid)
Fill(Stream_Video, 0, cbr_flag?Video_BitRate_Nominal:Video_BitRate_Maximum, bit_rate_value);
}
}