41 int block_w = plane_index ? block_size>>s->
chroma_h_shift : block_size;
42 int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
44 int obmc_stride= plane_index ? (2*block_size)>>s->
chroma_h_shift : 2*block_size;
55 for(y=block_h*mb_y; y<
FFMIN(
h,block_h*(mb_y+1)); y++){
62 if(v&(~255)) v= ~(v>>31);
63 dst8[x + y*ref_stride]= v;
67 for(y=block_h*mb_y; y<
FFMIN(
h,block_h*(mb_y+1)); y++){
80 for(mb_x=0; mb_x<=mb_w; mb_x++){
82 block_w*mb_x - block_w/2,
83 block_h*mb_y - block_h/2,
86 w, ref_stride, obmc_stride,
91 if(s->
avmv && mb_y < mb_h && plane_index == 0)
92 for(mb_x=0; mb_x<mb_w; mb_x++){
95 const int b_stride= b_width;
105 avmv->
dst_x = block_w*mb_x - block_w/2;
106 avmv->
dst_y = block_h*mb_y - block_h/2;
118 const int w= b->
width;
132 new_index = save_state[0];
135 for(y=start_y; y<
h; y++){
143 register int t= ( (v>>1)*qmul + qadd)>>
QEXPSHIFT;
144 register int u= -(v&1);
153 save_state[0] = new_index;
161 const int index= (x + y*w) << rem_depth;
162 int trx= (x+1)<<rem_depth;
166 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->
block[index-w+(1<<rem_depth)] : tl;
171 set_blocks(s, level, x, y,
null_block.
color[0],
null_block.
color[1],
null_block.
color[2],
null_block.
mx,
null_block.
my,
null_block.
ref,
BLOCK_INTRA);
177 int l = left->
color[0];
188 pred_mv(s, &mx, &my, 0, left, top, tr);
201 pred_mv(s, &mx, &my, ref, left, top, tr);
205 set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
217 const int w= b->
width;
225 for(y=start_y; y<end_y; y++){
231 line[x]= -((-i*qmul + qadd)>>(
QEXPSHIFT));
233 line[x]= (( i*qmul + qadd)>>(
QEXPSHIFT));
240 const int w= b->
width;
249 for(y=start_y; y<end_y; y++){
256 if(y && x+1<w) line[x] +=
mid_pred(line[x - 1], prev[x], prev[x + 1]);
257 else line[x] += line[x - 1];
259 if(y) line[x] +=
mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
260 else line[x] += line[x - 1];
263 if(y) line[x] += prev[x];
270 int plane_index,
level, orientation;
272 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
274 for(orientation=level ? 1:0; orientation<4; orientation++){
285 #define GET_S(dst, check) \
286 tmp= get_symbol(&s->c, s->header_state, 0);\
288 av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
289 return AVERROR_INVALIDDATA;\
294 int plane_index,
tmp;
297 memset(kstate,
MID_STATE,
sizeof(kstate));
353 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
358 if((
unsigned)htaps >
HTAPS_MAX || htaps==0)
361 for(i= htaps/2; i; i--){
432 int buf_size = avpkt->
size;
437 int level, orientation, plane_index;
458 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
475 "keyframe:%d qlog:%d qbias: %d mvscale: %d "
476 "decomposition_type:%d decomposition_count:%d\n",
491 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
512 for(orientation=level ? 1 : 0; orientation<4; orientation++){
522 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
530 for(mb_y=0; mb_y<=mb_h; mb_y++){
532 int slice_starty = block_h*mb_y;
533 int slice_h = block_h*(mb_y+1);
536 slice_starty =
FFMAX(0, slice_starty - (block_h >> 1));
537 slice_h -= (block_h >> 1);
541 for(orientation=level ? 1 : 0; orientation<4; orientation++){
545 int our_mb_start = mb_y;
546 int our_mb_end = (mb_y + 1);
557 if (start_y != end_y){
558 if (orientation == 0){
561 int correlate_start_y =
FFMIN(b->
height, (start_y ? start_y + 1 : 0));
572 for(; yd<slice_h; yd+=4){
577 for(; yq<slice_h && yq<
h; yq++){
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static av_always_inline void predict_plane(SnowContext *s, IDWTELEM *buf, int plane_index, int add)
int ff_snow_frame_start(SnowContext *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static const double htaps[HTAPS]
The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int16_t src_x
Absolute source position.
static av_cold int init(AVCodecContext *avctx)
#define BLOCK_INTRA
Intra block, inter otherwise.
void ff_slice_buffer_destroy(slice_buffer *buf)
static av_cold int decode_end(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int ff_snow_common_init_after_header(AVCodecContext *avctx)
void ff_spatial_idwt_buffered_slice(SnowDWTContext *dsp, DWTCompose *cs, slice_buffer *slice_buf, IDWTELEM *temp, int width, int height, int stride_line, int type, int decomposition_count, int y)
void ff_snow_reset_contexts(SnowContext *s)
static void set_blocks(SnowContext *s, int level, int x, int y, int l, int cb, int cr, int mx, int my, int ref, int type)
int qlog
log(qscale)/log[2^(1/6)]
uint8_t ref
Reference frame index.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static double cb(void *priv, double x, double y)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
int16_t mx
Motion vector component X, see mv_scale.
static int get_rac(RangeCoder *c, uint8_t *const state)
#define FF_DEBUG_PICT_INFO
int16_t dst_x
Absolute destination position.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Structure to hold side data for an AVFrame.
int16_t my
Motion vector component Y, see mv_scale.
int32_t source
Where the current macroblock comes from; negative value when it comes from the past, positive value when it comes from the future.
static const BlockNode null_block
void ff_snow_release_buffer(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width, int height, int stride_line, int type, int decomposition_count)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
uint8_t w
Width and height of the block.
static void pred_mv(DiracBlock *block, int stride, int x, int y, int ref)
const uint8_t *const ff_obmc_tab[4]
const char * name
Name of the codec implementation.
uint8_t color[3]
Color for intra.
static av_cold int decode_init(AVCodecContext *avctx)
void ff_slice_buffer_flush(slice_buffer *buf)
static av_noinline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
SubBand band[DWT_LEVELS][4]
enum AVPictureType pict_type
Picture type of the frame.
static void unpack_coeffs(SnowContext *s, SubBand *b, SubBand *parent, int orientation)
int32_t motion_x
Motion vector src_x = dst_x + motion_x / motion_scale src_y = dst_y + motion_y / motion_scale.
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index)
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void correlate_slice_buffered(SnowContext *s, slice_buffer *sb, SubBand *b, IDWTELEM *src, int stride, int inverse, int use_median, int start_y, int end_y)
static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer *sb, IDWTELEM *old_buffer, int plane_index, int add, int mb_y)
uint8_t block_state[128+32 *128]
Libavcodec external API header.
int spatial_decomposition_count
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_slice_buffer_init(slice_buffer *buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM *base_buffer)
main external API structure.
int8_t hcoeff[HTAPS_MAX/2]
int ff_snow_alloc_blocks(SnowContext *s)
static void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer *sb, int start_y, int h, int save_state[1])
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
static void decode_qlogs(SnowContext *s)
int ff_snow_common_init(AVCodecContext *avctx)
static int decode_header(SnowContext *s)
int spatial_decomposition_type
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVFrame * current_picture
#define MAX_DECOMPOSITIONS
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
uint64_t flags
Extra flag information.
int temporal_decomposition_type
common internal api header.
static int ref[MAX_W *MAX_W]
IDWTELEM ** line
For use by idwt and predict_slices.
IDWTELEM * temp_idwt_buffer
#define slice_buffer_get_line(slice_buf, line_num)
DWTELEM * spatial_dwt_buffer
IDWTELEM * spatial_idwt_buffer
uint8_t * bytestream_start
static void dequantize_slice_buffered(SnowContext *s, slice_buffer *sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y)
int flags2
AV_CODEC_FLAG2_*.
av_cold void ff_snow_common_end(SnowContext *s)
#define AV_CODEC_FLAG2_EXPORT_MVS
Export motion vectors through frame side data.
static int decode_blocks(SnowContext *s)
void ff_slice_buffer_release(slice_buffer *buf, int line)
static uint32_t inverse(uint32_t v)
find multiplicative inverse modulo 2 ^ 32
#define av_malloc_array(a, b)
uint8_t type
Bitfield of BLOCK_*.
Used to minimize the amount of memory used in order to optimize cache performance.
static double cr(void *priv, double x, double y)
int temporal_decomposition_count
This structure stores compressed data.
static int decode_q_branch(SnowContext *s, int level, int x, int y)
#define GET_S(dst, check)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int stride_line
Stride measured in lines, not pixels.