xine-lib: xine-lib-1.2.12/src/video_dec/libmpeg2new/libmpeg2/slice.c File Reference

xine-lib 1.2.12

Macros | Functions | Variables
slice.c File Reference
`#include "config.h"`
`#include <inttypes.h>`
`#include "../include/mpeg2.h"`
`#include "../include/attributes.h"`
`#include "mpeg2_internal.h"`
`#include "vlc.h"`

## Macros
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | SATURATE(val)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | MOTION_420(table, ref, motion_x, motion_y, size, y)
#define | MOTION_FIELD_420(table, ref, motion_x, motion_y, dest_field, op, src_field)
#define | MOTION_DMV_420(table, ref, motion_x, motion_y)
#define | MOTION_ZERO_420(table, ref)
#define | MOTION_422(table, ref, motion_x, motion_y, size, y)
#define | MOTION_FIELD_422(table, ref, motion_x, motion_y, dest_field, op, src_field)
#define | MOTION_DMV_422(table, ref, motion_x, motion_y)
#define | MOTION_ZERO_422(table, ref)
#define | MOTION_444(table, ref, motion_x, motion_y, size, y)
#define | MOTION_FIELD_444(table, ref, motion_x, motion_y, dest_field, op, src_field)
#define | MOTION_DMV_444(table, ref, motion_x, motion_y)
#define | MOTION_ZERO_444(table, ref)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | MOTION_FUNCTIONS(FORMAT, MOTION, MOTION_FIELD, MOTION_DMV, MOTION_ZERO)
#define | MOTION_CALL(routine, direction)
#define | NEXT_MACROBLOCK
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)
#define | bit_buf (decoder->bitstream_buf)
#define | bits (decoder->bitstream_bits)
#define | bit_ptr (decoder->bitstream_ptr)

## Functions
static int | get_macroblock_modes (mpeg2_decoder_t *const decoder)
static void | get_quantizer_scale (mpeg2_decoder_t *const decoder)
static int | get_motion_delta (mpeg2_decoder_t *const decoder, const int f_code)
static int | bound_motion_vector (const int vector, const int f_code)
static int | get_dmv (mpeg2_decoder_t *const decoder)
static int | get_coded_block_pattern (mpeg2_decoder_t *const decoder)
static int | get_luma_dc_dct_diff (mpeg2_decoder_t *const decoder)
static int | get_chroma_dc_dct_diff (mpeg2_decoder_t *const decoder)
static void | get_intra_block_B14 (mpeg2_decoder_t *const decoder, const uint16_t *const quant_matrix)
static void | get_intra_block_B15 (mpeg2_decoder_t *const decoder, const uint16_t *const quant_matrix)
static int | get_non_intra_block (mpeg2_decoder_t *const decoder, const uint16_t *const quant_matrix)
static void | get_mpeg1_intra_block (mpeg2_decoder_t *const decoder)
static int | get_mpeg1_non_intra_block (mpeg2_decoder_t *const decoder)
static void | slice_intra_DCT (mpeg2_decoder_t *const decoder, const int cc, uint8_t *const dest, const int stride)
static void | slice_non_intra_DCT (mpeg2_decoder_t *const decoder, const int cc, uint8_t *const dest, const int stride)
static void | motion_mp1 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_frame_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_field_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_dmv_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_reuse_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_zero_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_field_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_16x8_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_dmv_420 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_frame_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_field_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_dmv_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_reuse_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_zero_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_field_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_16x8_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_dmv_422 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_frame_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_field_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_dmv_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_reuse_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_zero_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_field_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_16x8_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fi_dmv_444 (mpeg2_decoder_t *const decoder, motion_t *const motion, mpeg2_mc_fct *const *const table)
static void | motion_fr_conceal (mpeg2_decoder_t *const decoder)
static void | motion_fi_conceal (mpeg2_decoder_t *const decoder)
void | mpeg2_init_fbuf (mpeg2_decoder_t *decoder, uint8_t *current_fbuf[3], uint8_t *forward_fbuf[3], uint8_t *backward_fbuf[3])
static int | slice_init (mpeg2_decoder_t *const decoder, int code)
void | mpeg2_slice (mpeg2_decoder_t *const decoder, const int code, const uint8_t *const buffer)

