/// <summary> /// Create region block based on test type. /// </summary> /// <param name="bReduceExtrapolate">This is used to indicate if DWT uses the "Reduce Extrapolate" method.</param> /// <param name="tileDict">This is used to indicate the dictionary of tile index and encoded data.</param> /// <param name="tileDataLength">This is used to indicate the encoded tile data length.</param> /// <param name="tileBlockType">This is used to indicate the tile data block type(simple, first, or upgrade).</param> public override RFX_Progressive_REGION BuildRegionBlock(bool bReduceExtrapolate, Dictionary <TileIndex, EncodedTile> tileDict, uint tileDataLength, RFXProgCodecBlockType tileBlockType) { RFX_Progressive_REGION region_block = base.BuildRegionBlock(bReduceExtrapolate, tileDict, tileDataLength, tileBlockType); if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectLen) { region_block.blockLen += 1; // Set block length into incorrect value. } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectTileSize) { region_block.tileSize += 1; // Set tile size in region block is other than 64. } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectRectsNumber) { region_block.numRects += 1; // Set numRects larger 1 than TS_RFX_RECT number in region_block.rects field. } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_ZeroRectsNumber) { // Set Rect number is zero region_block.numRects = 0; region_block.rects = null; } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectQuantNumber) { region_block.numQuant += 1; // Set numQuant larger 1 than TS_RFX_CODEC_QUANT number in region_block.quantVals field. } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_ZeroQuantNumber) { // Set quant data number is zero. region_block.numQuant = 0; region_block.quantVals = null; } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectProgQuantNumber) { region_block.numProgQuant += 1; // Set numProgQuant larger 1 than RFX_RPROGRESSIVE_CODEC_QUANT number in quantProgVals field. } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_IncorrectTileBlockNumber) { region_block.numTiles += 1; // Set numTiles larger 1 than tile block number in tiles field. } return(region_block); }
/// <summary> /// Create region blocks and tile data blocks(tile simple or tile first or tile upgrade) based on test type. /// </summary> /// <param name="bReduceExtrapolate">This is used to indicate if DWT uses the "Reduce Extrapolate" method.</param> /// <param name="tileDict">This is used to indicate the dictionary of tile index and encoded data.</param> /// <param name="tileBlockType">This is used to indicate the tile data block type(simple, first, or upgrade).</param> public override void CreateRegionTileBlocks(bool bReduceExtrapolate, Dictionary <TileIndex, EncodedTile> tileDict, RFXProgCodecBlockType tileBlockType) { if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_AfterFrameEndBlock) { base.CreateFrameEndBlock(); } List <RFX_Progressive_DataBlock> tile_block_list = new List <RFX_Progressive_DataBlock>(); uint tileDataLength = 0; RFX_Progressive_DataBlock tile_block = new RFX_Progressive_DataBlock(); foreach (KeyValuePair <TileIndex, EncodedTile> tilePair in tileDict) { // Set quantIdx is always 0 since all tiles share same quant table. tile_block = BuildTileDataBlock(0, tilePair.Key, tilePair.Value, tileBlockType); tile_block_list.Add(tile_block); tileDataLength += tile_block.blockLen; } if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_InvalidTileBlockType) { // Change type of last block tile_block.blockType = (RFXProgCodecBlockType)0xffff; // Set invalid block type to 0xffff. } RFX_Progressive_REGION region_block = BuildRegionBlock(bReduceExtrapolate, tileDict, tileDataLength, tileBlockType); blkList.Add(region_block); if (bmTestType == RdpegfxNegativeTypes.RfxProgCodec_RegionBlock_BeforeFrameBeginBlock) { CreateFrameBeginBlock(1); // Set region count as 1 since encoded image data exists. } // Add tile_data blocks after region block. blkList.AddRange(tile_block_list); }