Libav 0.7.1
|
00001 /* 00002 * pixel format descriptor 00003 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVUTIL_PIXDESC_H 00023 #define AVUTIL_PIXDESC_H 00024 00025 #include <inttypes.h> 00026 #include "pixfmt.h" 00027 00028 typedef struct AVComponentDescriptor{ 00029 uint16_t plane :2; 00030 00035 uint16_t step_minus1 :3; 00036 00041 uint16_t offset_plus1 :3; 00042 uint16_t shift :3; 00043 uint16_t depth_minus1 :4; 00044 }AVComponentDescriptor; 00045 00055 typedef struct AVPixFmtDescriptor{ 00056 const char *name; 00057 uint8_t nb_components; 00058 00066 uint8_t log2_chroma_w; 00067 00075 uint8_t log2_chroma_h; 00076 uint8_t flags; 00077 00083 AVComponentDescriptor comp[4]; 00084 }AVPixFmtDescriptor; 00085 00086 #define PIX_FMT_BE 1 ///< Pixel format is big-endian. 00087 #define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. 00088 #define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. 00089 #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. 00090 00094 extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; 00095 00112 void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], 00113 const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); 00114 00129 void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], 00130 const AVPixFmtDescriptor *desc, int x, int y, int c, int w); 00131 00143 enum PixelFormat av_get_pix_fmt(const char *name); 00144 00151 const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt); 00152 00163 char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); 00164 00173 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); 00174 00175 #endif /* AVUTIL_PIXDESC_H */