## Variables
mpeg2_mc_t | mpeg2_mc
void(* | mpeg2_idct_copy )(int16_t *block, uint8_t *dest, int stride)
void(* | mpeg2_idct_add )(int last, int16_t *block, uint8_t *dest, int stride)
void(* | mpeg2_cpu_state_save )(cpu_state_t *state)
void(* | mpeg2_cpu_state_restore )(cpu_state_t *state)

## Macro Definition Documentation

## ◆ bit_buf [1/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [2/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [3/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [4/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [5/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [6/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [7/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [8/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [9/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [10/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_buf [11/11]

#define bit_buf (decoder->bitstream_buf)

## ◆ bit_ptr [1/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [2/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [3/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [4/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [5/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [6/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [7/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [8/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [9/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [10/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bit_ptr [11/11]

#define bit_ptr (decoder->bitstream_ptr)

## ◆ bits [1/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [2/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [3/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [4/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [5/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [6/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [7/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [8/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [9/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [10/11]

#define bits (decoder->bitstream_bits)

## ◆ bits [11/11]

#define bits (decoder->bitstream_bits)

## ◆ MOTION_420

#define MOTION_420 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | size,
|  |  | y
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = 2 * decoder->v_offset + motion_y + 2 * y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y_ ## size)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y_ ## size; \
motion_y = pos_y - 2 * decoder->v_offset - 2 * y; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
table[xy_half] (decoder->dest[0] + y * decoder->stride + decoder->offset, \
ref[0] + (pos_x >> 1) + (pos_y >> 1) * decoder->stride, \
decoder->stride, size); \
motion_x /= 2; motion_y /= 2; \
xy_half = ((motion_y & 1) << 1) | (motion_x & 1); \
offset = (((decoder->offset + motion_x) >> 1) + \
((((decoder->v_offset + motion_y) >> 1) + y/2) * \
decoder->uv_stride)); \
table[4+xy_half] (decoder->dest[1] + y/2 * decoder->uv_stride + \
(decoder->offset >> 1), ref[1] + offset, \
decoder->uv_stride, size/2); \
table[4+xy_half] (decoder->dest[2] + y/2 * decoder->uv_stride + \
(decoder->offset >> 1), ref[2] + offset, \
decoder->uv_stride, size/2)
unlikely
#define unlikely(x)
Definition: attributes.h:32

## ◆ MOTION_422

#define MOTION_422 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | size,
|  |  | y
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = 2 * decoder->v_offset + motion_y + 2 * y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y_ ## size)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y_ ## size; \
motion_y = pos_y - 2 * decoder->v_offset - 2 * y; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
offset = (pos_x >> 1) + (pos_y >> 1) * decoder->stride; \
table[xy_half] (decoder->dest[0] + y * decoder->stride + decoder->offset, \
ref[0] + offset, decoder->stride, size); \
offset = (offset + (motion_x & (motion_x < 0))) >> 1; \
motion_x /= 2; \
xy_half = ((pos_y & 1) << 1) | (motion_x & 1); \
table[4+xy_half] (decoder->dest[1] + y * decoder->uv_stride + \
(decoder->offset >> 1), ref[1] + offset, \
decoder->uv_stride, size); \
table[4+xy_half] (decoder->dest[2] + y * decoder->uv_stride + \
(decoder->offset >> 1), ref[2] + offset, \
decoder->uv_stride, size)

## ◆ MOTION_444

