Mercurial > libavcodec.hg
comparison huffyuv.c @ 1598:932d306bf1dc libavcodec
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
author | michael |
---|---|
date | Mon, 03 Nov 2003 13:26:22 +0000 |
parents | cb523a2ca00f |
children | d49aae2f9027 |
comparison
equal
deleted
inserted
replaced
1597:4c9165372ab3 | 1598:932d306bf1dc |
---|---|
217 for(index=0; index<256; index++){ | 217 for(index=0; index<256; index++){ |
218 if(len_table[index]==len) | 218 if(len_table[index]==len) |
219 dst[index]= bits++; | 219 dst[index]= bits++; |
220 } | 220 } |
221 if(bits & 1){ | 221 if(bits & 1){ |
222 fprintf(stderr, "Error generating huffman table\n"); | 222 av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n"); |
223 return -1; | 223 return -1; |
224 } | 224 } |
225 bits >>= 1; | 225 bits >>= 1; |
226 } | 226 } |
227 return 0; | 227 return 0; |
478 avctx->coded_frame= &s->picture; | 478 avctx->coded_frame= &s->picture; |
479 | 479 |
480 switch(avctx->pix_fmt){ | 480 switch(avctx->pix_fmt){ |
481 case PIX_FMT_YUV420P: | 481 case PIX_FMT_YUV420P: |
482 if(avctx->strict_std_compliance>=0){ | 482 if(avctx->strict_std_compliance>=0){ |
483 fprintf(stderr, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n"); | 483 av_log(avctx, AV_LOG_ERROR, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n"); |
484 return -1; | 484 return -1; |
485 } | 485 } |
486 s->bitstream_bpp= 12; | 486 s->bitstream_bpp= 12; |
487 break; | 487 break; |
488 case PIX_FMT_YUV422P: | 488 case PIX_FMT_YUV422P: |
489 s->bitstream_bpp= 16; | 489 s->bitstream_bpp= 16; |
490 break; | 490 break; |
491 default: | 491 default: |
492 fprintf(stderr, "format not supported\n"); | 492 av_log(avctx, AV_LOG_ERROR, "format not supported\n"); |
493 return -1; | 493 return -1; |
494 } | 494 } |
495 avctx->bits_per_sample= s->bitstream_bpp; | 495 avctx->bits_per_sample= s->bitstream_bpp; |
496 s->decorrelate= s->bitstream_bpp >= 24; | 496 s->decorrelate= s->bitstream_bpp >= 24; |
497 s->predictor= avctx->prediction_method; | 497 s->predictor= avctx->prediction_method; |
701 if(p->data[0]) | 701 if(p->data[0]) |
702 avctx->release_buffer(avctx, p); | 702 avctx->release_buffer(avctx, p); |
703 | 703 |
704 p->reference= 0; | 704 p->reference= 0; |
705 if(avctx->get_buffer(avctx, p) < 0){ | 705 if(avctx->get_buffer(avctx, p) < 0){ |
706 fprintf(stderr, "get_buffer() failed\n"); | 706 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
707 return -1; | 707 return -1; |
708 } | 708 } |
709 | 709 |
710 fake_ystride= s->interlaced ? p->linesize[0]*2 : p->linesize[0]; | 710 fake_ystride= s->interlaced ? p->linesize[0]*2 : p->linesize[0]; |
711 fake_ustride= s->interlaced ? p->linesize[1]*2 : p->linesize[1]; | 711 fake_ustride= s->interlaced ? p->linesize[1]*2 : p->linesize[1]; |
722 p->data[0][3]= get_bits(&s->gb, 8); | 722 p->data[0][3]= get_bits(&s->gb, 8); |
723 p->data[0][2]= get_bits(&s->gb, 8); | 723 p->data[0][2]= get_bits(&s->gb, 8); |
724 p->data[0][1]= get_bits(&s->gb, 8); | 724 p->data[0][1]= get_bits(&s->gb, 8); |
725 p->data[0][0]= get_bits(&s->gb, 8); | 725 p->data[0][0]= get_bits(&s->gb, 8); |
726 | 726 |
727 fprintf(stderr, "YUY2 output isnt implemenetd yet\n"); | 727 av_log(avctx, AV_LOG_ERROR, "YUY2 output isnt implemenetd yet\n"); |
728 return -1; | 728 return -1; |
729 }else{ | 729 }else{ |
730 | 730 |
731 leftv= p->data[2][0]= get_bits(&s->gb, 8); | 731 leftv= p->data[2][0]= get_bits(&s->gb, 8); |
732 lefty= p->data[0][1]= get_bits(&s->gb, 8); | 732 lefty= p->data[0][1]= get_bits(&s->gb, 8); |
894 } | 894 } |
895 } | 895 } |
896 draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order | 896 draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order |
897 break; | 897 break; |
898 default: | 898 default: |
899 fprintf(stderr, "prediction type not supported!\n"); | 899 av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n"); |
900 } | 900 } |
901 }else{ | 901 }else{ |
902 | 902 |
903 fprintf(stderr, "BGR24 output isnt implemenetd yet\n"); | 903 av_log(avctx, AV_LOG_ERROR, "BGR24 output isnt implemenetd yet\n"); |
904 return -1; | 904 return -1; |
905 } | 905 } |
906 } | 906 } |
907 emms_c(); | 907 emms_c(); |
908 | 908 |
1047 | 1047 |
1048 encode_422_bitstream(s, width); | 1048 encode_422_bitstream(s, width); |
1049 } | 1049 } |
1050 } | 1050 } |
1051 }else{ | 1051 }else{ |
1052 fprintf(stderr, "Format not supported!\n"); | 1052 av_log(avctx, AV_LOG_ERROR, "Format not supported!\n"); |
1053 } | 1053 } |
1054 emms_c(); | 1054 emms_c(); |
1055 | 1055 |
1056 size= (get_bit_count(&s->pb)+31)/32; | 1056 size= (get_bit_count(&s->pb)+31)/32; |
1057 | 1057 |