Changeset 964
- Timestamp:
- 11/05/99 12:30:25 (14 years ago)
- Location:
- vic/trunk/codec
- Files:
-
- 2 modified
-
decoder-bvc.cpp (modified) (3 diffs)
-
encoder-bvc.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vic/trunk/codec/decoder-bvc.cpp
r902 r964 14 14 BvcDecoder(); 15 15 ~BvcDecoder(); 16 virtual void recv( const struct rtphdr*, const u_char* data, int len);16 virtual void recv(pktbuf* pb); 17 17 void resize(int width, int height); 18 18 int colorhist(u_int* hist) const; … … 813 813 } 814 814 815 void BvcDecoder::recv(const rtphdr* rh, const u_char* bp, int cc) 816 { 815 void BvcDecoder::recv(pktbuf* pb) 816 { 817 rtphdr* rh = (rtphdr*)pb->dp; 818 int hdrsize = sizeof(rtphdr) + hdrlen(); 819 u_char* bp = pb->dp + hdrsize; 820 int cc = pb->len - hdrsize; 821 817 822 const bvchdr* ph = (bvchdr*)(rh + 1); 818 823 int w = ph->width << 3; … … 840 845 resetndblk(); 841 846 } 847 pb->release(); 842 848 } 843 849 -
vic/trunk/codec/encoder-bvc.cpp
r902 r964 11 11 #include "rtp.h" 12 12 #include "crdef.h" 13 #include "pktbuf-rtp.h" 13 14 #include "module.h" 14 15 #include "transmitter.h" 16 17 #define HDRSIZE (sizeof(rtphdr) + sizeof(bvchdr)) 15 18 16 19 class BvcEncoder : public TransmitterModule { … … 22 25 protected: 23 26 void size(int w, int h); 24 Transmitter::pktbuf* getpkt(u_int32_t ts, int layer);25 int flush( Transmitter::pktbuf* pb, int sync);27 pktbuf* getpkt(u_int32_t ts, int layer); 28 int flush(pktbuf* pb, int sync); 26 29 void quantizer(int n, int q); 27 30 void encode_sbc(const u_char* blk); … … 105 108 106 109 /*XXX share with h261*/ 107 int BvcEncoder::flush( Transmitter::pktbuf* pb, int sync)110 int BvcEncoder::flush(pktbuf* pb, int sync) 108 111 { 109 112 /* flush bit buffer */ 110 113 STORE_BITS(bs_, bb_); 111 114 112 int cc = bs_ - (u_char*)pb->iov[1].iov_base; 115 //int cc = bs_ - (u_char*)pb->iov[1].iov_base; 116 int cc = bs_ - (u_char*)&pb->data[HDRSIZE]; 113 117 cc += nbb_ >> 3; 114 118 int nbit = nbb_ & 7; … … 121 125 abort(); 122 126 123 pb->iov[0].iov_len = sizeof(rtphdr) + sizeof(bvchdr); 124 pb->iov[1].iov_len = cc; 125 rtphdr* rh = (rtphdr*)pb->iov[0].iov_base; 127 //pb->iov[0].iov_len = sizeof(rtphdr) + sizeof(bvchdr); 128 //pb->iov[1].iov_len = cc; 129 pb->len = cc + HDRSIZE; 130 //rtphdr* rh = (rtphdr*)pb->iov[0].iov_base; 131 rtphdr* rh = (rtphdr*)pb->data; 126 132 if (sync) 127 133 rh->rh_flags |= htons(RTP_M); … … 131 137 tx_->send(pb); 132 138 133 return (cc + sizeof(rtphdr) + sizeof(bvchdr));139 return (cc + HDRSIZE); 134 140 } 135 141 … … 736 742 } 737 743 738 #define HDRSIZE (sizeof(rtphdr) + sizeof(bvchdr)) 739 740 Transmitter::pktbuf* BvcEncoder::getpkt(u_int32_t ts, int layer) 741 { 742 Transmitter::pktbuf* pb = tx_->alloc(ts, RTP_PT_BVC); 744 pktbuf* BvcEncoder::getpkt(u_int32_t ts, int layer) 745 { 746 //Transmitter::pktbuf* pb = tx_->alloc(ts, RTP_PT_BVC); 747 pktbuf* pb = pool_->alloc(ts, RTP_PT_BVC); 743 748 pb->layer = layer; 744 rtphdr* rh = (rtphdr*)pb->iov[0].iov_base; 749 //rtphdr* rh = (rtphdr*)pb->iov[0].iov_base; 750 rtphdr* rh = (rtphdr*)pb->data; 745 751 bvchdr* bh = (bvchdr*)(rh + 1); 746 752 bh->version = 0; … … 750 756 bh->quant = htonl(quant_); 751 757 bh->blkno = htons(blkno_); 752 bs_ = (u_char*)pb->iov[1].iov_base; 758 //bs_ = (u_char*)pb->iov[1].iov_base; 759 bs_ = (u_char*)&pb->data[HDRSIZE]; 753 760 es_ = bs_ + tx_->mtu() - HDRSIZE; 754 761 bb_ = 0; … … 769 776 const u_char* chm = frm + framesize_; 770 777 blkno_ = -1; 771 Transmitter::pktbuf* pb = getpkt(p->ts_, layer);778 pktbuf* pb = getpkt(p->ts_, layer); 772 779 const u_int8_t* crv = p->crvec_; 773 memset(&b, 0, sizeof(b)); 780 memset(&b, 0, sizeof(b)); 781 774 782 #ifdef SBC_STAT 775 if (f[0] == 0) {776 f[0] = fopen("sbc0", "w");777 f[1] = fopen("sbc1", "w");778 f[2] = fopen("sbc2", "w");779 f[3] = fopen("sbc3", "w");780 }783 if (f[0] == 0) { 784 f[0] = fopen("sbc0", "w"); 785 f[1] = fopen("sbc1", "w"); 786 f[2] = fopen("sbc2", "w"); 787 f[3] = fopen("sbc3", "w"); 788 } 781 789 #endif 782 790 int cc = 0;
