History

avcodec/mpeg12dec: Use CHROMA_* defines

Andreas Rheinhardt committed 1 year ago

Commit ce1cec61 parent 8940a611 file · +10 −10Browse files

Unified · Split

libavcodec/mpeg12dec.c+10−10
@@ -780,7 +780,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) · 779 unmodified lines
780 780
781 ff_mpeg12_init_vlcs();781 ff_mpeg12_init_vlcs();
782 782
783 s2->chroma_format = 1;783 s2->chroma_format = CHROMA_420;
784 avctx->color_range = AVCOL_RANGE_MPEG;784 avctx->color_range = AVCOL_RANGE_MPEG;
785 return 0;785 return 0;
786}786}
@@ -864,11 +864,11 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) · 77 unmodified lines
864 if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY))864 if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY))
865 return AV_PIX_FMT_GRAY8;865 return AV_PIX_FMT_GRAY8;
866 866
867 if (s->chroma_format < 2)867 if (s->chroma_format < CHROMA_422)
868 pix_fmts = avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?868 pix_fmts = avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?
869 mpeg1_hwaccel_pixfmt_list_420 :869 mpeg1_hwaccel_pixfmt_list_420 :
870 mpeg2_hwaccel_pixfmt_list_420;870 mpeg2_hwaccel_pixfmt_list_420;
871 else if (s->chroma_format == 2)871 else if (s->chroma_format == CHROMA_422)
872 pix_fmts = mpeg12_pixfmt_list_422;872 pix_fmts = mpeg12_pixfmt_list_422;
873 else873 else
874 pix_fmts = mpeg12_pixfmt_list_444;874 pix_fmts = mpeg12_pixfmt_list_444;
@@ -990,9 +990,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 115 unmodified lines
990#endif990#endif
991 991
992 switch (s->chroma_format) {992 switch (s->chroma_format) {
993 case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;993 case CHROMA_420: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
994 case 2:994 case CHROMA_422:
995 case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;995 case CHROMA_444: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
996 default: av_assert0(0);996 default: av_assert0(0);
997 }997 }
998 } // MPEG-2998 } // MPEG-2
@@ -1066,7 +1066,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) · 67 unmodified lines
1066 s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */1066 s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */
1067 1067
1068 if (!s->chroma_format) {1068 if (!s->chroma_format) {
1069 s->chroma_format = 1;1069 s->chroma_format = CHROMA_420;
1070 av_log(s->avctx, AV_LOG_WARNING, "Chroma format invalid\n");1070 av_log(s->avctx, AV_LOG_WARNING, "Chroma format invalid\n");
1071 }1071 }
1072 1072
@@ -1545,7 +1545,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 472 unmodified lines
1545 1545
1546 if (s->mb_y >= s->mb_height) {1546 if (s->mb_y >= s->mb_height) {
1547 int left = get_bits_left(&s->gb);1547 int left = get_bits_left(&s->gb);
1548 int is_d10 = s->chroma_format == 2 &&1548 int is_d10 = s->chroma_format == CHROMA_422 &&
1549 s->pict_type == AV_PICTURE_TYPE_I &&1549 s->pict_type == AV_PICTURE_TYPE_I &&
1550 avctx->profile == 0 && avctx->level == 5 &&1550 avctx->profile == 0 && avctx->level == 5 &&
1551 s->intra_dc_precision == 2 &&1551 s->intra_dc_precision == 2 &&
@@ -1843,7 +1843,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, · 291 unmodified lines
1843 s->picture_structure = PICT_FRAME;1843 s->picture_structure = PICT_FRAME;
1844 s->first_field = 0;1844 s->first_field = 0;
1845 s->frame_pred_frame_dct = 1;1845 s->frame_pred_frame_dct = 1;
1846 s->chroma_format = 1;1846 s->chroma_format = CHROMA_420;
1847 s->codec_id =1847 s->codec_id =
1848 s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;1848 s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
1849 if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)1849 if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
@@ -1895,7 +1895,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) · 45 unmodified lines
1895 s->picture_structure = PICT_FRAME;1895 s->picture_structure = PICT_FRAME;
1896 s->first_field = 0;1896 s->first_field = 0;
1897 s->frame_pred_frame_dct = 1;1897 s->frame_pred_frame_dct = 1;
1898 s->chroma_format = 1;1898 s->chroma_format = CHROMA_420;
1899 if (s->codec_tag == AV_RL32("BW10")) {1899 if (s->codec_tag == AV_RL32("BW10")) {
1900 s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;1900 s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
1901 } else {1901 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t