comparison asv1.c @ 7782:6efb15a24e91 libavcodec

Replace generic CONFIG_ENCODERS preprocessor conditionals by more specific CONFIG_FOO_ENCODER conditionals where appropriate.
author diego
date Wed, 03 Sep 2008 12:33:21 +0000
parents 3ec34b551aae
children 7a463923ecd1
comparison
equal deleted inserted replaced
7781:0d62fafc69ae 7782:6efb15a24e91
463 emms_c(); 463 emms_c();
464 464
465 return (get_bits_count(&a->gb)+31)/32*4; 465 return (get_bits_count(&a->gb)+31)/32*4;
466 } 466 }
467 467
468 #ifdef CONFIG_ENCODERS 468 #if defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER)
469 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ 469 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
470 ASV1Context * const a = avctx->priv_data; 470 ASV1Context * const a = avctx->priv_data;
471 AVFrame *pict = data; 471 AVFrame *pict = data;
472 AVFrame * const p= (AVFrame*)&a->picture; 472 AVFrame * const p= (AVFrame*)&a->picture;
473 int size; 473 int size;
517 buf[i]= ff_reverse[ buf[i] ]; 517 buf[i]= ff_reverse[ buf[i] ];
518 } 518 }
519 519
520 return size*4; 520 return size*4;
521 } 521 }
522 #endif /* CONFIG_ENCODERS */ 522 #endif /* defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) */
523 523
524 static av_cold void common_init(AVCodecContext *avctx){ 524 static av_cold void common_init(AVCodecContext *avctx){
525 ASV1Context * const a = avctx->priv_data; 525 ASV1Context * const a = avctx->priv_data;
526 526
527 dsputil_init(&a->dsp, avctx); 527 dsputil_init(&a->dsp, avctx);
567 memset(p->qscale_table, p->quality, p->qstride*a->mb_height); 567 memset(p->qscale_table, p->quality, p->qstride*a->mb_height);
568 568
569 return 0; 569 return 0;
570 } 570 }
571 571
572 #ifdef CONFIG_ENCODERS 572 #if defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER)
573 static av_cold int encode_init(AVCodecContext *avctx){ 573 static av_cold int encode_init(AVCodecContext *avctx){
574 ASV1Context * const a = avctx->priv_data; 574 ASV1Context * const a = avctx->priv_data;
575 int i; 575 int i;
576 const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2; 576 const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
577 577
591 a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q; 591 a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q;
592 } 592 }
593 593
594 return 0; 594 return 0;
595 } 595 }
596 #endif 596 #endif /* defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) */
597 597
598 static av_cold int decode_end(AVCodecContext *avctx){ 598 static av_cold int decode_end(AVCodecContext *avctx){
599 ASV1Context * const a = avctx->priv_data; 599 ASV1Context * const a = avctx->priv_data;
600 600
601 av_freep(&a->bitstream_buffer); 601 av_freep(&a->bitstream_buffer);
629 decode_frame, 629 decode_frame,
630 CODEC_CAP_DR1, 630 CODEC_CAP_DR1,
631 .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), 631 .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
632 }; 632 };
633 633
634 #ifdef CONFIG_ENCODERS 634 #ifdef CONFIG_ASV1_ENCODER
635
636 AVCodec asv1_encoder = { 635 AVCodec asv1_encoder = {
637 "asv1", 636 "asv1",
638 CODEC_TYPE_VIDEO, 637 CODEC_TYPE_VIDEO,
639 CODEC_ID_ASV1, 638 CODEC_ID_ASV1,
640 sizeof(ASV1Context), 639 sizeof(ASV1Context),
642 encode_frame, 641 encode_frame,
643 //encode_end, 642 //encode_end,
644 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, 643 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
645 .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"), 644 .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
646 }; 645 };
647 646 #endif
647
648 #ifdef CONFIG_ASV2_ENCODER
648 AVCodec asv2_encoder = { 649 AVCodec asv2_encoder = {
649 "asv2", 650 "asv2",
650 CODEC_TYPE_VIDEO, 651 CODEC_TYPE_VIDEO,
651 CODEC_ID_ASV2, 652 CODEC_ID_ASV2,
652 sizeof(ASV1Context), 653 sizeof(ASV1Context),
654 encode_frame, 655 encode_frame,
655 //encode_end, 656 //encode_end,
656 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, 657 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
657 .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), 658 .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
658 }; 659 };
659 660 #endif
660 #endif //CONFIG_ENCODERS