[svn] / trunk / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/encoder.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 198, Thu Jun 13 11:42:15 2002 UTC revision 317, Fri Jul 19 14:56:00 2002 UTC
# Line 32  Line 32 
32   *   *
33   *  History   *  History
34   *   *
35     *  10.07.2002  added BFRAMES_DEC_DEBUG support
36     *              MinChen <chenm001@163.com>
37     *  20.06.2002 bframe patch
38   *  08.05.2002 fix some problem in DEBUG mode;   *  08.05.2002 fix some problem in DEBUG mode;
39   *             MinChen <chenm001@163.com>   *             MinChen <chenm001@163.com>
40   *  14.04.2002 added FrameCodeB()   *  14.04.2002 added FrameCodeB()
41   *   *
42   *  $Id: encoder.c,v 1.42 2002-06-13 11:42:15 edgomez Exp $   *  $Id: encoder.c,v 1.57 2002-07-19 14:56:00 chl Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 50  Line 53 
53  #include "global.h"  #include "global.h"
54  #include "utils/timer.h"  #include "utils/timer.h"
55  #include "image/image.h"  #include "image/image.h"
56    #ifdef BFRAMES
57    #include "image/font.h"
58    #endif
59  #include "motion/motion.h"  #include "motion/motion.h"
60  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
61  #include "utils/mbfunctions.h"  #include "utils/mbfunctions.h"
# Line 62  Line 68 
68  #include "quant/quant_matrix.h"  #include "quant/quant_matrix.h"
69  #include "utils/mem_align.h"  #include "utils/mem_align.h"
70    
71    #ifdef _SMP
72    #include "motion/smp_motion_est.h"
73    #endif
74  /*****************************************************************************  /*****************************************************************************
75   * Local macros   * Local macros
76   ****************************************************************************/   ****************************************************************************/
# Line 132  Line 141 
141  encoder_create(XVID_ENC_PARAM * pParam)  encoder_create(XVID_ENC_PARAM * pParam)
142  {  {
143          Encoder *pEnc;          Encoder *pEnc;
144          uint32_t i;          int i;
145    
146          pParam->handle = NULL;          pParam->handle = NULL;
147    
# Line 203  Line 212 
212          if (pParam->max_key_interval == 0)          if (pParam->max_key_interval == 0)
213                  pParam->max_key_interval = 10 * pParam->fincr / pParam->fbase;                  pParam->max_key_interval = 10 * pParam->fincr / pParam->fbase;
214    
   
215          pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE);          pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE);
216          if (pEnc == NULL)          if (pEnc == NULL)
217                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
# Line 226  Line 234 
234          pEnc->mbParam.fbase = pParam->fbase;          pEnc->mbParam.fbase = pParam->fbase;
235          pEnc->mbParam.fincr = pParam->fincr;          pEnc->mbParam.fincr = pParam->fincr;
236    
237            pEnc->mbParam.m_quant_type = H263_QUANT;
238    
239    #ifdef _SMP
240            pEnc->mbParam.num_threads = MIN(pParam->num_threads, MAXNUMTHREADS);
241    #endif
242    
243          pEnc->sStat.fMvPrevSigma = -1;          pEnc->sStat.fMvPrevSigma = -1;
244    
245          /* Fill rate control parameters */          /* Fill rate control parameters */
# Line 257  Line 271 
271    
272          /* try to allocate image memory */          /* try to allocate image memory */
273    
274  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
275          image_null(&pEnc->sOriginal);          image_null(&pEnc->sOriginal);
276  #endif  #endif
277  #ifdef BFRAMES  #ifdef BFRAMES
# Line 273  Line 287 
287          image_null(&pEnc->vInterHV);          image_null(&pEnc->vInterHV);
288          image_null(&pEnc->vInterHVf);          image_null(&pEnc->vInterHVf);
289    
290  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
291          if (image_create          if (image_create
292                  (&pEnc->sOriginal, pEnc->mbParam.edged_width,                  (&pEnc->sOriginal, pEnc->mbParam.edged_width,
293                   pEnc->mbParam.edged_height) < 0)                   pEnc->mbParam.edged_height) < 0)
# Line 327  Line 341 
341          /* B Frames specific init */          /* B Frames specific init */
342  #ifdef BFRAMES  #ifdef BFRAMES
343    
344            pEnc->global = pParam->global;
345          pEnc->mbParam.max_bframes = pParam->max_bframes;          pEnc->mbParam.max_bframes = pParam->max_bframes;
346          pEnc->bquant_ratio = pParam->bquant_ratio;          pEnc->bquant_ratio = pParam->bquant_ratio;
347          pEnc->bframes = NULL;          pEnc->bframes = NULL;
# Line 371  Line 386 
386          pEnc->bframenum_head = 0;          pEnc->bframenum_head = 0;
387          pEnc->bframenum_tail = 0;          pEnc->bframenum_tail = 0;
388          pEnc->flush_bframes = 0;          pEnc->flush_bframes = 0;
389            pEnc->bframenum_dx50bvop = -1;
390    
391            pEnc->queue = NULL;
392    
393    
394            if (pEnc->mbParam.max_bframes > 0) {
395                    int n;
396    
397                    pEnc->queue =
398                            xvid_malloc(pEnc->mbParam.max_bframes * sizeof(IMAGE),
399                                                    CACHE_LINE);
400    
401                    if (pEnc->queue == NULL)
402                            goto xvid_err_memory4;
403    
404                    for (n = 0; n < pEnc->mbParam.max_bframes; n++)
405                            image_null(&pEnc->queue[n]);
406    
407                    for (n = 0; n < pEnc->mbParam.max_bframes; n++) {
408                            if (image_create
409                                    (&pEnc->queue[n], pEnc->mbParam.edged_width,
410                                     pEnc->mbParam.edged_height) < 0)
411                                    goto xvid_err_memory5;
412    
413                    }
414            }
415    
416            pEnc->queue_head = 0;
417            pEnc->queue_tail = 0;
418            pEnc->queue_size = 0;
419    
420    
421          pEnc->mbParam.m_seconds = 0;          pEnc->mbParam.m_seconds = 0;
422          pEnc->mbParam.m_ticks = 0;          pEnc->mbParam.m_ticks = 0;
423            pEnc->m_framenum = 0;
424            pEnc->last_pframe = 1;
425  #endif  #endif
426    
427          pParam->handle = (void *) pEnc;          pParam->handle = (void *) pEnc;
# Line 394  Line 442 
442           * We handle all XVID_ERR_MEMORY here, this makes the code lighter           * We handle all XVID_ERR_MEMORY here, this makes the code lighter
443           */           */
444  #ifdef BFRAMES  #ifdef BFRAMES
445      xvid_err_memory5:
446    
447    
448            if (pEnc->mbParam.max_bframes > 0) {
449    
450                    for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
451                            image_destroy(&pEnc->queue[i], pEnc->mbParam.edged_width,
452                                                      pEnc->mbParam.edged_height);
453                    }
454                    xvid_free(pEnc->queue);
455            }
456    
457    xvid_err_memory4:    xvid_err_memory4:
458    
459            if (pEnc->mbParam.max_bframes > 0) {
460    
461          for (i = 0; i < pEnc->mbParam.max_bframes; i++) {          for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
462    
463                  if (pEnc->bframes[i] == NULL)                  if (pEnc->bframes[i] == NULL)
# Line 410  Line 473 
473          }          }
474    
475          xvid_free(pEnc->bframes);          xvid_free(pEnc->bframes);
476            }
477    
478  #endif  #endif
479    
480    xvid_err_memory3:    xvid_err_memory3:
481  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
482          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,
483                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
484  #endif  #endif
# Line 471  Line 535 
535  int  int
536  encoder_destroy(Encoder * pEnc)  encoder_destroy(Encoder * pEnc)
537  {  {
538    #ifdef BFRAMES
539            int i;
540    #endif
541    
542          ENC_CHECK(pEnc);          ENC_CHECK(pEnc);
543    
544          /* B Frames specific */          /* B Frames specific */
545  #ifdef BFRAMES  #ifdef BFRAMES
546          int i;          if (pEnc->mbParam.max_bframes > 0) {
547    
548                    for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
549    
550                            image_destroy(&pEnc->queue[i], pEnc->mbParam.edged_width,
551                                              pEnc->mbParam.edged_height);
552                    }
553                    xvid_free(pEnc->queue);
554            }
555    
556    
557            if (pEnc->mbParam.max_bframes > 0) {
558    
559          for (i = 0; i < pEnc->mbParam.max_bframes; i++) {          for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
560    
# Line 488  Line 567 
567                  xvid_free(pEnc->bframes[i]->mbs);                  xvid_free(pEnc->bframes[i]->mbs);
568    
569                  xvid_free(pEnc->bframes[i]);                  xvid_free(pEnc->bframes[i]);
   
570          }          }
571    
572          xvid_free(pEnc->bframes);          xvid_free(pEnc->bframes);
573    
574            }
575  #endif  #endif
576    
577          /* All images, reference, current etc ... */          /* All images, reference, current etc ... */
# Line 519  Line 598 
598          image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width,          image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width,
599                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
600  #endif  #endif
601  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
602          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,
603                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
604  #endif  #endif
# Line 537  Line 616 
616          return XVID_ERR_OK;          return XVID_ERR_OK;
617  }  }
618    
619    
620    #ifdef BFRAMES
621    void inc_frame_num(Encoder * pEnc)
622    {
623            pEnc->iFrameNum++;
624            pEnc->mbParam.m_ticks += pEnc->mbParam.fincr;
625    
626            pEnc->mbParam.m_seconds = pEnc->mbParam.m_ticks / pEnc->mbParam.fbase;
627            pEnc->mbParam.m_ticks = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase;
628    }
629    #endif
630    
631    
632    #ifdef BFRAMES
633    void queue_image(Encoder * pEnc, XVID_ENC_FRAME * pFrame)
634    {
635            if (pEnc->queue_size >= pEnc->mbParam.max_bframes)
636            {
637                    DPRINTF(DPRINTF_DEBUG,"FATAL: QUEUE FULL");
638                    return;
639            }
640    
641            DPRINTF(DPRINTF_DEBUG,"*** QUEUE bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
642                                    pEnc->bframenum_head, pEnc->bframenum_tail,
643                                    pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
644    
645    
646            start_timer();
647            if (image_input
648                    (&pEnc->queue[pEnc->queue_tail], pEnc->mbParam.width, pEnc->mbParam.height,
649                     pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))
650                    return;
651            stop_conv_timer();
652    
653            pEnc->queue_size++;
654            pEnc->queue_tail =  (pEnc->queue_tail + 1) % pEnc->mbParam.max_bframes;
655    }
656    #endif
657    
658    
659    #ifdef BFRAMES
660  /*****************************************************************************  /*****************************************************************************
661   * Frame encoder entry point   * IPB frame encoder entry point
  *  
  * At this moment 2 versions coexist : one for IPB compatible encoder,  
  *                                     another one for the old IP encoder.  
662   *   *
663   * Returned values :   * Returned values :
664   *    - XVID_ERR_OK     - no errors   *    - XVID_ERR_OK     - no errors
# Line 549  Line 666 
666   *                        format   *                        format
667   ****************************************************************************/   ****************************************************************************/
668    
   
 #ifdef BFRAMES  
 /*****************************************************************************  
  * Frame encoder entry point for IPB capable encoder  
  ****************************************************************************/  
669  int  int
670  encoder_encode(Encoder * pEnc,  encoder_encode_bframes(Encoder * pEnc,
671                             XVID_ENC_FRAME * pFrame,                             XVID_ENC_FRAME * pFrame,
672                             XVID_ENC_STATS * pResult)                             XVID_ENC_STATS * pResult)
673  {  {
# Line 563  Line 675 
675          Bitstream bs;          Bitstream bs;
676          uint32_t bits;          uint32_t bits;
677    
678  #ifdef _DEBUG          int input_valid = 1;
679    
680    #ifdef _DEBUG_PSNR
681          float psnr;          float psnr;
682          char temp[128];          char temp[128];
683  #endif  #endif
684    
685          ENC_CHECK(pEnc);          ENC_CHECK(pEnc);
686          ENC_CHECK(pFrame);          ENC_CHECK(pFrame);
687            ENC_CHECK(pFrame->image);
688    
689          start_global_timer();          start_global_timer();
690    
691          BitstreamInit(&bs, pFrame->bitstream, 0);          BitstreamInit(&bs, pFrame->bitstream, 0);
692    
693    ipvop_loop:
694    
695          /*          /*
696           * bframe "flush" code           * bframe "flush" code
697           */           */
# Line 589  Line 706 
706                           * frame as a pframe                           * frame as a pframe
707                           */                           */
708    
709                          /* ToDo : remove dprintf calls */                          DPRINTF(DPRINTF_DEBUG,"*** BFRAME (final frame) bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
710                          /*                                  pEnc->bframenum_head, pEnc->bframenum_tail,
711                             dprintf("--- PFRAME (final frame correction) --- ");                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
712                           */  
713                          pEnc->bframenum_tail--;                          pEnc->bframenum_tail--;
714                          SWAP(pEnc->current, pEnc->reference);                          SWAP(pEnc->current, pEnc->reference);
715    
# Line 602  Line 719 
719    
720                          BitstreamPad(&bs);                          BitstreamPad(&bs);
721                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
                         pFrame->input_consumed = 0;  
722                          pFrame->intra = 0;                          pFrame->intra = 0;
723    
724                          return XVID_ERR_OK;                          return XVID_ERR_OK;
725                  }                  }
726    
727                  /* ToDo : remove dprintf calls */  
728                  /*                  DPRINTF(DPRINTF_DEBUG,"*** BFRAME (flush) bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
729                     dprintf("--- BFRAME (flush) --- ");                                  pEnc->bframenum_head, pEnc->bframenum_tail,
730                   */                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
731    
732                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);
733                  pEnc->bframenum_head++;                  pEnc->bframenum_head++;
734    
   
735                  BitstreamPad(&bs);                  BitstreamPad(&bs);
736                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
                 pFrame->input_consumed = 0;  
737                  pFrame->intra = 0;                  pFrame->intra = 0;
738    
739                    if (input_valid)
740                            queue_image(pEnc, pFrame);
741    
742                  return XVID_ERR_OK;                  return XVID_ERR_OK;
743          }          }
744    
745          if (pFrame->image == NULL) {          if (pEnc->bframenum_head > 0) {
746                  pFrame->length = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
747                  pFrame->input_consumed = 1;  
748                    if ((pEnc->global & XVID_GLOBAL_PACKED)) {
749    
750                            DPRINTF(DPRINTF_DEBUG,"*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
751                                    pEnc->bframenum_head, pEnc->bframenum_tail,
752                                    pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
753    
754                            BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);
755                            BitstreamPad(&bs);
756                            BitstreamPutBits(&bs, 0x7f, 8);
757    
758                            pFrame->length = BitstreamLength(&bs);
759                  pFrame->intra = 0;                  pFrame->intra = 0;
760    
761                            if (input_valid)
762                                    queue_image(pEnc, pFrame);
763    
764                  return XVID_ERR_OK;                  return XVID_ERR_OK;
765          }          }
766            }
767    
768          if (pEnc->bframenum_head > 0) {  
769                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;  bvop_loop:
770    
771            if (pEnc->bframenum_dx50bvop != -1)
772            {
773    
774                    SWAP(pEnc->current, pEnc->reference);
775                    SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_dx50bvop]);
776    
777                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
778                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 100, "DX50 IVOP");
779                    }
780    
781                    if (input_valid)
782                    {
783                            queue_image(pEnc, pFrame);
784                            input_valid = 0;
785                    }
786    
787            } else if (input_valid) {
788    
789                    SWAP(pEnc->current, pEnc->reference);
790    
791                    start_timer();
792                    if (image_input
793                            (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
794                            pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))
795                            return XVID_ERR_FORMAT;
796                    stop_conv_timer();
797    
798                    // queue input frame, and dequue next image
799                    if (pEnc->queue_size > 0)
800                    {
801                            image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_tail]);
802                            if (pEnc->queue_head != pEnc->queue_tail)
803                            {
804                                    image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_head]);
805                            }
806                            pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;
807                            pEnc->queue_tail =  (pEnc->queue_tail + 1) % pEnc->mbParam.max_bframes;
808                    }
809    
810            } else if (pEnc->queue_size > 0) {
811    
812                    SWAP(pEnc->current, pEnc->reference);
813    
814                    image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_head]);
815                    pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;
816                    pEnc->queue_size--;
817    
818            } else if (BitstreamPos(&bs) == 0) {
819    
820                    DPRINTF(DPRINTF_DEBUG,"*** SKIP bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
821                                    pEnc->bframenum_head, pEnc->bframenum_tail,
822                                    pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
823    
824                    pFrame->intra = 0;
825    
826                    BitstreamPutBits(&bs, 0x7f, 8);
827                    BitstreamPad(&bs);
828                    pFrame->length = BitstreamLength(&bs);
829    
830                    return XVID_ERR_OK;
831    
832            } else {
833    
834                    pFrame->length = BitstreamLength(&bs);
835                    return XVID_ERR_OK;
836          }          }
837    
838          pEnc->flush_bframes = 0;          pEnc->flush_bframes = 0;
# Line 643  Line 842 
842           * comment style :-)           * comment style :-)
843           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
844    
         SWAP(pEnc->current, pEnc->reference);  
   
