129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
2a43fb8fce6d9be5577de1e0f49c99bd4fe2f6d44Duy Truong * Copyright (c) 2011, The Linux Foundation. All rights reserved.
329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Redistribution and use in source and binary forms, with or without
529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * modification, are permitted provided that the following conditions are
629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * met:
729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     * Redistributions of source code must retain the above copyright
829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       notice, this list of conditions and the following disclaimer.
929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     * Redistributions in binary form must reproduce the above
1029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       copyright notice, this list of conditions and the following
1129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       disclaimer in the documentation and/or other materials provided
1229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       with the distribution.
13a43fb8fce6d9be5577de1e0f49c99bd4fe2f6d44Duy Truong *     * Neither the name of The Linux Foundation nor the names of its
1429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       contributors may be used to endorse or promote products derived
1529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *       from this software without specific prior written permission.
1629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
1729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
1829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
2029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
2129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
2929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include <copybit.h>
3329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "gralloc_priv.h"
3429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#include "gr.h"
3529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define COPYBIT_SUCCESS 0
3729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed#define COPYBIT_FAILURE -1
3829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
3929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedint convertYV12toYCrCb420SP(const copybit_image_t *src,private_handle_t *yv12_handle);
4029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
4129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
4229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Function to convert the c2d format into an equivalent Android format
4329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
4429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @param: source buffer handle
4529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @param: destination image
4629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
4729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @return: return status
4829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
4929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedint convert_yuv_c2d_to_yuv_android(private_handle_t *hnd,
5029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                   struct copybit_image_t const *rhs);
5129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Function to convert the Android format into an equivalent C2D format
5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
5629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @param: source buffer handle
5729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @param: destination image
5829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
5929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * @return: return status
6029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
6129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmedint convert_yuv_android_to_yuv_c2d(private_handle_t *hnd,
6229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed                                   struct copybit_image_t const *rhs);
63