mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-06 13:38:30 +09:00
interlacing wip2
This commit is contained in:
@@ -399,10 +399,10 @@ serial.println(` Resolution: ${width}x${height}, ${isInterlaced ? "interlaced"
|
|||||||
|
|
||||||
|
|
||||||
// DEBUG interlace raw output
|
// DEBUG interlace raw output
|
||||||
if (isInterlaced) {
|
//if (isInterlaced) {
|
||||||
height = height >> 1
|
// height = height >> 1
|
||||||
isInterlaced = false
|
// isInterlaced = false
|
||||||
}
|
//}
|
||||||
// END OF DEBUG
|
// END OF DEBUG
|
||||||
|
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ try {
|
|||||||
// Hardware-accelerated TEV decoding to RGB buffers (YCoCg-R or XYB based on version)
|
// Hardware-accelerated TEV decoding to RGB buffers (YCoCg-R or XYB based on version)
|
||||||
try {
|
try {
|
||||||
let decodeStart = sys.nanoTime()
|
let decodeStart = sys.nanoTime()
|
||||||
graphics.tevDecode(blockDataPtr, CURRENT_RGB_ADDR, PREV_RGB_ADDR, width, height, [qualityY, qualityCo, qualityCg], debugMotionVectors, version, isInterlaced)
|
graphics.tevDecode(blockDataPtr, CURRENT_RGB_ADDR, PREV_RGB_ADDR, width, height, [qualityY, qualityCo, qualityCg], frameCount, debugMotionVectors, version, isInterlaced)
|
||||||
decodeTime = (sys.nanoTime() - decodeStart) / 1000000.0 // Convert to milliseconds
|
decodeTime = (sys.nanoTime() - decodeStart) / 1000000.0 // Convert to milliseconds
|
||||||
|
|
||||||
// Upload RGB buffer to display framebuffer with dithering
|
// Upload RGB buffer to display framebuffer with dithering
|
||||||
|
|||||||
@@ -1526,6 +1526,7 @@ class GraphicsJSR223Delegate(private val vm: VM) {
|
|||||||
fun yadifDeinterlace(fieldRGBAddr: Long, outputRGBAddr: Long, width: Int, height: Int,
|
fun yadifDeinterlace(fieldRGBAddr: Long, outputRGBAddr: Long, width: Int, height: Int,
|
||||||
prevFieldAddr: Long, nextFieldAddr: Long, fieldParity: Int,
|
prevFieldAddr: Long, nextFieldAddr: Long, fieldParity: Int,
|
||||||
fieldIncVec: Int, outputIncVec: Int) {
|
fieldIncVec: Int, outputIncVec: Int) {
|
||||||
|
|
||||||
val fieldHeight = height / 2
|
val fieldHeight = height / 2
|
||||||
|
|
||||||
for (y in 0 until fieldHeight) {
|
for (y in 0 until fieldHeight) {
|
||||||
@@ -1796,8 +1797,8 @@ class GraphicsJSR223Delegate(private val vm: VM) {
|
|||||||
* @param frameCounter Frame counter for temporal patterns
|
* @param frameCounter Frame counter for temporal patterns
|
||||||
*/
|
*/
|
||||||
fun tevDecode(blockDataPtr: Long, currentRGBAddr: Long, prevRGBAddr: Long,
|
fun tevDecode(blockDataPtr: Long, currentRGBAddr: Long, prevRGBAddr: Long,
|
||||||
width: Int, height: Int, qualityIndices: IntArray, debugMotionVectors: Boolean = false,
|
width: Int, height: Int, qualityIndices: IntArray, frameCounter: Int,
|
||||||
tevVersion: Int = 2, isInterlaced: Boolean = false) {
|
debugMotionVectors: Boolean = false, tevVersion: Int = 2, isInterlaced: Boolean = false) {
|
||||||
|
|
||||||
// height doesn't change when interlaced, because that's the encoder's output
|
// height doesn't change when interlaced, because that's the encoder's output
|
||||||
|
|
||||||
@@ -2191,7 +2192,7 @@ class GraphicsJSR223Delegate(private val vm: VM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply Yadif deinterlacing if this is an interlaced frame
|
// Apply Yadif deinterlacing if this is an interlaced frame
|
||||||
/*if (isInterlaced) {
|
if (isInterlaced) {
|
||||||
// Decode produced a field at half-height, now deinterlace to full progressive frame
|
// Decode produced a field at half-height, now deinterlace to full progressive frame
|
||||||
val tempFieldBuffer = vm.malloc(width * decodingHeight * 3)
|
val tempFieldBuffer = vm.malloc(width * decodingHeight * 3)
|
||||||
|
|
||||||
@@ -2202,12 +2203,12 @@ class GraphicsJSR223Delegate(private val vm: VM) {
|
|||||||
yadifDeinterlace(
|
yadifDeinterlace(
|
||||||
tempFieldBuffer.toLong(), currentRGBAddr, width, height,
|
tempFieldBuffer.toLong(), currentRGBAddr, width, height,
|
||||||
prevRGBAddr, prevRGBAddr, // TODO: Implement proper temporal prediction
|
prevRGBAddr, prevRGBAddr, // TODO: Implement proper temporal prediction
|
||||||
0, // Field parity (0=even field first)
|
frameCounter % 2, // Field parity (0=even field first)
|
||||||
thisAddrIncVec, thisAddrIncVec
|
thisAddrIncVec, thisAddrIncVec
|
||||||
)
|
)
|
||||||
|
|
||||||
vm.free(tempFieldBuffer.toInt())
|
vm.free(tempFieldBuffer.toInt())
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user