#define MOTION_444 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | size,
|  |  | y
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = 2 * decoder->v_offset + motion_y + 2 * y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y_ ## size)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y_ ## size; \
motion_y = pos_y - 2 * decoder->v_offset - 2 * y; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
offset = (pos_x >> 1) + (pos_y >> 1) * decoder->stride; \
table[xy_half] (decoder->dest[0] + y * decoder->stride + decoder->offset, \
ref[0] + offset, decoder->stride, size); \
table[xy_half] (decoder->dest[1] + y * decoder->stride + decoder->offset, \
ref[1] + offset, decoder->stride, size); \
table[xy_half] (decoder->dest[2] + y * decoder->stride + decoder->offset, \
ref[2] + offset, decoder->stride, size)

## ◆ MOTION_CALL

#define MOTION_CALL | ( |  | routine,
|  |  | direction
| ) |  |

Value:
do { \
if ((direction) & MACROBLOCK_MOTION_FORWARD) \
routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
routine (decoder, &(decoder->b_motion), \
((direction) & MACROBLOCK_MOTION_FORWARD ? \
mpeg2_mc.avg : mpeg2_mc.put)); \
} while (0)
mpeg2_mc
mpeg2_mc_t mpeg2_mc
Definition: motion_comp.c:32
MACROBLOCK_MOTION_BACKWARD
#define MACROBLOCK_MOTION_BACKWARD
Definition: mpeg2_internal.h:37
MACROBLOCK_MOTION_FORWARD
#define MACROBLOCK_MOTION_FORWARD
Definition: mpeg2_internal.h:38
mpeg2_mc_t::avg
mpeg2_mc_fct * avg[8]
Definition: mpeg2_internal.h:286
mpeg2_mc_t::put
mpeg2_mc_fct * put[8]
Definition: mpeg2_internal.h:285

## ◆ MOTION_DMV_420

#define MOTION_DMV_420 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y
| ) |  |

## ◆ MOTION_DMV_422

#define MOTION_DMV_422 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y
| ) |  |

## ◆ MOTION_DMV_444

#define MOTION_DMV_444 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = decoder->v_offset + motion_y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y; \
motion_y = pos_y - decoder->v_offset; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
offset = (pos_x >> 1) + (pos_y & ~1) * decoder->stride; \
table[xy_half] (decoder->dest[0] + decoder->offset, \
ref[0] + offset, 2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[0] + decoder->stride + decoder->offset, \
ref[0] + decoder->stride + offset, \
2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[1] + decoder->offset, \
ref[1] + offset, 2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[1] + decoder->stride + decoder->offset, \
ref[1] + decoder->stride + offset, \
2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[2] + decoder->offset, \
ref[2] + offset, 2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[2] + decoder->stride + decoder->offset, \
ref[2] + decoder->stride + offset, \
2 * decoder->stride, 8)

## ◆ MOTION_FIELD_420

#define MOTION_FIELD_420 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | dest_field,
|  |  | op,
|  |  | src_field
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = decoder->v_offset + motion_y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y; \
motion_y = pos_y - decoder->v_offset; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
table[xy_half] (decoder->dest[0] + dest_field * decoder->stride + \
decoder->offset, \
(ref[0] + (pos_x >> 1) + \
((pos_y op) + src_field) * decoder->stride), \
2 * decoder->stride, 8); \
motion_x /= 2; motion_y /= 2; \
xy_half = ((motion_y & 1) << 1) | (motion_x & 1); \
offset = (((decoder->offset + motion_x) >> 1) + \
(((decoder->v_offset >> 1) + (motion_y op) + src_field) * \
decoder->uv_stride)); \
table[4+xy_half] (decoder->dest[1] + dest_field * decoder->uv_stride + \
(decoder->offset >> 1), ref[1] + offset, \
2 * decoder->uv_stride, 4); \
table[4+xy_half] (decoder->dest[2] + dest_field * decoder->uv_stride + \
(decoder->offset >> 1), ref[2] + offset, \
2 * decoder->uv_stride, 4)

## ◆ MOTION_FIELD_422

