45 int block_w = plane_index ? block_size/2 : block_size;
47 int obmc_stride= plane_index ? block_size : 2*block_size;
58 for(y=block_w*mb_y; y<
FFMIN(h,block_w*(mb_y+1)); y++){
65 if(v&(~255)) v= ~(v>>31);
66 dst8[x + y*ref_stride]= v;
70 for(y=block_w*mb_y; y<
FFMIN(h,block_w*(mb_y+1)); y++){
83 for(mb_x=0; mb_x<=mb_w; mb_x++){
85 block_w*mb_x - block_w/2,
86 block_w*mb_y - block_w/2,
89 w, ref_stride, obmc_stride,
96 const int w= b->
width;
110 new_index = save_state[0];
113 for(y=start_y; y<h; y++){
121 register int t= ( (v>>1)*qmul + qadd)>>
QEXPSHIFT;
122 register int u= -(v&1);
131 save_state[0] = new_index;
139 const int index= (x + y*w) << rem_depth;
140 int trx= (x+1)<<rem_depth;
144 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->
block[index-w+(1<<rem_depth)] : tl;
149 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);
155 int l = left->
color[0];
156 int cb= left->
color[1];
157 int cr= left->
color[2];
166 pred_mv(s, &mx, &my, 0, left, top, tr);
177 pred_mv(s, &mx, &my, ref, left, top, tr);
181 set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
193 const int w= b->
width;
201 for(y=start_y; y<end_y; y++){
207 line[x]= -((-i*qmul + qadd)>>(
QEXPSHIFT));
209 line[x]= (( i*qmul + qadd)>>(
QEXPSHIFT));
216 const int w= b->
width;
225 for(y=start_y; y<end_y; y++){
232 if(y && x+1<w) line[x] +=
mid_pred(line[x - 1], prev[x], prev[x + 1]);
233 else line[x] += line[x - 1];
235 if(y) line[x] +=
mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
236 else line[x] += line[x - 1];
239 if(y) line[x] += prev[x];
246 int plane_index,
level, orientation;
248 for(plane_index=0; plane_index<3; plane_index++){
250 for(orientation=level ? 1:0; orientation<4; orientation++){
261 #define GET_S(dst, check) \
262 tmp= get_symbol(&s->c, s->header_state, 0);\
264 av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
270 int plane_index, tmp;
273 memset(kstate,
MID_STATE,
sizeof(kstate));
303 for(plane_index=0; plane_index<2; plane_index++){
308 if((
unsigned)htaps >
HTAPS_MAX || htaps==0)
311 for(i= htaps/2; i; i--){
389 int buf_size = avpkt->
size;
394 int level, orientation, plane_index;
414 for(plane_index=0; plane_index<3; plane_index++){
432 for(plane_index=0; plane_index<3; plane_index++){
453 for(orientation=level ? 1 : 0; orientation<4; orientation++){
463 const int block_w = plane_index ? block_size/2 : block_size;
471 for(mb_y=0; mb_y<=mb_h; mb_y++){
473 int slice_starty = block_w*mb_y;
474 int slice_h = block_w*(mb_y+1);
476 slice_starty =
FFMAX(0, slice_starty - (block_w >> 1));
477 slice_h -= (block_w >> 1);
481 for(orientation=level ? 1 : 0; orientation<4; orientation++){
485 int our_mb_start = mb_y;
486 int our_mb_end = (mb_y + 1);
497 if (start_y != end_y){
498 if (orientation == 0){
501 int correlate_start_y =
FFMIN(b->
height, (start_y ? start_y + 1 : 0));
512 for(; yd<slice_h; yd+=4){
517 for(; yq<slice_h && yq<h; yq++){
#define slice_buffer_get_line(slice_buf, line_num)
static av_always_inline void predict_plane(SnowContext *s, IDWTELEM *buf, int plane_index, int add)
int ff_snow_frame_start(SnowContext *s)
void ff_slice_buffer_release(slice_buffer *buf, int line)
This structure describes decoded (raw) audio or video data.
int ff_slice_buffer_init(slice_buffer *buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM *base_buffer)
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_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)
IDWTELEM ** line
For use by idwt and predict_slices.
int qlog
log(qscale)/log[2^(1/6)]
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static int get_rac(RangeCoder *c, uint8_t *const state)
#define MAX_DECOMPOSITIONS
static const BlockNode null_block
void ff_snow_release_buffer(AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
Used to minimize the amount of memory used in order to optimize cache performance.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define FF_DEBUG_PICT_INFO
const uint8_t *const ff_obmc_tab[4]
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static av_cold int decode_init(AVCodecContext *avctx)
static av_noinline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
static void unpack_coeffs(SnowContext *s, SubBand *b, SubBand *parent, int orientation)
SubBand band[MAX_DECOMPOSITIONS][4]
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)
void ff_slice_buffer_flush(slice_buffer *buf)
struct SnowContext SnowContext
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]
int spatial_decomposition_count
void ff_slice_buffer_destroy(slice_buffer *buf)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
int8_t hcoeff[HTAPS_MAX/2]
static void close(AVCodecParserContext *s)
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])
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width, int height, int stride_line, int type, int decomposition_count)
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.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int temporal_decomposition_type
common internal api header.
IDWTELEM * temp_idwt_buffer
#define AVERROR_INVALIDDATA
DWTELEM * spatial_dwt_buffer
static void pred_mv(SnowContext *s, int *mx, int *my, int ref, const BlockNode *left, const BlockNode *top, const BlockNode *tr)
#define AVERROR_PATCHWELCOME
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)
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer *slice_buf, IDWTELEM *temp, int width, int height, int stride_line, int type, int decomposition_count, int y)
av_cold void ff_snow_common_end(SnowContext *s)
static int decode_blocks(SnowContext *s)
static uint32_t inverse(uint32_t v)
find multiplicative inverse modulo 2 ^ 32
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)
int stride_line
Stride measured in lines, not pixels.