Home | History | Annotate | Download | only in src

Lines Matching refs:bitstream1

405 /*  Function : BitstreamAppendEnc( BitstreamEncVideo *bitstream1,           */
409 /* output bitstream(bitstream1) */
416 PV_STATUS BitstreamAppendEnc(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2)
424 status = BitstreamSavePartial(bitstream1, &fraction);
437 if (!offset) /* bitstream1 is byte-aligned */
439 return BitstreamAppendPacket(bitstream1, bitstream2);
444 /* since bitstream1 doesn't have to be byte-aligned, we have to process byte by byte */
446 if (bitstream1->byteCount + bitstream2->byteCount + offset > bitstream1->bufferSize)
448 if (PV_SUCCESS != BitstreamUseOverrunBuffer(bitstream1, bitstream2->byteCount + offset))
450 bitstream1->byteCount += (bitstream2->byteCount + offset);
455 ptrBS1 = bitstream1->bitstreamBuffer + bitstream1->byteCount; /* move ptr bs1*/
458 bitused = (WORD_SIZE << 3) - bitstream1->bitLeft; /* this must be between 1-7 */
462 bitstream1->byteCount += numbyte2; /* new byteCount */
464 byteBS1 = ((UChar) bitstream1->word) << bitleft; /* fraction byte from bs1 */
475 bitstream1->word = byteBS1 >> bitleft; /* bitstream->bitLeft remains the same */
478 status = BitstreamPutBits(bitstream1, (WORD_SIZE << 3) - bitstream2->bitLeft, bitstream2->word);
484 /* Function : BitstreamAppendPacket( BitstreamEncVideo *bitstream1, */
488 /* output bitstream(bitstream1) knowing that bitstream1 is byte-aligned*/
493 PV_STATUS BitstreamAppendPacket(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2)
498 if (bitstream1->byteCount + bitstream2->byteCount > bitstream1->bufferSize)
500 if (PV_SUCCESS != BitstreamUseOverrunBuffer(bitstream1, bitstream2->byteCount))
502 bitstream1->byteCount += bitstream2->byteCount; /* legacy, to keep track of total bytes */
507 ptrBS1 = bitstream1->bitstreamBuffer + bitstream1->byteCount; /* move ptr bs1*/
511 bitstream1->byteCount += numbyte2; /* new byteCount */
516 bitstream1->word = bitstream2->word; /* bitstream1->bitLeft is the same */
517 bitstream1->bitLeft = bitstream2->bitLeft;
523 /* Function : BitstreamAppendPacketNoOffset( BitstreamEncVideo *bitstream1,*/
527 /* output bitstream(bitstream1) , for slice-based coding only */
532 PV_STATUS BitstreamAppendPacketNoOffset(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2)
541 if (bitstream1->byteCount + bitstream2->byteCount > bitstream1->bufferSize)
543 numbyte2 = bitstream1->bufferSize - bitstream1->byteCount;
547 ptrBS1 = bitstream1->bitstreamBuffer; /* move ptr bs1*/
550 bitstream1->byteCount += numbyte2; /* should be equal to bufferSize */
554 bitstream1->word = 0;
555 bitstream1->bitLeft = (WORD_SIZE << 3);
615 /* Function : BitstreamFlushBits(BitstreamEncVideo *bitstream1, */
625 PV_STATUS BitstreamFlushBits(BitstreamEncVideo *bitstream1, Int num_bit_left)
633 ptrSrc = bitstream1->bitstreamBuffer + bitstream1->byteCount;
634 ptrDst = bitstream1->bitstreamBuffer;
636 bitused = (WORD_SIZE << 3) - bitstream1->bitLeft;
640 bitstream1->byteCount = new_byte;
641 bitstream1->bitLeft = (WORD_SIZE << 3) - new_bit;
664 ptrSrc = bitstream1->bitstreamBuffer + new_byte;
665 bitstream1->word = (*ptrSrc) >> (8 - new_bit);
672 /* Function : BitstreamPrependPacket( BitstreamEncVideo *bitstream1, */
676 /* output bitstream(bitstream1) */
681 PV_STATUS BitstreamPrependPacket(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2)
687 BitstreamSavePartial(bitstream1, &fraction);
689 if (bitstream1->byteCount + bitstream2->byteCount >= bitstream1->bufferSize)
691 bitstream1->byteCount += bitstream2->byteCount;
695 movebyte = bitstream1->byteCount;
700 /* shift bitstream1 to the right by movebyte */
701 pSrc = bitstream1->bitstreamBuffer;
704 M4VENC_MEMCPY(pDst, pSrc, bitstream1->byteCount + 1);
706 /* copy bitstream2 to the beginning of bitstream1 */
709 /* now shift back previous bitstream1 buffer to the end */
711 pDst = bitstream1->bitstreamBuffer + bitstream2->byteCount;
720 for (i = 0; i < bitstream1->byteCount + 1; i++)
726 bitstream1->byteCount += bitstream2->byteCount;
727 //bitstream1->bitCount += bitstream2->bitCount;
728 bitused = (WORD_SIZE << 4) - (bitstream1->bitLeft + bitstream2->bitLeft);
733 bitstream1->byteCount++;
736 bitstream1->bitLeft = (WORD_SIZE << 3) - bitused;
741 pSrc = bitstream1->bitstreamBuffer + bitstream1->byteCount;
745 bitstream1->word = (UInt)((pSrc[0]) >> leftover);