#define MOTION_FIELD_422 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | dest_field,
|  |  | op,
|  |  | src_field
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = decoder->v_offset + motion_y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y; \
motion_y = pos_y - decoder->v_offset; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
offset = (pos_x >> 1) + ((pos_y op) + src_field) * decoder->stride; \
table[xy_half] (decoder->dest[0] + dest_field * decoder->stride + \
decoder->offset, ref[0] + offset, \
2 * decoder->stride, 8); \
offset = (offset + (motion_x & (motion_x < 0))) >> 1; \
motion_x /= 2; \
xy_half = ((pos_y & 1) << 1) | (motion_x & 1); \
table[4+xy_half] (decoder->dest[1] + dest_field * decoder->uv_stride + \
(decoder->offset >> 1), ref[1] + offset, \
2 * decoder->uv_stride, 8); \
table[4+xy_half] (decoder->dest[2] + dest_field * decoder->uv_stride + \
(decoder->offset >> 1), ref[2] + offset, \
2 * decoder->uv_stride, 8)

## ◆ MOTION_FIELD_444

#define MOTION_FIELD_444 | ( |  | table,
|  |  | ref,
|  |  | motion_x,
|  |  | motion_y,
|  |  | dest_field,
|  |  | op,
|  |  | src_field
| ) |  |

Value:
pos_x = 2 * decoder->offset + motion_x; \
pos_y = decoder->v_offset + motion_y; \
if (unlikely (pos_x > decoder->limit_x)) { \
pos_x = ((int)pos_x < 0) ? 0 : decoder->limit_x; \
motion_x = pos_x - 2 * decoder->offset; \
} \
if (unlikely (pos_y > decoder->limit_y)) { \
pos_y = ((int)pos_y < 0) ? 0 : decoder->limit_y; \
motion_y = pos_y - decoder->v_offset; \
} \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
offset = (pos_x >> 1) + ((pos_y op) + src_field) * decoder->stride; \
table[xy_half] (decoder->dest[0] + dest_field * decoder->stride + \
decoder->offset, ref[0] + offset, \
2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[1] + dest_field * decoder->stride + \
decoder->offset, ref[1] + offset, \
2 * decoder->stride, 8); \
table[xy_half] (decoder->dest[2] + dest_field * decoder->stride + \
decoder->offset, ref[2] + offset, \
2 * decoder->stride, 8)

## ◆ MOTION_FUNCTIONS

#define MOTION_FUNCTIONS | ( |  | FORMAT,
|  |  | MOTION,
|  |  | MOTION_FIELD,
|  |  | MOTION_DMV,
|  |  | MOTION_ZERO
| ) |  |

## ◆ MOTION_ZERO_420

#define MOTION_ZERO_420 | ( |  | table,
|  |  | ref
| ) |  |

Value:
table[0] (decoder->dest[0] + decoder->offset, \
(ref[0] + decoder->offset + \
decoder->v_offset * decoder->stride), decoder->stride, 16); \
offset = ((decoder->offset >> 1) + \
(decoder->v_offset >> 1) * decoder->uv_stride); \
table[4] (decoder->dest[1] + (decoder->offset >> 1), \
ref[1] + offset, decoder->uv_stride, 8); \
table[4] (decoder->dest[2] + (decoder->offset >> 1), \
ref[2] + offset, decoder->uv_stride, 8)

## ◆ MOTION_ZERO_422

#define MOTION_ZERO_422 | ( |  | table,
|  |  | ref
| ) |  |

Value:
offset = decoder->offset + decoder->v_offset * decoder->stride; \
table[0] (decoder->dest[0] + decoder->offset, \
ref[0] + offset, decoder->stride, 16); \
offset >>= 1; \
table[4] (decoder->dest[1] + (decoder->offset >> 1), \
ref[1] + offset, decoder->uv_stride, 16); \
table[4] (decoder->dest[2] + (decoder->offset >> 1), \
ref[2] + offset, decoder->uv_stride, 16)

