annotate libmpcodecs/img_format.c @ 36750:8a1186284090

Remove pointless "if".
author reimar
date Sun, 16 Feb 2014 14:01:20 +0000
parents 05f12b83c094
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 30115
diff changeset
18
17565
dc65faaadb04 include config.h as img_format.h needs endian definitions, noticed by Alan Curry <pacman at theworld com>
iive
parents: 12996
diff changeset
19 #include "config.h"
3199
1632d6824a68 New ones
nick
parents: 2599
diff changeset
20 #include "img_format.h"
23750
a9bf0730f6b2 Print the number of the Unknow color format,
iive
parents: 19108
diff changeset
21 #include "stdio.h"
33365
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
22 #include "libavutil/bswap.h"
2599
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
23
19108
5e767cabf4cd marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org
reynaldo
parents: 17565
diff changeset
24 const char *vo_format_name(int format)
2599
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
25 {
26701
85dc7d81935c cosmetics: Fix unknow vs. unknowN typo.
diego
parents: 23750
diff changeset
26 static char unknown_format[20];
2599
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
27 switch(format)
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
28 {
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
29 case IMGFMT_RGB1: return "RGB 1-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
30 case IMGFMT_RGB4: return "RGB 4-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
31 case IMGFMT_RG4B: return "RGB 4-bit per byte";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
32 case IMGFMT_RGB8: return "RGB 8-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
33 case IMGFMT_RGB12: return "RGB 12-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
34 case IMGFMT_RGB15: return "RGB 15-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
35 case IMGFMT_RGB16: return "RGB 16-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
36 case IMGFMT_RGB24: return "RGB 24-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
37 // case IMGFMT_RGB32: return "RGB 32-bit";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
38 case IMGFMT_RGB48LE: return "RGB 48-bit LE";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
39 case IMGFMT_RGB48BE: return "RGB 48-bit BE";
34572
2a372b469420 Support displaying 64bit RGB via OpenGL.
cehoyos
parents: 34565
diff changeset
40 case IMGFMT_RGB64LE: return "RGB 64-bit LE";
2a372b469420 Support displaying 64bit RGB via OpenGL.
cehoyos
parents: 34565
diff changeset
41 case IMGFMT_RGB64BE: return "RGB 64-bit BE";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
42 case IMGFMT_BGR1: return "BGR 1-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
43 case IMGFMT_BGR4: return "BGR 4-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
44 case IMGFMT_BG4B: return "BGR 4-bit per byte";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
45 case IMGFMT_BGR8: return "BGR 8-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
46 case IMGFMT_BGR12: return "BGR 12-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
47 case IMGFMT_BGR15: return "BGR 15-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
48 case IMGFMT_BGR16: return "BGR 16-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
49 case IMGFMT_BGR24: return "BGR 24-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
50 // case IMGFMT_BGR32: return "BGR 32-bit";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
51 case IMGFMT_ABGR: return "ABGR";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
52 case IMGFMT_BGRA: return "BGRA";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
53 case IMGFMT_ARGB: return "ARGB";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
54 case IMGFMT_RGBA: return "RGBA";
36104
4e3c56728d1e Support playback of JPEG 2000 digital cinema files.
cehoyos
parents: 34932
diff changeset
55 case IMGFMT_XYZ12LE: return "XYZ 36-bit LE";
4e3c56728d1e Support playback of JPEG 2000 digital cinema files.
cehoyos
parents: 34932
diff changeset
56 case IMGFMT_XYZ12BE: return "XYZ 36-bit BE";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
57 case IMGFMT_GBR24P: return "Planar GBR 24-bit";
34923
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
58 case IMGFMT_GBR12P: return "Planar GBR 36-bit";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
59 case IMGFMT_GBR14P: return "Planar GBR 42-bit";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
60 case IMGFMT_YVU9: return "Planar YVU9";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
61 case IMGFMT_IF09: return "Planar IF09";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
62 case IMGFMT_YV12: return "Planar YV12";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
63 case IMGFMT_I420: return "Planar I420";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
64 case IMGFMT_IYUV: return "Planar IYUV";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
65 case IMGFMT_CLPL: return "Planar CLPL";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
66 case IMGFMT_Y800: return "Planar Y800";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
67 case IMGFMT_Y8: return "Planar Y8";
34932
19212dea7a97 Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents: 34923
diff changeset
68 case IMGFMT_Y8A: return "Planar Y8 with alpha";
19212dea7a97 Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents: 34923
diff changeset
69 case IMGFMT_Y16_LE: return "Planar Y16 little-endian";
19212dea7a97 Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents: 34923
diff changeset
70 case IMGFMT_Y16_BE: return "Planar Y16 big-endian";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
71 case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
72 case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian";
34923
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
73 case IMGFMT_420P14_LE: return "Planar 420P 14-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
74 case IMGFMT_420P14_BE: return "Planar 420P 14-bit big-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
75 case IMGFMT_420P12_LE: return "Planar 420P 12-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
76 case IMGFMT_420P12_BE: return "Planar 420P 12-bit big-endian";
33364
e1ee4895e500 Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents: 32702
diff changeset
77 case IMGFMT_420P10_LE: return "Planar 420P 10-bit little-endian";
e1ee4895e500 Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents: 32702
diff changeset
78 case IMGFMT_420P10_BE: return "Planar 420P 10-bit big-endian";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
79 case IMGFMT_420P9_LE: return "Planar 420P 9-bit little-endian";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
80 case IMGFMT_420P9_BE: return "Planar 420P 9-bit big-endian";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
81 case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
82 case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian";
34923
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
83 case IMGFMT_422P14_LE: return "Planar 422P 14-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
84 case IMGFMT_422P14_BE: return "Planar 422P 14-bit big-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
85 case IMGFMT_422P12_LE: return "Planar 422P 12-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
86 case IMGFMT_422P12_BE: return "Planar 422P 12-bit big-endian";
33364
e1ee4895e500 Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents: 32702
diff changeset
87 case IMGFMT_422P10_LE: return "Planar 422P 10-bit little-endian";
e1ee4895e500 Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents: 32702
diff changeset
88 case IMGFMT_422P10_BE: return "Planar 422P 10-bit big-endian";
34436
8a96cf601e57 Add support for 422P9.
reimar
parents: 34191
diff changeset
89 case IMGFMT_422P9_LE: return "Planar 422P 9-bit little-endian";
8a96cf601e57 Add support for 422P9.
reimar
parents: 34191
diff changeset
90 case IMGFMT_422P9_BE: return "Planar 422P 9-bit big-endian";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
91 case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
92 case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian";
34923
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
93 case IMGFMT_444P14_LE: return "Planar 444P 14-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
94 case IMGFMT_444P14_BE: return "Planar 444P 14-bit big-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
95 case IMGFMT_444P12_LE: return "Planar 444P 12-bit little-endian";
eb76937af57e Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents: 34805
diff changeset
96 case IMGFMT_444P12_BE: return "Planar 444P 12-bit big-endian";
34028
cf2a4f4cac0e Add 444P10 support.
cehoyos
parents: 33365
diff changeset
97 case IMGFMT_444P10_LE: return "Planar 444P 10-bit little-endian";
cf2a4f4cac0e Add 444P10 support.
cehoyos
parents: 33365
diff changeset
98 case IMGFMT_444P10_BE: return "Planar 444P 10-bit big-endian";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
99 case IMGFMT_444P9_LE: return "Planar 444P 9-bit little-endian";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
100 case IMGFMT_444P9_BE: return "Planar 444P 9-bit big-endian";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
101 case IMGFMT_420A: return "Planar 420P with alpha";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
102 case IMGFMT_444P: return "Planar 444P";
34565
25acb5f98cb4 Support v408 and AYUV decoding via FFmpeg.
cehoyos
parents: 34436
diff changeset
103 case IMGFMT_444A: return "Planar 444P with alpha";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
104 case IMGFMT_422P: return "Planar 422P";
34805
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
105 case IMGFMT_422A: return "Planar 422P with alpha";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
106 case IMGFMT_411P: return "Planar 411P";
36691
05f12b83c094 Add name for image format IMGFMT_440P.
cehoyos
parents: 36635
diff changeset
107 case IMGFMT_440P: return "Planar 440P";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
108 case IMGFMT_NV12: return "Planar NV12";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
109 case IMGFMT_NV21: return "Planar NV21";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
110 case IMGFMT_HM12: return "Planar NV12 Macroblock";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
111 case IMGFMT_IUYV: return "Packed IUYV";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
112 case IMGFMT_IY41: return "Packed IY41";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
113 case IMGFMT_IYU1: return "Packed IYU1";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
114 case IMGFMT_IYU2: return "Packed IYU2";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
115 case IMGFMT_UYVY: return "Packed UYVY";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
116 case IMGFMT_UYNV: return "Packed UYNV";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
117 case IMGFMT_cyuv: return "Packed CYUV";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
118 case IMGFMT_Y422: return "Packed Y422";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
119 case IMGFMT_YUY2: return "Packed YUY2";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
120 case IMGFMT_YUNV: return "Packed YUNV";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
121 case IMGFMT_YVYU: return "Packed YVYU";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
122 case IMGFMT_Y41P: return "Packed Y41P";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
123 case IMGFMT_Y211: return "Packed Y211";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
124 case IMGFMT_Y41T: return "Packed Y41T";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
125 case IMGFMT_Y42T: return "Packed Y42T";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
126 case IMGFMT_V422: return "Packed V422";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
127 case IMGFMT_V655: return "Packed V655";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
128 case IMGFMT_CLJR: return "Packed CLJR";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
129 case IMGFMT_YUVP: return "Packed YUVP";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
130 case IMGFMT_UYVP: return "Packed UYVP";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
131 case IMGFMT_MPEGPES: return "Mpeg PES";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
132 case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
133 case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
134 case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first";
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
135 case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation";
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 31087
diff changeset
136 case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT";
34191
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
137 case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
138 case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
139 case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
140 case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
141 case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration";
47e1375c4d79 Whitespace cosmetics: Align some IMGFMT-lists.
cehoyos
parents: 34189
diff changeset
142 case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration";
2599
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
143 }
26701
85dc7d81935c cosmetics: Fix unknow vs. unknowN typo.
diego
parents: 23750
diff changeset
144 snprintf(unknown_format,20,"Unknown 0x%04x",format);
85dc7d81935c cosmetics: Fix unknow vs. unknowN typo.
diego
parents: 23750
diff changeset
145 return unknown_format;
2599
8286ce06dfa1 vo_format_name moved from video_out.c to img_format.c
alex
parents:
diff changeset
146 }
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
147
33365
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
148 int mp_get_chroma_shift(int format, int *x_shift, int *y_shift, int *component_bits)
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
149 {
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
150 int xs = 0, ys = 0;
30110
19414a605695 Add support for 16-bit per component YUV formats.
reimar
parents: 30098
diff changeset
151 int bpp;
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
152 int err = 0;
33365
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
153 int bits = 8;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
154 if ((format & 0xff0000f0) == 0x34000050)
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
155 format = av_bswap32(format);
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
156 if ((format & 0xf00000ff) == 0x50000034) {
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
157 switch (format >> 24) {
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
158 case 0x50:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
159 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
160 case 0x51:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
161 bits = 16;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
162 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
163 case 0x52:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
164 bits = 10;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
165 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
166 case 0x53:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
167 bits = 9;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
168 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
169 default:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
170 err = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
171 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
172 }
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
173 switch (format & 0x00ffffff) {
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
174 case 0x00343434: // 444
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
175 xs = 0;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
176 ys = 0;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
177 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
178 case 0x00323234: // 422
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
179 xs = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
180 ys = 0;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
181 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
182 case 0x00303234: // 420
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
183 xs = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
184 ys = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
185 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
186 case 0x00313134: // 411
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
187 xs = 2;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
188 ys = 0;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
189 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
190 case 0x00303434: // 440
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
191 xs = 0;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
192 ys = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
193 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
194 default:
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
195 err = 1;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
196 break;
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
197 }
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
198 } else switch (format) {
34565
25acb5f98cb4 Support v408 and AYUV decoding via FFmpeg.
cehoyos
parents: 34436
diff changeset
199 case IMGFMT_444A:
25acb5f98cb4 Support v408 and AYUV decoding via FFmpeg.
cehoyos
parents: 34436
diff changeset
200 xs = 0;
25acb5f98cb4 Support v408 and AYUV decoding via FFmpeg.
cehoyos
parents: 34436
diff changeset
201 ys = 0;
25acb5f98cb4 Support v408 and AYUV decoding via FFmpeg.
cehoyos
parents: 34436
diff changeset
202 break;
34805
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
203 case IMGFMT_422A:
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
204 xs = 1;
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
205 ys = 0;
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
206 break;
30115
ad61464d02a7 Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents: 30110
diff changeset
207 case IMGFMT_420A:
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
208 case IMGFMT_I420:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
209 case IMGFMT_IYUV:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
210 case IMGFMT_YV12:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
211 xs = 1;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
212 ys = 1;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
213 break;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
214 case IMGFMT_IF09:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
215 case IMGFMT_YVU9:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
216 xs = 2;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
217 ys = 2;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
218 break;
31087
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
219 case IMGFMT_Y8:
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
220 case IMGFMT_Y800:
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
221 xs = 31;
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
222 ys = 31;
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
223 break;
36170
4fc911fa5366 Add NV12/NV21 support to some helper functions.
reimar
parents: 36104
diff changeset
224 case IMGFMT_NV12:
4fc911fa5366 Add NV12/NV21 support to some helper functions.
reimar
parents: 36104
diff changeset
225 case IMGFMT_NV21:
4fc911fa5366 Add NV12/NV21 support to some helper functions.
reimar
parents: 36104
diff changeset
226 xs = 1;
4fc911fa5366 Add NV12/NV21 support to some helper functions.
reimar
parents: 36104
diff changeset
227 ys = 1;
36635
0b6385acafcc img_format: document why mp_get_chroma_shift does not work for NV12/NV21
reimar
parents: 36170
diff changeset
228 // TODO: allowing this though currently breaks
0b6385acafcc img_format: document why mp_get_chroma_shift does not work for NV12/NV21
reimar
parents: 36170
diff changeset
229 // things all over the place.
36170
4fc911fa5366 Add NV12/NV21 support to some helper functions.
reimar
parents: 36104
diff changeset
230 err = 1;
36635
0b6385acafcc img_format: document why mp_get_chroma_shift does not work for NV12/NV21
reimar
parents: 36170
diff changeset
231 break;
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
232 default:
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
233 err = 1;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
234 break;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
235 }
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
236 if (x_shift) *x_shift = xs;
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
237 if (y_shift) *y_shift = ys;
33365
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
238 if (component_bits) *component_bits = bits;
31087
9acad2e25ea1 Handle Y8/Y800 formats more similar to other YUV formats.
reimar
parents: 31082
diff changeset
239 bpp = 8 + ((16 >> xs) >> ys);
34805
0eba64545a27 Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents: 34572
diff changeset
240 if (format == IMGFMT_420A || format == IMGFMT_422A || format == IMGFMT_444A)
30115
ad61464d02a7 Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents: 30110
diff changeset
241 bpp += 8;
33365
706871635af7 Make mp_get_chroma_shift simpler/more generic and add an argument
reimar
parents: 33364
diff changeset
242 bpp *= (bits + 7) >> 3;
30110
19414a605695 Add support for 16-bit per component YUV formats.
reimar
parents: 30098
diff changeset
243 return err ? 0 : bpp;
30096
76c25bfa181b Add a helper function to get the chroma scale shift and use to simplify mpi setup.
reimar
parents: 29843
diff changeset
244 }