00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "libavutil/intmath.h"
00022 #include "libavutil/log.h"
00023 #include "libavutil/opt.h"
00024 #include "avcodec.h"
00025 #include "dsputil.h"
00026 #include "dwt.h"
00027 #include "internal.h"
00028 #include "snow.h"
00029
00030 #include "rangecoder.h"
00031 #include "mathops.h"
00032
00033 #include "mpegvideo.h"
00034 #include "h263.h"
00035
00036 #undef NDEBUG
00037 #include <assert.h>
00038
00039 static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){
00040 Plane *p= &s->plane[plane_index];
00041 const int mb_w= s->b_width << s->block_max_depth;
00042 const int mb_h= s->b_height << s->block_max_depth;
00043 int x, y, mb_x;
00044 int block_size = MB_SIZE >> s->block_max_depth;
00045 int block_w = plane_index ? block_size>>s->chroma_h_shift : block_size;
00046 int block_h = plane_index ? block_size>>s->chroma_v_shift : block_size;
00047 const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];
00048 int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size;
00049 int ref_stride= s->current_picture.linesize[plane_index];
00050 uint8_t *dst8= s->current_picture.data[plane_index];
00051 int w= p->width;
00052 int h= p->height;
00053
00054 if(s->keyframe || (s->avctx->debug&512)){
00055 if(mb_y==mb_h)
00056 return;
00057
00058 if(add){
00059 for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){
00060
00061 IDWTELEM * line = sb->line[y];
00062 for(x=0; x<w; x++){
00063
00064 int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
00065 v >>= FRAC_BITS;
00066 if(v&(~255)) v= ~(v>>31);
00067 dst8[x + y*ref_stride]= v;
00068 }
00069 }
00070 }else{
00071 for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){
00072
00073 IDWTELEM * line = sb->line[y];
00074 for(x=0; x<w; x++){
00075 line[x] -= 128 << FRAC_BITS;
00076
00077 }
00078 }
00079 }
00080
00081 return;
00082 }
00083
00084 for(mb_x=0; mb_x<=mb_w; mb_x++){
00085 add_yblock(s, 1, sb, old_buffer, dst8, obmc,
00086 block_w*mb_x - block_w/2,
00087 block_h*mb_y - block_h/2,
00088 block_w, block_h,
00089 w, h,
00090 w, ref_stride, obmc_stride,
00091 mb_x - 1, mb_y - 1,
00092 add, 0, plane_index);
00093 }
00094 }
00095
00096 static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){
00097 const int w= b->width;
00098 int y;
00099 const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
00100 int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
00101 int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
00102 int new_index = 0;
00103
00104 if(b->ibuf == s->spatial_idwt_buffer || s->qlog == LOSSLESS_QLOG){
00105 qadd= 0;
00106 qmul= 1<<QEXPSHIFT;
00107 }
00108
00109
00110 if (start_y != 0)
00111 new_index = save_state[0];
00112
00113
00114 for(y=start_y; y<h; y++){
00115 int x = 0;
00116 int v;
00117 IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset;
00118 memset(line, 0, b->width*sizeof(IDWTELEM));
00119 v = b->x_coeff[new_index].coeff;
00120 x = b->x_coeff[new_index++].x;
00121 while(x < w){
00122 register int t= ( (v>>1)*qmul + qadd)>>QEXPSHIFT;
00123 register int u= -(v&1);
00124 line[x] = (t^u) - u;
00125
00126 v = b->x_coeff[new_index].coeff;
00127 x = b->x_coeff[new_index++].x;
00128 }
00129 }
00130
00131
00132 save_state[0] = new_index;
00133
00134 return;
00135 }
00136
00137 static int decode_q_branch(SnowContext *s, int level, int x, int y){
00138 const int w= s->b_width << s->block_max_depth;
00139 const int rem_depth= s->block_max_depth - level;
00140 const int index= (x + y*w) << rem_depth;
00141 int trx= (x+1)<<rem_depth;
00142 const BlockNode *left = x ? &s->block[index-1] : &null_block;
00143 const BlockNode *top = y ? &s->block[index-w] : &null_block;
00144 const BlockNode *tl = y && x ? &s->block[index-w-1] : left;
00145 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl;
00146 int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
00147 int res;
00148
00149 if(s->keyframe){
00150 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);
00151 return 0;
00152 }
00153
00154 if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){
00155 int type, mx, my;
00156 int l = left->color[0];
00157 int cb= left->color[1];
00158 int cr= left->color[2];
00159 int ref = 0;
00160 int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
00161 int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
00162 int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
00163
00164 type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
00165
00166 if(type){
00167 pred_mv(s, &mx, &my, 0, left, top, tr);
00168 l += get_symbol(&s->c, &s->block_state[32], 1);
00169 cb+= get_symbol(&s->c, &s->block_state[64], 1);
00170 cr+= get_symbol(&s->c, &s->block_state[96], 1);
00171 }else{
00172 if(s->ref_frames > 1)
00173 ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0);
00174 if (ref >= s->ref_frames) {
00175 av_log(s->avctx, AV_LOG_ERROR, "Invalid ref\n");
00176 return AVERROR_INVALIDDATA;
00177 }
00178 pred_mv(s, &mx, &my, ref, left, top, tr);
00179 mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1);
00180 my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1);
00181 }
00182 set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
00183 }else{
00184 if ((res = decode_q_branch(s, level+1, 2*x+0, 2*y+0)) < 0 ||
00185 (res = decode_q_branch(s, level+1, 2*x+1, 2*y+0)) < 0 ||
00186 (res = decode_q_branch(s, level+1, 2*x+0, 2*y+1)) < 0 ||
00187 (res = decode_q_branch(s, level+1, 2*x+1, 2*y+1)) < 0)
00188 return res;
00189 }
00190 return 0;
00191 }
00192
00193 static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){
00194 const int w= b->width;
00195 const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
00196 const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
00197 const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
00198 int x,y;
00199
00200 if(s->qlog == LOSSLESS_QLOG) return;
00201
00202 for(y=start_y; y<end_y; y++){
00203
00204 IDWTELEM * line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
00205 for(x=0; x<w; x++){
00206 int i= line[x];
00207 if(i<0){
00208 line[x]= -((-i*qmul + qadd)>>(QEXPSHIFT));
00209 }else if(i>0){
00210 line[x]= (( i*qmul + qadd)>>(QEXPSHIFT));
00211 }
00212 }
00213 }
00214 }
00215
00216 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){
00217 const int w= b->width;
00218 int x,y;
00219
00220 IDWTELEM * line=0;
00221 IDWTELEM * prev;
00222
00223 if (start_y != 0)
00224 line = slice_buffer_get_line(sb, ((start_y - 1) * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
00225
00226 for(y=start_y; y<end_y; y++){
00227 prev = line;
00228
00229 line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
00230 for(x=0; x<w; x++){
00231 if(x){
00232 if(use_median){
00233 if(y && x+1<w) line[x] += mid_pred(line[x - 1], prev[x], prev[x + 1]);
00234 else line[x] += line[x - 1];
00235 }else{
00236 if(y) line[x] += mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
00237 else line[x] += line[x - 1];
00238 }
00239 }else{
00240 if(y) line[x] += prev[x];
00241 }
00242 }
00243 }
00244 }
00245
00246 static void decode_qlogs(SnowContext *s){
00247 int plane_index, level, orientation;
00248
00249 for(plane_index=0; plane_index<3; plane_index++){
00250 for(level=0; level<s->spatial_decomposition_count; level++){
00251 for(orientation=level ? 1:0; orientation<4; orientation++){
00252 int q;
00253 if (plane_index==2) q= s->plane[1].band[level][orientation].qlog;
00254 else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog;
00255 else q= get_symbol(&s->c, s->header_state, 1);
00256 s->plane[plane_index].band[level][orientation].qlog= q;
00257 }
00258 }
00259 }
00260 }
00261
00262 #define GET_S(dst, check) \
00263 tmp= get_symbol(&s->c, s->header_state, 0);\
00264 if(!(check)){\
00265 av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
00266 return -1;\
00267 }\
00268 dst= tmp;
00269
00270 static int decode_header(SnowContext *s){
00271 int plane_index, tmp;
00272 uint8_t kstate[32];
00273
00274 memset(kstate, MID_STATE, sizeof(kstate));
00275
00276 s->keyframe= get_rac(&s->c, kstate);
00277 if(s->keyframe || s->always_reset){
00278 ff_snow_reset_contexts(s);
00279 s->spatial_decomposition_type=
00280 s->qlog=
00281 s->qbias=
00282 s->mv_scale=
00283 s->block_max_depth= 0;
00284 }
00285 if(s->keyframe){
00286 GET_S(s->version, tmp <= 0U)
00287 s->always_reset= get_rac(&s->c, s->header_state);
00288 s->temporal_decomposition_type= get_symbol(&s->c, s->header_state, 0);
00289 s->temporal_decomposition_count= get_symbol(&s->c, s->header_state, 0);
00290 GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS)
00291 s->colorspace_type= get_symbol(&s->c, s->header_state, 0);
00292 s->chroma_h_shift= get_symbol(&s->c, s->header_state, 0);
00293 s->chroma_v_shift= get_symbol(&s->c, s->header_state, 0);
00294
00295 if(s->chroma_h_shift == 1 && s->chroma_v_shift==1){
00296 s->avctx->pix_fmt= AV_PIX_FMT_YUV420P;
00297 }else if(s->chroma_h_shift == 0 && s->chroma_v_shift==0){
00298 s->avctx->pix_fmt= AV_PIX_FMT_YUV444P;
00299 }else if(s->chroma_h_shift == 2 && s->chroma_v_shift==2){
00300 s->avctx->pix_fmt= AV_PIX_FMT_YUV410P;
00301 } else {
00302 av_log(s, AV_LOG_ERROR, "unsupported color subsample mode %d %d\n", s->chroma_h_shift, s->chroma_v_shift);
00303 s->chroma_h_shift = s->chroma_v_shift = 1;
00304 s->avctx->pix_fmt= AV_PIX_FMT_YUV420P;
00305 return AVERROR_INVALIDDATA;
00306 }
00307
00308 s->spatial_scalability= get_rac(&s->c, s->header_state);
00309
00310 GET_S(s->max_ref_frames, tmp < (unsigned)MAX_REF_FRAMES)
00311 s->max_ref_frames++;
00312
00313 decode_qlogs(s);
00314 }
00315
00316 if(!s->keyframe){
00317 if(get_rac(&s->c, s->header_state)){
00318 for(plane_index=0; plane_index<2; plane_index++){
00319 int htaps, i, sum=0;
00320 Plane *p= &s->plane[plane_index];
00321 p->diag_mc= get_rac(&s->c, s->header_state);
00322 htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2;
00323 if((unsigned)htaps > HTAPS_MAX || htaps==0)
00324 return -1;
00325 p->htaps= htaps;
00326 for(i= htaps/2; i; i--){
00327 p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1));
00328 sum += p->hcoeff[i];
00329 }
00330 p->hcoeff[0]= 32-sum;
00331 }
00332 s->plane[2].diag_mc= s->plane[1].diag_mc;
00333 s->plane[2].htaps = s->plane[1].htaps;
00334 memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff));
00335 }
00336 if(get_rac(&s->c, s->header_state)){
00337 GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS)
00338 decode_qlogs(s);
00339 }
00340 }
00341
00342 s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1);
00343 if(s->spatial_decomposition_type > 1U){
00344 av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported\n", s->spatial_decomposition_type);
00345 return -1;
00346 }
00347 if(FFMIN(s->avctx-> width>>s->chroma_h_shift,
00348 s->avctx->height>>s->chroma_v_shift) >> (s->spatial_decomposition_count-1) <= 0){
00349 av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_count %d too large for size\n", s->spatial_decomposition_count);
00350 return -1;
00351 }
00352
00353
00354 s->qlog += get_symbol(&s->c, s->header_state, 1);
00355 s->mv_scale += get_symbol(&s->c, s->header_state, 1);
00356 s->qbias += get_symbol(&s->c, s->header_state, 1);
00357 s->block_max_depth+= get_symbol(&s->c, s->header_state, 1);
00358 if(s->block_max_depth > 1 || s->block_max_depth < 0){
00359 av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large\n", s->block_max_depth);
00360 s->block_max_depth= 0;
00361 return -1;
00362 }
00363
00364 return 0;
00365 }
00366
00367 static av_cold int decode_init(AVCodecContext *avctx)
00368 {
00369 int ret;
00370
00371 if ((ret = ff_snow_common_init(avctx)) < 0) {
00372 ff_snow_common_end(avctx->priv_data);
00373 return ret;
00374 }
00375
00376 return 0;
00377 }
00378
00379 static int decode_blocks(SnowContext *s){
00380 int x, y;
00381 int w= s->b_width;
00382 int h= s->b_height;
00383 int res;
00384
00385 for(y=0; y<h; y++){
00386 for(x=0; x<w; x++){
00387 if ((res = decode_q_branch(s, 0, x, y)) < 0)
00388 return res;
00389 }
00390 }
00391 return 0;
00392 }
00393
00394 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
00395 AVPacket *avpkt)
00396 {
00397 const uint8_t *buf = avpkt->data;
00398 int buf_size = avpkt->size;
00399 SnowContext *s = avctx->priv_data;
00400 RangeCoder * const c= &s->c;
00401 int bytes_read;
00402 AVFrame *picture = data;
00403 int level, orientation, plane_index;
00404 int res;
00405
00406 ff_init_range_decoder(c, buf, buf_size);
00407 ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
00408
00409 s->current_picture.pict_type= AV_PICTURE_TYPE_I;
00410 if(decode_header(s)<0)
00411 return -1;
00412 if ((res=ff_snow_common_init_after_header(avctx)) < 0)
00413 return res;
00414
00415
00416 ff_slice_buffer_destroy(&s->sb);
00417 if ((res = ff_slice_buffer_init(&s->sb, s->plane[0].height,
00418 (MB_SIZE >> s->block_max_depth) +
00419 s->spatial_decomposition_count * 11 + 1,
00420 s->plane[0].width,
00421 s->spatial_idwt_buffer)) < 0)
00422 return res;
00423
00424 for(plane_index=0; plane_index<3; plane_index++){
00425 Plane *p= &s->plane[plane_index];
00426 p->fast_mc= p->diag_mc && p->htaps==6 && p->hcoeff[0]==40
00427 && p->hcoeff[1]==-10
00428 && p->hcoeff[2]==2;
00429 }
00430
00431 ff_snow_alloc_blocks(s);
00432
00433 if(ff_snow_frame_start(s) < 0)
00434 return -1;
00435
00436 if(avctx->debug&FF_DEBUG_PICT_INFO)
00437 av_log(avctx, AV_LOG_ERROR, "keyframe:%d qlog:%d\n", s->keyframe, s->qlog);
00438
00439 if ((res = decode_blocks(s)) < 0)
00440 return res;
00441
00442 for(plane_index=0; plane_index<3; plane_index++){
00443 Plane *p= &s->plane[plane_index];
00444 int w= p->width;
00445 int h= p->height;
00446 int x, y;
00447 int decode_state[MAX_DECOMPOSITIONS][4][1];
00448
00449 if(s->avctx->debug&2048){
00450 memset(s->spatial_dwt_buffer, 0, sizeof(DWTELEM)*w*h);
00451 predict_plane(s, s->spatial_idwt_buffer, plane_index, 1);
00452
00453 for(y=0; y<h; y++){
00454 for(x=0; x<w; x++){
00455 int v= s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x];
00456 s->mconly_picture.data[plane_index][y*s->mconly_picture.linesize[plane_index] + x]= v;
00457 }
00458 }
00459 }
00460
00461 {
00462 for(level=0; level<s->spatial_decomposition_count; level++){
00463 for(orientation=level ? 1 : 0; orientation<4; orientation++){
00464 SubBand *b= &p->band[level][orientation];
00465 unpack_coeffs(s, b, b->parent, orientation);
00466 }
00467 }
00468 }
00469
00470 {
00471 const int mb_h= s->b_height << s->block_max_depth;
00472 const int block_size = MB_SIZE >> s->block_max_depth;
00473 const int block_h = plane_index ? block_size>>s->chroma_v_shift : block_size;
00474 int mb_y;
00475 DWTCompose cs[MAX_DECOMPOSITIONS];
00476 int yd=0, yq=0;
00477 int y;
00478 int end_y;
00479
00480 ff_spatial_idwt_buffered_init(cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count);
00481 for(mb_y=0; mb_y<=mb_h; mb_y++){
00482
00483 int slice_starty = block_h*mb_y;
00484 int slice_h = block_h*(mb_y+1);
00485
00486 if (!(s->keyframe || s->avctx->debug&512)){
00487 slice_starty = FFMAX(0, slice_starty - (block_h >> 1));
00488 slice_h -= (block_h >> 1);
00489 }
00490
00491 for(level=0; level<s->spatial_decomposition_count; level++){
00492 for(orientation=level ? 1 : 0; orientation<4; orientation++){
00493 SubBand *b= &p->band[level][orientation];
00494 int start_y;
00495 int end_y;
00496 int our_mb_start = mb_y;
00497 int our_mb_end = (mb_y + 1);
00498 const int extra= 3;
00499 start_y = (mb_y ? ((block_h * our_mb_start) >> (s->spatial_decomposition_count - level)) + s->spatial_decomposition_count - level + extra: 0);
00500 end_y = (((block_h * our_mb_end) >> (s->spatial_decomposition_count - level)) + s->spatial_decomposition_count - level + extra);
00501 if (!(s->keyframe || s->avctx->debug&512)){
00502 start_y = FFMAX(0, start_y - (block_h >> (1+s->spatial_decomposition_count - level)));
00503 end_y = FFMAX(0, end_y - (block_h >> (1+s->spatial_decomposition_count - level)));
00504 }
00505 start_y = FFMIN(b->height, start_y);
00506 end_y = FFMIN(b->height, end_y);
00507
00508 if (start_y != end_y){
00509 if (orientation == 0){
00510 SubBand * correlate_band = &p->band[0][0];
00511 int correlate_end_y = FFMIN(b->height, end_y + 1);
00512 int correlate_start_y = FFMIN(b->height, (start_y ? start_y + 1 : 0));
00513 decode_subband_slice_buffered(s, correlate_band, &s->sb, correlate_start_y, correlate_end_y, decode_state[0][0]);
00514 correlate_slice_buffered(s, &s->sb, correlate_band, correlate_band->ibuf, correlate_band->stride, 1, 0, correlate_start_y, correlate_end_y);
00515 dequantize_slice_buffered(s, &s->sb, correlate_band, correlate_band->ibuf, correlate_band->stride, start_y, end_y);
00516 }
00517 else
00518 decode_subband_slice_buffered(s, b, &s->sb, start_y, end_y, decode_state[level][orientation]);
00519 }
00520 }
00521 }
00522
00523 for(; yd<slice_h; yd+=4){
00524 ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, s->temp_idwt_buffer, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
00525 }
00526
00527 if(s->qlog == LOSSLESS_QLOG){
00528 for(; yq<slice_h && yq<h; yq++){
00529 IDWTELEM * line = slice_buffer_get_line(&s->sb, yq);
00530 for(x=0; x<w; x++){
00531 line[x] <<= FRAC_BITS;
00532 }
00533 }
00534 }
00535
00536 predict_slice_buffered(s, &s->sb, s->spatial_idwt_buffer, plane_index, 1, mb_y);
00537
00538 y = FFMIN(p->height, slice_starty);
00539 end_y = FFMIN(p->height, slice_h);
00540 while(y < end_y)
00541 ff_slice_buffer_release(&s->sb, y++);
00542 }
00543
00544 ff_slice_buffer_flush(&s->sb);
00545 }
00546
00547 }
00548
00549 emms_c();
00550
00551 ff_snow_release_buffer(avctx);
00552
00553 if(!(s->avctx->debug&2048))
00554 *picture= s->current_picture;
00555 else
00556 *picture= s->mconly_picture;
00557
00558 *got_frame = 1;
00559
00560 bytes_read= c->bytestream - c->bytestream_start;
00561 if(bytes_read ==0) av_log(s->avctx, AV_LOG_ERROR, "error at end of frame\n");
00562
00563 return bytes_read;
00564 }
00565
00566 static av_cold int decode_end(AVCodecContext *avctx)
00567 {
00568 SnowContext *s = avctx->priv_data;
00569
00570 ff_slice_buffer_destroy(&s->sb);
00571
00572 ff_snow_common_end(s);
00573
00574 return 0;
00575 }
00576
00577 AVCodec ff_snow_decoder = {
00578 .name = "snow",
00579 .type = AVMEDIA_TYPE_VIDEO,
00580 .id = AV_CODEC_ID_SNOW,
00581 .priv_data_size = sizeof(SnowContext),
00582 .init = decode_init,
00583 .close = decode_end,
00584 .decode = decode_frame,
00585 .capabilities = CODEC_CAP_DR1 ,
00586 .long_name = NULL_IF_CONFIG_SMALL("Snow"),
00587 };