## ◆ MOTION_ZERO_444

#define MOTION_ZERO_444 | ( |  | table,
|  |  | ref
| ) |  |

Value:
offset = decoder->offset + decoder->v_offset * decoder->stride; \
table[0] (decoder->dest[0] + decoder->offset, \
ref[0] + offset, decoder->stride, 16); \
table[4] (decoder->dest[1] + decoder->offset, \
ref[1] + offset, decoder->stride, 16); \
table[4] (decoder->dest[2] + (decoder->offset >> 1), \
ref[2] + offset, decoder->stride, 16)

## ◆ NEXT_MACROBLOCK

#define NEXT_MACROBLOCK

Value:
do { \
decoder->offset += 16; \
if (decoder->offset == decoder->width) { \
do { /* just so we can use the break statement */ \
if (decoder->convert) { \
decoder->convert (decoder->convert_id, decoder->dest, \
decoder->v_offset); \
if (decoder->coding_type == B_TYPE) \
break; \
} \
decoder->dest[0] += decoder->slice_stride; \
decoder->dest[1] += decoder->slice_uv_stride; \
decoder->dest[2] += decoder->slice_uv_stride; \
} while (0); \
decoder->v_offset += 16; \
if (decoder->v_offset > decoder->limit_y) { \
if (mpeg2_cpu_state_restore) \
mpeg2_cpu_state_restore (&cpu_state); \
return; \
} \
decoder->offset = 0; \
} \
} while (0)
B_TYPE
#define B_TYPE
Definition: ff_mpeg_parser.c:45
mpeg2_cpu_state_restore
void(* mpeg2_cpu_state_restore)(cpu_state_t *state)
Definition: cpu_state.c:34

## ◆ SATURATE

#define SATURATE | ( |  | val | ) |

Value:
do { \
val <<= 4; \
if (unlikely (val != (int16_t) val)) \
val = (SBITS (val, 1) ^ 2047) << 4; \
} while (0)
SBITS
#define SBITS(bit_buf, num)
Definition: vlc.h:58

## Function Documentation

## ◆ bound_motion_vector()

static int bound_motion_vector | ( | const int | vector,
|  | const int | f_code
| ) |  |
| inlinestatic

## ◆ get_chroma_dc_dct_diff()

static int get_chroma_dc_dct_diff | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References bit_buf, bit_ptr, bits, DC_chrom_5, DC_long, DUMPBITS, mpeg2_decoder_s::intra_dc_precision, DCtab::len, NEEDBITS, SBITS, DCtab::size, and UBITS.

## ◆ get_coded_block_pattern()

static int get_coded_block_pattern | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References bit_buf, bit_ptr, bits, CBPtab::cbp, CBP_7, CBP_9, DUMPBITS, CBPtab::len, NEEDBITS, and UBITS.

## ◆ get_dmv()

static int get_dmv | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References bit_buf, bits, DMVtab::dmv, DMV_2, DUMPBITS, DMVtab::len, and UBITS.

## ◆ get_intra_block_B14()

static void get_intra_block_B14 | ( | mpeg2_decoder_t *const | decoder,
|  | const uint16_t *const | quant_matrix
| ) |  |
| static

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::bitstream_bits, mpeg2_decoder_s::bitstream_buf, mpeg2_decoder_s::bitstream_ptr, DCT_13, DCT_15, DCT_16, DCT_B14_10, DCT_B14_8, DCT_B14AC_5, mpeg2_decoder_s::DCTblock, DUMPBITS, GETWORD, DCTtab::len, DCTtab::level, NEEDBITS, DCTtab::run, SATURATE, SBITS, mpeg2_decoder_s::scan, and UBITS.

## ◆ get_intra_block_B15()

static void get_intra_block_B15 | ( | mpeg2_decoder_t *const | decoder,
|  | const uint16_t *const | quant_matrix
| ) |  |
| static

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::bitstream_bits, mpeg2_decoder_s::bitstream_buf, mpeg2_decoder_s::bitstream_ptr, DCT_13, DCT_15, DCT_16, DCT_B15_10, DCT_B15_8, mpeg2_decoder_s::DCTblock, DUMPBITS, GETWORD, DCTtab::len, DCTtab::level, NEEDBITS, DCTtab::run, SATURATE, SBITS, mpeg2_decoder_s::scan, and UBITS.

## ◆ get_luma_dc_dct_diff()

static int get_luma_dc_dct_diff | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References bit_buf, bit_ptr, bits, DC_long, DC_lum_5, DUMPBITS, mpeg2_decoder_s::intra_dc_precision, DCtab::len, NEEDBITS, SBITS, DCtab::size, and UBITS.

## ◆ get_macroblock_modes()

static int get_macroblock_modes | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References B_TYPE, bit_buf, bits, mpeg2_decoder_s::coding_type, D_TYPE, DCT_TYPE_INTERLACED, DUMPBITS, FRAME_PICTURE, mpeg2_decoder_s::frame_pred_frame_dct, I_TYPE, MBtab::len, MACROBLOCK_INTRA, MACROBLOCK_MOTION_FORWARD, MACROBLOCK_PATTERN, MB_B, MB_I, MB_P, MC_FRAME, MBtab::modes, MOTION_TYPE_SHIFT, P_TYPE, mpeg2_decoder_s::picture_structure, and UBITS.

## ◆ get_motion_delta()

static int get_motion_delta | ( | mpeg2_decoder_t *const | decoder,
|  | const int | f_code
| ) |  |
| inlinestatic

References bit_buf, bit_ptr, bits, MVtab::delta, DUMPBITS, MVtab::len, MV_10, MV_4, NEEDBITS, SBITS, and UBITS.

## ◆ get_mpeg1_intra_block()

static void get_mpeg1_intra_block | ( | mpeg2_decoder_t *const | decoder | ) |
| static

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::bitstream_bits, mpeg2_decoder_s::bitstream_buf, mpeg2_decoder_s::bitstream_ptr, DCT_13, DCT_15, DCT_16, DCT_B14_10, DCT_B14_8, DCT_B14AC_5, mpeg2_decoder_s::DCTblock, DUMPBITS, GETWORD, DCTtab::len, DCTtab::level, NEEDBITS, mpeg2_decoder_s::quantizer_matrix, DCTtab::run, SATURATE, SBITS, mpeg2_decoder_s::scan, and UBITS.

## ◆ get_mpeg1_non_intra_block()

static int get_mpeg1_non_intra_block | ( | mpeg2_decoder_t *const | decoder | ) |
| static

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::bitstream_bits, mpeg2_decoder_s::bitstream_buf, mpeg2_decoder_s::bitstream_ptr, DCT_13, DCT_15, DCT_16, DCT_B14_10, DCT_B14_8, DCT_B14AC_5, DCT_B14DC_5, mpeg2_decoder_s::DCTblock, DUMPBITS, GETWORD, DCTtab::len, DCTtab::level, NEEDBITS, mpeg2_decoder_s::quantizer_matrix, DCTtab::run, SATURATE, SBITS, mpeg2_decoder_s::scan, and UBITS.

## ◆ get_non_intra_block()

static int get_non_intra_block | ( | mpeg2_decoder_t *const | decoder,
|  | const uint16_t *const | quant_matrix
| ) |  |
| static

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::bitstream_bits, mpeg2_decoder_s::bitstream_buf, mpeg2_decoder_s::bitstream_ptr, DCT_13, DCT_15, DCT_16, DCT_B14_10, DCT_B14_8, DCT_B14AC_5, DCT_B14DC_5, mpeg2_decoder_s::DCTblock, DUMPBITS, GETWORD, DCTtab::len, DCTtab::level, NEEDBITS, DCTtab::run, SATURATE, SBITS, mpeg2_decoder_s::scan, and UBITS.