845          emms();          emms();
846    
847            // only inc frame num, adapt quant, etc. if we havent seen it before
848            if (pEnc->bframenum_dx50bvop < 0 )
849            {
850          if (pFrame->quant == 0)          if (pFrame->quant == 0)
851                  pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0);                  pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0);
852          else          else
# Line 660  Line 860 
860    
861          pEnc->current->global_flags = pFrame->general;          pEnc->current->global_flags = pFrame->general;
862          pEnc->current->motion_flags = pFrame->motion;          pEnc->current->motion_flags = pFrame->motion;
863          pEnc->current->seconds = pEnc->mbParam.m_seconds;  
         pEnc->current->ticks = pEnc->mbParam.m_ticks;  
864          /* ToDo : dynamic fcode (in both directions) */          /* ToDo : dynamic fcode (in both directions) */
865          pEnc->current->fcode = pEnc->mbParam.m_fcode;          pEnc->current->fcode = pEnc->mbParam.m_fcode;
866          pEnc->current->bcode = pEnc->mbParam.m_fcode;          pEnc->current->bcode = pEnc->mbParam.m_fcode;
867    
868          start_timer();                  pEnc->current->seconds = pEnc->mbParam.m_seconds;
869          if (image_input                  pEnc->current->ticks = pEnc->mbParam.m_ticks;
                 (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,  
                  pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))  
                 return XVID_ERR_FORMAT;  
         stop_conv_timer();  
