@@ -412,6 +412,305 @@ static inline uint32_t h265hvcc_get_profile_compatibility(const uint8_t *p)
412412 return (p [2 ] << 24 ) | (p [3 ] << 16 ) | (p [4 ] << 8 ) | p [5 ];
413413}
414414
415+ static const char * h265_get_range_ext_profile (bool max_12bit , bool max_10bit , bool max_8bit , bool max_422chroma , bool max_420chroma , bool max_monochrome , bool intra , bool one_picture_only , bool lower_bit_rate )
416+ {
417+ /* ITU-T H.265 (V9) Table A.2 */
418+
419+ union constraint {
420+ struct {
421+ bool max_12bit : 1 ;
422+ bool max_10bit : 1 ;
423+ bool max_8bit : 1 ;
424+ bool max_422chroma : 1 ;
425+ bool max_420chroma : 1 ;
426+ bool max_monochrome : 1 ;
427+ bool intra : 1 ;
428+ bool one_picture_only : 1 ;
429+ };
430+ unsigned int constraint ;
431+ };
432+
433+ static const struct {
434+ union constraint c ;
435+ const char name [32 ];
436+ } profile_name [] = {
437+ {
438+ {
439+ .max_12bit = true,
440+ .max_10bit = true,
441+ .max_8bit = true,
442+ .max_422chroma = true,
443+ .max_420chroma = true,
444+ .max_monochrome = true,
445+ .intra = false,
446+ .one_picture_only = false,
447+ },
448+ .name = "Monochrome" ,
449+ }, {
450+ {
451+ .max_12bit = true,
452+ .max_10bit = true,
453+ .max_8bit = false,
454+ .max_422chroma = true,
455+ .max_420chroma = true,
456+ .max_monochrome = true,
457+ .intra = false,
458+ .one_picture_only = false,
459+ },
460+ .name = "Monochrome 10" ,
461+ }, {
462+ {
463+ .max_12bit = true,
464+ .max_10bit = false,
465+ .max_8bit = false,
466+ .max_422chroma = true,
467+ .max_420chroma = true,
468+ .max_monochrome = true,
469+ .intra = false,
470+ .one_picture_only = false,
471+ },
472+ .name = "Monochrome 12" ,
473+ }, {
474+ {
475+ .max_12bit = false,
476+ .max_10bit = false,
477+ .max_8bit = false,
478+ .max_422chroma = true,
479+ .max_420chroma = true,
480+ .max_monochrome = true,
481+ .intra = false,
482+ .one_picture_only = false,
483+ },
484+ .name = "Monochrome 16" ,
485+ }, {
486+ {
487+ .max_12bit = true,
488+ .max_10bit = false,
489+ .max_8bit = false,
490+ .max_422chroma = true,
491+ .max_420chroma = true,
492+ .max_monochrome = false,
493+ .intra = false,
494+ .one_picture_only = false,
495+ },
496+ .name = "Main 12" ,
497+ }, {
498+ {
499+ .max_12bit = true,
500+ .max_10bit = true,
501+ .max_8bit = false,
502+ .max_422chroma = true,
503+ .max_420chroma = false,
504+ .max_monochrome = false,
505+ .intra = false,
506+ .one_picture_only = false,
507+ },
508+ .name = "Main 4:2:2 10" ,
509+ }, {
510+ {
511+ .max_12bit = true,
512+ .max_10bit = false,
513+ .max_8bit = false,
514+ .max_422chroma = true,
515+ .max_420chroma = false,
516+ .max_monochrome = false,
517+ .intra = false,
518+ .one_picture_only = false,
519+ },
520+ .name = "Main 4:2:2 12" ,
521+ }, {
522+ {
523+ .max_12bit = true,
524+ .max_10bit = true,
525+ .max_8bit = true,
526+ .max_422chroma = false,
527+ .max_420chroma = false,
528+ .max_monochrome = false,
529+ .intra = false,
530+ .one_picture_only = false,
531+ },
532+ .name = "Main 4:4:4" ,
533+ }, {
534+ {
535+ .max_12bit = true,
536+ .max_10bit = true,
537+ .max_8bit = false,
538+ .max_422chroma = false,
539+ .max_420chroma = false,
540+ .max_monochrome = false,
541+ .intra = false,
542+ .one_picture_only = false,
543+ },
544+ .name = "Main 4:4:4 10" ,
545+ }, {
546+ {
547+ .max_12bit = true,
548+ .max_10bit = false,
549+ .max_8bit = false,
550+ .max_422chroma = false,
551+ .max_420chroma = false,
552+ .max_monochrome = false,
553+ .intra = false,
554+ .one_picture_only = false,
555+ },
556+ .name = "Main 4:4:4 12" ,
557+ }, {
558+ {
559+ .max_12bit = true,
560+ .max_10bit = true,
561+ .max_8bit = true,
562+ .max_422chroma = true,
563+ .max_420chroma = true,
564+ .max_monochrome = false,
565+ .intra = true,
566+ .one_picture_only = false,
567+ },
568+ .name = "Main Intra" ,
569+ }, {
570+ {
571+ .max_12bit = true,
572+ .max_10bit = true,
573+ .max_8bit = false,
574+ .max_422chroma = true,
575+ .max_420chroma = true,
576+ .max_monochrome = false,
577+ .intra = true,
578+ .one_picture_only = false,
579+ },
580+ .name = "Main 10 Intra" ,
581+ }, {
582+ {
583+ .max_12bit = true,
584+ .max_10bit = false,
585+ .max_8bit = false,
586+ .max_422chroma = true,
587+ .max_420chroma = true,
588+ .max_monochrome = false,
589+ .intra = true,
590+ .one_picture_only = false,
591+ },
592+ .name = "Main 12 Intra" ,
593+ }, {
594+ {
595+ .max_12bit = true,
596+ .max_10bit = true,
597+ .max_8bit = false,
598+ .max_422chroma = true,
599+ .max_420chroma = false,
600+ .max_monochrome = false,
601+ .intra = true,
602+ .one_picture_only = false,
603+ },
604+ .name = "Main 4:2:2 10 Intra" ,
605+ }, {
606+ {
607+ .max_12bit = true,
608+ .max_10bit = false,
609+ .max_8bit = false,
610+ .max_422chroma = true,
611+ .max_420chroma = false,
612+ .max_monochrome = false,
613+ .intra = true,
614+ .one_picture_only = false,
615+ },
616+ .name = "Main 4:2:2 12 Intra" ,
617+ }, {
618+ {
619+ .max_12bit = true,
620+ .max_10bit = true,
621+ .max_8bit = true,
622+ .max_422chroma = false,
623+ .max_420chroma = false,
624+ .max_monochrome = false,
625+ .intra = true,
626+ .one_picture_only = false,
627+ },
628+ .name = "Main 4:4:4 Intra" ,
629+ }, {
630+ {
631+ .max_12bit = true,
632+ .max_10bit = true,
633+ .max_8bit = false,
634+ .max_422chroma = false,
635+ .max_420chroma = false,
636+ .max_monochrome = false,
637+ .intra = true,
638+ .one_picture_only = false,
639+ },
640+ .name = "Main 4:4:4 10 Intra" ,
641+ }, {
642+ {
643+ .max_12bit = true,
644+ .max_10bit = false,
645+ .max_8bit = false,
646+ .max_422chroma = false,
647+ .max_420chroma = false,
648+ .max_monochrome = false,
649+ .intra = true,
650+ .one_picture_only = false,
651+ },
652+ .name = "Main 4:4:4 12 Intra" ,
653+ }, {
654+ {
655+ .max_12bit = false,
656+ .max_10bit = false,
657+ .max_8bit = false,
658+ .max_422chroma = false,
659+ .max_420chroma = false,
660+ .max_monochrome = false,
661+ .intra = true,
662+ .one_picture_only = false,
663+ },
664+ .name = "Main 4:4:4 16 Intra" ,
665+ }, {
666+ {
667+ .max_12bit = true,
668+ .max_10bit = true,
669+ .max_8bit = true,
670+ .max_422chroma = false,
671+ .max_420chroma = false,
672+ .max_monochrome = false,
673+ .intra = true,
674+ .one_picture_only = true,
675+ },
676+ .name = "Main 4:4:4 Still Picture" ,
677+ }, {
678+ {
679+ .max_12bit = false,
680+ .max_10bit = false,
681+ .max_8bit = false,
682+ .max_422chroma = false,
683+ .max_420chroma = false,
684+ .max_monochrome = false,
685+ .intra = true,
686+ .one_picture_only = true,
687+ },
688+ .name = "Main 4:4:4 16 Still Picture" ,
689+ },
690+ };
691+
692+ const union constraint c = {
693+ .max_12bit = max_12bit ,
694+ .max_10bit = max_10bit ,
695+ .max_8bit = max_8bit ,
696+ .max_422chroma = max_422chroma ,
697+ .max_420chroma = max_420chroma ,
698+ .max_monochrome = max_monochrome ,
699+ .intra = intra ,
700+ .one_picture_only = one_picture_only ,
701+ };
702+
703+ if (!intra && !lower_bit_rate )
704+ goto unknown ;
705+
706+ for (int i = 0 ; i < sizeof (profile_name ) / sizeof (* profile_name ); i ++ )
707+ if (profile_name [i ].c .constraint == c .constraint )
708+ return profile_name [i ].name ;
709+
710+ unknown :
711+ return "Range ext unknown profile" ;
712+ }
713+
415714static inline const char * h265_get_profile_txt (uint8_t i_profile )
416715{
417716 return i_profile == 0 ? "None" :
0 commit comments