comparison dv.c @ 8163:e1a094cabfc3 libavcodec

Getting rid of unneeded extra wrapper functions
author romansh
date Tue, 18 Nov 2008 20:33:08 +0000
parents c30bdda1adb1
children ab31736c0f23
comparison
equal deleted inserted replaced
8162:368413cfe34b 8163:e1a094cabfc3
393 *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */ 393 *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
394 } 394 }
395 } 395 }
396 396
397 /* mb_x and mb_y are in units of 8 pixels */ 397 /* mb_x and mb_y are in units of 8 pixels */
398 static inline void dv_decode_video_segment(DVVideoContext *s, DVwork_chunk *work_chunk) 398 static int dv_decode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chunk)
399 { 399 {
400 DVVideoContext *s = avctx->priv_data;
400 int quant, dc, dct_mode, class1, j; 401 int quant, dc, dct_mode, class1, j;
401 int mb_index, mb_x, mb_y, last_index; 402 int mb_index, mb_x, mb_y, last_index;
402 int y_stride, linesize; 403 int y_stride, linesize;
403 DCTELEM *block, *block1; 404 DCTELEM *block, *block1;
404 int c_offset; 405 int c_offset;
574 (mb++)->idct_put(c_ptr + y_stride, linesize, block); block += 64; 575 (mb++)->idct_put(c_ptr + y_stride, linesize, block); block += 64;
575 } 576 }
576 } 577 }
577 } 578 }
578 } 579 }
580 return 0;
579 } 581 }
580 582
581 #if ENABLE_SMALL 583 #if ENABLE_SMALL
582 /* Converts run and level (where level != 0) pair into vlc, returning bit size */ 584 /* Converts run and level (where level != 0) pair into vlc, returning bit size */
583 static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) 585 static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)
855 } 857 }
856 } 858 }
857 } 859 }
858 } 860 }
859 861
860 static inline void dv_encode_video_segment(DVVideoContext *s, DVwork_chunk *work_chunk) 862 static int dv_encode_video_segment(AVCodecContext *avctx, DVwork_chunk *work_chunk)
861 { 863 {
864 DVVideoContext *s = avctx->priv_data;
862 int mb_index, i, j; 865 int mb_index, i, j;
863 int mb_x, mb_y, c_offset, linesize; 866 int mb_x, mb_y, c_offset, linesize;
864 uint8_t* y_ptr; 867 uint8_t* y_ptr;
865 uint8_t* data; 868 uint8_t* data;
866 uint8_t* ptr; 869 uint8_t* ptr;
1002 av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n"); 1005 av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n");
1003 } 1006 }
1004 1007
1005 for (j = 0; j < 5 * 6; j++) 1008 for (j = 0; j < 5 * 6; j++)
1006 flush_put_bits(&pbs[j]); 1009 flush_put_bits(&pbs[j]);
1007 } 1010
1008
1009 static int dv_decode_mt(AVCodecContext *avctx, void* sl)
1010 {
1011 dv_decode_video_segment((DVVideoContext *)avctx->priv_data, (DVwork_chunk*)sl);
1012 return 0; 1011 return 0;
1013 } 1012 }
1014
1015 #ifdef CONFIG_DVVIDEO_ENCODER
1016 static int dv_encode_mt(AVCodecContext *avctx, void* sl)
1017 {
1018 dv_encode_video_segment((DVVideoContext *)avctx->priv_data, (DVwork_chunk*)sl);
1019 return 0;
1020 }
1021 #endif
1022 1013
1023 #ifdef CONFIG_DVVIDEO_DECODER 1014 #ifdef CONFIG_DVVIDEO_DECODER
1024 /* NOTE: exactly one frame must be given (120000 bytes for NTSC, 1015 /* NOTE: exactly one frame must be given (120000 bytes for NTSC,
1025 144000 bytes for PAL - or twice those for 50Mbps) */ 1016 144000 bytes for PAL - or twice those for 50Mbps) */
1026 static int dvvideo_decode_frame(AVCodecContext *avctx, 1017 static int dvvideo_decode_frame(AVCodecContext *avctx,
1048 } 1039 }
1049 s->picture.interlaced_frame = 1; 1040 s->picture.interlaced_frame = 1;
1050 s->picture.top_field_first = 0; 1041 s->picture.top_field_first = 0;
1051 1042
1052 s->buf = buf; 1043 s->buf = buf;
1053 avctx->execute(avctx, dv_decode_mt, s->sys->work_chunks, NULL, 1044 avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL,
1054 dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); 1045 dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
1055 1046
1056 emms_c(); 1047 emms_c();
1057 1048
1058 /* return image */ 1049 /* return image */
1201 s->picture = *((AVFrame *)data); 1192 s->picture = *((AVFrame *)data);
1202 s->picture.key_frame = 1; 1193 s->picture.key_frame = 1;
1203 s->picture.pict_type = FF_I_TYPE; 1194 s->picture.pict_type = FF_I_TYPE;
1204 1195
1205 s->buf = buf; 1196 s->buf = buf;
1206 c->execute(c, dv_encode_mt, s->sys->work_chunks, NULL, 1197 c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL,
1207 dv_work_pool_size(s->sys), sizeof(DVwork_chunk)); 1198 dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
1208 1199
1209 emms_c(); 1200 emms_c();
1210 1201
1211 dv_format_frame(s, buf); 1202 dv_format_frame(s, buf);