You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

668 lines
19KB

  1. /*
  2. * H263 decoder
  3. * Copyright (c) 2001 Fabrice Bellard.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include "avcodec.h"
  20. #include "dsputil.h"
  21. #include "mpegvideo.h"
  22. #if 1
  23. #define PRINT_QP(a, b) {}
  24. #else
  25. #define PRINT_QP(a, b) printf(a, b)
  26. #endif
  27. //#define DEBUG
  28. //#define PRINT_FRAME_TIME
  29. #ifdef PRINT_FRAME_TIME
  30. static inline long long rdtsc()
  31. {
  32. long long l;
  33. asm volatile( "rdtsc\n\t"
  34. : "=A" (l)
  35. );
  36. // printf("%d\n", int(l/1000));
  37. return l;
  38. }
  39. #endif
  40. static int h263_decode_init(AVCodecContext *avctx)
  41. {
  42. MpegEncContext *s = avctx->priv_data;
  43. s->avctx = avctx;
  44. s->out_format = FMT_H263;
  45. s->width = avctx->width;
  46. s->height = avctx->height;
  47. s->workaround_bugs= avctx->workaround_bugs;
  48. // set defaults
  49. s->quant_precision=5;
  50. s->progressive_sequence=1;
  51. s->decode_mb= ff_h263_decode_mb;
  52. /* select sub codec */
  53. switch(avctx->codec->id) {
  54. case CODEC_ID_H263:
  55. s->gob_number = 0;
  56. s->first_slice_line = 0;
  57. break;
  58. case CODEC_ID_MPEG4:
  59. s->time_increment_bits = 4; /* default value for broken headers */
  60. s->h263_pred = 1;
  61. s->has_b_frames = 1; //default, might be overriden in the vol header during header parsing
  62. break;
  63. case CODEC_ID_MSMPEG4V1:
  64. s->h263_msmpeg4 = 1;
  65. s->h263_pred = 1;
  66. s->msmpeg4_version=1;
  67. break;
  68. case CODEC_ID_MSMPEG4V2:
  69. s->h263_msmpeg4 = 1;
  70. s->h263_pred = 1;
  71. s->msmpeg4_version=2;
  72. break;
  73. case CODEC_ID_MSMPEG4V3:
  74. s->h263_msmpeg4 = 1;
  75. s->h263_pred = 1;
  76. s->msmpeg4_version=3;
  77. break;
  78. case CODEC_ID_WMV1:
  79. s->h263_msmpeg4 = 1;
  80. s->h263_pred = 1;
  81. s->msmpeg4_version=4;
  82. break;
  83. case CODEC_ID_WMV2:
  84. s->h263_msmpeg4 = 1;
  85. s->h263_pred = 1;
  86. s->msmpeg4_version=5;
  87. break;
  88. case CODEC_ID_H263I:
  89. s->h263_intel = 1;
  90. break;
  91. default:
  92. return -1;
  93. }
  94. s->codec_id= avctx->codec->id;
  95. /* for h263, we allocate the images after having read the header */
  96. if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
  97. if (MPV_common_init(s) < 0)
  98. return -1;
  99. if (s->h263_msmpeg4)
  100. ff_msmpeg4_decode_init(s);
  101. else
  102. h263_decode_init_vlc(s);
  103. return 0;
  104. }
  105. static int h263_decode_end(AVCodecContext *avctx)
  106. {
  107. MpegEncContext *s = avctx->priv_data;
  108. MPV_common_end(s);
  109. return 0;
  110. }
  111. /**
  112. * retunrs the number of bytes consumed for building the current frame
  113. */
  114. static int get_consumed_bytes(MpegEncContext *s, int buf_size){
  115. int pos= (get_bits_count(&s->gb)+7)>>3;
  116. if(s->divx_version>=500){
  117. //we would have to scan through the whole buf to handle the weird reordering ...
  118. return buf_size;
  119. }else{
  120. if(pos==0) pos=1; //avoid infinite loops (i doubt thats needed but ...)
  121. if(pos+10>buf_size) pos=buf_size; // oops ;)
  122. return pos;
  123. }
  124. }
  125. static int decode_slice(MpegEncContext *s){
  126. s->last_resync_gb= s->gb;
  127. s->first_slice_line= 1;
  128. s->resync_mb_x= s->mb_x;
  129. s->resync_mb_y= s->mb_y;
  130. s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
  131. s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
  132. if(s->partitioned_frame){
  133. const int qscale= s->qscale;
  134. if(s->codec_id==CODEC_ID_MPEG4){
  135. if(ff_mpeg4_decode_partitions(s) < 0)
  136. return -1;
  137. }
  138. /* restore variables which where modified */
  139. s->first_slice_line=1;
  140. s->mb_x= s->resync_mb_x;
  141. s->mb_y= s->resync_mb_y;
  142. s->qscale= qscale;
  143. s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
  144. s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
  145. }
  146. for(; s->mb_y < s->mb_height; s->mb_y++) {
  147. /* per-row end of slice checks */
  148. if(s->msmpeg4_version){
  149. if(s->resync_mb_y + s->slice_height == s->mb_y){
  150. const int xy= s->mb_x + s->mb_y*s->mb_width;
  151. s->error_status_table[xy-1]|= AC_END|DC_END|MV_END;
  152. return 0;
  153. }
  154. }
  155. if(s->msmpeg4_version==1){
  156. s->last_dc[0]=
  157. s->last_dc[1]=
  158. s->last_dc[2]= 128;
  159. }
  160. ff_init_block_index(s);
  161. for(; s->mb_x < s->mb_width; s->mb_x++) {
  162. int ret;
  163. ff_update_block_index(s);
  164. if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){
  165. s->first_slice_line=0;
  166. }
  167. /* DCT & quantize */
  168. clear_blocks(s->block[0]);
  169. s->mv_dir = MV_DIR_FORWARD;
  170. s->mv_type = MV_TYPE_16X16;
  171. //printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
  172. ret= s->decode_mb(s, s->block);
  173. PRINT_QP("%2d", s->qscale);
  174. MPV_decode_mb(s, s->block);
  175. if(ret<0){
  176. const int xy= s->mb_x + s->mb_y*s->mb_width;
  177. if(ret==SLICE_END){
  178. //printf("%d %d %06X\n", s->mb_x, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
  179. s->error_status_table[xy]|= AC_END;
  180. if(!s->partitioned_frame)
  181. s->error_status_table[xy]|= MV_END|DC_END;
  182. if(++s->mb_x >= s->mb_width){
  183. s->mb_x=0;
  184. ff_draw_horiz_band(s);
  185. s->mb_y++;
  186. }
  187. return 0;
  188. }else if(ret==SLICE_NOEND){
  189. fprintf(stderr,"Slice mismatch at MB: %d\n", xy);
  190. return -1;
  191. }
  192. fprintf(stderr,"Error at MB: %d\n", xy);
  193. s->error_status_table[xy]|= AC_ERROR;
  194. if(!s->partitioned_frame)
  195. s->error_status_table[xy]|= DC_ERROR|MV_ERROR;
  196. return -1;
  197. }
  198. }
  199. ff_draw_horiz_band(s);
  200. PRINT_QP("%s", "\n");
  201. s->mb_x= 0;
  202. }
  203. assert(s->mb_x==0 && s->mb_y==s->mb_height);
  204. // handle formats which dont have unique end markers
  205. if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly
  206. int left= s->gb.size*8 - get_bits_count(&s->gb);
  207. int max_extra=7;
  208. /* no markers in M$ crap */
  209. if(s->msmpeg4_version && s->pict_type==I_TYPE)
  210. max_extra+= 17;
  211. /* buggy padding but the frame should still end approximately at the bitstream end */
  212. if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3)
  213. max_extra+= 48;
  214. else if((s->workaround_bugs&FF_BUG_NO_PADDING))
  215. max_extra+= 256*256*256*64;
  216. if(left>max_extra){
  217. fprintf(stderr, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
  218. }
  219. else if(left<0){
  220. fprintf(stderr, "overreading %d bits\n", -left);
  221. }else
  222. s->error_status_table[s->mb_num-1]|= AC_END|MV_END|DC_END;
  223. return 0;
  224. }
  225. fprintf(stderr, "slice end not reached but screenspace end (%d left %06X)\n",
  226. s->gb.size*8 - get_bits_count(&s->gb),
  227. show_bits(&s->gb, 24));
  228. return -1;
  229. }
  230. static int h263_decode_frame(AVCodecContext *avctx,
  231. void *data, int *data_size,
  232. UINT8 *buf, int buf_size)
  233. {
  234. MpegEncContext *s = avctx->priv_data;
  235. int ret,i;
  236. AVPicture *pict = data;
  237. #ifdef PRINT_FRAME_TIME
  238. uint64_t time= rdtsc();
  239. #endif
  240. #ifdef DEBUG
  241. printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
  242. printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
  243. #endif
  244. s->hurry_up= avctx->hurry_up;
  245. s->error_resilience= avctx->error_resilience;
  246. s->flags= avctx->flags;
  247. *data_size = 0;
  248. /* no supplementary picture */
  249. if (buf_size == 0) {
  250. return 0;
  251. }
  252. if(s->bitstream_buffer_size && buf_size<20){ //divx 5.01+ frame reorder
  253. init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size);
  254. }else
  255. init_get_bits(&s->gb, buf, buf_size);
  256. s->bitstream_buffer_size=0;
  257. if (!s->context_initialized) {
  258. if (DCT_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
  259. return -1;
  260. }
  261. /* let's go :-) */
  262. if (s->h263_msmpeg4) {
  263. ret = msmpeg4_decode_picture_header(s);
  264. } else if (s->h263_pred) {
  265. if(s->avctx->extradata_size && s->picture_number==0){
  266. GetBitContext gb;
  267. init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size);
  268. ret = ff_mpeg4_decode_picture_header(s, &gb);
  269. }
  270. ret = ff_mpeg4_decode_picture_header(s, &s->gb);
  271. s->has_b_frames= !s->low_delay;
  272. } else if (s->h263_intel) {
  273. ret = intel_h263_decode_picture_header(s);
  274. } else {
  275. ret = h263_decode_picture_header(s);
  276. }
  277. avctx->has_b_frames= s->has_b_frames;
  278. if(s->workaround_bugs&FF_BUG_AUTODETECT){
  279. if(s->avctx->fourcc == ff_get_fourcc("XVIX"))
  280. s->workaround_bugs|= FF_BUG_XVID_ILACE;
  281. if(s->avctx->fourcc == ff_get_fourcc("MP4S"))
  282. s->workaround_bugs|= FF_BUG_AC_VLC;
  283. if(s->avctx->fourcc == ff_get_fourcc("M4S2"))
  284. s->workaround_bugs|= FF_BUG_AC_VLC;
  285. if(s->avctx->fourcc == ff_get_fourcc("UMP4")){
  286. s->workaround_bugs|= FF_BUG_UMP4;
  287. s->workaround_bugs|= FF_BUG_AC_VLC;
  288. }
  289. if(s->divx_version==500)
  290. s->workaround_bugs|= FF_BUG_NO_PADDING;
  291. /* very ugly XVID padding bug detection FIXME/XXX solve this differently
  292. * lets hope this at least works
  293. */
  294. if( s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==0
  295. && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0)
  296. s->workaround_bugs|= FF_BUG_NO_PADDING;
  297. if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok
  298. s->workaround_bugs|= FF_BUG_NO_PADDING;
  299. }
  300. #if 0 // dump bits per frame / qp / complexity
  301. {
  302. static FILE *f=NULL;
  303. if(!f) f=fopen("rate_qp_cplx.txt", "w");
  304. fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale);
  305. }
  306. #endif
  307. /* After H263 & mpeg4 header decode we have the height, width,*/
  308. /* and other parameters. So then we could init the picture */
  309. /* FIXME: By the way H263 decoder is evolving it should have */
  310. /* an H263EncContext */
  311. if ( s->width != avctx->width || s->height != avctx->height
  312. || avctx->aspect_ratio_info != s->aspect_ratio_info
  313. || avctx->aspected_width != s->aspected_width
  314. || avctx->aspected_height != s->aspected_height) {
  315. /* H.263 could change picture size any time */
  316. MPV_common_end(s);
  317. s->context_initialized=0;
  318. }
  319. if (!s->context_initialized) {
  320. avctx->width = s->width;
  321. avctx->height = s->height;
  322. avctx->aspect_ratio_info= s->aspect_ratio_info;
  323. if (s->aspect_ratio_info == FF_ASPECT_EXTENDED)
  324. {
  325. avctx->aspected_width = s->aspected_width;
  326. avctx->aspected_height = s->aspected_height;
  327. }
  328. if (s->codec_id==CODEC_ID_H263 && s->codec_id==CODEC_ID_H263)
  329. s->gob_index = ff_h263_get_gob_height(s);
  330. if (MPV_common_init(s) < 0)
  331. return -1;
  332. }
  333. if(ret==FRAME_SKIPED) return get_consumed_bytes(s, buf_size);
  334. /* skip if the header was thrashed */
  335. if (ret < 0){
  336. fprintf(stderr, "header damaged\n");
  337. return -1;
  338. }
  339. /* skip b frames if we dont have reference frames */
  340. if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size);
  341. /* skip b frames if we are in a hurry */
  342. if(s->hurry_up && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size);
  343. if(s->next_p_frame_damaged){
  344. if(s->pict_type==B_TYPE)
  345. return get_consumed_bytes(s, buf_size);
  346. else
  347. s->next_p_frame_damaged=0;
  348. }
  349. MPV_frame_start(s, avctx);
  350. #ifdef DEBUG
  351. printf("qscale=%d\n", s->qscale);
  352. #endif
  353. if(s->error_resilience)
  354. memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_num*sizeof(UINT8));
  355. /* decode each macroblock */
  356. s->block_wrap[0]=
  357. s->block_wrap[1]=
  358. s->block_wrap[2]=
  359. s->block_wrap[3]= s->mb_width*2 + 2;
  360. s->block_wrap[4]=
  361. s->block_wrap[5]= s->mb_width + 2;
  362. s->mb_x=0;
  363. s->mb_y=0;
  364. decode_slice(s);
  365. s->error_status_table[0]|= VP_START;
  366. while(s->mb_y<s->mb_height && s->gb.size*8 - get_bits_count(&s->gb)>32){
  367. if(s->msmpeg4_version){
  368. if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0)
  369. break;
  370. }else{
  371. if(ff_h263_resync(s)<0)
  372. break;
  373. }
  374. if(s->msmpeg4_version!=4)
  375. ff_mpeg4_clean_buffers(s);
  376. decode_slice(s);
  377. s->error_status_table[s->resync_mb_x + s->resync_mb_y*s->mb_width]|= VP_START;
  378. }
  379. if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE)
  380. if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1;
  381. /* divx 5.01+ bistream reorder stuff */
  382. if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_version>=500){
  383. int current_pos= get_bits_count(&s->gb)>>3;
  384. if( buf_size - current_pos > 5
  385. && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){
  386. int i;
  387. int startcode_found=0;
  388. for(i=current_pos; i<buf_size-3; i++){
  389. if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
  390. startcode_found=1;
  391. break;
  392. }
  393. }
  394. if(startcode_found){
  395. memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
  396. s->bitstream_buffer_size= buf_size - current_pos;
  397. }
  398. }
  399. }
  400. if(s->error_resilience){
  401. int error=0, num_end_markers=0;
  402. for(i=0; i<s->mb_num; i++){
  403. int status= s->error_status_table[i];
  404. #if 0
  405. if(i%s->mb_width == 0) printf("\n");
  406. printf("%2X ", status);
  407. #endif
  408. if(status==0) continue;
  409. if(status&(DC_ERROR|AC_ERROR|MV_ERROR))
  410. error=1;
  411. if(status&VP_START){
  412. if(num_end_markers)
  413. error=1;
  414. num_end_markers=3;
  415. }
  416. if(status&AC_END)
  417. num_end_markers--;
  418. if(status&DC_END)
  419. num_end_markers--;
  420. if(status&MV_END)
  421. num_end_markers--;
  422. }
  423. if(num_end_markers || error){
  424. fprintf(stderr, "concealing errors\n");
  425. //printf("type:%d\n", s->pict_type);
  426. ff_error_resilience(s);
  427. }
  428. }
  429. MPV_frame_end(s);
  430. #if 0 //dirty show MVs, we should export the MV tables and write a filter to show them
  431. {
  432. int mb_y;
  433. s->has_b_frames=1;
  434. for(mb_y=0; mb_y<s->mb_height; mb_y++){
  435. int mb_x;
  436. int y= mb_y*16 + 8;
  437. for(mb_x=0; mb_x<s->mb_width; mb_x++){
  438. int x= mb_x*16 + 8;
  439. uint8_t *ptr= s->last_picture[0];
  440. int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2);
  441. int mx= (s->motion_val[xy][0]>>1) + x;
  442. int my= (s->motion_val[xy][1]>>1) + y;
  443. int i;
  444. int max;
  445. if(mx<0) mx=0;
  446. if(my<0) my=0;
  447. if(mx>=s->width) mx= s->width -1;
  448. if(my>=s->height) my= s->height-1;
  449. max= ABS(mx-x);
  450. if(ABS(my-y) > max) max= ABS(my-y);
  451. /* the ugliest linedrawing routine ... */
  452. for(i=0; i<max; i++){
  453. int x1= x + (mx-x)*i/max;
  454. int y1= y + (my-y)*i/max;
  455. ptr[y1*s->linesize + x1]+=100;
  456. }
  457. ptr[y*s->linesize + x]+=100;
  458. s->mbskip_table[mb_x + mb_y*s->mb_width]=0;
  459. }
  460. }
  461. }
  462. #endif
  463. if(s->pict_type==B_TYPE || (!s->has_b_frames)){
  464. pict->data[0] = s->current_picture[0];
  465. pict->data[1] = s->current_picture[1];
  466. pict->data[2] = s->current_picture[2];
  467. } else {
  468. pict->data[0] = s->last_picture[0];
  469. pict->data[1] = s->last_picture[1];
  470. pict->data[2] = s->last_picture[2];
  471. }
  472. pict->linesize[0] = s->linesize;
  473. pict->linesize[1] = s->uvlinesize;
  474. pict->linesize[2] = s->uvlinesize;
  475. avctx->quality = s->qscale;
  476. /* Return the Picture timestamp as the frame number */
  477. /* we substract 1 because it is added on utils.c */
  478. avctx->frame_number = s->picture_number - 1;
  479. /* dont output the last pic after seeking
  480. note we allready added +1 for the current pix in MPV_frame_end(s) */
  481. if(s->num_available_buffers>=2 || (!s->has_b_frames))
  482. *data_size = sizeof(AVPicture);
  483. #ifdef PRINT_FRAME_TIME
  484. printf("%Ld\n", rdtsc()-time);
  485. #endif
  486. return get_consumed_bytes(s, buf_size);
  487. }
  488. AVCodec mpeg4_decoder = {
  489. "mpeg4",
  490. CODEC_TYPE_VIDEO,
  491. CODEC_ID_MPEG4,
  492. sizeof(MpegEncContext),
  493. h263_decode_init,
  494. NULL,
  495. h263_decode_end,
  496. h263_decode_frame,
  497. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  498. };
  499. AVCodec h263_decoder = {
  500. "h263",
  501. CODEC_TYPE_VIDEO,
  502. CODEC_ID_H263,
  503. sizeof(MpegEncContext),
  504. h263_decode_init,
  505. NULL,
  506. h263_decode_end,
  507. h263_decode_frame,
  508. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  509. };
  510. AVCodec msmpeg4v1_decoder = {
  511. "msmpeg4v1",
  512. CODEC_TYPE_VIDEO,
  513. CODEC_ID_MSMPEG4V1,
  514. sizeof(MpegEncContext),
  515. h263_decode_init,
  516. NULL,
  517. h263_decode_end,
  518. h263_decode_frame,
  519. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  520. };
  521. AVCodec msmpeg4v2_decoder = {
  522. "msmpeg4v2",
  523. CODEC_TYPE_VIDEO,
  524. CODEC_ID_MSMPEG4V2,
  525. sizeof(MpegEncContext),
  526. h263_decode_init,
  527. NULL,
  528. h263_decode_end,
  529. h263_decode_frame,
  530. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  531. };
  532. AVCodec msmpeg4v3_decoder = {
  533. "msmpeg4",
  534. CODEC_TYPE_VIDEO,
  535. CODEC_ID_MSMPEG4V3,
  536. sizeof(MpegEncContext),
  537. h263_decode_init,
  538. NULL,
  539. h263_decode_end,
  540. h263_decode_frame,
  541. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  542. };
  543. AVCodec wmv1_decoder = {
  544. "wmv1",
  545. CODEC_TYPE_VIDEO,
  546. CODEC_ID_WMV1,
  547. sizeof(MpegEncContext),
  548. h263_decode_init,
  549. NULL,
  550. h263_decode_end,
  551. h263_decode_frame,
  552. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  553. };
  554. AVCodec wmv2_decoder = {
  555. "wmv2",
  556. CODEC_TYPE_VIDEO,
  557. CODEC_ID_WMV2,
  558. sizeof(MpegEncContext),
  559. h263_decode_init,
  560. NULL,
  561. h263_decode_end,
  562. h263_decode_frame,
  563. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  564. };
  565. AVCodec h263i_decoder = {
  566. "h263i",
  567. CODEC_TYPE_VIDEO,
  568. CODEC_ID_H263I,
  569. sizeof(MpegEncContext),
  570. h263_decode_init,
  571. NULL,
  572. h263_decode_end,
  573. h263_decode_frame,
  574. CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
  575. };