SHA256
Apply VFlip to Encoder
This commit is contained in:
1 parent
1c984176cd
commit
8dd33c1807
1 file changed
+6
-2
@@ -174,8 +174,12 @@ namespace ADOFAIRenderer.Util.FFmpeg
|
||||
{
|
||||
if (!_isInitialized) throw new InvalidOperationException("인코더가 초기화되지 않았습니다.");
|
||||
|
||||
_pSrcFrame->data[0] = buffer;
|
||||
_pSrcFrame->linesize[0] = _settings.Width * 4; // RGBA = 4 bytes per pixel
|
||||
// Unity의 Bottom-Left origin 좌표계를 FFmpeg의 Top-Left origin 좌표계로 맞추기 위해
|
||||
// 포인터를 마지막 행의 시작 위치로 옮기고 stride(linesize)를 음수(-)로 주어 상하 반전(vflip)을 수행합니다.
|
||||
// 추가적인 메모리 카피나 GPU 연산 없이 sws_scale 내부에서 초고속으로 상하가 반전됩니다.
|
||||
int stride = _settings.Width * 4;
|
||||
_pSrcFrame->data[0] = buffer + stride * (_settings.Height - 1);
|
||||
_pSrcFrame->linesize[0] = -stride;
|
||||
_pSrcFrame->width = _settings.Width;
|
||||
_pSrcFrame->height = _settings.Height;
|
||||
_pSrcFrame->format = (int)AVPixelFormat.AV_PIX_FMT_RGBA;
|
||||
|
||||
Reference in new issue
Block a user