diff --git a/src/rdo.c b/src/rdo.c index 2cd622ba..1e17a6f3 100644 --- a/src/rdo.c +++ b/src/rdo.c @@ -58,22 +58,8 @@ static const uint32_t g_auiGoRiceParsCoeff[32] = }; /** - * Entropy bits to estimate coded bits in RDO / RDOQ (From HM 12.0) + * Entropy bits to estimate coded bits in RDO / RDOQ (From VTM 13.0) */ -/* -const uint32_t kvz_entropy_bits[128] = -{ - 0x08000, 0x08000, 0x076da, 0x089a0, 0x06e92, 0x09340, 0x0670a, 0x09cdf, 0x06029, 0x0a67f, 0x059dd, 0x0b01f, 0x05413, 0x0b9bf, 0x04ebf, 0x0c35f, - 0x049d3, 0x0ccff, 0x04546, 0x0d69e, 0x0410d, 0x0e03e, 0x03d22, 0x0e9de, 0x0397d, 0x0f37e, 0x03619, 0x0fd1e, 0x032ee, 0x106be, 0x02ffa, 0x1105d, - 0x02d37, 0x119fd, 0x02aa2, 0x1239d, 0x02836, 0x12d3d, 0x025f2, 0x136dd, 0x023d1, 0x1407c, 0x021d2, 0x14a1c, 0x01ff2, 0x153bc, 0x01e2f, 0x15d5c, - 0x01c87, 0x166fc, 0x01af7, 0x1709b, 0x0197f, 0x17a3b, 0x0181d, 0x183db, 0x016d0, 0x18d7b, 0x01595, 0x1971b, 0x0146c, 0x1a0bb, 0x01354, 0x1aa5a, - 0x0124c, 0x1b3fa, 0x01153, 0x1bd9a, 0x01067, 0x1c73a, 0x00f89, 0x1d0da, 0x00eb7, 0x1da79, 0x00df0, 0x1e419, 0x00d34, 0x1edb9, 0x00c82, 0x1f759, - 0x00bda, 0x200f9, 0x00b3c, 0x20a99, 0x00aa5, 0x21438, 0x00a17, 0x21dd8, 0x00990, 0x22778, 0x00911, 0x23118, 0x00898, 0x23ab8, 0x00826, 0x24458, - 0x007ba, 0x24df7, 0x00753, 0x25797, 0x006f2, 0x26137, 0x00696, 0x26ad7, 0x0063f, 0x27477, 0x005ed, 0x27e17, 0x0059f, 0x287b6, 0x00554, 0x29156, - 0x0050e, 0x29af6, 0x004cc, 0x2a497, 0x0048d, 0x2ae35, 0x00451, 0x2b7d6, 0x00418, 0x2c176, 0x003e2, 0x2cb15, 0x003af, 0x2d4b5, 0x0037f, 0x2de55 -};*/ - -// ToDo: check all usage const uint32_t kvz_entropy_bits[2*256] = { 0x0005c, 0x48000 , 0x00116, 0x3b520, 0x001d0, 0x356cb, 0x0028b, 0x318a9, 0x00346, 0x2ea40 , 0x00403, 0x2c531, 0x004c0, 0x2a658, 0x0057e, 0x28beb, @@ -144,10 +130,71 @@ const uint32_t kvz_entropy_bits[2*256] = { // Entropy bits scaled so that 50% probability yields 1 bit. const float kvz_f_entropy_bits[256*2] = { -0.0028076171875, 9.0, 0.00848388671875, 7.4150390625, 0.01416015625, 6.67807006835938, 0.019866943359375, 6.19265747070312, 0.02557373046875, 5.830078125, -0.031341552734375, 5.54055786132812, 0.037109375, 5.299560546875, 0.04290771484375, 5.09310913085938, 0.0487060546875, 4.91253662109375, 0.0545654296875, -4.7520751953125, 0.0604248046875, 4.60769653320312, 0.066314697265625, 4.4764404296875, 0.072235107421875, 4.35614013671875, 0.078155517578125, 4.2451171875, -0.0841064453125, 4.14202880859375, 0.090118408203125, 4.04580688476562, 0.09613037109375, 3.95559692382812, 0.102142333984375, 3.8707275390625, 0.10821533203125, 3.79055786132812, 0.11431884765625, 3.714599609375, 0.12042236328125, 3.6424560546875, 0.126556396484375, 3.57373046875, 0.132720947265625, 3.50814819335938, 0.138916015625, 3.44540405273438, 0.1451416015625, 3.38528442382812, 0.1513671875, 3.32757568359375, 0.15765380859375, 3.2720947265625, 0.1639404296875, 3.2186279296875, 0.1702880859375, 3.1671142578125, 0.1766357421875, 3.11737060546875, 0.183013916015625, 3.06927490234375, 0.189422607421875, 3.022705078125, 0.19586181640625, 2.97763061523438, 0.20233154296875, 2.93389892578125, 0.208831787109375, 2.8914794921875, 0.215362548828125, 2.85025024414062, 0.221923828125, 2.8101806640625, 0.228515625, 2.77117919921875, 0.235137939453125, 2.73321533203125, 0.241790771484375, 2.69622802734375, 0.248443603515625, 2.66015625, 0.255157470703125, 2.62496948242188, 0.26190185546875, 2.59060668945312, 0.2686767578125, 2.55706787109375, 0.275482177734375, 2.52426147460938, 0.282318115234375, 2.49221801757812, 0.2891845703125, 2.46084594726562, 0.29608154296875, 2.43014526367188, 0.30303955078125, 2.40008544921875, 0.30999755859375, 2.37063598632812, 0.3170166015625, 2.341796875, 0.32403564453125, 2.31350708007812, 0.33111572265625, 2.2857666015625, 0.338226318359375, 2.258544921875, 0.345367431640625, 2.2318115234375, 0.3525390625, 2.20559692382812, 0.3597412109375, 2.1798095703125, 0.36700439453125, 2.15451049804688, 0.374298095703125, 2.129638671875, 0.381622314453125, 2.10519409179688, 0.38897705078125, 2.08114624023438, 0.3963623046875, 2.0574951171875, 0.40380859375, 2.03421020507812, 0.411285400390625, 2.01132202148438, 0.418792724609375, 1.98876953125, 0.426361083984375, 1.96658325195312, 0.4339599609375, 1.94473266601562, 0.44158935546875, 1.92318725585938, 0.449249267578125, 1.9019775390625, 0.45697021484375, 1.88107299804688, 0.4647216796875, 1.86044311523438, 0.4725341796875, 1.84011840820312, 0.480377197265625, 1.82009887695312, 0.488250732421875, 1.80032348632812, 0.496185302734375, 1.78082275390625, 0.504150390625, 1.7615966796875, 0.51214599609375, 1.74261474609375, 0.520233154296875, 1.723876953125, 0.5283203125, 1.70538330078125, 0.536468505859375, 1.68710327148438, 0.544677734375, 1.66909790039062, 0.55291748046875, 1.65127563476562, 0.56121826171875, 1.6336669921875, 0.569549560546875, 1.61630249023438, 0.57794189453125, 1.59912109375, 0.58636474609375, 1.5821533203125, 0.5948486328125, 1.56536865234375, 0.6033935546875, 1.54879760742188, 0.611968994140625, 1.53240966796875, 0.620635986328125, 1.51617431640625, 0.629302978515625, 1.50015258789062, 0.6380615234375, 1.48431396484375, 0.6468505859375, 1.4686279296875, 0.65570068359375, 1.45309448242188, 0.66461181640625, 1.437744140625, 0.673583984375, 1.42257690429688, 0.682586669921875, 1.40753173828125, 0.691650390625, 1.39266967773438, 0.7008056640625, 1.37796020507812, 0.709991455078125, 1.36337280273438, 0.71923828125, 1.34893798828125, 0.728546142578125, 1.33465576171875, 0.7379150390625, 1.32052612304688, 0.747344970703125, 1.3065185546875, 0.7568359375, 1.29263305664062, 0.766387939453125, 1.27890014648438, 0.7760009765625, 1.26528930664062, 0.785675048828125, 1.25180053710938, 0.795440673828125, 1.23843383789062, 0.80523681640625, 1.2252197265625, 0.81512451171875, 1.21209716796875, 0.8250732421875, 1.1990966796875, 0.8350830078125, 1.18621826171875, 0.845184326171875, 1.1734619140625, 0.8553466796875, 1.16079711914062, 0.865570068359375, 1.14825439453125, 0.875885009765625, 1.13580322265625, 0.886260986328125, 1.12347412109375, 0.896697998046875, 1.11126708984375, 0.907257080078125, 1.09912109375, 0.9178466796875, 1.08709716796875, 0.92852783203125, 1.0751953125, 0.939300537109375, 1.0633544921875, 0.950164794921875, 1.0516357421875, 0.961090087890625, 1.04000854492188, 0.97210693359375, 1.0284423828125, 0.983184814453125, 1.01699829101562, 0.994384765625, 1.00564575195312, 1.00564575195312, 0.994384765625, 1.01699829101562, 0.983184814453125, 1.0284423828125, 0.97210693359375, 1.04000854492188, 0.961090087890625, 1.0516357421875, 0.950164794921875, 1.0633544921875, 0.939300537109375, 1.0751953125, 0.92852783203125, 1.08709716796875, 0.9178466796875, 1.09912109375, 0.907257080078125, 1.11126708984375, 0.896697998046875, 1.12347412109375, 0.886260986328125, 1.13580322265625, 0.875885009765625, 1.14825439453125, 0.865570068359375, 1.16079711914062, 0.8553466796875, 1.1734619140625, 0.845184326171875, 1.18621826171875, 0.8350830078125, 1.1990966796875, 0.8250732421875, 1.21209716796875, 0.81512451171875, 1.2252197265625, 0.80523681640625, 1.23843383789062, 0.795440673828125, 1.25180053710938, 0.785675048828125, 1.26528930664062, 0.7760009765625, 1.27890014648438, 0.766387939453125, 1.29263305664062, 0.7568359375, 1.3065185546875, 0.747344970703125, 1.32052612304688, 0.7379150390625, 1.33465576171875, 0.728546142578125, 1.34893798828125, 0.71923828125, 1.36337280273438, 0.709991455078125, 1.37796020507812, 0.7008056640625, 1.39266967773438, 0.691650390625, 1.40753173828125, 0.682586669921875, 1.42257690429688, 0.673583984375, 1.437744140625, 0.66461181640625, 1.45309448242188, 0.65570068359375, 1.4686279296875, 0.6468505859375, 1.48431396484375, 0.6380615234375, 1.50015258789062, 0.629302978515625, 1.51617431640625, 0.620635986328125, 1.53240966796875, 0.611968994140625, 1.54879760742188, 0.6033935546875, 1.56536865234375, 0.5948486328125, 1.5821533203125, 0.58636474609375, 1.59912109375, 0.57794189453125, 1.61630249023438, 0.569549560546875, 1.6336669921875, 0.56121826171875, 1.65127563476562, 0.55291748046875, 1.66909790039062, 0.544677734375, 1.68710327148438, 0.536468505859375, 1.70538330078125, 0.5283203125, 1.723876953125, 0.520233154296875, 1.74261474609375, 0.51214599609375, 1.7615966796875, 0.504150390625, 1.78082275390625, 0.496185302734375, 1.80032348632812, 0.488250732421875, 1.82009887695312, 0.480377197265625, 1.84011840820312, 0.4725341796875, 1.86044311523438, 0.4647216796875, 1.88107299804688, 0.45697021484375, 1.9019775390625, 0.449249267578125, 1.92318725585938, 0.44158935546875, 1.94473266601562, 0.4339599609375, 1.96658325195312, 0.426361083984375, 1.98876953125, 0.418792724609375, 2.01132202148438, 0.411285400390625, 2.03421020507812, 0.40380859375, 2.0574951171875, 0.3963623046875, 2.08114624023438, 0.38897705078125, 2.10519409179688, 0.381622314453125, 2.129638671875, 0.374298095703125, 2.15451049804688, 0.36700439453125, 2.1798095703125, 0.3597412109375, 2.20559692382812, 0.3525390625, 2.2318115234375, 0.345367431640625, 2.258544921875, 0.338226318359375, 2.2857666015625, 0.33111572265625, 2.31350708007812, 0.32403564453125, 2.341796875, 0.3170166015625, 2.37063598632812, 0.30999755859375, 2.40008544921875, 0.30303955078125, 2.43014526367188, 0.29608154296875, 2.46084594726562, 0.2891845703125, 2.49221801757812, 0.282318115234375, 2.52426147460938, 0.275482177734375, 2.55706787109375, 0.2686767578125, 2.59060668945312, 0.26190185546875, 2.62496948242188, 0.255157470703125, 2.66015625, 0.248443603515625, 2.69622802734375, 0.241790771484375, 2.73321533203125, 0.235137939453125, 2.77117919921875, 0.228515625, 2.8101806640625, 0.221923828125, 2.85025024414062, 0.215362548828125, 2.8914794921875, 0.208831787109375, 2.93389892578125, 0.20233154296875, 2.97763061523438, 0.19586181640625, 3.022705078125, 0.189422607421875, 3.06927490234375, 0.183013916015625, 3.11737060546875, 0.1766357421875, 3.1671142578125, 0.1702880859375, 3.2186279296875, 0.1639404296875, 3.2720947265625, 0.15765380859375, 3.32757568359375, 0.1513671875, 3.38528442382812, 0.1451416015625, 3.44540405273438, 0.138916015625, 3.50814819335938, 0.132720947265625, 3.57373046875, 0.126556396484375, 3.6424560546875, 0.12042236328125, 3.714599609375, 0.11431884765625, 3.79055786132812, 0.10821533203125, 3.8707275390625, 0.102142333984375, 3.95559692382812, 0.09613037109375, 4.04580688476562, 0.090118408203125, 4.14202880859375, 0.0841064453125, 4.2451171875, 0.078155517578125, 4.35614013671875, 0.072235107421875, 4.4764404296875, 0.066314697265625, 4.60769653320312, 0.0604248046875, 4.7520751953125, 0.0545654296875, 4.91253662109375, 0.0487060546875, 5.09310913085938, 0.04290771484375, 5.299560546875, 0.037109375, 5.54055786132812, 0.031341552734375, 5.830078125, 0.02557373046875, 6.19265747070312, 0.019866943359375, 6.67807006835938, 0.01416015625, 7.4150390625, 0.00848388671875, 9.0, 0.0028076171875 + 0.002807617187500, 9.000000000000000, 0.008483886718750, 7.415039062500000, 0.014160156250000, 6.678070068359375, 0.019866943359375, 6.192657470703125, + 0.025573730468750, 5.830078125000000, 0.031341552734375, 5.540557861328125, 0.037109375000000, 5.299560546875000, 0.042907714843750, 5.093109130859375, + 0.048706054687500, 4.912536621093750, 0.054565429687500, 4.752075195312500, 0.060424804687500, 4.607696533203125, 0.066314697265625, 4.476440429687500, + 0.072235107421875, 4.356140136718750, 0.078155517578125, 4.245117187500000, 0.084106445312500, 4.142028808593750, 0.090118408203125, 4.045806884765625, + 0.096130371093750, 3.955596923828125, 0.102142333984375, 3.870727539062500, 0.108215332031250, 3.790557861328125, 0.114318847656250, 3.714599609375000, + 0.120422363281250, 3.642456054687500, 0.126556396484375, 3.573730468750000, 0.132720947265625, 3.508148193359375, 0.138916015625000, 3.445404052734375, + 0.145141601562500, 3.385284423828125, 0.151367187500000, 3.327575683593750, 0.157653808593750, 3.272094726562500, 0.163940429687500, 3.218627929687500, + 0.170288085937500, 3.167114257812500, 0.176635742187500, 3.117370605468750, 0.183013916015625, 3.069274902343750, 0.189422607421875, 3.022705078125000, + 0.195861816406250, 2.977630615234375, 0.202331542968750, 2.933898925781250, 0.208831787109375, 2.891479492187500, 0.215362548828125, 2.850250244140625, + 0.221923828125000, 2.810180664062500, 0.228515625000000, 2.771179199218750, 0.235137939453125, 2.733215332031250, 0.241790771484375, 2.696228027343750, + 0.248443603515625, 2.660156250000000, 0.255157470703125, 2.624969482421875, 0.261901855468750, 2.590606689453125, 0.268676757812500, 2.557067871093750, + 0.275482177734375, 2.524261474609375, 0.282318115234375, 2.492218017578125, 0.289184570312500, 2.460845947265625, 0.296081542968750, 2.430145263671875, + 0.303039550781250, 2.400085449218750, 0.309997558593750, 2.370635986328125, 0.317016601562500, 2.341796875000000, 0.324035644531250, 2.313507080078125, + 0.331115722656250, 2.285766601562500, 0.338226318359375, 2.258544921875000, 0.345367431640625, 2.231811523437500, 0.352539062500000, 2.205596923828125, + 0.359741210937500, 2.179809570312500, 0.367004394531250, 2.154510498046875, 0.374298095703125, 2.129638671875000, 0.381622314453125, 2.105194091796875, + 0.388977050781250, 2.081146240234375, 0.396362304687500, 2.057495117187500, 0.403808593750000, 2.034210205078125, 0.411285400390625, 2.011322021484375, + 0.418792724609375, 1.988769531250000, 0.426361083984375, 1.966583251953125, 0.433959960937500, 1.944732666015625, 0.441589355468750, 1.923187255859375, + 0.449249267578125, 1.901977539062500, 0.456970214843750, 1.881072998046875, 0.464721679687500, 1.860443115234375, 0.472534179687500, 1.840118408203125, + 0.480377197265625, 1.820098876953125, 0.488250732421875, 1.800323486328125, 0.496185302734375, 1.780822753906250, 0.504150390625000, 1.761596679687500, + 0.512145996093750, 1.742614746093750, 0.520233154296875, 1.723876953125000, 0.528320312500000, 1.705383300781250, 0.536468505859375, 1.687103271484375, + 0.544677734375000, 1.669097900390625, 0.552917480468750, 1.651275634765625, 0.561218261718750, 1.633666992187500, 0.569549560546875, 1.616302490234375, + 0.577941894531250, 1.599121093750000, 0.586364746093750, 1.582153320312500, 0.594848632812500, 1.565368652343750, 0.603393554687500, 1.548797607421875, + 0.611968994140625, 1.532409667968750, 0.620635986328125, 1.516174316406250, 0.629302978515625, 1.500152587890625, 0.638061523437500, 1.484313964843750, + 0.646850585937500, 1.468627929687500, 0.655700683593750, 1.453094482421875, 0.664611816406250, 1.437744140625000, 0.673583984375000, 1.422576904296875, + 0.682586669921875, 1.407531738281250, 0.691650390625000, 1.392669677734375, 0.700805664062500, 1.377960205078125, 0.709991455078125, 1.363372802734375, + 0.719238281250000, 1.348937988281250, 0.728546142578125, 1.334655761718750, 0.737915039062500, 1.320526123046875, 0.747344970703125, 1.306518554687500, + 0.756835937500000, 1.292633056640625, 0.766387939453125, 1.278900146484375, 0.776000976562500, 1.265289306640625, 0.785675048828125, 1.251800537109375, + 0.795440673828125, 1.238433837890625, 0.805236816406250, 1.225219726562500, 0.815124511718750, 1.212097167968750, 0.825073242187500, 1.199096679687500, + 0.835083007812500, 1.186218261718750, 0.845184326171875, 1.173461914062500, 0.855346679687500, 1.160797119140625, 0.865570068359375, 1.148254394531250, + 0.875885009765625, 1.135803222656250, 0.886260986328125, 1.123474121093750, 0.896697998046875, 1.111267089843750, 0.907257080078125, 1.099121093750000, + 0.917846679687500, 1.087097167968750, 0.928527832031250, 1.075195312500000, 0.939300537109375, 1.063354492187500, 0.950164794921875, 1.051635742187500, + 0.961090087890625, 1.040008544921875, 0.972106933593750, 1.028442382812500, 0.983184814453125, 1.016998291015625, 0.994384765625000, 1.005645751953125, + 1.005645751953125, 0.994384765625000, 1.016998291015625, 0.983184814453125, 1.028442382812500, 0.972106933593750, 1.040008544921875, 0.961090087890625, + 1.051635742187500, 0.950164794921875, 1.063354492187500, 0.939300537109375, 1.075195312500000, 0.928527832031250, 1.087097167968750, 0.917846679687500, + 1.099121093750000, 0.907257080078125, 1.111267089843750, 0.896697998046875, 1.123474121093750, 0.886260986328125, 1.135803222656250, 0.875885009765625, + 1.148254394531250, 0.865570068359375, 1.160797119140625, 0.855346679687500, 1.173461914062500, 0.845184326171875, 1.186218261718750, 0.835083007812500, + 1.199096679687500, 0.825073242187500, 1.212097167968750, 0.815124511718750, 1.225219726562500, 0.805236816406250, 1.238433837890625, 0.795440673828125, + 1.251800537109375, 0.785675048828125, 1.265289306640625, 0.776000976562500, 1.278900146484375, 0.766387939453125, 1.292633056640625, 0.756835937500000, + 1.306518554687500, 0.747344970703125, 1.320526123046875, 0.737915039062500, 1.334655761718750, 0.728546142578125, 1.348937988281250, 0.719238281250000, + 1.363372802734375, 0.709991455078125, 1.377960205078125, 0.700805664062500, 1.392669677734375, 0.691650390625000, 1.407531738281250, 0.682586669921875, + 1.422576904296875, 0.673583984375000, 1.437744140625000, 0.664611816406250, 1.453094482421875, 0.655700683593750, 1.468627929687500, 0.646850585937500, + 1.484313964843750, 0.638061523437500, 1.500152587890625, 0.629302978515625, 1.516174316406250, 0.620635986328125, 1.532409667968750, 0.611968994140625, + 1.548797607421875, 0.603393554687500, 1.565368652343750, 0.594848632812500, 1.582153320312500, 0.586364746093750, 1.599121093750000, 0.577941894531250, + 1.616302490234375, 0.569549560546875, 1.633666992187500, 0.561218261718750, 1.651275634765625, 0.552917480468750, 1.669097900390625, 0.544677734375000, + 1.687103271484375, 0.536468505859375, 1.705383300781250, 0.528320312500000, 1.723876953125000, 0.520233154296875, 1.742614746093750, 0.512145996093750, + 1.761596679687500, 0.504150390625000, 1.780822753906250, 0.496185302734375, 1.800323486328125, 0.488250732421875, 1.820098876953125, 0.480377197265625, + 1.840118408203125, 0.472534179687500, 1.860443115234375, 0.464721679687500, 1.881072998046875, 0.456970214843750, 1.901977539062500, 0.449249267578125, + 1.923187255859375, 0.441589355468750, 1.944732666015625, 0.433959960937500, 1.966583251953125, 0.426361083984375, 1.988769531250000, 0.418792724609375, + 2.011322021484375, 0.411285400390625, 2.034210205078125, 0.403808593750000, 2.057495117187500, 0.396362304687500, 2.081146240234375, 0.388977050781250, + 2.105194091796875, 0.381622314453125, 2.129638671875000, 0.374298095703125, 2.154510498046875, 0.367004394531250, 2.179809570312500, 0.359741210937500, + 2.205596923828125, 0.352539062500000, 2.231811523437500, 0.345367431640625, 2.258544921875000, 0.338226318359375, 2.285766601562500, 0.331115722656250, + 2.313507080078125, 0.324035644531250, 2.341796875000000, 0.317016601562500, 2.370635986328125, 0.309997558593750, 2.400085449218750, 0.303039550781250, + 2.430145263671875, 0.296081542968750, 2.460845947265625, 0.289184570312500, 2.492218017578125, 0.282318115234375, 2.524261474609375, 0.275482177734375, + 2.557067871093750, 0.268676757812500, 2.590606689453125, 0.261901855468750, 2.624969482421875, 0.255157470703125, 2.660156250000000, 0.248443603515625, + 2.696228027343750, 0.241790771484375, 2.733215332031250, 0.235137939453125, 2.771179199218750, 0.228515625000000, 2.810180664062500, 0.221923828125000, + 2.850250244140625, 0.215362548828125, 2.891479492187500, 0.208831787109375, 2.933898925781250, 0.202331542968750, 2.977630615234375, 0.195861816406250, + 3.022705078125000, 0.189422607421875, 3.069274902343750, 0.183013916015625, 3.117370605468750, 0.176635742187500, 3.167114257812500, 0.170288085937500, + 3.218627929687500, 0.163940429687500, 3.272094726562500, 0.157653808593750, 3.327575683593750, 0.151367187500000, 3.385284423828125, 0.145141601562500, + 3.445404052734375, 0.138916015625000, 3.508148193359375, 0.132720947265625, 3.573730468750000, 0.126556396484375, 3.642456054687500, 0.120422363281250, + 3.714599609375000, 0.114318847656250, 3.790557861328125, 0.108215332031250, 3.870727539062500, 0.102142333984375, 3.955596923828125, 0.096130371093750, + 4.045806884765625, 0.090118408203125, 4.142028808593750, 0.084106445312500, 4.245117187500000, 0.078155517578125, 4.356140136718750, 0.072235107421875, + 4.476440429687500, 0.066314697265625, 4.607696533203125, 0.060424804687500, 4.752075195312500, 0.054565429687500, 4.912536621093750, 0.048706054687500, + 5.093109130859375, 0.042907714843750, 5.299560546875000, 0.037109375000000, 5.540557861328125, 0.031341552734375, 5.830078125000000, 0.025573730468750, + 6.192657470703125, 0.019866943359375, 6.678070068359375, 0.014160156250000, 7.415039062500000, 0.008483886718750, 9.000000000000000, 0.002807617187500, + }; @@ -367,7 +414,7 @@ uint32_t kvz_get_coeff_cost(const encoder_state_t * const state, * \param ctx_num_abs current ctxInc for coeff_abs_level_greater2 (remaining bins of coeff_abs_level_minus1 in AVC) * \param abs_go_rice Rice parameter for coeff_abs_level_minus3 * \returns cost of given absolute transform level - * From HM 12.0 + * From VTM 13.0 */ INLINE int32_t kvz_get_ic_rate(encoder_state_t * const state, uint32_t abs_level, @@ -499,7 +546,7 @@ INLINE int32_t kvz_get_ic_rate(encoder_state_t * const state, * \param last indicates if the coefficient is the last significant * \returns best quantized transform level for given scan position * This method calculates the best quantized transform level for a given scan position. - * From HM 12.0 + * From VTM 13.0 */ INLINE uint32_t kvz_get_coded_level( encoder_state_t * const state, double *coded_cost, double *coded_cost0, double *coded_cost_sig, int32_t level_double, uint32_t max_abs_level, @@ -553,7 +600,7 @@ INLINE uint32_t kvz_get_coded_level( encoder_state_t * const state, double *code * \returns cost of last significant coefficient * \param uiWidth width of the transform unit (TU) * - * From HM 12.0 + * From VTM 13.0 */ static double get_rate_last(double lambda, const uint32_t pos_x, const uint32_t pos_y, @@ -619,10 +666,10 @@ void kvz_rdoq_sign_hiding( const int32_t last_pos, const coeff_t *const coeffs, coeff_t *const quant_coeffs, - const int8_t type) + const int8_t color) { const encoder_control_t * const ctrl = state->encoder_control; - const double lambda = type ? state->c_lambda : state->lambda; + const double lambda = color ? state->c_lambda : state->lambda; int inv_quant = kvz_g_inv_quant_scales[qp_scaled % 6]; // This somehow scales quant_delta into fractional bits. Instead of the bits @@ -1302,10 +1349,8 @@ int kvz_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_ * \returns void * Rate distortion optimized quantization for entropy * coding engines using probability models like CABAC - * From HM 12.0 + * From VTM 13.0 */ - -// ToDo: implement new RDOQ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff, int32_t width, int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth, uint16_t cbf) { diff --git a/src/search.c b/src/search.c index 2d10cb0d..c874f6c2 100644 --- a/src/search.c +++ b/src/search.c @@ -253,17 +253,6 @@ double kvz_cu_rd_cost_luma(const encoder_state_t *const state, const uint8_t tr_depth = tr_cu->tr_depth - depth; - // Add transform_tree split_transform_flag bit cost. - bool intra_split_flag = pred_cu->type == CU_INTRA && pred_cu->part_size == SIZE_NxN && depth == 3; - if (width <= TR_MAX_WIDTH - && width > TR_MIN_WIDTH - && !intra_split_flag) - { - // ToDo: check cost - //const cabac_ctx_t *ctx = &(state->cabac.ctx.trans_subdiv_model[5 - (6 - depth)]); - //tr_tree_bits += CTX_ENTROPY_FBITS(ctx, tr_depth > 0); - } - if (tr_depth > 0) { int offset = width / 2; double sum = 0; @@ -330,7 +319,6 @@ double kvz_cu_rd_cost_chroma(const encoder_state_t *const state, if (depth < MAX_PU_DEPTH) { const int tr_depth = depth - pred_cu->depth; - // ToDo: Update for VVC contexts const cabac_ctx_t *ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]); if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) { tr_tree_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U)); diff --git a/src/search_intra.c b/src/search_intra.c index b06e17a5..30623aa4 100644 --- a/src/search_intra.c +++ b/src/search_intra.c @@ -382,19 +382,8 @@ static double search_intra_trdepth(encoder_state_t * const state, split_cost += search_intra_trdepth(state, x_px + offset, y_px + offset, depth + 1, max_depth, intra_mode, nosplit_cost, pred_cu, lcu, -1); } - double tr_split_bit = 0.0; double cbf_bits = 0.0; - // Add bits for split_transform_flag = 1, because transform depth search bypasses - // the normal recursion in the cost functions. - /* - // ToDo: check costs - if (depth >= 1 && depth <= 3) { - const cabac_ctx_t *ctx = &(state->cabac.ctx.trans_subdiv_model[5 - (6 - depth)]); - tr_split_bit += CTX_ENTROPY_FBITS(ctx, 1); - } - */ - // Add cost of cbf chroma bits on transform tree. // All cbf bits are accumulated to pred_cu.cbf and cbf_is_set returns true // if cbf is set at any level >= depth, so cbf chroma is assumed to be 0 @@ -404,7 +393,6 @@ static double search_intra_trdepth(encoder_state_t * const state, if (state->encoder_control->chroma_format != KVZ_CSP_400) { const uint8_t tr_depth = depth - pred_cu->depth; - // ToDo: update for VVC contexts const cabac_ctx_t* ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]); if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) { cbf_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U)); @@ -415,7 +403,7 @@ static double search_intra_trdepth(encoder_state_t * const state, } } - double bits = tr_split_bit + cbf_bits; + double bits = cbf_bits; split_cost += bits * state->lambda; } else { assert(width <= TR_MAX_WIDTH);