870    
871  #ifdef _DEBUG                  inc_frame_num(pEnc);
872    
873    #ifdef _DEBUG_PSNR
874          image_copy(&pEnc->sOriginal, &pEnc->current->image,          image_copy(&pEnc->sOriginal, &pEnc->current->image,
875                             pEnc->mbParam.edged_width, pEnc->mbParam.height);                             pEnc->mbParam.edged_width, pEnc->mbParam.height);
876  #endif  #endif
877    
878          emms();          emms();
879    
880                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
881                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,
882                                    "%i  if:%i  st:%i:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->seconds, pEnc->current->ticks);
883                    }
884    
885          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
886           * Luminance masking           * Luminance masking
887           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
# Line 709  Line 911 
911                          }                          }
912    
913  #undef OFFSET  #undef OFFSET
   
914                  }                  }
915    
916                  xvid_free(temp_dquants);                  xvid_free(temp_dquants);
917          }          }
918    
919            }
920    
921          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
922           * ivop/pvop/bvop selection           * ivop/pvop/bvop selection
923           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
924    
925    
926          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 ||          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||
927                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&
928                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)
929                  || image_mad(&pEnc->reference->image, &pEnc->current->image,                  || image_mad(&pEnc->reference->image, &pEnc->current->image,
# Line 730  Line 933 
933                   * This will be coded as an Intra Frame                   * This will be coded as an Intra Frame
934                   */                   */
935    
936                  /* ToDo : Remove dprintf calls */                  DPRINTF(DPRINTF_DEBUG,"*** IFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
937                  /*                                  pEnc->bframenum_head, pEnc->bframenum_tail,
938                     dprintf("--- IFRAME ---");                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
                  */  
939    
940                  FrameCodeI(pEnc, &bs, &bits);                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
941                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");
942                    }
943    
944                    // when we reach an iframe in DX50BVOP mode, encode the last bframe as a pframe
945    
946                    if ((pEnc->global & XVID_GLOBAL_DX50BVOP) && pEnc->bframenum_tail > 0) {
947    
948                            pEnc->bframenum_tail--;
949                            pEnc->bframenum_dx50bvop = pEnc->bframenum_tail;
950    
951                            SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_dx50bvop]);
952                            if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
953                                    image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 100, "DX50 BVOP->PVOP");
954                            }
955                            FrameCodeP(pEnc, &bs, &bits, 1, 0);
956    
957                            pFrame->intra = 0;
958    
959                    } else {
960    
961                            FrameCodeI(pEnc, &bs, &bits);
962                  pFrame->intra = 1;                  pFrame->intra = 1;
963    
964                            pEnc->bframenum_dx50bvop = -1;
965                    }
966    
967                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
968    
969                    if ((pEnc->global & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) {
970                            BitstreamPad(&bs);
971                            input_valid = 0;
972                            goto ipvop_loop;
973                    }
974    
975                  /*                  /*
976                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
977                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
# Line 749  Line 981 
981                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
982                   */                   */
983    
984                  /* ToDo : Remove dprintf calls */                  DPRINTF(DPRINTF_DEBUG,"*** PFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
985                  /*                                  pEnc->bframenum_head, pEnc->bframenum_tail,
986                     dprintf("--- PFRAME ---");                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
987                   */  
988                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
989                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "PVOP");
990                    }
991    
992                  FrameCodeP(pEnc, &bs, &bits, 1, 0);                  FrameCodeP(pEnc, &bs, &bits, 1, 0);
993                  pFrame->intra = 0;                  pFrame->intra = 0;
994                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
995    
996                    if ((pEnc->global & XVID_GLOBAL_PACKED)) {
997                            BitstreamPad(&bs);
998                            input_valid = 0;
999                            goto ipvop_loop;
1000                    }
1001    
1002          } else {          } else {
1003                  /*                  /*
1004                   * This will be coded as a Bidirectional Frame                   * This will be coded as a Bidirectional Frame
1005                   */                   */
1006    
1007                  /* ToDo : Remove dprintf calls */                  DPRINTF(DPRINTF_DEBUG,"*** BFRAME (store) bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
1008                  /*                                  pEnc->bframenum_head, pEnc->bframenum_tail,
1009                     dprintf("--- BFRAME (store) ---  head=%i tail=%i",                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
1010                     pEnc->bframenum_head,  
1011                     pEnc->bframenum_tail);                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
1012                   */                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "BVOP");
1013                    }
1014    
1015                  if (pFrame->bquant < 1) {                  if (pFrame->bquant < 1) {
1016                          pEnc->current->quant =                          pEnc->current->quant =
# Line 785  Line 1028 
1028    
1029                  pFrame->intra = 0;                  pFrame->intra = 0;
1030                  pFrame->length = 0;                  pFrame->length = 0;
                 pFrame->input_consumed = 1;  
1031    
1032                  pEnc->mbParam.m_ticks += pEnc->mbParam.fincr;                  input_valid = 0;
1033                  if (pEnc->mbParam.m_ticks > pEnc->mbParam.fbase) {                  goto bvop_loop;
                         pEnc->mbParam.m_seconds++;  
                         pEnc->mbParam.m_ticks = 0;  
                 }  
   
                 return XVID_ERR_OK;  
1034          }          }
1035    
1036          BitstreamPad(&bs);          BitstreamPad(&bs);
# Line 809  Line 1046 
1046    
1047          emms();          emms();
1048    
1049  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
1050          psnr =          psnr =
1051                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,
1052                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,
# Line 824  Line 1061 
1061                                                    pFrame->length, pFrame->intra);                                                    pFrame->length, pFrame->intra);
1062          }          }
1063    
         pEnc->iFrameNum++;  
         pEnc->mbParam.m_ticks += pEnc->mbParam.fincr;  
         if (pEnc->mbParam.m_ticks > pEnc->mbParam.fbase) {  
                 pEnc->mbParam.m_seconds++;  
                 pEnc->mbParam.m_ticks = 0;  
         }  
         pFrame->input_consumed = 1;  
