GNOME Bugzilla – Bug 627768
add NV12 support to textoverlay
Last modified: 2010-08-30 22:56:45 UTC
patch attached
Created attachment 168590 [details] [review] patch to add NV12 support
commit 1b6918709c4bb843a6dbd932f292d45519d15dcf Author: Rob Clark <rob@ti.com> Date: Mon Aug 23 13:59:38 2010 -0500 textoverlay: add NV12 support Fixes bug #627768.
Apparently something is wrong here with the chroma. If you choose a color that has cb!=cr you'll see that the chroma planes are both swapped. This should be blue, not red: gst-launch-0.10 videotestsrc ! "video/x-raw-yuv,format=(fourcc)NV12,width=800,height=600" ! clockoverlay color=0xff0000ff font-desc="Sans 30" ! ffmpegcolorspace ! ximagesink
Unfortunately I don't see the mistake here, it seems to be written in the correct order and it's done in the same order as for I420 where it works.
hmm, maybe offset to first pixel of U is off by one? Ok, well, I'll check into this in the evening
well, I can reproduce same issue.. with above pipeline I get red (whereas I420 I get blue).. I can't help but think there is an off by one somewhere, which would show up this way as inverted Cr/Cb with NV12/NV21 but may be less noticed with I420.. but I'll have to debug tomorrow.
Marking as blocker as this should get fixed before 0.10.31 or reverted
Created attachment 169124 [details] [review] fix Cb/Cr inversion that previously existed with NV12/NV21/UYVY In case of odd values for xpos or ypos, the division by two in CbCr plane would result in an off-by-one error, which in the case of NV12, NV21, or UYVY would cause inversion of blue and red colors. (And would be not so easily noticed for I420 as it would just cause the chroma to be offset slightly from the luma.) This patch also fixes a silly typo from the earlier patch which added NV12 support that broke UYVY support.
commit 54f4aa28c227825e48fd7940b3566630a10cffe9 Author: Rob Clark <rob@ti.com> Date: Mon Aug 30 14:59:22 2010 -0500 textoverlay: fix Cb/Cr inversion for colored text overlays In case of odd values for xpos or ypos, the division by two in CbCr plane would result in an off-by-one error, which in the case of NV12, NV21, or UYVY would cause inversion of blue and red colors. (And would be not so easily noticed for I420 as it would just cause the chroma to be offset slightly from the luma.) This patch also fixes a silly typo from the earlier patch which added NV12 support that broke UYVY support.
As an aside, is there a reason for using NV12?