Commit 229a1e86 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'b2e059a1'

* commit 'b2e059a1':
  pixdesc: K&R formatting cosmetics

Conflicts:
	libavutil/pixdesc.c
	libavutil/pixdesc.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5727d387 b2e059a1
...@@ -1957,7 +1957,8 @@ int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) ...@@ -1957,7 +1957,8 @@ int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
return bits >> log2_pixels; return bits >> log2_pixels;
} }
char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt) char *av_get_pix_fmt_string(char *buf, int buf_size,
enum AVPixelFormat pix_fmt)
{ {
/* print header */ /* print header */
if (pix_fmt < 0) { if (pix_fmt < 0) {
......
...@@ -27,23 +27,35 @@ ...@@ -27,23 +27,35 @@
#include "attributes.h" #include "attributes.h"
#include "pixfmt.h" #include "pixfmt.h"
typedef struct AVComponentDescriptor{ typedef struct AVComponentDescriptor {
uint16_t plane :2; ///< which of the 4 planes contains the component /**
* Which of the 4 planes contains the component.
*/
uint16_t plane : 2;
/** /**
* Number of elements between 2 horizontally consecutive pixels minus 1. * Number of elements between 2 horizontally consecutive pixels minus 1.
* Elements are bits for bitstream formats, bytes otherwise. * Elements are bits for bitstream formats, bytes otherwise.
*/ */
uint16_t step_minus1 :3; uint16_t step_minus1 : 3;
/** /**
* Number of elements before the component of the first pixel plus 1. * Number of elements before the component of the first pixel plus 1.
* Elements are bits for bitstream formats, bytes otherwise. * Elements are bits for bitstream formats, bytes otherwise.
*/ */
uint16_t offset_plus1 :3; uint16_t offset_plus1 : 3;
uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value
uint16_t depth_minus1 :4; ///< number of bits in the component minus 1 /**
}AVComponentDescriptor; * Number of least significant bits that must be shifted away
* to get the value.
*/
uint16_t shift : 3;
/**
* Number of bits in the component minus 1.
*/
uint16_t depth_minus1 : 4;
} AVComponentDescriptor;
/** /**
* Descriptor that unambiguously describes how the bits of a pixel are * Descriptor that unambiguously describes how the bits of a pixel are
...@@ -54,9 +66,9 @@ typedef struct AVComponentDescriptor{ ...@@ -54,9 +66,9 @@ typedef struct AVComponentDescriptor{
* and all the YUV variants) AVPixFmtDescriptor just stores how values * and all the YUV variants) AVPixFmtDescriptor just stores how values
* are stored not what these values represent. * are stored not what these values represent.
*/ */
typedef struct AVPixFmtDescriptor{ typedef struct AVPixFmtDescriptor {
const char *name; const char *name;
uint8_t nb_components; ///< The number of components each pixel has, (1-4) uint8_t nb_components; ///< The number of components each pixel has, (1-4)
/** /**
* Amount to shift the luma width right to find the chroma width. * Amount to shift the luma width right to find the chroma width.
...@@ -65,7 +77,7 @@ typedef struct AVPixFmtDescriptor{ ...@@ -65,7 +77,7 @@ typedef struct AVPixFmtDescriptor{
* The note above is needed to ensure rounding up. * The note above is needed to ensure rounding up.
* This value only refers to the chroma components. * This value only refers to the chroma components.
*/ */
uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w)
/** /**
* Amount to shift the luma height right to find the chroma height. * Amount to shift the luma height right to find the chroma height.
...@@ -86,7 +98,7 @@ typedef struct AVPixFmtDescriptor{ ...@@ -86,7 +98,7 @@ typedef struct AVPixFmtDescriptor{
* otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V.
*/ */
AVComponentDescriptor comp[4]; AVComponentDescriptor comp[4];
}AVPixFmtDescriptor; } AVPixFmtDescriptor;
/** /**
* Pixel format is big-endian. * Pixel format is big-endian.
...@@ -160,8 +172,9 @@ extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; ...@@ -160,8 +172,9 @@ extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[];
* component c in data[1] to dst, rather than the palette indexes in * component c in data[1] to dst, rather than the palette indexes in
* data[0]. The behavior is undefined if the format is not paletted. * data[0]. The behavior is undefined if the format is not paletted.
*/ */
void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], void av_read_image_line(uint16_t *dst, const uint8_t *data[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); const int linesize[4], const AVPixFmtDescriptor *desc,
int x, int y, int c, int w, int read_pal_component);
/** /**
* Write the values from src to the pixel format component c of an * Write the values from src to the pixel format component c of an
...@@ -177,8 +190,9 @@ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesiz ...@@ -177,8 +190,9 @@ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesiz
* @param w the width of the line to write, that is the number of * @param w the width of the line to write, that is the number of
* values to write to the image line * values to write to the image line
*/ */
void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], void av_write_image_line(const uint16_t *src, uint8_t *data[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w); const int linesize[4], const AVPixFmtDescriptor *desc,
int x, int y, int c, int w);
/** /**
* Return the pixel format corresponding to name. * Return the pixel format corresponding to name.
...@@ -211,7 +225,8 @@ const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); ...@@ -211,7 +225,8 @@ const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
* corresponding info string, or a negative value to print the * corresponding info string, or a negative value to print the
* corresponding header. * corresponding header.
*/ */
char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt); char *av_get_pix_fmt_string(char *buf, int buf_size,
enum AVPixelFormat pix_fmt);
/** /**
* Return the number of bits per pixel used by the pixel format * Return the number of bits per pixel used by the pixel format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment