// This file is a unit of some effects on frame.

// brightness range -> -100 - 100
// contrast range -> -100 - 100

// AVCodecContext -> width, height
// AVFrame/AVPicture -> data, linesize

// adjust full frame -> (0, 0) - (width, height)
// adjust_eq(data[0],
//           linesize[0],
//           width,
//           height,
//           brightness,
//           contrast);

// adjust rect frame -> (x1, y1) - (x2, y2)
// adjust_eq(PByte(NativeUInt(data[0]) + NativeUInt(linesize[0] * y1  + x1)),
//           linesize[0],
//           x2 - x1,
//           y2 - y1,
//           brightness,
//           contrast);

procedure adjust_eq(y_line: PByte; stride, w, h, brightness, contrast: Integer); overload;
procedure adjust_eq(y_dst: PByte; linesize_dst: Integer;
  y_src: PByte; linesize_src: Integer; w, h, brightness, contrast: Integer); overload;

// hue range -> -100 - 100
// saturation range -> -100 - 100

// AVCodecContext -> pix_fmt, width, height
// AVFrame/AVPicture -> data, linesize

// avcodec_get_chroma_sub_sample(pix_fmt, @hsub, @vsub);
// PIX_FMT_YUV420P -> hsub=1, vsub=1

// adjust full frame -> (0, 0) - (width, height)
// adjust_hue(data[1],
//            data[2],
//            linesize[1],
//            width shr hsub,
//            height shr vsub,
//            hue,
//            saturation);

// adjust rect frame -> (x1, y1) - (x2, y2)
// adjust_hue(PByte(NativeUInt(data[1]) + NativeUInt(linesize[1] * (y1 shr vsub) + (x1 shr vsub))),
//            PByte(NativeUInt(data[2]) + NativeUInt(linesize[2] * (y1 shr vsub) + (x1 shr vsub))),
//            linesize[1],
//            (x2 - x1) shr hsub,
//            (y2 - y1) shr vsub,
//            hue,
//            saturation);

procedure adjust_hue(u_line, v_line: PByte; stride, w, h, hue, saturation: Integer); overload;
procedure adjust_hue(u_dst, v_dst: PByte; linesize_dst: Integer;
  u_src, v_src: PByte; linesize_src: Integer; w, h, hue, saturation: Integer); overload;
