Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
fix: keep portrait viewport consistent when rotation metadata has no SAR
Veyra Goal Agentd64d7afda94f
diff --git a/scripts/acceptance/pro-video-geometry-test.py b/scripts/acceptance/pro-video-geometry-test.pyindex 7245e20b..f49ed179 100644--- a/scripts/acceptance/pro-video-geometry-test.py+++ b/scripts/acceptance/pro-video-geometry-test.py@@ -109,7 +109,6 @@ try:with console.open('wb') as stream:command=[str(APP/'veyra_qml_ui.exe'),'--data-dir',str(PROFILE),'--page','home','--size','1400x900','--exit-after','70000']if MODE=='software':command.append('--obs-game-capture')- if MODE=='software':command.append('--obs-game-capture')proc=subprocess.Popen(command,cwd=APP,env=env,stdout=stream,stderr=subprocess.STDOUT)while proc.poll() is None:if time.monotonic()-start>80:proc.kill();raise TimeoutError('GUI timeout')diff --git a/scripts/acceptance/rotation-video-test.py b/scripts/acceptance/rotation-video-test.pyindex d2971de7..efa6094c 100644--- a/scripts/acceptance/rotation-video-test.py+++ b/scripts/acceptance/rotation-video-test.py@@ -26,10 +26,13 @@ if not stage.exists():dest.parent.mkdir(parents=True,exist_ok=True)if rel.parts[0]=='qml':shutil.copy2(source,dest)else:os.link(source,dest)+assert hashlib.sha256((stage/'veyra_qml_ui.exe').read_bytes()).digest()==hashlib.sha256((a.donor_app/'veyra_qml_ui.exe').read_bytes()).digest(),'Stage belongs to a different donor build'qml=stage/'qml/Veyra/Main.qml';original=qml.read_bytes()angles=(0,90,180,270,0)paths=[str(a.media_dir/f'rotation{angle}.mp4') for angle in angles]assert all(Path(path).is_file() for path in paths)+fixture=json.loads((a.media_dir/'rotation0.json').read_text('utf8'))['streams'][0]+codedAspect=fixture['width']/fixture['height']probe=stage/'qml/Veyra/RotationVideoProbe.qml';shutil.copy2(root/'scripts/acceptance/rotation-video-probe.qml',probe)text=original.decode('utf8');at=text.rfind('}')qml.write_text(text[:at]+'\nLoader { source:"RotationVideoProbe.qml"; onLoaded:item.paths='+json.dumps(paths,ensure_ascii=False)+' }\n'+text[at:],'utf8')@@ -62,7 +65,7 @@ def video_window(pid):command=[str(stage/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','min','--size','720x500','--exit-after','80000']-rows=[];seen=set();references=None;proc=None;start=time.monotonic()+rows=[];seen=set();references=None;proc=None;rc=None;error='';start=time.monotonic()try:with (log/'console.log').open('wb') as stream:proc=subprocess.Popen(command,cwd=stage,env=env,stdout=stream,stderr=subprocess.STDOUT)@@ -74,6 +77,7 @@ try:if index in seen:continueseen.add(index);hwnd=video_window(proc.pid)u.SetWindowPos(u.GetParent(hwnd),W.HWND(-1),0,0,0,0,0x0013)+ time.sleep(.15)rect=W.RECT();assert u.GetWindowRect(hwnd,ctypes.byref(rect))image=ImageGrab.grab(bbox=(rect.left,rect.top,rect.right,rect.bottom),all_screens=True)image.save(log/f'rotation-{index}-{angles[index]}.png')@@ -83,21 +87,27 @@ try:references=values;assert all(references[k]-references[k+1]>25 for k in range(3)),valuesorder={0:(0,1,2,3),90:(2,0,3,1),180:(3,2,1,0),270:(1,3,0,2)}[angles[index]]expected=[references[k] for k in order]- row.update(angle=angles[index],samples=values,expected=expected,passed=max(abs(x-y) for x,y in zip(values,expected))<15,+ expectedAspect=1/codedAspect if angles[index] in (90,270) else codedAspect+ aspectPassed=abs(row['aspect']-expectedAspect)<.001+ row.update(angle=angles[index],samples=values,expected=expected,expectedAspect=expectedAspect,aspectPassed=aspectPassed,+ passed=aspectPassed and max(abs(x-y) for x,y in zip(values,expected))<15,hwndExtent=[image.width,image.height])rows.append(row);print(json.dumps(row),flush=True)time.sleep(.08)rc=proc.returncode+except Exception as exc:+ error=type(exc).__name__+': '+str(exc);print(error,flush=True)finally:if proc is not None and proc.poll() is None:proc.terminate();proc.wait(timeout=10)qml.write_bytes(original);probe.unlink(missing_ok=True)text=(log/'console.log').read_text('utf8',errors='replace')-completed=rc==0 and len(rows)==len(angles) and 'GUI_ROTATION_DONE' in text and 'GUI_ROTATION_FAIL' not in text+completed=not error and rc==0 and len(rows)==len(angles) and 'GUI_ROTATION_DONE' in text and 'GUI_ROTATION_FAIL' not in textpassed=completed and (all(row['passed'] for row in rows) if a.variant=='after' else all(row['passed'] for row in rows if row['angle']==0) and all(not row['passed'] for row in rows if row['angle']!=0))-result=dict(passed=passed,completed=completed,variant=a.variant,command=command,rows=rows,+result=dict(passed=passed,completed=completed,variant=a.variant,command=command,rows=rows,error=error,exit=rc,exeSha256=hashlib.sha256((stage/'veyra_qml_ui.exe').read_bytes()).hexdigest(),scope='Actual GUI/native video pixels, SDR synthetic display-matrix files; no NR/FG enabled')(log/'receipt.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),'utf8')+(base/'reports'/a.task).mkdir(parents=True,exist_ok=True)(base/'reports'/a.task/('rotation-'+a.variant+'.json')).write_text(json.dumps(dict(passed=passed,receipt=str(log/'receipt.json')),indent=2),'utf8')print('RESULT',passed,log,flush=True)raise SystemExit(not passed)diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 04f89d5f..faac70c1 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -4060,13 +4060,12 @@ double QmlPlayerBridge::sourceFps() const { return impl_->snapshot.nominalSourceint QmlPlayerBridge::sourceRotation() const { return impl_->snapshot.sourceRotationDegrees; }double QmlPlayerBridge::sourceAspect() const {const auto& s = impl_->snapshot;- // The container's display aspect already accounts for sample aspect ratio and- // rotation, so prefer it. The pixel ratio is only a fallback for a source that- // reported none, and it is never presented as more than that.- if (s.sourceDisplayAspect > 0.01) return s.sourceDisplayAspect;- if (s.sourceWidth > 0 && s.sourceHeight > 0)- return double(s.sourceWidth) / double(s.sourceHeight);- return 0.0;+ // A known DAR already includes SAR/rotation. With no DAR, rotate the coded+ // extent as the presenter does; phone files can omit SAR yet carry a matrix.+ engine::PreviewView view;+ view.displayAspect=s.sourceDisplayAspect;+ view.rotationDegrees=s.sourceRotationDegrees;+ return view.aspect(float(s.sourceWidth),float(s.sourceHeight));}// --- live performance -------------------------------------------------------@@ -6751,7 +6750,10 @@ double QmlPlayerBridge::previewAspect() const {const int mode=impl_->screenFillActive?2:impl_->aspectMode;if(mode==4)return 16.0/9;if(mode==5)return 4.0/3;if(mode==6)return 21.0/9;const auto e=impl_->snapshot.metrics.resolution.output;- if(mode==1&&e.height)return double(e.width)/e.height;+ if(mode==1&&e.height){+ engine::PreviewView view;view.mode=1;view.rotationDegrees=impl_->snapshot.sourceRotationDegrees;+ return view.aspect(float(e.width),float(e.height));+ }return sourceAspect();}void QmlPlayerBridge::setDisplaySync(int value) {diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cppindex a392ef8b..4036f34a 100644--- a/tests/unit/UiContractTests.cpp+++ b/tests/unit/UiContractTests.cpp@@ -126,10 +126,12 @@ int wmain(int argc,wchar_t** argv){try{v.wheel(-3,800,300,1000,600,1920,1080);require(std::abs(v.zoom-1)<.0001f&&std::abs(v.centerX-.5f)<.0001f,"inverse wheel returns same view");v.pan(100,0,1000,600,1920,1080);require(std::abs(v.centerX-.4f)<.0001f,"pan measured in displayed pixels");}{engine::PreviewView v;v.rotationDegrees=90;+ require(std::abs(v.aspect(1920,1080)-9.0/16)<.00001,"missing SAR still gives oriented preview aspect");const auto size=v.renderedSize(320,240,64,32);require(size.first==120&&size.second==240,"portrait contain uses rotated extent");const auto source=v.sourcePoint(130,60,320,240,64,32);require(source.first==.25f&&source.second==.75f,"portrait protection maps display corner to coded source");const auto display=v.displayUv(source.first,source.second);require(display.first==.25f&&display.second==.25f,"inverse source/display rotation agrees");v.mode=1;const auto native=v.renderedSize(320,240,64,32);require(native.first==32&&native.second==64,"native-pixel view swaps dimensions for portrait");+ require(std::abs(v.aspect(1920,1080)-9.0/16)<.00001,"native preview aspect rotates the output extent");v.mode=0;v.rotationDegrees=-90;const auto opposite=v.sourceUv(.25f,.25f);require(opposite.first==.75f&&opposite.second==.25f,"opposite display matrix rotates the other way");v.rotationDegrees=180;const auto upsideDown=v.sourceUv(.25f,.25f);require(upsideDown.first==.75f&&upsideDown.second==.75f,"upside-down display matrix maps both axes");v.rotationDegrees=90;v.displayAspect=.75;require(std::abs(v.aspect(64,32)-.75)<.00001,"already-oriented SAR is not inverted twice");}