-
Notifications
You must be signed in to change notification settings - Fork 35
mp4再生で半透明になる問題修正 #24
base: main
Are you sure you want to change the base?
mp4再生で半透明になる問題修正 #24
Conversation
4d3bd2d to
42c893e
Compare
| private let commandQueue: MTLCommandQueue | ||
| private let textureCache: CVMetalTextureCache | ||
| private let pipelineState: MTLRenderPipelineState | ||
| private let mp4PipelineState: MTLRenderPipelineState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipelineは常に1つのみを保持するようにしてください
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlayerViewインスタンスが作ったらmp4,hevcどっちでも再生可能なので2つ用意する必要があるが、どこか勘違いしてました? もしくはlazy initか
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
将来的にPlayerViewとPlayer・Assetに分割するのでこの実装のままでもOKとします。
ただし変数名に関してはビデオフォーマットではなくシェーダの実態を表す名前にしてください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名前修正しました
| baseCbCrTexture.sample(colorSampler, in.texCoords).rg, | ||
| 1.0f); | ||
| // yuv video range to full range | ||
| baseYUVColor.r = (baseYUVColor.r - (16.0f/255.0f)) * (255.0f/(235.0f-16.0f)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
フルレンジのmp4を読み込んだ場合に意図しない変換が行われるように見えます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range shader内で判定できないので、asset読み込みで指定しないといけないが、それであってますか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あってます、レンダリング前に判断して分岐する必要があります。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
動画読み込み時にPixelFormatType明示的にvideo rangeに指定しました
530c11f to
bb58acc
Compare
thread blockされたときにメモリー使用量急に増えないようにした
* mp4再生で半透明になる問題
bb58acc to
4e7ccf9
Compare
defaultのPixelFormatが kCVPixelFormatType_420YpCbCr8BiPlanarVideoRangeになっていて、rangeとしては(luma=[16,235] chroma=[16,240])のため、alpha用のr値が0,255になれなかった問題。
metal部分でrange変更追加して修正.
hevcのalpha部分は修正不要なので、処理わけるようにした