[svn] / branches / dev-api-3 / vfw / src / 2pass.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/vfw/src/2pass.c

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

revision 687, Thu Nov 28 07:43:16 2002 UTC revision 814, Sun Feb 2 10:05:27 2003 UTC
# Line 49  Line 49 
49          double total2 = 0.0;          double total2 = 0.0;
50          double dbytes, dbytes2;          double dbytes, dbytes2;
51    
52            /* ensure free() is called safely */
53            codec->twopass.hintstream = NULL;
54            twopass->nns1_array = NULL;
55            twopass->nns2_array = NULL;
56    
57          if (codec->config.hinted_me)          if (codec->config.hinted_me)
58          {          {
59                  codec->twopass.hintstream = malloc(100000);                  codec->twopass.hintstream = malloc(100000);
# Line 988  Line 993 
993    
994          if (twopass->nns_array_pos >= twopass->nns_array_length)          if (twopass->nns_array_pos >= twopass->nns_array_length)
995          {          {
996                  twopass->nns_array_pos = 0;                  // fix for VirtualDub 1.4.13 bframe handling
997                    if (codec->config.max_bframes > 0 &&
998                            codec->framenum < twopass->nns_array_length + codec->config.max_bframes)
999                    {
1000                            return ICERR_OK;
1001                    }
1002                    else
1003                    {
1004                  DEBUGERR("ERROR: VIDEO EXCEEDS 1ST PASS!!!");                  DEBUGERR("ERROR: VIDEO EXCEEDS 1ST PASS!!!");
1005                  return ICERR_ERROR;                  return ICERR_ERROR;
1006          }          }
1007            }
1008    
1009          memcpy(&twopass->nns1, &twopass->nns1_array[twopass->nns_array_pos], sizeof(NNSTATS));          memcpy(&twopass->nns1, &twopass->nns1_array[twopass->nns_array_pos], sizeof(NNSTATS));
1010          if (codec->config.mode == DLG_MODE_2PASS_2_EXT)          if (codec->config.mode == DLG_MODE_2PASS_2_EXT)
# Line 1007  Line 1020 
1020                  twopass->bytes2 = bytes1;                  twopass->bytes2 = bytes1;
1021                  twopass->desired_bytes2 = bytes1;                  twopass->desired_bytes2 = bytes1;
1022                  frame->intra = 3;                  frame->intra = 3;
1023                  return 2;                  return ICERR_OK;
1024          }          }
1025          else if (twopass->nns1.dd_v & NNSTATS_PADFRAME)          else if (twopass->nns1.dd_v & NNSTATS_PADFRAME)
1026          {          {
# Line 1015  Line 1028 
1028                  twopass->bytes2 = bytes1;                  twopass->bytes2 = bytes1;
1029                  twopass->desired_bytes2 = bytes1;                  twopass->desired_bytes2 = bytes1;
1030                  frame->intra = 4;                  frame->intra = 4;
1031                  return 2;                  return ICERR_OK;
1032          }          }
1033          else if (twopass->nns1.dd_v & NNSTATS_DELAYFRAME)          else if (twopass->nns1.dd_v & NNSTATS_DELAYFRAME)
1034          {          {
# Line 1023  Line 1036 
1036                  twopass->bytes2 = bytes1;                  twopass->bytes2 = bytes1;
1037                  twopass->desired_bytes2 = bytes1;                  twopass->desired_bytes2 = bytes1;
1038                  frame->intra = 5;                  frame->intra = 5;
1039                  return 2;                  return ICERR_OK;
1040          }          }
1041    
1042          overflow = twopass->overflow / 8;          overflow = twopass->overflow / 8;
# Line 1468  Line 1481 
1481                  frame->general |= (frame->quant < 4) ? XVID_MPEGQUANT : XVID_H263QUANT;                  frame->general |= (frame->quant < 4) ? XVID_MPEGQUANT : XVID_H263QUANT;
1482                  frame->general &= (frame->quant < 4) ? ~XVID_H263QUANT : ~XVID_MPEGQUANT;                  frame->general &= (frame->quant < 4) ? ~XVID_H263QUANT : ~XVID_MPEGQUANT;
1483          }          }
1484  /*  
1485          if (codec->config.quant_type == QUANT_MODE_MOD_NEW)          if (codec->config.quant_type == QUANT_MODE_MOD_NEW)
1486          {          {
1487                  frame->general |= (frame->quant < 4) ? XVID_H263QUANT : XVID_MPEGQUANT;                  frame->general |= (frame->quant < 4) ? XVID_H263QUANT : XVID_MPEGQUANT;
1488                  frame->general &= (frame->quant < 4) ? ~XVID_MPEGQUANT : ~XVID_H263QUANT;                  frame->general &= (frame->quant < 4) ? ~XVID_MPEGQUANT : ~XVID_H263QUANT;
1489          }          }
1490  */  
1491          return ICERR_OK;          return ICERR_OK;
1492  }  }
1493    
# Line 1502  Line 1515 
1515          {          {
1516          case DLG_MODE_2PASS_1 :          case DLG_MODE_2PASS_1 :
1517                  nns1.bytes = frame->length;     // total bytes                  nns1.bytes = frame->length;     // total bytes
1518                  nns1.dd_v = stats->hlength;     // header bytes  // THIS small bugger messed up 2pass encoding!
1519    //              nns1.dd_v = stats->hlength;     // header bytes
1520                    nns1.dd_v = 0;
1521                  nns1.dd_u = nns1.dd_y = 0;                  nns1.dd_u = nns1.dd_y = 0;
1522                  nns1.dk_v = nns1.dk_u = nns1.dk_y = 0;                  nns1.dk_v = nns1.dk_u = nns1.dk_y = 0;
1523                  nns1.md_u = nns1.md_y = 0;                  nns1.md_u = nns1.md_y = 0;

Legend:
Removed from v.687  
changed lines
  Added in v.814

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