Go to the documentation of this file.
82 int *is_packed_rgba,
uint8_t rgba_map_ptr[4])
95 if (*is_packed_rgba) {
97 for (
i = 0;
i < 4;
i++)
98 dst_color[rgba_map[
i]] = rgba_color[
i];
103 for (
i = 0;
i <
w;
i++)
104 memcpy(
line[0] +
i * pixel_step[0], dst_color, pixel_step[0]);
106 memcpy(rgba_map_ptr, rgba_map,
sizeof(rgba_map[0]) * 4);
110 dst_color[0] =
RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
111 dst_color[1] =
RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
112 dst_color[2] =
RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
113 dst_color[3] = rgba_color[3];
115 for (plane = 0; plane < 4; plane++) {
117 int hsub1 = (plane == 1 || plane == 2) ?
hsub : 0;
119 pixel_step[plane] = 1;
123 while(plane &&
line[plane-1])
127 memset(
line[plane], dst_color[plane], line_size);
136 int hsub,
int vsub,
int x,
int y,
int w,
int h)
141 for (plane = 0; plane < 4 && dst[plane]; plane++) {
142 int hsub1 = plane == 1 || plane == 2 ?
hsub : 0;
143 int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
147 p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
149 memcpy(p + (x >> hsub1) * pixelstep[plane],
150 src[plane],
width * pixelstep[plane]);
151 p += dst_linesize[plane];
157 uint8_t *
src[4],
int src_linesize[4],
int pixelstep[4],
158 int hsub,
int vsub,
int x,
int y,
int y2,
int w,
int h)
163 for (plane = 0; plane < 4 && dst[plane]; plane++) {
164 int hsub1 = plane == 1 || plane == 2 ?
hsub : 0;
165 int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
169 p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
171 memcpy(p + (x >> hsub1) * pixelstep[plane],
172 src[plane] + src_linesize[plane]*(
i+(y2>>vsub1)),
width * pixelstep[plane]);
173 p += dst_linesize[plane];
182 unsigned i, nb_planes = 0;
195 for (
i = 0;
i <
desc->nb_components;
i++) {
198 if (
c->depth < 8 ||
c->depth > 16)
205 if (pixelstep[
c->plane] != 0 &&
206 pixelstep[
c->plane] !=
c->step)
208 if (pixelstep[
c->plane] == 6 &&
211 pixelstep[
c->plane] =
c->step;
212 if (pixelstep[
c->plane] >= 8)
214 nb_planes =
FFMAX(nb_planes,
c->plane + 1);
216 memset(draw, 0,
sizeof(*draw));
227 1 <<
desc->comp[
i].offset;
236 if (rgba !=
color->rgba)
237 memcpy(
color->rgba, rgba,
sizeof(
color->rgba));
241 for (
i = 0;
i < 4;
i++) {
242 color->comp[0].u8[rgba_map[
i]] = rgba[
i];
244 color->comp[0].u16[rgba_map[
i]] =
color->comp[0].u8[rgba_map[
i]] << 8;
248 for (
i = 0;
i < 4;
i++) {
249 color->comp[rgba_map[
i]].u8[0] = rgba[
i];
260 color->comp[3].u8[0] = rgba[3];
261 #define EXPAND(compn) \
262 if (desc->comp[compn].depth > 8) \
263 color->comp[desc->comp[compn].plane].u16[desc->comp[compn].offset] = \
264 color->comp[desc->comp[compn].plane].u8[desc->comp[compn].offset] << \
265 (draw->desc->comp[compn].depth + draw->desc->comp[compn].shift - 8)
279 color->comp[1].u8[0] = rgba[3];
283 "Color conversion not implemented for %s\n", draw->
desc->
name);
289 int plane,
int x,
int y)
292 (y >> draw->
vsub[plane]) * linesize[plane] +
297 uint8_t *dst[],
int dst_linesize[],
299 int dst_x,
int dst_y,
int src_x,
int src_y,
302 int plane, y, wp, hp;
305 for (plane = 0; plane < draw->
nb_planes; plane++) {
306 p =
pointer_at(draw,
src, src_linesize, plane, src_x, src_y);
307 q =
pointer_at(draw, dst, dst_linesize, plane, dst_x, dst_y);
310 for (y = 0; y < hp; y++) {
312 p += src_linesize[plane];
313 q += dst_linesize[plane];
319 uint8_t *dst[],
int dst_linesize[],
320 int dst_x,
int dst_y,
int w,
int h)
322 int plane, x, y, wp, hp;
326 for (plane = 0; plane < draw->
nb_planes; plane++) {
327 p0 =
pointer_at(draw, dst, dst_linesize, plane, dst_x, dst_y);
335 for (x = 0; 2*x < draw->
pixelstep[plane]; x++)
340 for (x = 0; x < wp; x++) {
346 p = p0 + dst_linesize[plane];
347 for (y = 1; y < hp; y++) {
349 p += dst_linesize[plane];
380 int mask = (1 << sub) - 1;
382 *start = (-*x) &
mask;
384 *start =
FFMIN(*start, *
w);
399 int dx,
int w,
unsigned hsub,
int left,
int right)
402 unsigned tau = 0x1010101 -
alpha;
407 *dst = (*dst * (0x1010101 - suba) +
src * suba) >> 24;
410 for (x = 0; x <
w; x++) {
411 *dst = (*dst * tau + asrc) >> 24;
416 *dst = (*dst * (0x1010101 - suba) +
src * suba) >> 24;
421 int dx,
int w,
unsigned hsub,
int left,
int right)
424 unsigned tau = 0x10001 -
alpha;
433 for (x = 0; x <
w; x++) {
446 uint8_t *dst[],
int dst_linesize[],
447 int dst_w,
int dst_h,
448 int x0,
int y0,
int w,
int h)
450 unsigned alpha, nb_planes, nb_comp, plane,
comp;
451 int w_sub, h_sub, x_sub, y_sub,
left, right, top, bottom, y;
457 if (
w <= 0 || h <= 0 || !color->rgba[3])
467 nb_planes += !nb_planes;
468 for (plane = 0; plane < nb_planes; plane++) {
470 p0 =
pointer_at(draw, dst, dst_linesize, plane, x0, y0);
493 p += dst_linesize[plane];
496 for (y = 0; y < h_sub; y++) {
500 p += dst_linesize[plane];
503 for (y = 0; y < h_sub; y++) {
507 p += dst_linesize[plane];
526 const uint8_t *
mask,
int mask_linesize,
int l2depth,
527 unsigned w,
unsigned h,
unsigned shift,
unsigned xm0)
529 unsigned xm, x, y, t = 0;
530 unsigned xmshf = 3 - l2depth;
531 unsigned xmmod = 7 >> l2depth;
532 unsigned mbits = (1 << (1 << l2depth)) - 1;
533 unsigned mmult = 255 / mbits;
536 for (y = 0; y <
h; y++) {
538 for (x = 0; x <
w; x++) {
539 t += ((
mask[xm >> xmshf] >> ((~xm & xmmod) << l2depth)) & mbits)
543 mask += mask_linesize;
550 const uint8_t *
mask,
int mask_linesize,
int l2depth,
551 unsigned w,
unsigned h,
unsigned shift,
unsigned xm0)
553 unsigned xm, x, y, t = 0;
554 unsigned xmshf = 3 - l2depth;
555 unsigned xmmod = 7 >> l2depth;
556 unsigned mbits = (1 << (1 << l2depth)) - 1;
557 unsigned mmult = 255 / mbits;
559 for (y = 0; y <
h; y++) {
561 for (x = 0; x <
w; x++) {
562 t += ((
mask[xm >> xmshf] >> ((~xm & xmmod) << l2depth)) & mbits)
566 mask += mask_linesize;
574 const uint8_t *
mask,
int mask_linesize,
int l2depth,
int w,
575 unsigned hsub,
unsigned vsub,
576 int xm,
int left,
int right,
int hband)
586 for (x = 0; x <
w; x++) {
594 right, hband,
hsub + vsub, xm);
599 const uint8_t *
mask,
int mask_linesize,
int l2depth,
int w,
600 unsigned hsub,
unsigned vsub,
601 int xm,
int left,
int right,
int hband)
611 for (x = 0; x <
w; x++) {
619 right, hband,
hsub + vsub, xm);
623 uint8_t *dst[],
int dst_linesize[],
int dst_w,
int dst_h,
624 const uint8_t *
mask,
int mask_linesize,
int mask_w,
int mask_h,
625 int l2depth,
unsigned endianness,
int x0,
int y0)
627 unsigned alpha, nb_planes, nb_comp, plane,
comp;
628 int xm0, ym0, w_sub, h_sub, x_sub, y_sub,
left, right, top, bottom, y;
634 mask += ym0 * mask_linesize;
635 if (mask_w <= 0 || mask_h <= 0 || !color->rgba[3])
640 alpha = (0x10307 *
color->rgba[3] + 0x3) >> 8;
645 nb_planes += !nb_planes;
646 for (plane = 0; plane < nb_planes; plane++) {
648 p0 =
pointer_at(draw, dst, dst_linesize, plane, x0, y0);
666 m, mask_linesize, l2depth, w_sub,
667 draw->
hsub[plane], draw->
vsub[plane],
668 xm0,
left, right, top);
672 m, mask_linesize, l2depth, w_sub,
673 draw->
hsub[plane], draw->
vsub[plane],
674 xm0,
left, right, top);
676 p += dst_linesize[plane];
677 m += top * mask_linesize;
680 for (y = 0; y < h_sub; y++) {
683 m, mask_linesize, l2depth, w_sub,
684 draw->
hsub[plane], draw->
vsub[plane],
685 xm0,
left, right, 1 << draw->
vsub[plane]);
686 p += dst_linesize[plane];
687 m += mask_linesize << draw->
vsub[plane];
690 for (y = 0; y < h_sub; y++) {
693 m, mask_linesize, l2depth, w_sub,
694 draw->
hsub[plane], draw->
vsub[plane],
695 xm0,
left, right, 1 << draw->
vsub[plane]);
696 p += dst_linesize[plane];
697 m += mask_linesize << draw->
vsub[plane];
704 m, mask_linesize, l2depth, w_sub,
705 draw->
hsub[plane], draw->
vsub[plane],
706 xm0,
left, right, bottom);
710 m, mask_linesize, l2depth, w_sub,
711 draw->
hsub[plane], draw->
vsub[plane],
712 xm0,
left, right, bottom);
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define RGB_TO_U_JPEG(r1, g1, b1)
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
static void subsampling_bounds(int sub, int *x, int *w, int *start, int *end)
Decompose w pixels starting at x into start + (w starting at x) + end with x and w aligned on multipl...
static av_cold int end(AVCodecContext *avctx)
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
const struct AVPixFmtDescriptor * desc
int depth
Number of bits in the component.
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
static void blend_pixel16(uint8_t *dst, unsigned src, unsigned alpha, const uint8_t *mask, int mask_linesize, int l2depth, unsigned w, unsigned h, unsigned shift, unsigned xm0)
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
int pixelstep[MAX_PLANES]
void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4], uint8_t *src[4], int src_linesize[4], int pixelstep[4], int hsub, int vsub, int x, int y, int y2, int w, int h)
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
union FFDrawColor::@204 comp[MAX_PLANES]
void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, const uint8_t *mask, int mask_linesize, int mask_w, int mask_h, int l2depth, unsigned endianness, int x0, int y0)
Blend an alpha mask with an uniform color.
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
#define RGB_TO_V_JPEG(r1, g1, b1)
static const uint16_t mask[17]
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
#define AV_CEIL_RSHIFT(a, b)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
#define RGB_TO_Y_CCIR(r, g, b)
void ff_copy_rectangle2(FFDrawContext *draw, uint8_t *dst[], int dst_linesize[], uint8_t *src[], int src_linesize[], int dst_x, int dst_y, int src_x, int src_y, int w, int h)
Copy a rectangle from an image to another.
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
#define FF_DRAW_PROCESS_ALPHA
Process alpha pixel component.
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
static void blend_line_hv16(uint8_t *dst, int dst_delta, unsigned src, unsigned alpha, const uint8_t *mask, int mask_linesize, int l2depth, int w, unsigned hsub, unsigned vsub, int xm, int left, int right, int hband)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static enum AVPixelFormat pix_fmt
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GRAY8A
alias for AV_PIX_FMT_YA8
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static void clip_interval(int wmax, int *x, int *w, int *dx)
Clip interval [x; x+w[ within [0; wmax[.
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4], enum AVPixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba, uint8_t rgba_map_ptr[4])
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, int x0, int y0, int w, int h)
Blend a rectangle with an uniform color.
enum AVPixelFormat format
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
uint8_t comp_mask[MAX_PLANES]
static int component_used(FFDrawContext *draw, int plane, int comp)
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4], uint8_t *src[4], int pixelstep[4], int hsub, int vsub, int x, int y, int w, int h)
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
#define i(width, name, range_min, range_max)
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
#define av_malloc_array(a, b)
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir, int value)
Round a dimension according to subsampling.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
static void blend_pixel(uint8_t *dst, unsigned src, unsigned alpha, const uint8_t *mask, int mask_linesize, int l2depth, unsigned w, unsigned h, unsigned shift, unsigned xm0)
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
static void blend_line(uint8_t *dst, unsigned src, unsigned alpha, int dx, int w, unsigned hsub, int left, int right)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
static int shift(int a, int b)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static const int16_t alpha[]
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
static uint8_t * pointer_at(FFDrawContext *draw, uint8_t *data[], int linesize[], int plane, int x, int y)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
#define flags(name, subs,...)
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
static void blend_line_hv(uint8_t *dst, int dst_delta, unsigned src, unsigned alpha, const uint8_t *mask, int mask_linesize, int l2depth, int w, unsigned hsub, unsigned vsub, int xm, int left, int right, int hband)
static void blend_line16(uint8_t *dst, unsigned src, unsigned alpha, int dx, int w, unsigned hsub, int left, int right)
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
#define RGB_TO_Y_JPEG(r, g, b)
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...