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;
115 const int w= b->
width;
129 new_index = save_state[0];
132 for(y=start_y; y<
h; y++){
140 register int t= ( (v>>1)*qmul + qadd)>>
QEXPSHIFT;
141 register int u= -(v&1);
150 save_state[0] = new_index;
158 const int index= (x + y*w) << rem_depth;
159 int trx= (x+1)<<rem_depth;
163 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->
block[index-w+(1<<rem_depth)] : tl;
168 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);
174 int l = left->
color[0];
185 pred_mv(s, &mx, &my, 0, left, top, tr);
198 pred_mv(s, &mx, &my, ref, left, top, tr);
202 set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
214 const int w= b->
width;
222 for(y=start_y; y<end_y; y++){
228 line[x]= -((-i*qmul + qadd)>>(
QEXPSHIFT));
230 line[x]= (( i*qmul + qadd)>>(
QEXPSHIFT));
237 const int w= b->
width;
246 for(y=start_y; y<end_y; y++){
253 if(y && x+1<w) line[x] +=
mid_pred(line[x - 1], prev[x], prev[x + 1]);
254 else line[x] += line[x - 1];
256 if(y) line[x] +=
mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
257 else line[x] += line[x - 1];
260 if(y) line[x] += prev[x];
267 int plane_index,
level, orientation;
269 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
271 for(orientation=level ? 1:0; orientation<4; orientation++){
282 #define GET_S(dst, check) \
283 tmp= get_symbol(&s->c, s->header_state, 0);\
285 av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
286 return AVERROR_INVALIDDATA;\
291 int plane_index, tmp;
294 memset(kstate,
MID_STATE,
sizeof(kstate));
350 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
355 if((
unsigned)htaps >
HTAPS_MAX || htaps==0)
358 for(i= htaps/2; i; i--){
429 int buf_size = avpkt->
size;
434 int level, orientation, plane_index;
455 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
472 "keyframe:%d qlog:%d qbias: %d mvscale: %d "
473 "decomposition_type:%d decomposition_count:%d\n",
488 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
509 for(orientation=level ? 1 : 0; orientation<4; orientation++){
519 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
527 for(mb_y=0; mb_y<=mb_h; mb_y++){
529 int slice_starty = block_h*mb_y;
530 int slice_h = block_h*(mb_y+1);
533 slice_starty =
FFMAX(0, slice_starty - (block_h >> 1));
534 slice_h -= (block_h >> 1);
538 for(orientation=level ? 1 : 0; orientation<4; orientation++){
542 int our_mb_start = mb_y;
543 int our_mb_end = (mb_y + 1);
554 if (start_y != end_y){
555 if (orientation == 0){
558 int correlate_start_y =
FFMIN(b->
height, (start_y ? start_y + 1 : 0));
569 for(; yd<slice_h; yd+=4){
574 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)
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)]
#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...
static int get_rac(RangeCoder *c, uint8_t *const state)
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.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Structure to hold side data for an AVFrame.
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 CODEC_FLAG2_EXPORT_MVS
Export motion vectors through frame side data.
#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.
Libavcodec external API header.
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)
enum AVPictureType pict_type
Picture type of the frame.
static void unpack_coeffs(SnowContext *s, SubBand *b, SubBand *parent, int orientation)
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)
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)
SubBand band[MAX_DWT_LEVELS][4]
uint8_t block_state[128+32 *128]
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 FF_DEBUG_PICT_INFO
#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.
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)
av_cold void ff_snow_common_end(SnowContext *s)
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)
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)
int stride_line
Stride measured in lines, not pixels.