📄 convertpar.cpp
字号:
for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbNewpredSegmentType [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } rgbNewpredSegmentType [ENHN_LAYER] [iObj] = FALSE; } } // NewpredRefName nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { rgcNewpredRefName [BASE_LAYER] [iObj] = new char [128]; if (fscanf (pfPara, "%s", rgcNewpredRefName [BASE_LAYER] [iObj] ) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { rgcNewpredRefName [ENHN_LAYER] [iObj] = new char [128]; if (fscanf (pfPara, "%s", rgcNewpredRefName [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } } } // NewpredSlicePoint nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { rgcNewpredSlicePoint [BASE_LAYER] [iObj] = new char [128]; if (fscanf (pfPara, "%s", rgcNewpredSlicePoint [BASE_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } if (rgbNewpredSegmentType [BASE_LAYER] [iObj]) strcpy(rgcNewpredSlicePoint [BASE_LAYER] [iObj], "0"); } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { rgcNewpredSlicePoint [ENHN_LAYER] [iObj] = new char [128]; if (fscanf (pfPara, "%s", rgcNewpredSlicePoint [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } } } } else { for (iObj = 0; iObj < nVO; iObj++) { // default values rgbNewpredEnable [BASE_LAYER] [iObj] = 0; rgbNewpredEnable [ENHN_LAYER] [iObj] = 0; rgbNewpredSegmentType [BASE_LAYER] [iObj] = 0; rgbNewpredSegmentType [ENHN_LAYER] [iObj] = 0; rgcNewpredRefName [BASE_LAYER] [iObj] = NULL; rgcNewpredRefName [ENHN_LAYER] [iObj] = NULL; rgcNewpredSlicePoint [BASE_LAYER] [iObj] = NULL; rgcNewpredSlicePoint [ENHN_LAYER] [iObj] = NULL; } } for (iObj = 0; iObj < nVO; iObj++) { /*************/ fprintf(pfOut, "Newpred.Enable [%d] = %d\n", iObj, rgbNewpredEnable [BASE_LAYER] [iObj]); fprintf(pfOut, "Newpred.SegmentType [%d] = \"%s\"\n", iObj, rgbNewpredSegmentType [BASE_LAYER] [iObj]==0 ? "VideoPacket" : "VOP"); fprintf(pfOut, "Newpred.Filename [%d] = \"%s\"\n", iObj, rgcNewpredRefName [BASE_LAYER] [iObj]==NULL ? "" : rgcNewpredRefName [BASE_LAYER] [iObj]); fprintf(pfOut, "Newpred.SliceList [%d] = \"%s\"\n", iObj, rgcNewpredSlicePoint [BASE_LAYER] [iObj]==NULL ? "" : rgcNewpredSlicePoint [BASE_LAYER] [iObj]); /*************/ if(bAnyScalability) { /*************/ fprintf(pfOut, "Newpred.Enable [%d] = %d\n", iObj + nVO, rgbNewpredEnable [ENHN_LAYER] [iObj]); fprintf(pfOut, "Newpred.SegmentType [%d] = \"%s\"\n", iObj + nVO, rgbNewpredSegmentType [ENHN_LAYER] [iObj]==0 ? "VideoPacket" : "VOP"); fprintf(pfOut, "Newpred.Filename [%d] = \"%s\"\n", iObj + nVO, rgcNewpredRefName [ENHN_LAYER] [iObj]==NULL ? "" : rgcNewpredRefName [ENHN_LAYER] [iObj]); fprintf(pfOut, "Newpred.SliceList [%d] = \"%s\"\n", iObj + nVO, rgcNewpredSlicePoint [ENHN_LAYER] [iObj]==NULL ? "" : rgcNewpredSlicePoint [ENHN_LAYER] [iObj]); /*************/ } } // rate control flag nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%u", &rguiRateControl [BASE_LAYER] [iObj] ) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rguiRateControl [BASE_LAYER] [iObj] == RC_MPEG4 || rguiRateControl [BASE_LAYER] [iObj] == RC_TM5 || rguiRateControl [BASE_LAYER] [iObj] == 0); /*************/ fprintf(pfOut, "RateControl.Type [%d] = \"%s\"\n", iObj, rguiRateControl [BASE_LAYER] [iObj] == 0 ? "None" : (rguiRateControl [BASE_LAYER] [iObj] == RC_MPEG4 ? "MP4" : "TM5")); /*************/ } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%u", &rguiRateControl [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rguiRateControl [ENHN_LAYER] [iObj] == 0 || rguiRateControl [ENHN_LAYER] [iObj] == RC_MPEG4 || rguiRateControl [ENHN_LAYER] [iObj] == RC_TM5); /*************/ fprintf(pfOut, "RateControl.Type [%d] = \"%s\"\n", iObj + nVO, rguiRateControl [ENHN_LAYER] [iObj] == 0 ? "None" : (rguiRateControl [ENHN_LAYER] [iObj] == RC_MPEG4 ? "MP4" : "TM5")); /*************/ } } // bit budget for each object. nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rguiBitsBudget [BASE_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } /*************/ fprintf(pfOut, "RateControl.BitsPerVOP [%d] = %d\n", iObj, rguiBitsBudget [BASE_LAYER] [iObj]); /*************/ } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rguiBitsBudget [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rguiBitsBudget [ENHN_LAYER] [iObj] > 0); /*************/ fprintf(pfOut, "RateControl.BitsPerVOP [%d] = %d\n", iObj + nVO, rguiBitsBudget [ENHN_LAYER] [iObj]); /*************/ } } // alpha usage for each object. 0: rectangle, 1: binary, 2: 8-bit, 3: shape only nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { UInt uiAlpha; if (fscanf (pfPara, "%d", &uiAlpha) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } else { my_assert (uiAlpha == 0 || uiAlpha == 1 || uiAlpha == 2 || uiAlpha == 3); if(uiAlpha<3) { rgfAlphaUsage [iObj] = (AlphaUsage) uiAlpha; rgbShapeOnly [iObj] = FALSE; } else { rgfAlphaUsage [iObj] = ONE_BIT; rgbShapeOnly [iObj] = TRUE; } } /*************/ fprintf(pfOut, "Alpha.Type [%d] = \"%s\"\n", iObj, uiAlpha==0 ? "None" : (uiAlpha==1 ? "Binary" : (uiAlpha==2 ? "Gray" : "ShapeOnly"))); /*************/ } // binary shape rounding para nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgiBinaryAlphaTH [iObj]) != 1) { fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgiBinaryAlphaTH [iObj] >= 0); /*************/ fprintf(pfOut, "Alpha.Binary.RoundingThreshold [%d] = %d\n", iObj, rgiBinaryAlphaTH [iObj]); /*************/ } // binary shape size conversion flag nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbNoCrChange [iObj]) != 1) { fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgbNoCrChange [iObj] == TRUE || rgbNoCrChange [iObj] == FALSE); //boolean value if (rgiBinaryAlphaTH [iObj] == 0) my_assert (rgbNoCrChange [iObj] == TRUE); //MB-level size conversion of shape is off in lossless mode\n"); /*************/ fprintf(pfOut, "Alpha.Binary.SizeConversion.Enable [%d] = %d\n", iObj, !rgbNoCrChange [iObj]); /*************/ } // Added for error resilient mode by Toshiba(1997-11-14) nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgiBinaryAlphaRR [iObj]) != 1) { fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgiBinaryAlphaRR [iObj] >= 0); /*************/ fprintf(pfOut, "ErrorResil.AlphaRefreshRate [%d] = %d\n", iObj, rgiBinaryAlphaRR [iObj]); /*************/ } // End Toshiba(1997-11-14) // rounding control disable if(iVersion > 812) nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if(iVersion > 812) { if (fscanf (pfPara, "%d", &rgbRoundingControlDisable [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } } else rgbRoundingControlDisable [iObj] = 0; my_assert (rgbRoundingControlDisable [iObj] == 0 || rgbRoundingControlDisable [iObj] == 1); /*************/ fprintf(pfOut, "Motion.RoundingControl.Enable [%d] = %d\n", iObj, !rgbRoundingControlDisable [iObj]); /*************/ } if(iVersion > 812) nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if(iVersion > 812) { if (fscanf (pfPara, "%d", &rgiInitialRoundingType [iObj]) != 1) { fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } } else rgiInitialRoundingType [iObj] = 0; my_assert (rgiInitialRoundingType [iObj] == 0 || rgiInitialRoundingType [iObj] == 1); /*************/ fprintf(pfOut, "Motion.RoundingControl.StartValue [%d] = %d\n", iObj, rgiInitialRoundingType [iObj]); /*************/ } // error resilient coding disable nextValidLine (pfPara, pnLine); Int iErrorResilientFlags; for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &iErrorResilientFlags) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } rgbErrorResilientDisable [BASE_LAYER] [iObj] = iErrorResilientFlags & 0x1;// Modified for error resilient mode by Toshiba(1998-1-16) rgbDataPartitioning [BASE_LAYER] [iObj] = (iErrorResilientFlags & 0x2) ? TRUE : FALSE; rgbReversibleVlc [BASE_LAYER] [iObj] = (iErrorResilientFlags & 0x4) ? TRUE : FALSE;// End Toshiba(1998-1-16) if( rgbErrorResilientDisable [BASE_LAYER] [iObj]) rgiBinaryAlphaRR [iObj] = -1; /*************/ fprintf(pfOut, "ErrorResil.RVLC.Enable [%d] = %d\n", iObj, rgbReversibleVlc [BASE_LAYER] [iObj]); fprintf(pfOut, "ErrorResil.DataPartition.Enable [%d] = %d\n", iObj, rgbDataPartitioning [BASE_LAYER] [iObj]); fprintf(pfOut, "ErrorResil.VideoPacket.Enable [%d] = %d\n", iObj, !rgbErrorResilientDisable [BASE_LAYER] [iObj]); /*************/ } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbErrorResilientDisable [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgbErrorResilientDisable [ENHN_LAYER] [iObj] == TRUE); //error resilient coding not supported as for now rgbErrorResilientDisable [ENHN_LAYER] [iObj] = TRUE; rgbDataPartitioning [ENHN_LAYER] [iObj] = FALSE; rgbReversibleVlc [ENHN_LAYER] [iObj] = FALSE; /*************/ fprintf(pfOut, "ErrorResil.RVLC.Enable [%d] = %d\n", iObj + nVO, rgbReversibleVlc [ENHN_LAYER] [iObj]); fprintf(pfOut, "ErrorResil.DataPartition.Enable [%d] = %d\n", iObj + nVO, rgbDataPartitioning [ENHN_LAYER] [iObj]); fprintf(pfOut, "ErrorResil.VideoPacket.Enable [%d] = %d\n", iObj + nVO, !rgbErrorResilientDisable [ENHN_LAYER] [iObj]); /*************/ } } // Bit threshold for video packet spacing control nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgiVPBitTh [BASE_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } if (rgbErrorResilientDisable [BASE_LAYER] [iObj]) rgiVPBitTh [BASE_LAYER] [iObj] = -1; // set VPBitTh to negative value /*************/ fprintf(pfOut, "ErrorResil.VideoPacket.Length [%d] = %d\n", iObj, rgiVPBitTh [BASE_LAYER] [iObj]); /*************/ } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgiVPBitTh [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } rgiVPBitTh [ENHN_LAYER] [iObj] = -1; /*************/ fprintf(pfOut, "ErrorResil.VideoPacket.Length [%d] = %d\n", iObj + nVO, rgiVPBitTh [ENHN_LAYER] [iObj]); /*************/ } } // Interlaced coding nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbInterlacedCoding [BASE_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgbInterlacedCoding [BASE_LAYER] [iObj] == 0 || rgbInterlacedCoding [BASE_LAYER] [iObj] == 1); /*************/ fprintf(pfOut, "Motion.Interlaced.Enable [%d] = %d\n", iObj, rgbInterlacedCoding [BASE_LAYER] [iObj]); /*************/ } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbInterlacedCoding [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } my_assert (rgbInterlacedCoding [ENHN_LAYER] [iObj] == 0 || rgbInterlacedCoding [ENHN_LAYER] [iObj] == 1); /*************/ fprintf(pfOut, "Motion.Interlaced.Enable [%d] = %d\n", iObj + nVO, rgbInterlacedCoding [ENHN_LAYER] [iObj]); /*************/ } } // sadct disable_flag if (iVersion>=817) { nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbSadctDisable [BASE_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } my_assert (rgbSadctDisable [BASE_LAYER] [iObj] == 0 || rgbSadctDisable [BASE_LAYER] [iObj] == 1); } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbSadctDisable [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } my_assert (rgbSadctDisable [ENHN_LAYER] [iObj] == 0 || rgbSadctDisable [ENHN_LAYER] [iObj] == 1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -