Skip to content

Commit 474e661

Browse files
committed
Work on colors
1 parent dcb1d8a commit 474e661

File tree

6 files changed

+52
-34
lines changed

6 files changed

+52
-34
lines changed

mini_analyser/src/mainwindow_datas.cpp

+1-14
Original file line numberDiff line numberDiff line change
@@ -1126,20 +1126,7 @@ int MainWindow::printVideoDetails()
11261126
else
11271127
ui->label_video_color_space->setText("YCbCr (best guess)");
11281128

1129-
if (t->color_subsampling == SS_4444)
1130-
ui->label_video_color_subsampling->setText("4:4:4:4");
1131-
else if (t->color_subsampling == SS_444)
1132-
ui->label_video_color_subsampling->setText("4:4:4");
1133-
else if (t->color_subsampling == SS_422)
1134-
ui->label_video_color_subsampling->setText("4:2:2");
1135-
else if (t->color_subsampling == SS_420)
1136-
ui->label_video_color_subsampling->setText("4:2:0");
1137-
else if (t->color_subsampling == SS_411)
1138-
ui->label_video_color_subsampling->setText("4:1:1");
1139-
else if (t->color_subsampling == SS_400)
1140-
ui->label_video_color_subsampling->setText("4:0:0");
1141-
else
1142-
ui->label_video_color_subsampling->setText("4:2:0 (best guess)");
1129+
ui->label_video_color_subsampling->setText(getChromaSubsamplingQString((ChromaSubSampling_e)t->color_subsampling));
11431130
}
11441131
else
11451132
{

mini_analyser/src/minivideo_utils_qt.cpp

+30-12
Original file line numberDiff line numberDiff line change
@@ -670,20 +670,38 @@ QString getStereoModeQString(const StereoMode_e stereoMode)
670670

671671
QString getHdrModeQString(const HdrMode_e hdrMode)
672672
{
673-
QString hdr_mode_qstr;
674-
675-
if (hdrMode == HLG)
676-
hdr_mode_qstr = "HDR10";
677-
else if (hdrMode == HDR10)
678-
hdr_mode_qstr = "HDR10";
679-
else if (hdrMode == HDR10plus)
680-
hdr_mode_qstr = "HDR10+";
681-
else if (hdrMode == DolbyVision)
682-
hdr_mode_qstr = "Dolby Vision";
673+
// product names, not translated, so we can use the function from minivideo
674+
return QString::fromLatin1(getHdrModeString(hdrMode));
675+
}
676+
677+
/* ************************************************************************** */
678+
679+
QString getChromaSubsamplingQString(const ChromaSubSampling_e subsampling)
680+
{
681+
// technical terms, not translated, so we can use the function from minivideo
682+
return QString::fromLatin1(getChromaSubsamplingString(subsampling));
683+
}
684+
685+
QString getChromaLocationQString(const ChromaLocation_e location)
686+
{
687+
QString loc_qstr;
688+
689+
if (location == CHROMA_LOC_LEFT)
690+
loc_qstr = QObject::tr("Left");
691+
else if (location == CHROMA_LOC_CENTER)
692+
loc_qstr = QObject::tr("Center");
693+
else if (location == CHROMA_LOC_TOPLEFT)
694+
loc_qstr = QObject::tr("Top left");
695+
else if (location == CHROMA_LOC_TOP)
696+
loc_qstr = QObject::tr("Top");
697+
else if (location == CHROMA_LOC_BOTTOMLEFT)
698+
loc_qstr = QObject::tr("Bottom left");
699+
else if (location == CHROMA_LOC_BOTTOM)
700+
loc_qstr = QObject::tr("Bottom");
683701
else
684-
hdr_mode_qstr = "SDR";
702+
loc_qstr = QObject::tr("Unknown");
685703

686-
return hdr_mode_qstr;
704+
return loc_qstr;
687705
}
688706

689707
/* ************************************************************************** */

mini_analyser/src/minivideo_utils_qt.h

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ QString getContainerQString(const Containers_e container, const bool long_descri
145145

146146
QString getCodecQString(const StreamType_e type, const Codecs_e codec, const bool long_description);
147147

148+
QString getChromaSubsamplingQString(const ChromaSubSampling_e subsampling);
149+
150+
QString getChromaLocationQString(const ChromaLocation_e location);
151+
148152
/*!
149153
* \brief Get a readable language string.
150154
* \param languageCode[in]: ISO 639-2 or ISO 639-3 language code.

minivideo/src/bitstream_map.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,9 @@ bool computeCodecsSpecifics(MediaFile_t *media)
553553

554554
if (track->stream_codec == CODEC_H264 && track->avcC)
555555
{
556-
// Handle H.264 profile & level
557556
if (avcC->sps_count > 0 && avcC->sps_array[0])
558557
{
558+
// H.264 profile & level
559559
track->stream_codec_profile = getH264CodecProfile(
560560
avcC->sps_array[0]->profile_idc,
561561
avcC->sps_array[0]->constraint_setX_flag[0],
@@ -569,6 +569,18 @@ bool computeCodecsSpecifics(MediaFile_t *media)
569569
track->max_ref_frames = avcC->sps_array[0]->max_num_ref_frames;
570570
track->color_depth = avcC->sps_array[0]->BitDepthY;
571571

572+
// Chroma
573+
if (avcC->sps_array[0]->chroma_format_idc == 0)
574+
track->color_subsampling = CHROMA_SS_400;
575+
else if (avcC->sps_array[0]->chroma_format_idc == 1)
576+
track->color_subsampling = CHROMA_SS_420;
577+
else if (avcC->sps_array[0]->chroma_format_idc == 2)
578+
track->color_subsampling = CHROMA_SS_422;
579+
else if (avcC->sps_array[0]->chroma_format_idc == 3)
580+
track->color_subsampling = CHROMA_SS_444;
581+
else
582+
track->color_subsampling = CHROMA_SS_420;
583+
572584
if (avcC->sps_array[0]->vui)
573585
{
574586
track->color_range = avcC->sps_array[0]->vui->video_full_range_flag;

minivideo/src/demuxer/mp4/mp4_stsd.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1963,12 +1963,9 @@ int parse_colr(Bitstream_t *bitstr, Mp4Box_t *box_header, Mp4Track_t *track, Mp4
19631963
if (track->color_range) track->color_range = colour_range;
19641964
}
19651965

1966-
if (track->color_matrix == 0 && track->color_matrix && track->color_matrix)
1967-
{
1968-
track->color_primaries = colour_primaries;
1969-
track->color_transfer = transfer_characteristics;
1970-
track->color_matrix = colour_primaries;
1971-
}
1966+
track->color_primaries = colour_primaries;
1967+
track->color_transfer = transfer_characteristics;
1968+
track->color_matrix = matrix_coefficients;
19721969
}
19731970
else if (colour_type == fourcc_be("rICC"))
19741971
{

minivideo/src/minivideo_codecs.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ const char *getChromaSubsamplingString(const ChromaSubSampling_e subsampling)
11331133
case CHROMA_SS_411:
11341134
return "4:1:1";
11351135
case CHROMA_SS_420:
1136-
return "4:2:0+";
1136+
return "4:2:0";
11371137
case CHROMA_SS_421:
11381138
return "4:2:1";
11391139
case CHROMA_SS_422:

0 commit comments

Comments
 (0)