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
780780
781781 ff_mpeg12_init_vlcs();
782782
783− s2->chroma_format = 1;
783+ s2->chroma_format = CHROMA_420;
784784 avctx->color_range = AVCOL_RANGE_MPEG;
785785 return 0;
786786 }
@@ -864,11 +864,11 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx) · 77 unmodified lines
864864 if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY))
865865 return AV_PIX_FMT_GRAY8;
866866
867− if (s->chroma_format < 2)
867+ if (s->chroma_format < CHROMA_422)
868868 pix_fmts = avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ?
869869 mpeg1_hwaccel_pixfmt_list_420 :
870870 mpeg2_hwaccel_pixfmt_list_420;
871− else if (s->chroma_format == 2)
871+ else if (s->chroma_format == CHROMA_422)
872872 pix_fmts = mpeg12_pixfmt_list_422;
873873 else
874874 pix_fmts = mpeg12_pixfmt_list_444;
@@ -990,9 +990,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 115 unmodified lines
990990 #endif
991991
992992 switch (s->chroma_format) {
993− case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
994− case 2:
995− case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
993+ case CHROMA_420: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
994+ case CHROMA_422:
995+ case CHROMA_444: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
996996 default: av_assert0(0);
997997 }
998998 } // MPEG-2
@@ -1066,7 +1066,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) · 67 unmodified lines
10661066 s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */
10671067
10681068 if (!s->chroma_format) {
1069− s->chroma_format = 1;
1069+ s->chroma_format = CHROMA_420;
10701070 av_log(s->avctx, AV_LOG_WARNING, "Chroma format invalid\n");
10711071 }
10721072
@@ -1545,7 +1545,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 472 unmodified lines
15451545
15461546 if (s->mb_y >= s->mb_height) {
15471547 int left = get_bits_left(&s->gb);
1548− int is_d10 = s->chroma_format == 2 &&
1548+ int is_d10 = s->chroma_format == CHROMA_422 &&
15491549 s->pict_type == AV_PICTURE_TYPE_I &&
15501550 avctx->profile == 0 && avctx->level == 5 &&
15511551 s->intra_dc_precision == 2 &&
@@ -1843,7 +1843,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, · 291 unmodified lines
18431843 s->picture_structure = PICT_FRAME;
18441844 s->first_field = 0;
18451845 s->frame_pred_frame_dct = 1;
1846− s->chroma_format = 1;
1846+ s->chroma_format = CHROMA_420;
18471847 s->codec_id =
18481848 s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
18491849 if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
@@ -1895,7 +1895,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) · 45 unmodified lines
18951895 s->picture_structure = PICT_FRAME;
18961896 s->first_field = 0;
18971897 s->frame_pred_frame_dct = 1;
1898− s->chroma_format = 1;
1898+ s->chroma_format = CHROMA_420;
18991899 if (s->codec_tag == AV_RL32("BW10")) {
19001900 s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
19011901 } 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