1064    
1065          stop_global_timer();          stop_global_timer();
1066          write_timer();          write_timer();
1067    
1068          return XVID_ERR_OK;          return XVID_ERR_OK;
1069  }  }
1070  #else  
1071    #endif
1072    
1073    
1074    
1075  /*****************************************************************************  /*****************************************************************************
1076   * Frame encoder entry point for IP capable encoder   * "original" IP frame encoder entry point
1077     *
1078     * Returned values :
1079     *    - XVID_ERR_OK     - no errors
1080     *    - XVID_ERR_FORMAT - the image subsystem reported the image had a wrong
1081     *                        format
1082   ****************************************************************************/   ****************************************************************************/
1083    
1084  int  int
1085  encoder_encode(Encoder * pEnc,  encoder_encode(Encoder * pEnc,
1086                             XVID_ENC_FRAME * pFrame,                             XVID_ENC_FRAME * pFrame,
# Line 851  Line 1091 
1091          uint32_t bits;          uint32_t bits;
1092          uint16_t write_vol_header = 0;          uint16_t write_vol_header = 0;
1093    
1094  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
1095          float psnr;          float psnr;
1096          uint8_t temp[128];          uint8_t temp[128];
1097  #endif  #endif
# Line 867  Line 1107 
1107    
1108          pEnc->current->global_flags = pFrame->general;          pEnc->current->global_flags = pFrame->general;
1109          pEnc->current->motion_flags = pFrame->motion;          pEnc->current->motion_flags = pFrame->motion;
1110    #ifdef BFRAMES
1111            pEnc->current->seconds = pEnc->mbParam.m_seconds;
1112            pEnc->current->ticks = pEnc->mbParam.m_ticks;
1113    #endif
1114          pEnc->mbParam.hint = &pFrame->hint;          pEnc->mbParam.hint = &pFrame->hint;
1115    
1116          start_timer();          start_timer();
# Line 876  Line 1120 
1120                  return XVID_ERR_FORMAT;                  return XVID_ERR_FORMAT;
1121          stop_conv_timer();          stop_conv_timer();
1122    
1123  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
1124          image_copy(&pEnc->sOriginal, &pEnc->current->image,          image_copy(&pEnc->sOriginal, &pEnc->current->image,
1125                             pEnc->mbParam.edged_width, pEnc->mbParam.height);                             pEnc->mbParam.edged_width, pEnc->mbParam.height);
1126  #endif  #endif
# Line 986  Line 1230 
1230                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,
1231                                                    pFrame->length, pFrame->intra);                                                    pFrame->length, pFrame->intra);
1232          }          }
1233  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
1234          psnr =          psnr =
1235                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,
1236                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,
# Line 996  Line 1240 
1240          DEBUG(temp);          DEBUG(temp);
1241  #endif  #endif
1242    
1243    #ifdef BFRAMES
1244            inc_frame_num(pEnc);
1245    #else
1246          pEnc->iFrameNum++;          pEnc->iFrameNum++;
1247    #endif
1248    
1249    
1250          stop_global_timer();          stop_global_timer();
1251          write_timer();          write_timer();
1252    
1253          return XVID_ERR_OK;          return XVID_ERR_OK;
1254  }  }
 #endif  
