//
// Created by 阳坤 on 2022/4/1.
//

#ifndef BYTESFLOW_OPENCV_MEDIA_YUV_CONVERT_H
#define BYTESFLOW_OPENCV_MEDIA_YUV_CONVERT_H
#include <string.h>
#include "libyuv.h"
typedef uint8_t  jbyte_;    /* signed 8 bits */
typedef int32_t  jint_;     /* signed 32 bits */
void ScaleI420AndRotate(jbyte_ *src_i420_data, jint_ width, jint_ height,
                        jbyte_ *dst_i420_data, int scale_width, int scale_height, int rotate);
void scaleI420(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_i420_data, jint_ dst_width,
               jint_ dst_height, jint_ mode);

void rotateI420(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_i420_data, jint_ degree);

void RotateI420fff(jbyte_ *src_i420_data, jint_ width, jint_ height,
                   jbyte_ *dst_i420_data, jint_ degree);

void MirrorI420(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void CropI420(jbyte_ *src_i420_data, jint_ src_length, jint_ width, jint_ height,
              jbyte_ *dst_i420_data, jint_ dst_width, jint_ dst_height, jint_ left, jint_ top);

void I420ToNv12(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *src_nv12_data);
void NV12ToNV21(jbyte_ *src_nv12_data, jint_ width, jint_ height, jbyte_ *src_nv21_data);

void I420ToRGB24(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_rgb24_data);

void I420ToARGB(jbyte_ *src_i420_data, jint_ width, jint_ height,
                jint_ dst_stride, jbyte_ *dst_argb_data);

void I420ToRGBAMac(jbyte_ *src_i420_data, jint_ width, jint_ height, jint_ dst_stride,
                   jbyte_ *dst_rgba_mac_data);

void I420ToARGB4444(jbyte_ *src_i420_data, jint_ width, jint_ height, jint_ dst_stride,
                    jbyte_ *dst_argb4444_data);

void I420ToRGB565(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_rgb565_data);

void I420ToRGB565Android(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_rgb565_data);

void I420ToARGB1555(jbyte_ *src_i420_data, jint_ width, jint_ height, jint_ dst_stride,
                    jbyte_ *dst_argb1555_data);

void I420ToYUY2(jbyte_ *src_i420_data, jint_ width, jint_ height,
                jint_ dst_stride, jbyte_ *dst_yuy2_data);

void I420ToUYVY(jbyte_ *src_i420_data, jint_ width, jint_ height,
                jint_ dst_stride, jbyte_ *dst_uyvy_data);

void I420ToYV12(jbyte_ *src_i420_data, jint_ width, jint_ height,
                jint_ dst_stride, jbyte_ *dst_yv12_data);

void YV12ToI420(jbyte_ *src_yv12_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void NV12ToI420(jbyte_ *src_nv21_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void I420ToNv21(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *src_nv21_data);

void NV12ToI420AndRotate180(jbyte_ *src_nv12_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void NV12ToScaleI420AndRotate(jbyte_ *src_y_data, jint_ width, jint_ height,
                              jbyte_ *dst_i420_data, int scale_width, int scale_height,int rotate);

void NV12ToI420AndRotateClockwise(jbyte_ *src_nv12_data, jint_ width, jint_ height,
                                  jbyte_ *dst_i420_data);

void NV12ToI420AndRotateAntiClockwise(jbyte_ *src_nv12_data, jint_ width, jint_ height,
                                      jbyte_ *dst_i420_data);

void NV12ToRGB565(jbyte_ *src_nv12_data, jint_ width, jint_ height, jbyte_ *dst_rgb565_data);

void NV21ToI420(jbyte_ *src_nv21_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void NV21ToI420AndRotate180(jbyte_ *src_nv21_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void NV21ToI420AndRotateClockwise(jbyte_ *src_nv21_data, jint_ width,
                                  jint_ height, jbyte_ *dst_i420_data);

void NV21ToI420AndRotateAntiClockwise(jbyte_ *src_nv21_data, jint_ width,
                                      jint_ height, jbyte_ *dst_i420_data);

void I420ToRGBAIPhone(jbyte_ *src_i420_data, jint_ width, jint_ height,
                      jint_ dst_stride, jbyte_ *dst_rgba_data);

void I420Copy(jbyte_ *src_i420_data, jint_ width, jint_ height,
              jint_ dst_stride, jbyte_ *dst_i420_data);

void UYVYToI420(jbyte_ *src_uyvy_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void YUY2ToI420(jbyte_ *src_yuy2_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void RGB24ToARGB(jbyte_ *src_rbg24_data, jint_ width, jint_ height,
                 jint_ dst_stride, jbyte_ *dst_argb_data);

void RGB24ToI420(jbyte_ *src_rbg24_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void RGBAToI420(jbyte_ *src_rbga_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void I420ToARGBMac(jbyte_ *src_i420_data, jint_ width, jint_ height,
                   jint_ dst_stride, jbyte_ *dst_argb_mac_data);

void ARGBMacToI420(jbyte_ *src_argb_mac_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);
void BGRAToI420(jbyte_ *src_argb_mac_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void MirrorI420LeftRight(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);

void MirrorI420UpDown(jbyte_ *src_i420_data, jint_ width, jint_ height, jbyte_ *dst_i420_data);


#endif //BYTESFLOW_OPENCV_MEDIA_YUV_CONVERT_H
