{"action":"created","issue":{"url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/334","labels_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/334/labels{/name}","comments_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/334/comments","events_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/334/events","html_url":"https://github.com/AngryLawyer/rust-sdl2/issues/334","id":57583367,"number":334,"title":"Texture::with_lock() is too small for planar pixel formats","user":{"login":"pcwalton","id":157897,"avatar_url":"https://avatars.githubusercontent.com/u/157897?v=3","gravatar_id":"","url":"https://api.github.com/users/pcwalton","html_url":"https://github.com/pcwalton","followers_url":"https://api.github.com/users/pcwalton/followers","following_url":"https://api.github.com/users/pcwalton/following{/other_user}","gists_url":"https://api.github.com/users/pcwalton/gists{/gist_id}","starred_url":"https://api.github.com/users/pcwalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcwalton/subscriptions","organizations_url":"https://api.github.com/users/pcwalton/orgs","repos_url":"https://api.github.com/users/pcwalton/repos","events_url":"https://api.github.com/users/pcwalton/events{/privacy}","received_events_url":"https://api.github.com/users/pcwalton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-13T10:35:27Z","updated_at":"2015-02-13T20:49:43Z","closed_at":null,"body":"Sadly the fix for #331 doesn't seem to be correct for planar pixel formats like YUV. We need to multiply by the stride and take 4:2:0 sampling into account. i.e. the length for YUV will be `height * stride + 2 * (height / 2) * (stride / 2)`. (Note that SDL itself doesn't handle this correctly in all drivers when the width is odd—see this [workaround in FFmpeg]).\r\n\r\n[workaround in FFmpeg]: https://trac.ffmpeg.org/attachment/ticket/1322/0001-ffplay-fix-odd-YUV-width-by-cropping-the-video.patch"},"comment":{"url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/comments/74324481","html_url":"https://github.com/AngryLawyer/rust-sdl2/issues/334#issuecomment-74324481","issue_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/334","id":74324481,"user":{"login":"nukep","id":1551458,"avatar_url":"https://avatars.githubusercontent.com/u/1551458?v=3","gravatar_id":"","url":"https://api.github.com/users/nukep","html_url":"https://github.com/nukep","followers_url":"https://api.github.com/users/nukep/followers","following_url":"https://api.github.com/users/nukep/following{/other_user}","gists_url":"https://api.github.com/users/nukep/gists{/gist_id}","starred_url":"https://api.github.com/users/nukep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nukep/subscriptions","organizations_url":"https://api.github.com/users/nukep/orgs","repos_url":"https://api.github.com/users/nukep/repos","events_url":"https://api.github.com/users/nukep/events{/privacy}","received_events_url":"https://api.github.com/users/nukep/received_events","type":"User","site_admin":false},"created_at":"2015-02-13T20:49:43Z","updated_at":"2015-02-13T20:49:43Z","body":"So does this mean that Textures with planar formats should be required to have multiple-of-two widths on `Texture::create_texture()` (due to driver inconsistencies)? I suppose that's easier to fix here than SDL itself...\r\n\r\nDoes the `height` also need to be a multiple-of-two? In the length calculation `height * stride + 2 * (height / 2) * (stride / 2)`, I see that `height` is truncated in the case that `height` is odd."}}