Skip to content

Commit dcb1d8a

Browse files
committed
minivideo: add a few string helpers in minivideo_codecs.h
1 parent 47c6b6b commit dcb1d8a

File tree

3 files changed

+176
-14
lines changed

3 files changed

+176
-14
lines changed

minivideo/src/minivideo_avutils.h

+35-14
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ typedef enum StereoMode_e
149149

150150
} StereoMode_e;
151151

152+
/* ************************************************************************** */
153+
152154
//! The color model used by the video
153155
typedef enum ColorModel_e
154156
{
@@ -165,6 +167,39 @@ typedef enum ColorModel_e
165167

166168
} ColorModel_e;
167169

170+
//! The chroma subsampling format used by the video/pictures
171+
typedef enum ChromaSubSampling_e
172+
{
173+
CHROMA_SS_UNKNOWN = 0, //!< Unknown chroma subsampling
174+
175+
CHROMA_SS_311 = 1, //!< 3:1:1 subsampling
176+
CHROMA_SS_400 = 2, //!< 4:0:0 subsampling (monochrome)
177+
CHROMA_SS_410 = 3, //!< 4:1:0 subsampling
178+
CHROMA_SS_411 = 4, //!< 4:1:1 subsampling
179+
CHROMA_SS_420 = 5, //!< 4:2:0 subsampling
180+
CHROMA_SS_421 = 6, //!< 4:2:1 subsampling
181+
CHROMA_SS_422 = 7, //!< 4:2:2 subsampling
182+
CHROMA_SS_440 = 8, //!< 4:4:0 subsampling
183+
CHROMA_SS_441 = 9, //!< 4:4:1 subsampling
184+
CHROMA_SS_442 = 10, //!< 4:4:2 subsampling
185+
CHROMA_SS_444 = 11, //!< 4:4:4 subsampling
186+
187+
} ChromaSubSampling_e;
188+
189+
//! The chroma subsampling format used by the video/pictures
190+
typedef enum ChromaLocation_e
191+
{
192+
CHROMA_LOC_UNKNOWN = 0, //!< Unknown chroma location
193+
194+
CHROMA_LOC_LEFT = 1, //!<
195+
CHROMA_LOC_CENTER = 2,
196+
CHROMA_LOC_TOPLEFT = 3,
197+
CHROMA_LOC_TOP = 4,
198+
CHROMA_LOC_BOTTOMLEFT = 5,
199+
CHROMA_LOC_BOTTOM = 6,
200+
201+
} ChromaLocation_e;
202+
168203
typedef enum ColorsRec_e
169204
{
170205
COLORS_BT470_6,
@@ -201,20 +236,6 @@ typedef enum ColorMatrix_e
201236

202237
} ColorMatrix_e;
203238

204-
//! The subsampling format used by the video
205-
typedef enum SubSampling_e
206-
{
207-
SS_UNKNOWN = 0, //!< Unknown subsampling
208-
209-
SS_400 = 1, //!< 4:0:0 monochrome subsampling
210-
SS_411 = 2, //!< 4:1:1 subsampling
211-
SS_420 = 3, //!< 4:2:0 subsampling
212-
SS_422 = 4, //!< 4:2:2 subsampling
213-
SS_444 = 5, //!< 4:4:4 subsampling
214-
SS_4444 = 6 //!< 4:4:4:4 subsampling
215-
216-
} SubSampling_e;
217-
218239
/* ************************************************************************** */
219240

220241
//! Chromaticity coordinates of the source primaries

minivideo/src/minivideo_codecs.cpp