1255    
1256    
1257  static __inline void  static __inline void
# Line 1073  Line 1321 
1321                                  &pEnc->current->mbs[x + y * pEnc->mbParam.mb_width];                                  &pEnc->current->mbs[x + y * pEnc->mbParam.mb_width];
1322                          MVBLOCKHINT *bhint =                          MVBLOCKHINT *bhint =
1323                                  &hint->mvhint.block[x + y * pEnc->mbParam.mb_width];                                  &hint->mvhint.block[x + y * pEnc->mbParam.mb_width];
1324                          VECTOR pred[4];                          VECTOR pred;
1325                          VECTOR tmp;                          VECTOR tmp;
                         int32_t dummy[4];  
1326                          int vec;                          int vec;
1327    
1328                          pMB->mode =                          pMB->mode =
# Line 1095  Line 1342 
1342                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1343                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1344    
1345                                  get_pmvdata(pEnc->current->mbs, x, y, pEnc->mbParam.mb_width,                                  pred = get_pmv2(pEnc->current->mbs,pEnc->mbParam.mb_width,0,x,y,0);
                                                         0, pred, dummy);  
1346    
1347                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
1348                                          pMB->mvs[vec].x = tmp.x;                                          pMB->mvs[vec].x = tmp.x;
1349                                          pMB->mvs[vec].y = tmp.y;                                          pMB->mvs[vec].y = tmp.y;
1350                                          pMB->pmvs[vec].x = pMB->mvs[0].x - pred[0].x;                                          pMB->pmvs[vec].x = pMB->mvs[0].x - pred.x;
1351                                          pMB->pmvs[vec].y = pMB->mvs[0].y - pred[0].y;                                          pMB->pmvs[vec].y = pMB->mvs[0].y - pred.y;
1352                                  }                                  }
1353                          } else if (pMB->mode == MODE_INTER4V) {                          } else if (pMB->mode == MODE_INTER4V) {
1354                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
# Line 1115  Line 1361 
1361                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1362                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1363    
1364                                          get_pmvdata(pEnc->current->mbs, x, y,                                          pred = get_pmv2(pEnc->current->mbs,pEnc->mbParam.mb_width,0,x,y,vec);
                                                                 pEnc->mbParam.mb_width, vec, pred, dummy);  
1365    
1366                                          pMB->mvs[vec].x = tmp.x;                                          pMB->mvs[vec].x = tmp.x;
1367                                          pMB->mvs[vec].y = tmp.y;                                          pMB->mvs[vec].y = tmp.y;
1368                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred[0].x;                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred.x;
1369                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred[0].y;                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred.y;
1370                                  }                                  }
1371                          } else                          // intra / stuffing / not_coded                          } else                          // intra / stuffing / not_coded
1372                          {                          {
# Line 1251  Line 1496 
1496          pEnc->current->coding_type = I_VOP;          pEnc->current->coding_type = I_VOP;
1497    
1498          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1499          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current);  #ifdef BFRAMES
1500    #define DIVX501B481P "DivX501b481p"
1501            if ((pEnc->global & XVID_GLOBAL_PACKED)) {
1502                    BitstreamWriteUserData(bs, DIVX501B481P, strlen(DIVX501B481P));
1503            }
1504    #endif
1505            BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1506    
1507          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
1508    
# Line 1346  Line 1597 
1597          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {
1598                  HintedMESet(pEnc, &bIntra);                  HintedMESet(pEnc, &bIntra);
1599          } else {          } else {
1600    
1601    #ifdef _SMP
1602            if (pEnc->mbParam.num_threads > 1)
1603                    bIntra =
1604                            SMP_MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference,
1605                                                     &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1606                                                     iLimit);
1607            else
1608    #endif
1609                  bIntra =                  bIntra =
1610                          MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference,                          MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference,
1611                                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,                                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1612                                                           iLimit);                                                           iLimit);
1613    
1614          }          }
1615          stop_motion_timer();          stop_motion_timer();
1616    
# Line 1362  Line 1623 
1623          if (vol_header)          if (vol_header)
1624                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1625    
1626          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1627    
1628          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
1629    
# Line 1463  Line 1724 
1724    
1725          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
1726    
1727            pEnc->time_pp = ((int32_t)pEnc->mbParam.fbase - (int32_t)pEnc->last_pframe + (int32_t)pEnc->mbParam.m_ticks) % (int32_t)pEnc->mbParam.fbase;
1728            fprintf(stderr,"fbase=%d last_p=%d ticks=%d time_pp = %d\n",pEnc->mbParam.fbase,pEnc->last_pframe,pEnc->mbParam.m_ticks,pEnc->time_pp);
1729    
1730            pEnc->last_pframe = pEnc->mbParam.m_ticks;
1731          return 0;                                       // inter          return 0;                                       // inter
1732  }  }
1733    
# Line 1483  Line 1748 
1748          IMAGE *f_ref = &pEnc->reference->image;          IMAGE *f_ref = &pEnc->reference->image;
1749          IMAGE *b_ref = &pEnc->current->image;          IMAGE *b_ref = &pEnc->current->image;
1750    
1751    #ifdef BFRAMES_DEC_DEBUG
1752            FILE *fp;
1753            static char first=0;
1754    #define BFRAME_DEBUG    if (!first && fp){ \
1755                    fprintf(fp,"Y=%3d   X=%3d   MB=%2d   CBP=%02X\n",y,x,mb->mode,mb->cbp); \
1756            }
1757    
1758            if (!first){
1759                    fp=fopen("C:\\XVIDDBGE.TXT","w");
1760            }
1761    #endif
1762    
1763          // forward          // forward
1764          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
1765                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
# Line 1506  Line 1783 
1783          stop_inter_timer();          stop_inter_timer();
1784    
1785          start_timer();          start_timer();
1786          MotionEstimationBVOP(&pEnc->mbParam, frame, pEnc->reference->mbs, f_ref,          fprintf(stderr,"m_ticks =%d\n",(int32_t)pEnc->mbParam.m_ticks+1);
1787            MotionEstimationBVOP(&pEnc->mbParam, frame,
1788              ((int32_t)pEnc->mbParam.fbase + (int32_t)pEnc->mbParam.m_ticks + 1 - (int32_t)pEnc->last_pframe) % pEnc->mbParam.fbase,
1789                                                    pEnc->time_pp,
1790                                                    pEnc->reference->mbs, f_ref,
1791                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
1792                                                   pEnc->current->mbs, b_ref, &pEnc->vInterH,                                                   pEnc->current->mbs, b_ref, &pEnc->vInterH,
1793                                                   &pEnc->vInterV, &pEnc->vInterHV);                                                   &pEnc->vInterV, &pEnc->vInterHV);
# Line 1520  Line 1801 
1801             } */             } */
1802    
1803          frame->coding_type = B_VOP;          frame->coding_type = B_VOP;
1804          BitstreamWriteVopHeader(bs, &pEnc->mbParam, frame);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, frame, 1);
1805    
1806          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
1807    
# Line 1549  Line 1830 
1830                          if (mb->mode == MODE_NOT_CODED) {                          if (mb->mode == MODE_NOT_CODED) {
1831                                  mb->mvs[0].x = 0;                                  mb->mvs[0].x = 0;
1832                                  mb->mvs[0].y = 0;                                  mb->mvs[0].y = 0;
1833    
1834                                    mb->cbp = 0;
1835    #ifdef BFRAMES_DEC_DEBUG
1836            BFRAME_DEBUG
1837    #endif
1838                                  continue;                                  continue;
1839                          }                          }
1840    
# Line 1567  Line 1853 
1853    
1854                          if ((mb->mode == MODE_INTERPOLATE || mb->mode == MODE_DIRECT)                          if ((mb->mode == MODE_INTERPOLATE || mb->mode == MODE_DIRECT)
1855                                  && mb->cbp == 0 && mb->mvs[0].x == 0 && mb->mvs[0].y == 0) {                                  && mb->cbp == 0 && mb->mvs[0].x == 0 && mb->mvs[0].y == 0) {
1856                                  mb->mode = 5;   // skipped                                  mb->mode = MODE_DIRECT_NONE_MV; // skipped
1857                          }                          }
1858    
1859                          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_FORWARD) {                          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_FORWARD) {
# Line 1583  Line 1869 
1869                                  backward.x = mb->b_mvs[0].x;                                  backward.x = mb->b_mvs[0].x;
1870                                  backward.y = mb->b_mvs[0].y;                                  backward.y = mb->b_mvs[0].y;
1871                          }                          }
1872  //          printf("[%i %i] M=%i CBP=%i MVX=%i MVY=%i %i,%i  %i,%i\n", x, y, pMB->mode, pMB->cbp, pMB->mvs[0].x, bmb->pmvs[0].x, bmb->pmvs[0].y, forward.x, forward.y);  //                      DPRINTF("%05i : [%i %i] M=%i CBP=%i MVS=%i,%i forward=%i,%i", pEnc->m_framenum, x, y, mb->mode, mb->cbp, mb->mvs[0].x, mb->mvs[0].y, forward.x, forward.y);
1873    
1874    #ifdef BFRAMES_DEC_DEBUG
1875            BFRAME_DEBUG
1876    #endif
1877                          start_timer();                          start_timer();
1878                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,
1879                                                   &pEnc->sStat);                                                   &pEnc->sStat);
# Line 1597  Line 1886 
1886          // TODO: dynamic fcode/bcode ???          // TODO: dynamic fcode/bcode ???
1887    
1888          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
1889    
1890    #ifdef BFRAMES_DEC_DEBUG
1891            if (!first){
1892                    first=1;
1893                    if (fp)
1894                            fclose(fp);
1895            }
1896    #endif
1897  }  }
1898  #endif  #endif

Legend:
Removed from v.198  
changed lines
  Added in v.317

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4