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= (
int)( (v>>1)*(unsigned)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);
190 if (ld < -255 || ld > 255) {
197 if (cbd < -255 || cbd > 255 || crd < -255 || crd > 255) {
210 pred_mv(s, &mx, &my, ref, left, top, tr);
214 set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
226 const int w= b->
width;
234 for(y=start_y; y<end_y; y++){
240 line[x]= -((-i*(unsigned)qmul + qadd)>>(
QEXPSHIFT));
242 line[x]= (( i*(unsigned)qmul + qadd)>>(
QEXPSHIFT));
249 const int w= b->
width;
258 for(y=start_y; y<end_y; y++){
265 if(y && x+1<w) line[x] +=
mid_pred(line[x - 1], prev[x], prev[x + 1]);
266 else line[x] += line[x - 1];
268 if(y) line[x] +=
mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
269 else line[x] += line[x - 1];
272 if(y) line[x] += prev[x];
279 int plane_index,
level, orientation;
281 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
283 for(orientation=level ? 1:0; orientation<4; orientation++){
294 #define GET_S(dst, check) \
295 tmp= get_symbol(&s->c, s->header_state, 0);\
297 av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
298 return AVERROR_INVALIDDATA;\
303 int plane_index,
tmp;
306 memset(kstate,
MID_STATE,
sizeof(kstate));
362 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
367 if((
unsigned)htaps >=
HTAPS_MAX || htaps==0)
370 for(i= htaps/2; i; i--){
453 int buf_size = avpkt->
size;
458 int level, orientation, plane_index;
479 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
496 "keyframe:%d qlog:%d qbias: %d mvscale: %d "
497 "decomposition_type:%d decomposition_count:%d\n",
512 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
532 for(orientation=level ? 1 : 0; orientation<4; orientation++){
541 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
549 for(mb_y=0; mb_y<=mb_h; mb_y++){
551 int slice_starty = block_h*mb_y;
552 int slice_h = block_h*(mb_y+1);
555 slice_starty =
FFMAX(0, slice_starty - (block_h >> 1));
556 slice_h -= (block_h >> 1);
560 for(orientation=level ? 1 : 0; orientation<4; orientation++){
564 int our_mb_start = mb_y;
565 int our_mb_end = (mb_y + 1);
576 if (start_y != end_y){
577 if (orientation == 0){
580 int correlate_start_y =
FFMIN(b->
height, (start_y ? start_y + 1 : 0));
591 for(; yd<slice_h; yd+=4){
596 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 decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
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.
int width
picture width / height.
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
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.