## ◆ get_quantizer_scale()

static void get_quantizer_scale | ( | mpeg2_decoder_t *const | decoder | ) |
| inlinestatic

References bit_buf, bits, mpeg2_decoder_s::chroma_quantizer, DUMPBITS, mpeg2_decoder_s::quantizer_matrix, mpeg2_decoder_s::quantizer_prescale, and UBITS.

## ◆ motion_fi_16x8_420()

static void motion_fi_16x8_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_16x8_422()

static void motion_fi_16x8_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_16x8_444()

static void motion_fi_16x8_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_conceal()

static void motion_fi_conceal | ( | mpeg2_decoder_t *const | decoder | ) |
| static

## ◆ motion_fi_dmv_420()

static void motion_fi_dmv_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_dmv_422()

static void motion_fi_dmv_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_dmv_444()

static void motion_fi_dmv_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_field_420()

static void motion_fi_field_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_field_422()

static void motion_fi_field_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fi_field_444()

static void motion_fi_field_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_conceal()

static void motion_fr_conceal | ( | mpeg2_decoder_t *const | decoder | ) |
| static

References bit_buf, bit_ptr, bits, bound_motion_vector(), get_motion_delta(), and NEEDBITS.

## ◆ motion_fr_dmv_420()

static void motion_fr_dmv_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_dmv_422()

static void motion_fr_dmv_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_dmv_444()

static void motion_fr_dmv_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_field_420()

static void motion_fr_field_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_field_422()

static void motion_fr_field_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_field_444()

static void motion_fr_field_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_frame_420()

static void motion_fr_frame_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_frame_422()

static void motion_fr_frame_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_fr_frame_444()

static void motion_fr_frame_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_mp1()

static void motion_mp1 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

References bit_buf, bit_ptr, bits, bound_motion_vector(), motion_t::f_code, get_motion_delta(), MOTION_420, NEEDBITS, motion_t::pmv, and motion_t::ref.

## ◆ motion_reuse_420()

static void motion_reuse_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_reuse_422()

static void motion_reuse_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_reuse_444()

static void motion_reuse_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_zero_420()

static void motion_zero_420 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_zero_422()

static void motion_zero_422 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ motion_zero_444()

static void motion_zero_444 | ( | mpeg2_decoder_t *const | decoder,
|  | motion_t *const | motion,
|  | mpeg2_mc_fct *const *const | table
| ) |  |
| static

Referenced by mpeg2_init_fbuf().

## ◆ mpeg2_init_fbuf()

void mpeg2_init_fbuf | ( | mpeg2_decoder_t * | decoder,
|  | uint8_t * | current_fbuf[3],
|  | uint8_t * | forward_fbuf[3],
|  | uint8_t * | backward_fbuf[3]
| ) |  |

References mpeg2_decoder_s::b_motion, B_TYPE, BOTTOM_FIELD, mpeg2_decoder_s::chroma_format, mpeg2_decoder_s::coding_type, mpeg2_decoder_s::dmv_offset, mpeg2_decoder_s::f_motion, FRAME_PICTURE, height, mpeg2_decoder_s::height, mpeg2_decoder_s::limit_x, mpeg2_decoder_s::limit_y, mpeg2_decoder_s::limit_y_16, mpeg2_decoder_s::limit_y_8, MC_16X8, MC_DMV, MC_FIELD, MC_FRAME, motion_fi_16x8_420(), motion_fi_16x8_422(), motion_fi_16x8_444(), motion_fi_dmv_420(), motion_fi_dmv_422(), motion_fi_dmv_444(), motion_fi_field_420(), motion_fi_field_422(), motion_fi_field_444(), motion_fr_dmv_420(), motion_fr_dmv_422(), motion_fr_dmv_444(), motion_fr_field_420(), motion_fr_field_422(), motion_fr_field_444(), motion_fr_frame_420(), motion_fr_frame_422(), motion_fr_frame_444(), motion_mp1(), mpeg2_decoder_s::motion_parser, motion_reuse_420(), motion_reuse_422(), motion_reuse_444(), motion_zero_420(), motion_zero_422(), motion_zero_444(), mpeg2_decoder_s::mpeg1, mpeg2_decoder_s::picture_dest, mpeg2_decoder_s::picture_structure, motion_t::ref, motion_t::ref2, mpeg2_decoder_s::second_field, mpeg2_decoder_s::slice_stride, mpeg2_decoder_s::slice_uv_stride, mpeg2_decoder_s::stride, mpeg2_decoder_s::stride_frame, mpeg2_decoder_s::uv_stride, and mpeg2_decoder_s::width.

