TOP ROW: Y00, U00, Y01, V00, Y02, U01, Y03, V01,
BOTTOM ROW: Y10, U10, Y11, V10, Y12, U11, Y13, V11,
Result is interpolation of: (Y00, Y01, Y10, Y11), (U00, U01, U10, U11), (Y02, Y03, Y12, Y13), (U00, U01, U10, U11).
That forms my first two YUYV pixels of 32 bits.
Hello,I was going through libyuv's scaling algorithms in scale.cc, and understand that it does per plane scaling. I had a couple of questions:
- Can Y, U and V also be treated as planes just the same as R, G and B would be? Meaning, Y, U and V are difference channels - would the arithmetic of doing bilinear interpolation between luma and the two chroma channels work out alright? Are there any edge cases I need to be worried about?
- If the format is pixel instead of Planar (that is, if the luma and chroma channels are interleaved, example: YUV422),then is this bilinear interpolation algorithm correct?
TOP ROW: Y00, U00, Y01, V00, Y02, U01, Y03, V01,
BOTTOM ROW: Y10, U10, Y11, V10, Y12, U11, Y13, V11,
Result is interpolation of: (Y00, Y01, Y10, Y11), (U00, U01, U10, U11), (Y02, Y03, Y12, Y13), (U00, U01, U10, U11).
That forms my first two YUYV pixels of 32 bits.
--RegardsSrujan
You received this message because you are subscribed to the Google Groups "discuss-libyuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyuv+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
RegardsSrujan
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyu...@googlegroups.com.
I am not sure I understand the reasoning for the second question. Whether you convert into planar format, perform the arithmetic and convert back to pixel format OR you pick the values at the right indices without doing a conversion and then perform the arithmetic - the result ought to be the same. What am I missing? Are the interpolation indices I chose in the example wrong?
The whole point of doing a direct YUYV conversion is to avoid any conversions. A few known recommendations were to convert to RGBA, scale and then scale back.
On Wednesday, September 14, 2016 at 10:21:37 AM UTC-7, Frank Barchard wrote:On Wed, Sep 14, 2016 at 8:39 AM, Srujan Sriram <srujan...@gmail.com> wrote:Hello,I was going through libyuv's scaling algorithms in scale.cc, and understand that it does per plane scaling. I had a couple of questions:
- Can Y, U and V also be treated as planes just the same as R, G and B would be? Meaning, Y, U and V are difference channels - would the arithmetic of doing bilinear interpolation between luma and the two chroma channels work out alright? Are there any edge cases I need to be worried about?
Yes you can scale them independently. There may be a small shift in chroma if you scale chroma differently than luma.
- If the format is pixel instead of Planar (that is, if the luma and chroma channels are interleaved, example: YUV422),then is this bilinear interpolation algorithm correct?
TOP ROW: Y00, U00, Y01, V00, Y02, U01, Y03, V01,
BOTTOM ROW: Y10, U10, Y11, V10, Y12, U11, Y13, V11,
Result is interpolation of: (Y00, Y01, Y10, Y11), (U00, U01, U10, U11), (Y02, Y03, Y12, Y13), (U00, U01, U10, U11).
That forms my first two YUYV pixels of 32 bits.no that would not directly scale correctly. You'd need to first convert the YUY2 to planar YUV using YUY2ToI422. Then scale that. And convert back if necessary.The only exception to that being a vertical-only scale. If width remained the same, and the vertical was scaled, you could use ScalePlane.
--RegardsSrujan
You received this message because you are subscribed to the Google Groups "discuss-libyuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "discuss-libyuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyuv+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "discuss-libyuv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-libyuv/jJCLsPUZc5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-libyuv+unsubscribe@googlegroups.com.
Great, I think this is exactly what I was saying - that it is possible to perform bilinear interpolation by jumping to the next byte of the same channel. That is, if we are interpolating luma - then jump from Y00 to the next luma byte, which is Y01 - as I had depicted in my example - likewise with Chroma - jump to next relevant byte and interpolate. Agreed that a different algorithm needs to be written - I never intended for ScalePlane to already do this. The new algorithm seems straight-forward to implement, although to optimize (vectorize) would be difficult.Thanks for the feedback, and keep the thoughts flowing...
You had me convinced to do the conversion to YV12, scale and then back-convert, mostly because I already have super efficient implementations of scaling grayscale images - all that would mean is that I could simply use those existing implementations to scale Y,U,V independently.
The benefit I am seeing with scaling YUV422 directly, as you have shown, is that data needs to be brought into cache just once. Thanks for your feedback.