def rgb2ycbcr(r__, g__, b__):
    """Convert the three RGB channels to YCbCr."""
    kb_ = 0.114
    kr_ = 0.299
    y__ = kr_ * r__ + (1 - kr_ - kb_) * g__ + kb_ * b__
    cb_ = 1.0 / (2 * (1 - kb_)) * (b__ - y__)
    cr_ = 1.0 / (2 * (1 - kr_)) * (r__ - y__)
    return y__, cb_, cr_