+134
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,140 @@ const char *getCodecProfileString(const CodecProfiles_e profile, const bool long
10421042

10431043
/* ************************************************************************** */
10441044

1045+
const char *getScanModeString(const ScanType_e mode)
1046+
{
1047+
switch (mode)
1048+
{
1049+
case SCAN_PROGRESSIVE:
1050+
return "Progressive";
1051+
case SCAN_INTERLACED:
1052+
return "Interlaced scan";
1053+
1054+
default:
1055+
return "";
1056+
}
1057+
}
1058+
/* ************************************************************************** */
1059+
1060+
const char *getStereoModeString(const StereoMode_e mode)
1061+
{
1062+
switch (mode)
1063+
{
1064+
case MONOSCOPIC:
1065+
return "Monoscopic";
1066+
1067+
case STEREO_ANAGLYPH_CR:
1068+
return "Anaglyph (cyan/red)";
1069+
case STEREO_ANAGLYPH_GM:
1070+
return "Anaglyph (green/magenta)";
1071+
1072+
case STEREO_SIDEBYSIDE_LEFT:
1073+
return "Side by side (left eye is first)";
1074+
case STEREO_SIDEBYSIDE_RIGHT:
1075+
return "Side by side (right eye is first)";
1076+
case STEREO_TOPBOTTOM_LEFT:
1077+
return "Top bottom (left eye is first)";
1078+
case STEREO_TOPBOTTOM_RIGHT:
1079+
return "Top bottom (right eye is first)";
1080+
case STEREO_CHECKBOARD_LEFT:
1081+
return "Checkerboard (left eye is first)";
1082+
case STEREO_CHECKBOARD_RIGHT:
1083+
return "Checkerboard (right eye is first)";
1084+
case STEREO_ROWINTERLEAVED_LEFT:
1085+
return "Row interleaved (left eye is first)";
1086+
case STEREO_ROWINTERLEAVED_RIGHT:
1087+
return "Row interleaved (right eye is first)";
1088+
case STEREO_COLUMNINTERLEAVED_LEFT:
1089+
return "Column interleaved (left eye is first)";
1090+
case STEREO_COLUMNINTERLEAVED_RIGHT:
1091+
return "Column interleaved (right eye is first)";
1092+
1093+
default:
1094+
return "";
1095+
}
1096+
}
1097+
1098+
/* ************************************************************************** */
1099+
1100+
const char *getHdrModeString(const HdrMode_e mode)
1101+
{
1102+
switch (mode)
1103+
{
1104+
case SDR:
1105+
return "SDR";
1106+
1107+
case HLG:
1108+
return "HLG";
1109+
case HDR10:
1110+
return "HDR10";
1111+
case HDR10plus:
1112+
return "HDR10+";
1113+
case DolbyVision:
1114+
return "Dolby Vision";
1115+
1116+
default:
1117+
return "";
1118+
}
1119+
}
1120+
1121+
/* ************************************************************************** */
1122+
1123+
const char *getChromaSubsamplingString(const ChromaSubSampling_e subsampling)
1124+
{
1125+
switch (subsampling)
1126+
{
1127+
case CHROMA_SS_311:
1128+
return "3:1:1";
1129+
case CHROMA_SS_400:
1130+
return "4:0:0";
1131+
case CHROMA_SS_410:
1132+
return "4:1:0";
1133+
case CHROMA_SS_411:
1134+
return "4:1:1";
1135+
case CHROMA_SS_420:
1136+
return "4:2:0+";
1137+
case CHROMA_SS_421:
1138+
return "4:2:1";
1139+
case CHROMA_SS_422:
1140+
return "4:2:2";
1141+
case CHROMA_SS_440:
1142+
return "4:4:0";
1143+
case CHROMA_SS_441:
1144+
return "4:4:1";
1145+
case CHROMA_SS_442:
1146+
return "4:4:2";
1147+
case CHROMA_SS_444:
1148+
return "4:4:4";
1149+
1150+
default:
1151+
return "";
1152+
}
1153+
}
1154+
1155+
const char *getChromaLocationString(const ChromaLocation_e location)
1156+
{
1157+
switch (location)
1158+
{
1159+
case CHROMA_LOC_LEFT:
1160+
return "Left";
1161+
case CHROMA_LOC_CENTER:
1162+
return "Center";
1163+
case CHROMA_LOC_TOPLEFT:
1164+
return "Top left";
1165+
case CHROMA_LOC_TOP:
1166+
return "Top";
1167+
case CHROMA_LOC_BOTTOMLEFT:
1168+
return "Bottom left";
1169+
case CHROMA_LOC_BOTTOM:
1170+
return "Bottom";
1171+
1172+
default:
1173+
return "";
1174+
}
1175+
}
1176+
1177+
/* ************************************************************************** */
1178+
10451179
const char *getColorPrimariesString(const ColorPrimaries_e primaries)
10461180
{
10471181
switch (primaries)

minivideo/src/minivideo_codecs.h

+7
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,13 @@ minivideo_EXPORT const char *getPictureString(const Pictures_e picture, const bo
434434

435435
/* ************************************************************************** */
436436

437+
minivideo_EXPORT const char *getScanModeString(const ScanType_e mode);
438+
minivideo_EXPORT const char *getStereoModeString(const StereoMode_e mode);
439+
minivideo_EXPORT const char *getHdrModeString(const HdrMode_e mode);
440+
441+
minivideo_EXPORT const char *getChromaSubsamplingString(const ChromaSubSampling_e subsampling);
442+
minivideo_EXPORT const char *getChromaLocationString(const ChromaLocation_e location);
443+
437444
minivideo_EXPORT const char *getColorPrimariesString(const ColorPrimaries_e primaries);
438445
minivideo_EXPORT const char *getColorTransferCharacteristicString(const ColorTransferCharacteristic_e transfert);
439446
minivideo_EXPORT const char *getColorMatrixString(const ColorSpace_e space);

0 commit comments

Comments
 (0)