Referenced by mpeg2_header_slice_start().

## ◆ mpeg2_slice()

void mpeg2_slice | ( | mpeg2_decoder_t *const | decoder,
|  | const int | code,
|  | const uint8_t *const | buffer
| ) |  |

## ◆ slice_init()

static int slice_init | ( | mpeg2_decoder_t *const | decoder,
|  | int | code
| ) |  |
| inlinestatic

## ◆ slice_intra_DCT()

static void slice_intra_DCT | ( | mpeg2_decoder_t *const | decoder,
|  | const int | cc,
|  | uint8_t *const | dest,
|  | const int | stride
| ) |  |
| inlinestatic

References bit_buf, bit_ptr, bits, mpeg2_decoder_s::coding_type, D_TYPE, mpeg2_decoder_s::dc_dct_pred, mpeg2_decoder_s::DCTblock, get_chroma_dc_dct_diff(), get_intra_block_B14(), get_intra_block_B15(), get_luma_dc_dct_diff(), get_mpeg1_intra_block(), mpeg2_decoder_s::intra_vlc_format, mpeg2_decoder_s::mpeg1, mpeg2_idct_copy, NEEDBITS, and mpeg2_decoder_s::quantizer_matrix.

## ◆ slice_non_intra_DCT()

static void slice_non_intra_DCT | ( | mpeg2_decoder_t *const | decoder,
|  | const int | cc,
|  | uint8_t *const | dest,
|  | const int | stride
| ) |  |
| inlinestatic

References mpeg2_decoder_s::DCTblock, get_mpeg1_non_intra_block(), get_non_intra_block(), mpeg2_decoder_s::mpeg1, mpeg2_idct_add, and mpeg2_decoder_s::quantizer_matrix.

## Variable Documentation

## ◆ mpeg2_cpu_state_restore

void(* mpeg2_cpu_state_restore) (cpu_state_t *state) | ( | cpu_state_t * | state | ) |
| extern

Referenced by mpeg2_cpu_state_init(), mpeg2_slice(), and mpeg2_xvmc_slice().

## ◆ mpeg2_cpu_state_save

void(* mpeg2_cpu_state_save) (cpu_state_t *state) | ( | cpu_state_t * | state | ) |
| extern

Referenced by mpeg2_cpu_state_init(), mpeg2_slice(), and mpeg2_xvmc_slice().

## ◆ mpeg2_idct_add

void(* mpeg2_idct_add) (int last, int16_t *block, uint8_t *dest, int stride) | ( | int | last,
|  | int16_t * | block,
|  | uint8_t * | dest,
|  | int | stride
| ) |  |
| extern

## ◆ mpeg2_idct_copy

void(* mpeg2_idct_copy) (int16_t *block, uint8_t *dest, int stride) | ( | int16_t * | block,
|  | uint8_t * | dest,
|  | int | stride
| ) |  |
| extern

Referenced by mpeg2_idct_init(), and slice_intra_DCT().

## ◆ mpeg2_mc

mpeg2_mc_t mpeg2_mc
| extern

Referenced by motion_fi_dmv(), motion_fr_dmv(), mpeg2_mc_init(), and mpeg2_xvmc_slice().