1 #include <strings.h> 2 #include <stdio.h> 3 #include "gfx_util.h" 4 #include "gfx_conv_c.h" 5 #include "gfx_conv_mmx.h" 6 7 /* 8 * ref docs 9 * http://www.joemaller.com/fcp/fxscript_yuv_color.shtml 10 */ 11 12 #if 1 13 #define TRACE(a...) printf(a) 14 #else 15 #define TRACE(a...) 16 #endif 17 18 //#define INCLUDE_MMX defined(__INTEL__) 19 #define INCLUDE_MMX 0 20 21 // this function will try to find the best colorspaces for both the ff-codec and 22 // the Media Kit sides. 23 gfx_convert_func resolve_colorspace(color_space colorSpace, PixelFormat pixelFormat) 24 { 25 #if INCLUDE_MMX 26 bool mmx = IsMmxCpu(); 27 #endif 28 29 switch (colorSpace) 30 { 31 case B_RGB32: 32 if (pixelFormat == PIX_FMT_YUV410P) { 33 #if INCLUDE_MMX 34 if (mmx) { 35 TRACE("resolve_colorspace: gfx_conv_yuv410p_rgb32_mmx\n"); 36 return gfx_conv_yuv410p_rgb32_mmx; 37 } else 38 #endif 39 { 40 TRACE("resolve_colorspace: gfx_conv_yuv410p_rgb32_c\n"); 41 return gfx_conv_yuv410p_rgb32_c; 42 } 43 } 44 45 if (pixelFormat == PIX_FMT_YUV411P) { 46 #if INCLUDE_MMX 47 if (mmx) { 48 TRACE("resolve_colorspace: gfx_conv_yuv411p_rgb32_mmx\n"); 49 return gfx_conv_yuv411p_rgb32_mmx; 50 } else 51 #endif 52 { 53 TRACE("resolve_colorspace: gfx_conv_yuv411p_rgb32_c\n"); 54 return gfx_conv_yuv411p_rgb32_c; 55 } 56 } 57 58 if (pixelFormat == PIX_FMT_YUV420P || pixelFormat == PIX_FMT_YUVJ420P) { 59 #if INCLUDE_MMX 60 if (mmx) { 61 TRACE("resolve_colorspace: gfx_conv_yuv420p_rgb32_mmx\n"); 62 return gfx_conv_yuv420p_rgb32_mmx; 63 } else 64 #endif 65 { 66 TRACE("resolve_colorspace: gfx_conv_yuv420p_rgb32_c\n"); 67 return gfx_conv_YCbCr420p_RGB32_c; 68 } 69 } 70 71 if (pixelFormat == PIX_FMT_YUV422P || pixelFormat == PIX_FMT_YUVJ422P) { 72 return gfx_conv_YCbCr422_RGB32_c; 73 } 74 75 TRACE("resolve_colorspace: %s => B_RGB32: NULL\n", pixfmt_to_string(pixelFormat)); 76 return NULL; 77 78 case B_RGB24_BIG: 79 TRACE("resolve_colorspace: %s => B_RGB24_BIG: NULL\n", pixfmt_to_string(pixelFormat)); 80 return NULL; 81 82 case B_RGB24: 83 TRACE("resolve_colorspace: %s => B_RGB24: NULL\n", pixfmt_to_string(pixelFormat)); 84 return NULL; 85 86 case B_YCbCr422: 87 88 if (pixelFormat == PIX_FMT_YUV410P) { 89 #if INCLUDE_MMX 90 if (mmx) { 91 TRACE("resolve_colorspace: gfx_conv_yuv410p_ycbcr422_mmx\n"); 92 return gfx_conv_yuv410p_ycbcr422_mmx; 93 } else 94 #endif 95 { 96 TRACE("resolve_colorspace: gfx_conv_yuv410p_ycbcr422_c\n"); 97 return gfx_conv_yuv410p_ycbcr422_c; 98 } 99 } 100 101 if (pixelFormat == PIX_FMT_YUV411P) { 102 #if INCLUDE_MMX 103 if (mmx) { 104 TRACE("resolve_colorspace: gfx_conv_yuv411p_ycbcr422_mmx\n"); 105 return gfx_conv_yuv411p_ycbcr422_mmx; 106 } else 107 #endif 108 { 109 TRACE("resolve_colorspace: gfx_conv_yuv411p_ycbcr422_c\n"); 110 return gfx_conv_yuv411p_ycbcr422_c; 111 } 112 } 113 114 if (pixelFormat == PIX_FMT_YUV420P || pixelFormat == PIX_FMT_YUVJ420P) { 115 #if INCLUDE_MMX 116 if (mmx) { 117 TRACE("resolve_colorspace: gfx_conv_yuv420p_ycbcr422_mmx\n"); 118 return gfx_conv_yuv420p_ycbcr422_mmx; 119 } else 120 #endif 121 { 122 TRACE("resolve_colorspace: gfx_conv_yuv420p_ycbcr422_c\n"); 123 return gfx_conv_yuv420p_ycbcr422_c; 124 } 125 } 126 127 if (pixelFormat == PIX_FMT_YUYV422) { 128 #if INCLUDE_MMX 129 if (mmx) { 130 TRACE("resolve_colorspace: PIX_FMT_YUV422 => B_YCbCr422: gfx_conv_null_mmx\n"); 131 return gfx_conv_null_mmx; 132 } else 133 #endif 134 { 135 TRACE("resolve_colorspace: PIX_FMT_YUV422 => B_YCbCr422: gfx_conv_null_c\n"); 136 return gfx_conv_null_c; 137 } 138 } 139 140 TRACE("resolve_colorspace: %s => B_YCbCr422: NULL\n", pixfmt_to_string(pixelFormat)); 141 return gfx_conv_null_c; 142 143 default: 144 TRACE("resolve_colorspace: default: NULL !!!\n"); 145 return NULL; 146 } 147 } 148 149 const char* 150 pixfmt_to_string(int p) 151 { 152 switch(p) { 153 case PIX_FMT_NONE: return "PIX_FMT_NONE"; 154 case PIX_FMT_YUV420P: return "PIX_FMT_YUV420P"; ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 155 case PIX_FMT_YUYV422: return "PIX_FMT_YUYV422"; ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr 156 case PIX_FMT_RGB24: return "PIX_FMT_RGB24"; ///< packed RGB 8:8:8, 24bpp, RGBRGB... 157 case PIX_FMT_BGR24: return "PIX_FMT_BGR24"; ///< packed RGB 8:8:8, 24bpp, BGRBGR... 158 case PIX_FMT_YUV422P: return "PIX_FMT_YUV422P"; ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) 159 case PIX_FMT_YUV444P: return "PIX_FMT_YUV444P"; ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) 160 case PIX_FMT_RGB32: return "PIX_FMT_RGB32"; ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness 161 case PIX_FMT_YUV410P: return "PIX_FMT_YUV410P"; ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) 162 case PIX_FMT_YUV411P: return "PIX_FMT_YUV411P"; ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) 163 case PIX_FMT_RGB565: return "PIX_FMT_RGB565"; ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness 164 case PIX_FMT_RGB555: return "PIX_FMT_RGB555"; ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 165 case PIX_FMT_GRAY8: return "PIX_FMT_GRAY8"; ///< Y , 8bpp 166 case PIX_FMT_MONOWHITE: return "PIX_FMT_MONOWHITE"; ///< Y , 1bpp, 0 is white, 1 is black 167 case PIX_FMT_MONOBLACK: return "PIX_FMT_MONOBLACK"; ///< Y , 1bpp, 0 is black, 1 is white 168 case PIX_FMT_PAL8: return "PIX_FMT_PAL8"; ///< 8 bit with PIX_FMT_RGB32 palette 169 case PIX_FMT_YUVJ420P: return "PIX_FMT_YUVJ420P - YUV420P (Jpeg)"; ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) 170 case PIX_FMT_YUVJ422P: return "PIX_FMT_YUVJ422P - YUV422P (Jpeg)"; ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) 171 case PIX_FMT_YUVJ444P: return "PIX_FMT_YUVJ444P"; ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) 172 case PIX_FMT_XVMC_MPEG2_MC: return "PIX_FMT_XVMC_MPEG2_MC";///< XVideo Motion Acceleration via common packet passing 173 case PIX_FMT_XVMC_MPEG2_IDCT: return "PIX_FMT_XVMC_MPEG2_IDCT"; 174 case PIX_FMT_UYVY422: return "PIX_FMT_UYVY422"; ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 175 case PIX_FMT_UYYVYY411: return "PIX_FMT_UYYVYY411"; ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 176 case PIX_FMT_BGR32: return "PIX_FMT_BGR32"; ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness 177 case PIX_FMT_BGR565: return "PIX_FMT_BGR565"; ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness 178 case PIX_FMT_BGR555: return "PIX_FMT_BGR555"; ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 179 case PIX_FMT_BGR8: return "PIX_FMT_BGR8"; ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) 180 case PIX_FMT_BGR4: return "PIX_FMT_BGR4"; ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) 181 case PIX_FMT_BGR4_BYTE: return "PIX_FMT_BGR4_BYTE"; ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) 182 case PIX_FMT_RGB8: return "PIX_FMT_RGB8"; ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) 183 case PIX_FMT_RGB4: return "PIX_FMT_RGB4"; ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) 184 case PIX_FMT_RGB4_BYTE: return "PIX_FMT_RGB4_BYTE"; ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) 185 case PIX_FMT_NV12: return "PIX_FMT_NV12"; ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV 186 case PIX_FMT_NV21: return "PIX_FMT_NV21"; ///< as above, but U and V bytes are swapped 187 case PIX_FMT_RGB32_1: return "PIX_FMT_RGB32_1"; ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness 188 case PIX_FMT_BGR32_1: return "PIX_FMT_BGR32_1"; ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness 189 case PIX_FMT_GRAY16BE: return "PIX_FMT_GRAY16BE"; ///< Y , 16bpp, big-endian 190 case PIX_FMT_GRAY16LE: return "PIX_FMT_GRAY16LE"; ///< Y , 16bpp, little-endian 191 case PIX_FMT_YUV440P: return "PIX_FMT_YUV440P"; ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) 192 case PIX_FMT_YUVJ440P: return "PIX_FMT_YUVJ440P - YUV440P (Jpeg)"; ///< planar YUV 4:4:0 full scale (JPEG) 193 case PIX_FMT_YUVA420P: return "PIX_FMT_YUVA420P - YUV420P (Alpha)"; ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) 194 case PIX_FMT_VDPAU_H264: return "PIX_FMT_VDPAU_H264";///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 195 case PIX_FMT_VDPAU_MPEG1: return "PIX_FMT_VDPAU_MPEG1";///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 196 case PIX_FMT_VDPAU_MPEG2: return "PIX_FMT_VDPAU_MPEG2";///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 197 case PIX_FMT_VDPAU_WMV3: return "PIX_FMT_VDPAU_WMV3";///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 198 case PIX_FMT_VDPAU_VC1: return "PIX_FMT_VDPAU_VC1"; ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 199 case PIX_FMT_RGB48BE: return "PIX_FMT_RGB48BE"; ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian 200 case PIX_FMT_RGB48LE: return "PIX_FMT_RGB48LE"; ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian 201 case PIX_FMT_VAAPI_MOCO: return "PIX_FMT_VAAPI_MOCO"; ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[0] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers 202 case PIX_FMT_VAAPI_IDCT: return "PIX_FMT_VAAPI_IDCT"; ///< HW acceleration through VA API at IDCT entry-point, Picture.data[0] contains a vaapi_render_state struct which contains fields extracted from headers 203 case PIX_FMT_VAAPI_VLD: return "PIX_FMT_VAAPI_VLD"; ///< HW decoding through VA API, Picture.data[0] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 204 default: 205 return "(unknown)"; 206 } 207 } 208 209 210 color_space 211 pixfmt_to_colorspace(int p) 212 { 213 switch(p) { 214 default: 215 case PIX_FMT_NONE: 216 return B_NO_COLOR_SPACE; 217 218 case PIX_FMT_YUV420P: return B_YUV420; ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 219 case PIX_FMT_YUYV422: return B_YUV422; ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr 220 case PIX_FMT_RGB24: return B_RGB24_BIG; ///< packed RGB 8:8:8, 24bpp, RGBRGB... 221 case PIX_FMT_BGR24: return B_RGB24; ///< packed RGB 8:8:8, 24bpp, BGRBGR... 222 case PIX_FMT_YUV422P: return B_YUV422; ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) 223 case PIX_FMT_YUV444P: return B_YUV444; ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) 224 case PIX_FMT_RGB32: return B_RGBA32_BIG; ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness 225 case PIX_FMT_YUV410P: return B_YUV9; ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) 226 case PIX_FMT_YUV411P: return B_YUV12; ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) 227 case PIX_FMT_RGB565: return B_RGB16_BIG; ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness 228 case PIX_FMT_RGB555: return B_RGB15_BIG; ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 229 case PIX_FMT_GRAY8: return B_GRAY8; ///< Y , 8bpp 230 // case PIX_FMT_MONOWHITE: return B_GRAY1; ///< Y , 1bpp, 0 is white, 1 is black 231 case PIX_FMT_MONOBLACK: return B_GRAY1; ///< Y , 1bpp, 0 is black, 1 is white 232 case PIX_FMT_PAL8: return B_CMAP8; ///< 8 bit with PIX_FMT_RGB32 palette 233 // case PIX_FMT_YUVJ420P: return "PIX_FMT_YUVJ420P - YUV420P (Jpeg)"; ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) 234 // case PIX_FMT_YUVJ422P: return "PIX_FMT_YUVJ422P - YUV422P (Jpeg)"; ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) 235 // case PIX_FMT_YUVJ444P: return "PIX_FMT_YUVJ444P"; ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) 236 // case PIX_FMT_XVMC_MPEG2_MC: return "PIX_FMT_XVMC_MPEG2_MC";///< XVideo Motion Acceleration via common packet passing 237 // case PIX_FMT_XVMC_MPEG2_IDCT: return "PIX_FMT_XVMC_MPEG2_IDCT"; 238 // case PIX_FMT_UYVY422: return "PIX_FMT_UYVY422"; ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 239 // case PIX_FMT_UYYVYY411: return "PIX_FMT_UYYVYY411"; ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 240 case PIX_FMT_BGR32: return B_RGB32; ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness 241 case PIX_FMT_BGR565: return B_RGB16; ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness 242 case PIX_FMT_BGR555: return B_RGB15; ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 243 // case PIX_FMT_BGR8: return "PIX_FMT_BGR8"; ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) 244 // case PIX_FMT_BGR4: return "PIX_FMT_BGR4"; ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) 245 // case PIX_FMT_BGR4_BYTE: return "PIX_FMT_BGR4_BYTE"; ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) 246 // case PIX_FMT_RGB8: return "PIX_FMT_RGB8"; ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) 247 // case PIX_FMT_RGB4: return "PIX_FMT_RGB4"; ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) 248 // case PIX_FMT_RGB4_BYTE: return "PIX_FMT_RGB4_BYTE"; ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) 249 // case PIX_FMT_NV12: return "PIX_FMT_NV12"; ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV 250 // case PIX_FMT_NV21: return "PIX_FMT_NV21"; ///< as above, but U and V bytes are swapped 251 // case PIX_FMT_RGB32_1: return "PIX_FMT_RGB32_1"; ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness 252 // case PIX_FMT_BGR32_1: return "PIX_FMT_BGR32_1"; ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness 253 // case PIX_FMT_GRAY16BE: return "PIX_FMT_GRAY16BE"; ///< Y , 16bpp, big-endian 254 // case PIX_FMT_GRAY16LE: return "PIX_FMT_GRAY16LE"; ///< Y , 16bpp, little-endian 255 // case PIX_FMT_YUV440P: return "PIX_FMT_YUV440P"; ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) 256 // case PIX_FMT_YUVJ440P: return "PIX_FMT_YUVJ440P - YUV440P (Jpeg)"; ///< planar YUV 4:4:0 full scale (JPEG) 257 // case PIX_FMT_YUVA420P: return "PIX_FMT_YUVA420P - YUV420P (Alpha)"; ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) 258 // case PIX_FMT_VDPAU_H264: return "PIX_FMT_VDPAU_H264";///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 259 // case PIX_FMT_VDPAU_MPEG1: return "PIX_FMT_VDPAU_MPEG1";///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 260 // case PIX_FMT_VDPAU_MPEG2: return "PIX_FMT_VDPAU_MPEG2";///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 261 // case PIX_FMT_VDPAU_WMV3: return "PIX_FMT_VDPAU_WMV3";///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 262 // case PIX_FMT_VDPAU_VC1: return "PIX_FMT_VDPAU_VC1"; ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 263 // case PIX_FMT_RGB48BE: return "PIX_FMT_RGB48BE"; ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian 264 // case PIX_FMT_RGB48LE: return "PIX_FMT_RGB48LE"; ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian 265 // case PIX_FMT_VAAPI_MOCO: return "PIX_FMT_VAAPI_MOCO"; ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[0] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers 266 // case PIX_FMT_VAAPI_IDCT: return "PIX_FMT_VAAPI_IDCT"; ///< HW acceleration through VA API at IDCT entry-point, Picture.data[0] contains a vaapi_render_state struct which contains fields extracted from headers 267 // case PIX_FMT_VAAPI_VLD: return "PIX_FMT_VAAPI_VLD"; ///< HW decoding through VA API, Picture.data[0] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 268 } 269 } 270 271 272 #define BEGIN_TAG "\033[31m" 273 #define END_TAG "\033[0m" 274 275 void dump_ffframe(AVFrame *frame, const char *name) 276 { 277 const char *picttypes[] = {"no pict type", "intra", "predicted", "bidir pre", "s(gmc)-vop"}; 278 printf(BEGIN_TAG"AVFrame(%s) pts:%-10lld cnum:%-5d dnum:%-5d %s%s, ]\n"END_TAG, 279 name, 280 frame->pts, 281 frame->coded_picture_number, 282 frame->display_picture_number, 283 // frame->quality, 284 frame->key_frame?"keyframe, ":"", 285 picttypes[frame->pict_type]); 286 // printf(BEGIN_TAG"\t\tlinesize[] = {%ld, %ld, %ld, %ld}\n"END_TAG, frame->linesize[0], frame->linesize[1], frame->linesize[2], frame->linesize[3]); 287 } 288 289