Skip to content

Instantly share code, notes, and snippets.

@gen2brain
Created January 12, 2021 13:05
Show Gist options
  • Save gen2brain/f5ead089cbf29110bb7c59bddad8bee7 to your computer and use it in GitHub Desktop.
Save gen2brain/f5ead089cbf29110bb7c59bddad8bee7 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
diff -ur x264-go/encode.go x264-go.new/encode.go
--- x264-go/encode.go 2020-04-20 16:40:00.859331841 +0200
+++ x264-go.new/encode.go 2020-06-06 15:48:52.593083554 +0200
@@ -82,8 +82,9 @@
param.IWidth = int32(e.opts.Width)
param.IHeight = int32(e.opts.Height)
-
param.ICsp = e.csp
+
+ param.IBitdepth = 8
param.BVfrInput = 0
param.BRepeatHeaders = 1
param.BAnnexb = 1
@@ -95,7 +96,7 @@
param.IFpsDen = 1
param.IKeyintMax = int32(e.opts.FrameRate)
- param.BIntraRefresh = 1
+ //param.BIntraRefresh = 1
}
if e.opts.Profile != "" {
@@ -108,18 +109,20 @@
// Allocate on create instead while encoding
var picIn x264c.Picture
- ret := x264c.PictureAlloc(&picIn, e.csp, int32(e.opts.Width), int32(e.opts.Height))
- if ret < 0 {
- err = fmt.Errorf("x264: cannot allocate picture")
- return
- }
+ x264c.PictureInit(&picIn)
+ //ret := x264c.PictureAlloc(&picIn, e.csp, int32(e.opts.Width), int32(e.opts.Height))
+ //if ret < 0 {
+ //err = fmt.Errorf("x264: cannot allocate picture")
+ //return
+ //}
+
e.picIn = picIn
- defer func() {
- // Cleanup if intialization fail
- if err != nil {
- x264c.PictureClean(&picIn)
- }
- }()
+ //defer func() {
+ //// Cleanup if intialization fail
+ //if err != nil {
+ //x264c.PictureClean(&picIn)
+ //}
+ //}()
e.e = x264c.EncoderOpen(&param)
if e.e == nil {
@@ -127,7 +130,7 @@
return
}
- ret = x264c.EncoderHeaders(e.e, e.nals, &e.nnals)
+ ret := x264c.EncoderHeaders(e.e, e.nals, &e.nnals)
if ret < 0 {
err = fmt.Errorf("x264: cannot encode headers")
return
@@ -156,7 +159,20 @@
e.img.ToYCbCr(im)
picIn := e.picIn
- e.img.CopyToCPointer(picIn.Img.Plane[0], picIn.Img.Plane[1], picIn.Img.Plane[2])
+
+ picIn.Img.ICsp = e.csp
+
+ picIn.Img.IPlane = 3
+ picIn.Img.IStride[0] = int32(e.opts.Width)
+ picIn.Img.IStride[1] = int32(e.opts.Width) / 2
+ picIn.Img.IStride[2] = int32(e.opts.Width) / 2
+
+ picIn.Img.Plane[0] = C.CBytes(e.img.Y)
+ picIn.Img.Plane[1] = C.CBytes(e.img.Cb)
+ picIn.Img.Plane[2] = C.CBytes(e.img.Cr)
+
+ //e.img.CopyToCPointer(picIn.Img.Plane[0], picIn.Img.Plane[1], picIn.Img.Plane[2])
+
picIn.IPts = e.pts
e.pts++
@@ -218,4 +234,4 @@
x264c.PictureClean(&picIn)
x264c.EncoderClose(e.e)
return nil
-}
\ No newline at end of file
+}
diff -ur x264-go/encode_test.go x264-go.new/encode_test.go
--- x264-go/encode_test.go 2018-03-05 18:23:21.000000000 +0100
+++ x264-go.new/encode_test.go 2020-06-05 21:13:34.464319909 +0200
@@ -20,7 +20,7 @@
FrameRate: 25,
Tune: "zerolatency",
Preset: "veryfast",
- Profile: "baseline",
+ Profile: "high",
LogLevel: LogDebug,
}
diff -ur x264-go/examples/basic/basic.go x264-go.new/examples/basic/basic.go
--- x264-go/examples/basic/basic.go 2018-02-14 03:39:14.000000000 +0100
+++ x264-go.new/examples/basic/basic.go 2020-06-05 21:52:23.943381303 +0200
@@ -14,9 +14,9 @@
Width: 640,
Height: 480,
FrameRate: 25,
- Preset: "veryfast",
- Tune: "zerolatency",
- Profile: "baseline",
+ Preset: "fast",
+ Tune: "stillimage",
+ Profile: "high",
LogLevel: x264.LogDebug,
}
@@ -52,5 +52,11 @@
if err != nil {
fmt.Println(err)
os.Exit(1)
+ }
+
+ err = enc.Flush()
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
}
}
diff -ur x264-go/examples/screengrab/screengrab.go x264-go.new/examples/screengrab/screengrab.go
--- x264-go/examples/screengrab/screengrab.go 2020-08-24 17:31:59.372106174 +0200
+++ x264-go.new/examples/screengrab/screengrab.go 2020-06-05 21:20:50.117331390 +0200
@@ -1,9 +1,7 @@
package main
import (
- "bytes"
"fmt"
- "io/ioutil"
"os"
"os/signal"
"syscall"
@@ -13,21 +11,25 @@
)
func main() {
- buf := bytes.NewBuffer(make([]byte, 0))
+ file, err := os.Create("screen.264")
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "%s\n", err.Error())
+ os.Exit(1)
+ }
bounds := screenshot.GetDisplayBounds(0)
opts := &x264.Options{
Width: bounds.Dx(),
Height: bounds.Dy(),
- FrameRate: 15,
+ FrameRate: 10,
Tune: "zerolatency",
Preset: "veryfast",
- Profile: "baseline",
+ Profile: "high",
LogLevel: x264.LogDebug,
}
- enc, err := x264.NewEncoder(buf, opts)
+ enc, err := x264.NewEncoder(file, opts)
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
os.Exit(1)
@@ -43,7 +45,7 @@
case <-s:
enc.Flush()
- err = ioutil.WriteFile("screen.264", buf.Bytes(), 0644)
+ err = file.Close()
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
os.Exit(1)
diff -ur x264-go/x264c/external/x264/common/aarch64/asm-offsets.c x264-go.new/x264c/external/x264/common/aarch64/asm-offsets.c
--- x264-go/x264c/external/x264/common/aarch64/asm-offsets.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/asm-offsets.c 2020-06-06 15:20:58.684039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* asm-offsets.c: check asm offsets for aarch64
*****************************************************************************
- * Copyright (C) 2014-2017 x264 project
+ * Copyright (C) 2014-2020 x264 project
*
* Authors: Janne Grunau <janne-x264@jannau.net>
*
diff -ur x264-go/x264c/external/x264/common/aarch64/asm-offsets.h x264-go.new/x264c/external/x264/common/aarch64/asm-offsets.h
--- x264-go/x264c/external/x264/common/aarch64/asm-offsets.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/asm-offsets.h 2020-06-06 15:20:58.684039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* asm-offsets.h: asm offsets for aarch64
*****************************************************************************
- * Copyright (C) 2014-2017 x264 project
+ * Copyright (C) 2014-2020 x264 project
*
* Authors: Janne Grunau <janne-x264@jannau.net>
*
Only in x264-go.new/x264c/external/x264/common/aarch64: asm.S
Only in x264-go.new/x264c/external/x264/common/aarch64: bitstream-a.S
Only in x264-go.new/x264c/external/x264/common/aarch64: bitstream.h
Only in x264-go.new/x264c/external/x264/common/aarch64: cabac-a.S
Only in x264-go.new/x264c/external/x264/common/aarch64: dct-a.S
diff -ur x264-go/x264c/external/x264/common/aarch64/dct.h x264-go.new/x264c/external/x264/common/aarch64/dct.h
--- x264-go/x264c/external/x264/common/aarch64/dct.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/dct.h 2020-06-06 15:20:58.684039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* dct.h: aarch64 transform and zigzag
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,41 +27,68 @@
#ifndef X264_AARCH64_DCT_H
#define X264_AARCH64_DCT_H
+#define x264_dct4x4dc_neon x264_template(dct4x4dc_neon)
void x264_dct4x4dc_neon( int16_t d[16] );
+#define x264_idct4x4dc_neon x264_template(idct4x4dc_neon)
void x264_idct4x4dc_neon( int16_t d[16] );
+#define x264_sub4x4_dct_neon x264_template(sub4x4_dct_neon)
void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_neon x264_template(sub8x8_dct_neon)
void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_neon x264_template(sub16x16_dct_neon)
void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_neon x264_template(add4x4_idct_neon)
void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_add8x8_idct_neon x264_template(add8x8_idct_neon)
void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] );
+#define x264_add16x16_idct_neon x264_template(add16x16_idct_neon)
void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add8x8_idct_dc_neon x264_template(add8x8_idct_dc_neon)
void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] );
+#define x264_add16x16_idct_dc_neon x264_template(add16x16_idct_dc_neon)
void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_sub8x8_dct_dc_neon x264_template(sub8x8_dct_dc_neon)
void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_neon x264_template(sub8x16_dct_dc_neon)
void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_neon x264_template(sub8x8_dct8_neon)
void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_neon x264_template(sub16x16_dct8_neon)
void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct8_neon x264_template(add8x8_idct8_neon)
void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] );
+#define x264_add16x16_idct8_neon x264_template(add16x16_idct8_neon)
void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] );
+#define x264_zigzag_scan_4x4_frame_neon x264_template(zigzag_scan_4x4_frame_neon)
void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_field_neon x264_template(zigzag_scan_4x4_field_neon)
void x264_zigzag_scan_4x4_field_neon( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_8x8_frame_neon x264_template(zigzag_scan_8x8_frame_neon)
void x264_zigzag_scan_8x8_frame_neon( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_neon x264_template(zigzag_scan_8x8_field_neon)
void x264_zigzag_scan_8x8_field_neon( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_sub_4x4_field_neon x264_template(zigzag_sub_4x4_field_neon)
int x264_zigzag_sub_4x4_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_4x4ac_field_neon x264_template(zigzag_sub_4x4ac_field_neon)
int x264_zigzag_sub_4x4ac_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc );
+#define x264_zigzag_sub_4x4_frame_neon x264_template(zigzag_sub_4x4_frame_neon)
int x264_zigzag_sub_4x4_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_4x4ac_frame_neon x264_template(zigzag_sub_4x4ac_frame_neon)
int x264_zigzag_sub_4x4ac_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc );
+#define x264_zigzag_sub_8x8_field_neon x264_template(zigzag_sub_8x8_field_neon)
int x264_zigzag_sub_8x8_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_8x8_frame_neon x264_template(zigzag_sub_8x8_frame_neon)
int x264_zigzag_sub_8x8_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_interleave_8x8_cavlc_neon x264_template(zigzag_interleave_8x8_cavlc_neon)
void x264_zigzag_interleave_8x8_cavlc_neon( dctcoef *dst, dctcoef *src, uint8_t *nnz );
#endif
Only in x264-go.new/x264c/external/x264/common/aarch64: deblock-a.S
Only in x264-go.new/x264c/external/x264/common/aarch64: deblock.h
Only in x264-go.new/x264c/external/x264/common/aarch64: mc-a.S
diff -ur x264-go/x264c/external/x264/common/aarch64/mc-c.c x264-go.new/x264c/external/x264/common/aarch64/mc-c.c
--- x264-go/x264c/external/x264/common/aarch64/mc-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/mc-c.c 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc-c.c: aarch64 motion compensation
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,54 +27,96 @@
#include "common/common.h"
#include "mc.h"
+#define x264_prefetch_ref_aarch64 x264_template(prefetch_ref_aarch64)
void x264_prefetch_ref_aarch64( uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_420_aarch64 x264_template(prefetch_fenc_420_aarch64)
void x264_prefetch_fenc_420_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_422_aarch64 x264_template(prefetch_fenc_422_aarch64)
void x264_prefetch_fenc_422_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_memcpy_aligned_neon x264_template(memcpy_aligned_neon)
void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_neon x264_template(memzero_aligned_neon)
void x264_memzero_aligned_neon( void *dst, size_t n );
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_plane_copy_core_neon x264_template(plane_copy_core_neon)
void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_swap_core_neon x264_template(plane_copy_swap_core_neon)
void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_neon x264_template(plane_copy_deinterleave_neon)
void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu,
pixel *dstv, intptr_t i_dstv,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_neon x264_template(plane_copy_deinterleave_rgb_neon)
void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_interleave_core_neon x264_template(plane_copy_interleave_core_neon)
void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_store_interleave_chroma_neon x264_template(store_interleave_chroma_neon)
void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fdec_neon x264_template(load_deinterleave_chroma_fdec_neon)
void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_neon x264_template(load_deinterleave_chroma_fenc_neon)
void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_mc_weight_w16_neon x264_template(mc_weight_w16_neon)
+#define x264_mc_weight_w16_nodenom_neon x264_template(mc_weight_w16_nodenom_neon)
+#define x264_mc_weight_w16_offsetadd_neon x264_template(mc_weight_w16_offsetadd_neon)
+#define x264_mc_weight_w16_offsetsub_neon x264_template(mc_weight_w16_offsetsub_neon)
+#define x264_mc_weight_w20_neon x264_template(mc_weight_w20_neon)
+#define x264_mc_weight_w20_nodenom_neon x264_template(mc_weight_w20_nodenom_neon)
+#define x264_mc_weight_w20_offsetadd_neon x264_template(mc_weight_w20_offsetadd_neon)
+#define x264_mc_weight_w20_offsetsub_neon x264_template(mc_weight_w20_offsetsub_neon)
+#define x264_mc_weight_w4_neon x264_template(mc_weight_w4_neon)
+#define x264_mc_weight_w4_nodenom_neon x264_template(mc_weight_w4_nodenom_neon)
+#define x264_mc_weight_w4_offsetadd_neon x264_template(mc_weight_w4_offsetadd_neon)
+#define x264_mc_weight_w4_offsetsub_neon x264_template(mc_weight_w4_offsetsub_neon)
+#define x264_mc_weight_w8_neon x264_template(mc_weight_w8_neon)
+#define x264_mc_weight_w8_nodenom_neon x264_template(mc_weight_w8_nodenom_neon)
+#define x264_mc_weight_w8_offsetadd_neon x264_template(mc_weight_w8_offsetadd_neon)
+#define x264_mc_weight_w8_offsetsub_neon x264_template(mc_weight_w8_offsetsub_neon)
#define MC_WEIGHT(func)\
void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w16##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
\
-static void (* x264_mc##func##_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int ) =\
+static void (* mc##func##_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int ) =\
{\
x264_mc_weight_w4##func##_neon,\
x264_mc_weight_w4##func##_neon,\
@@ -84,50 +126,64 @@
x264_mc_weight_w20##func##_neon,\
};
+#if !HIGH_BIT_DEPTH
MC_WEIGHT()
MC_WEIGHT(_nodenom)
MC_WEIGHT(_offsetadd)
MC_WEIGHT(_offsetsub)
+#endif
+#define x264_mc_copy_w4_neon x264_template(mc_copy_w4_neon)
void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w8_neon x264_template(mc_copy_w8_neon)
void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_neon x264_template(mc_copy_w16_neon)
void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_chroma_neon x264_template(mc_chroma_neon)
void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int );
+#define x264_integral_init4h_neon x264_template(integral_init4h_neon)
void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init4v_neon x264_template(integral_init4v_neon)
void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t );
+#define x264_integral_init8h_neon x264_template(integral_init8h_neon)
void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init8v_neon x264_template(integral_init8v_neon)
void x264_integral_init8v_neon( uint16_t *, intptr_t );
+#define x264_frame_init_lowres_core_neon x264_template(frame_init_lowres_core_neon)
void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int );
+#define x264_mbtree_propagate_cost_neon x264_template(mbtree_propagate_cost_neon)
void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int );
+#define x264_mbtree_fix8_pack_neon x264_template(mbtree_fix8_pack_neon)
void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_neon x264_template(mbtree_fix8_unpack_neon)
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
-static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w )
+static void weight_cache_neon( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
if( w->i_offset < 0 )
{
- w->weightfn = x264_mc_offsetsub_wtab_neon;
+ w->weightfn = mc_offsetsub_wtab_neon;
w->cachea[0] = -w->i_offset;
}
else
{
- w->weightfn = x264_mc_offsetadd_wtab_neon;
+ w->weightfn = mc_offsetadd_wtab_neon;
w->cachea[0] = w->i_offset;
}
}
else if( !w->i_denom )
- w->weightfn = x264_mc_nodenom_wtab_neon;
+ w->weightfn = mc_nodenom_wtab_neon;
else
- w->weightfn = x264_mc_wtab_neon;
+ w->weightfn = mc_wtab_neon;
}
-static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
+static void (* const pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
{
NULL,
x264_pixel_avg2_w4_neon,
@@ -137,7 +193,7 @@
x264_pixel_avg2_w20_neon,
};
-static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
+static void (* const mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
{
NULL,
x264_mc_copy_w4_neon,
@@ -160,7 +216,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
@@ -169,7 +225,7 @@
else if( weight->weightfn )
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );
else
- x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
}
static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride,
@@ -186,7 +242,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, *i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
@@ -205,6 +261,7 @@
}
}
+#define x264_hpel_filter_neon x264_template(hpel_filter_neon)
void x264_hpel_filter_neon( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,
uint8_t *src, intptr_t stride, int width,
int height, int16_t *buf );
@@ -212,11 +269,10 @@
PLANE_COPY(16, neon)
PLANE_COPY_SWAP(16, neon)
PLANE_INTERLEAVE(neon)
-#endif // !HIGH_BIT_DEPTH
-
PROPAGATE_LIST(neon)
+#endif // !HIGH_BIT_DEPTH
-void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf )
+void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
@@ -234,11 +290,11 @@
pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon;
pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon;
- pf->plane_copy = x264_plane_copy_neon;
- pf->plane_copy_swap = x264_plane_copy_swap_neon;
+ pf->plane_copy = plane_copy_neon;
+ pf->plane_copy_swap = plane_copy_swap_neon;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon;
- pf->plane_copy_interleave = x264_plane_copy_interleave_neon;
+ pf->plane_copy_interleave = plane_copy_interleave_neon;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_neon;
@@ -254,10 +310,10 @@
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon;
- pf->weight = x264_mc_wtab_neon;
- pf->offsetadd = x264_mc_offsetadd_wtab_neon;
- pf->offsetsub = x264_mc_offsetsub_wtab_neon;
- pf->weight_cache = x264_weight_cache_neon;
+ pf->weight = mc_wtab_neon;
+ pf->offsetadd = mc_offsetadd_wtab_neon;
+ pf->offsetsub = mc_offsetsub_wtab_neon;
+ pf->weight_cache = weight_cache_neon;
pf->mc_chroma = x264_mc_chroma_neon;
pf->mc_luma = mc_luma_neon;
@@ -271,7 +327,7 @@
pf->integral_init8v = x264_integral_init8v_neon;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon;
+ pf->mbtree_propagate_list = mbtree_propagate_list_neon;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon;
diff -ur x264-go/x264c/external/x264/common/aarch64/mc.h x264-go.new/x264c/external/x264/common/aarch64/mc.h
--- x264-go/x264c/external/x264/common/aarch64/mc.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/mc.h 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc.h: aarch64 motion compensation
*****************************************************************************
- * Copyright (C) 2014-2017 x264 project
+ * Copyright (C) 2014-2020 x264 project
*
* Authors: Janne Grunau <janne-x264@jannau.net>
*
@@ -26,6 +26,7 @@
#ifndef X264_AARCH64_MC_H
#define X264_AARCH64_MC_H
-void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf );
+#define x264_mc_init_aarch64 x264_template(mc_init_aarch64)
+void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf );
#endif
Only in x264-go.new/x264c/external/x264/common/aarch64: pixel-a.S
diff -ur x264-go/x264c/external/x264/common/aarch64/pixel.h x264-go.new/x264c/external/x264/common/aarch64/pixel.h
--- x264-go/x264c/external/x264/common/aarch64/pixel.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/pixel.h 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* pixel.h: aarch64 pixel metrics
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,6 +27,44 @@
#ifndef X264_AARCH64_PIXEL_H
#define X264_AARCH64_PIXEL_H
+#define x264_pixel_sad_16x16_neon x264_template(pixel_sad_16x16_neon)
+#define x264_pixel_sad_16x8_neon x264_template(pixel_sad_16x8_neon)
+#define x264_pixel_sad_4x16_neon x264_template(pixel_sad_4x16_neon)
+#define x264_pixel_sad_4x4_neon x264_template(pixel_sad_4x4_neon)
+#define x264_pixel_sad_4x8_neon x264_template(pixel_sad_4x8_neon)
+#define x264_pixel_sad_8x16_neon x264_template(pixel_sad_8x16_neon)
+#define x264_pixel_sad_8x4_neon x264_template(pixel_sad_8x4_neon)
+#define x264_pixel_sad_8x8_neon x264_template(pixel_sad_8x8_neon)
+#define x264_pixel_sad_x3_16x16_neon x264_template(pixel_sad_x3_16x16_neon)
+#define x264_pixel_sad_x3_16x8_neon x264_template(pixel_sad_x3_16x8_neon)
+#define x264_pixel_sad_x3_4x4_neon x264_template(pixel_sad_x3_4x4_neon)
+#define x264_pixel_sad_x3_4x8_neon x264_template(pixel_sad_x3_4x8_neon)
+#define x264_pixel_sad_x3_8x16_neon x264_template(pixel_sad_x3_8x16_neon)
+#define x264_pixel_sad_x3_8x4_neon x264_template(pixel_sad_x3_8x4_neon)
+#define x264_pixel_sad_x3_8x8_neon x264_template(pixel_sad_x3_8x8_neon)
+#define x264_pixel_sad_x4_16x16_neon x264_template(pixel_sad_x4_16x16_neon)
+#define x264_pixel_sad_x4_16x8_neon x264_template(pixel_sad_x4_16x8_neon)
+#define x264_pixel_sad_x4_4x4_neon x264_template(pixel_sad_x4_4x4_neon)
+#define x264_pixel_sad_x4_4x8_neon x264_template(pixel_sad_x4_4x8_neon)
+#define x264_pixel_sad_x4_8x16_neon x264_template(pixel_sad_x4_8x16_neon)
+#define x264_pixel_sad_x4_8x4_neon x264_template(pixel_sad_x4_8x4_neon)
+#define x264_pixel_sad_x4_8x8_neon x264_template(pixel_sad_x4_8x8_neon)
+#define x264_pixel_satd_16x16_neon x264_template(pixel_satd_16x16_neon)
+#define x264_pixel_satd_16x8_neon x264_template(pixel_satd_16x8_neon)
+#define x264_pixel_satd_4x16_neon x264_template(pixel_satd_4x16_neon)
+#define x264_pixel_satd_4x4_neon x264_template(pixel_satd_4x4_neon)
+#define x264_pixel_satd_4x8_neon x264_template(pixel_satd_4x8_neon)
+#define x264_pixel_satd_8x16_neon x264_template(pixel_satd_8x16_neon)
+#define x264_pixel_satd_8x4_neon x264_template(pixel_satd_8x4_neon)
+#define x264_pixel_satd_8x8_neon x264_template(pixel_satd_8x8_neon)
+#define x264_pixel_ssd_16x16_neon x264_template(pixel_ssd_16x16_neon)
+#define x264_pixel_ssd_16x8_neon x264_template(pixel_ssd_16x8_neon)
+#define x264_pixel_ssd_4x16_neon x264_template(pixel_ssd_4x16_neon)
+#define x264_pixel_ssd_4x4_neon x264_template(pixel_ssd_4x4_neon)
+#define x264_pixel_ssd_4x8_neon x264_template(pixel_ssd_4x8_neon)
+#define x264_pixel_ssd_8x16_neon x264_template(pixel_ssd_8x16_neon)
+#define x264_pixel_ssd_8x4_neon x264_template(pixel_ssd_8x4_neon)
+#define x264_pixel_ssd_8x8_neon x264_template(pixel_ssd_8x8_neon)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
@@ -50,30 +88,47 @@
DECL_X1( ssd, neon )
+#define x264_pixel_ssd_nv12_core_neon x264_template(pixel_ssd_nv12_core_neon)
void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * );
+#define x264_pixel_vsad_neon x264_template(pixel_vsad_neon)
int x264_pixel_vsad_neon( uint8_t *, intptr_t, int );
+#define x264_pixel_sa8d_8x8_neon x264_template(pixel_sa8d_8x8_neon)
int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_16x16_neon x264_template(pixel_sa8d_16x16_neon)
int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_satd_16x16_neon x264_template(pixel_sa8d_satd_16x16_neon)
uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_var_8x8_neon x264_template(pixel_var_8x8_neon)
uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_8x16_neon x264_template(pixel_var_8x16_neon)
uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_16x16_neon x264_template(pixel_var_16x16_neon)
uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_var2_8x8_neon x264_template(pixel_var2_8x8_neon)
int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * );
+#define x264_pixel_var2_8x16_neon x264_template(pixel_var2_8x16_neon)
int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * );
+#define x264_pixel_hadamard_ac_8x8_neon x264_template(pixel_hadamard_ac_8x8_neon)
uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_8x16_neon x264_template(pixel_hadamard_ac_8x16_neon)
uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x8_neon x264_template(pixel_hadamard_ac_16x8_neon)
uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x16_neon x264_template(pixel_hadamard_ac_16x16_neon)
uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_ssim_4x4x2_core_neon x264_template(pixel_ssim_4x4x2_core_neon)
void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t,
const uint8_t *, intptr_t,
int sums[2][4] );
+#define x264_pixel_ssim_end4_neon x264_template(pixel_ssim_end4_neon)
float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_asd8_neon x264_template(pixel_asd8_neon)
int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
#endif
Only in x264-go.new/x264c/external/x264/common/aarch64: predict-a.S
diff -ur x264-go/x264c/external/x264/common/aarch64/predict-c.c x264-go.new/x264c/external/x264/common/aarch64/predict-c.c
--- x264-go/x264c/external/x264/common/aarch64/predict-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/predict-c.c 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.c: aarch64 intra prediction
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -28,30 +28,7 @@
#include "predict.h"
#include "pixel.h"
-void x264_predict_4x4_dc_top_neon( uint8_t *src );
-void x264_predict_4x4_ddr_neon( uint8_t *src );
-void x264_predict_4x4_ddl_neon( uint8_t *src );
-
-void x264_predict_8x8c_dc_top_neon( uint8_t *src );
-void x264_predict_8x8c_dc_left_neon( uint8_t *src );
-void x264_predict_8x8c_p_neon( uint8_t *src );
-
-void x264_predict_8x16c_dc_left_neon( uint8_t *src );
-void x264_predict_8x16c_dc_top_neon( uint8_t *src );
-void x264_predict_8x16c_p_neon( uint8_t *src );
-
-void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
-
-void x264_predict_16x16_dc_top_neon( uint8_t *src );
-void x264_predict_16x16_dc_left_neon( uint8_t *src );
-void x264_predict_16x16_p_neon( uint8_t *src );
-
-void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
+void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
@@ -70,7 +47,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
@@ -90,7 +67,7 @@
}
-void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
@@ -105,7 +82,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
+void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
@@ -123,7 +100,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] )
+void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
diff -ur x264-go/x264c/external/x264/common/aarch64/predict.h x264-go.new/x264c/external/x264/common/aarch64/predict.h
--- x264-go/x264c/external/x264/common/aarch64/predict.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/predict.h 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.h: aarch64 intra prediction
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,8 +27,11 @@
#ifndef X264_AARCH64_PREDICT_H
#define X264_AARCH64_PREDICT_H
+#define x264_predict_4x4_h_aarch64 x264_template(predict_4x4_h_aarch64)
void x264_predict_4x4_h_aarch64( uint8_t *src );
+#define x264_predict_4x4_v_aarch64 x264_template(predict_4x4_v_aarch64)
void x264_predict_4x4_v_aarch64( uint8_t *src );
+#define x264_predict_8x8c_v_aarch64 x264_template(predict_8x8c_v_aarch64)
void x264_predict_8x8c_v_aarch64( uint8_t *src );
// for the merged 4x4 intra sad/satd which expects unified suffix
@@ -36,23 +39,81 @@
#define x264_predict_4x4_v_neon x264_predict_4x4_v_aarch64
#define x264_predict_8x8c_v_neon x264_predict_8x8c_v_aarch64
+#define x264_predict_4x4_dc_top_neon x264_template(predict_4x4_dc_top_neon)
+void x264_predict_4x4_dc_top_neon( uint8_t *src );
+#define x264_predict_4x4_ddr_neon x264_template(predict_4x4_ddr_neon)
+void x264_predict_4x4_ddr_neon( uint8_t *src );
+#define x264_predict_4x4_ddl_neon x264_template(predict_4x4_ddl_neon)
+void x264_predict_4x4_ddl_neon( uint8_t *src );
+
+#define x264_predict_8x8c_dc_top_neon x264_template(predict_8x8c_dc_top_neon)
+void x264_predict_8x8c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_left_neon x264_template(predict_8x8c_dc_left_neon)
+void x264_predict_8x8c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x8c_p_neon x264_template(predict_8x8c_p_neon)
+void x264_predict_8x8c_p_neon( uint8_t *src );
+
+#define x264_predict_8x16c_dc_left_neon x264_template(predict_8x16c_dc_left_neon)
+void x264_predict_8x16c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_top_neon x264_template(predict_8x16c_dc_top_neon)
+void x264_predict_8x16c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x16c_p_neon x264_template(predict_8x16c_p_neon)
+void x264_predict_8x16c_p_neon( uint8_t *src );
+
+#define x264_predict_8x8_ddl_neon x264_template(predict_8x8_ddl_neon)
+void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_neon x264_template(predict_8x8_ddr_neon)
+void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vl_neon x264_template(predict_8x8_vl_neon)
+void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_neon x264_template(predict_8x8_vr_neon)
+void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hd_neon x264_template(predict_8x8_hd_neon)
+void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_neon x264_template(predict_8x8_hu_neon)
+void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
+
+#define x264_predict_16x16_dc_top_neon x264_template(predict_16x16_dc_top_neon)
+void x264_predict_16x16_dc_top_neon( uint8_t *src );
+#define x264_predict_16x16_dc_left_neon x264_template(predict_16x16_dc_left_neon)
+void x264_predict_16x16_dc_left_neon( uint8_t *src );
+#define x264_predict_16x16_p_neon x264_template(predict_16x16_p_neon)
+void x264_predict_16x16_p_neon( uint8_t *src );
+
+#define x264_predict_4x4_dc_neon x264_template(predict_4x4_dc_neon)
void x264_predict_4x4_dc_neon( uint8_t *src );
+#define x264_predict_8x8_v_neon x264_template(predict_8x8_v_neon)
void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_neon x264_template(predict_8x8_h_neon)
void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_neon x264_template(predict_8x8_dc_neon)
void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8c_dc_neon x264_template(predict_8x8c_dc_neon)
void x264_predict_8x8c_dc_neon( uint8_t *src );
+#define x264_predict_8x8c_h_neon x264_template(predict_8x8c_h_neon)
void x264_predict_8x8c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_v_neon x264_template(predict_8x16c_v_neon)
void x264_predict_8x16c_v_neon( uint8_t *src );
+#define x264_predict_8x16c_h_neon x264_template(predict_8x16c_h_neon)
void x264_predict_8x16c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_neon x264_template(predict_8x16c_dc_neon)
void x264_predict_8x16c_dc_neon( uint8_t *src );
+#define x264_predict_16x16_v_neon x264_template(predict_16x16_v_neon)
void x264_predict_16x16_v_neon( uint8_t *src );
+#define x264_predict_16x16_h_neon x264_template(predict_16x16_h_neon)
void x264_predict_16x16_h_neon( uint8_t *src );
+#define x264_predict_16x16_dc_neon x264_template(predict_16x16_dc_neon)
void x264_predict_16x16_dc_neon( uint8_t *src );
-void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] );
-void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
-void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] );
-void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init_aarch64 x264_template(predict_4x4_init_aarch64)
+void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_aarch64 x264_template(predict_8x8_init_aarch64)
+void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
+#define x264_predict_8x8c_init_aarch64 x264_template(predict_8x8c_init_aarch64)
+void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_aarch64 x264_template(predict_8x16c_init_aarch64)
+void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_16x16_init_aarch64 x264_template(predict_16x16_init_aarch64)
+void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#endif /* X264_AARCH64_PREDICT_H */
Only in x264-go.new/x264c/external/x264/common/aarch64: quant-a.S
diff -ur x264-go/x264c/external/x264/common/aarch64/quant.h x264-go.new/x264c/external/x264/common/aarch64/quant.h
--- x264-go/x264c/external/x264/common/aarch64/quant.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/aarch64/quant.h 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* quant.h: arm quantization and level-run
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,33 +27,55 @@
#ifndef X264_AARCH64_QUANT_H
#define X264_AARCH64_QUANT_H
+#define x264_quant_2x2_dc_aarch64 x264_template(quant_2x2_dc_aarch64)
int x264_quant_2x2_dc_aarch64( int16_t dct[4], int mf, int bias );
+#define x264_quant_2x2_dc_neon x264_template(quant_2x2_dc_neon)
int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_neon x264_template(quant_4x4_dc_neon)
int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias );
+#define x264_quant_4x4_neon x264_template(quant_4x4_neon)
int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_4x4x4_neon x264_template(quant_4x4x4_neon)
int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_8x8_neon x264_template(quant_8x8_neon)
int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] );
+#define x264_dequant_4x4_dc_neon x264_template(dequant_4x4_dc_neon)
void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4_neon x264_template(dequant_4x4_neon)
void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_neon x264_template(dequant_8x8_neon)
void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_decimate_score15_neon x264_template(decimate_score15_neon)
int x264_decimate_score15_neon( int16_t * );
+#define x264_decimate_score16_neon x264_template(decimate_score16_neon)
int x264_decimate_score16_neon( int16_t * );
+#define x264_decimate_score64_neon x264_template(decimate_score64_neon)
int x264_decimate_score64_neon( int16_t * );
+#define x264_coeff_last4_aarch64 x264_template(coeff_last4_aarch64)
int x264_coeff_last4_aarch64( int16_t * );
+#define x264_coeff_last8_aarch64 x264_template(coeff_last8_aarch64)
int x264_coeff_last8_aarch64( int16_t * );
+#define x264_coeff_last15_neon x264_template(coeff_last15_neon)
int x264_coeff_last15_neon( int16_t * );
+#define x264_coeff_last16_neon x264_template(coeff_last16_neon)
int x264_coeff_last16_neon( int16_t * );
+#define x264_coeff_last64_neon x264_template(coeff_last64_neon)
int x264_coeff_last64_neon( int16_t * );
+#define x264_coeff_level_run4_aarch64 x264_template(coeff_level_run4_aarch64)
int x264_coeff_level_run4_aarch64( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run8_neon x264_template(coeff_level_run8_neon)
int x264_coeff_level_run8_neon( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run15_neon x264_template(coeff_level_run15_neon)
int x264_coeff_level_run15_neon( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run16_neon x264_template(coeff_level_run16_neon)
int x264_coeff_level_run16_neon( int16_t *, x264_run_level_t * );
+#define x264_denoise_dct_neon x264_template(denoise_dct_neon)
void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int );
#endif
Only in x264-go.new/x264c/external/x264/common/arm: asm.S
Only in x264-go.new/x264c/external/x264/common/arm: bitstream-a.S
Only in x264-go.new/x264c/external/x264/common/arm: bitstream.h
Only in x264-go.new/x264c/external/x264/common/arm: cpu-a.S
Only in x264-go.new/x264c/external/x264/common/arm: dct-a.S
diff -ur x264-go/x264c/external/x264/common/arm/dct.h x264-go.new/x264c/external/x264/common/arm/dct.h
--- x264-go/x264c/external/x264/common/arm/dct.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/dct.h 2020-06-06 15:20:58.685039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* dct.h: arm transform and zigzag
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -26,28 +26,45 @@
#ifndef X264_ARM_DCT_H
#define X264_ARM_DCT_H
+#define x264_dct4x4dc_neon x264_template(dct4x4dc_neon)
void x264_dct4x4dc_neon( int16_t d[16] );
+#define x264_idct4x4dc_neon x264_template(idct4x4dc_neon)
void x264_idct4x4dc_neon( int16_t d[16] );
+#define x264_sub4x4_dct_neon x264_template(sub4x4_dct_neon)
void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_neon x264_template(sub8x8_dct_neon)
void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_neon x264_template(sub16x16_dct_neon)
void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_neon x264_template(add4x4_idct_neon)
void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_add8x8_idct_neon x264_template(add8x8_idct_neon)
void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] );
+#define x264_add16x16_idct_neon x264_template(add16x16_idct_neon)
void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add8x8_idct_dc_neon x264_template(add8x8_idct_dc_neon)
void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] );
+#define x264_add16x16_idct_dc_neon x264_template(add16x16_idct_dc_neon)
void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_sub8x8_dct_dc_neon x264_template(sub8x8_dct_dc_neon)
void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_neon x264_template(sub8x16_dct_dc_neon)
void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_neon x264_template(sub8x8_dct8_neon)
void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_neon x264_template(sub16x16_dct8_neon)
void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct8_neon x264_template(add8x8_idct8_neon)
void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] );
+#define x264_add16x16_idct8_neon x264_template(add16x16_idct8_neon)
void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] );
+#define x264_zigzag_scan_4x4_frame_neon x264_template(zigzag_scan_4x4_frame_neon)
void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] );
#endif
Only in x264-go.new/x264c/external/x264/common/arm: deblock-a.S
Only in x264-go.new/x264c/external/x264/common/arm: deblock.h
Only in x264-go.new/x264c/external/x264/common/arm: mc-a.S
diff -ur x264-go/x264c/external/x264/common/arm/mc-c.c x264-go.new/x264c/external/x264/common/arm/mc-c.c
--- x264-go/x264c/external/x264/common/arm/mc-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/mc-c.c 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc-c.c: arm motion compensation
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
* Janne Grunau <janne-x264@jannau.net>
@@ -27,46 +27,87 @@
#include "common/common.h"
#include "mc.h"
+#define x264_prefetch_ref_arm x264_template(prefetch_ref_arm)
void x264_prefetch_ref_arm( uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_arm x264_template(prefetch_fenc_arm)
void x264_prefetch_fenc_arm( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_memcpy_aligned_neon x264_template(memcpy_aligned_neon)
void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_neon x264_template(memzero_aligned_neon)
void x264_memzero_aligned_neon( void *dst, size_t n );
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_plane_copy_core_neon x264_template(plane_copy_core_neon)
void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_neon x264_template(plane_copy_deinterleave_neon)
void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu,
pixel *dstv, intptr_t i_dstv,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_neon x264_template(plane_copy_deinterleave_rgb_neon)
void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_interleave_core_neon x264_template(plane_copy_interleave_core_neon)
void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_swap_core_neon x264_template(plane_copy_swap_core_neon)
void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_store_interleave_chroma_neon x264_template(store_interleave_chroma_neon)
void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fdec_neon x264_template(load_deinterleave_chroma_fdec_neon)
void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_neon x264_template(load_deinterleave_chroma_fenc_neon)
void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_mc_weight_w16_neon x264_template(mc_weight_w16_neon)
+#define x264_mc_weight_w16_nodenom_neon x264_template(mc_weight_w16_nodenom_neon)
+#define x264_mc_weight_w16_offsetadd_neon x264_template(mc_weight_w16_offsetadd_neon)
+#define x264_mc_weight_w16_offsetsub_neon x264_template(mc_weight_w16_offsetsub_neon)
+#define x264_mc_weight_w20_neon x264_template(mc_weight_w20_neon)
+#define x264_mc_weight_w20_nodenom_neon x264_template(mc_weight_w20_nodenom_neon)
+#define x264_mc_weight_w20_offsetadd_neon x264_template(mc_weight_w20_offsetadd_neon)
+#define x264_mc_weight_w20_offsetsub_neon x264_template(mc_weight_w20_offsetsub_neon)
+#define x264_mc_weight_w4_neon x264_template(mc_weight_w4_neon)
+#define x264_mc_weight_w4_nodenom_neon x264_template(mc_weight_w4_nodenom_neon)
+#define x264_mc_weight_w4_offsetadd_neon x264_template(mc_weight_w4_offsetadd_neon)
+#define x264_mc_weight_w4_offsetsub_neon x264_template(mc_weight_w4_offsetsub_neon)
+#define x264_mc_weight_w8_neon x264_template(mc_weight_w8_neon)
+#define x264_mc_weight_w8_nodenom_neon x264_template(mc_weight_w8_nodenom_neon)
+#define x264_mc_weight_w8_offsetadd_neon x264_template(mc_weight_w8_offsetadd_neon)
+#define x264_mc_weight_w8_offsetsub_neon x264_template(mc_weight_w8_offsetsub_neon)
#if !HIGH_BIT_DEPTH
#define MC_WEIGHT(func)\
void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
@@ -74,7 +115,7 @@
void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
\
-static weight_fn_t x264_mc##func##_wtab_neon[6] =\
+static weight_fn_t mc##func##_wtab_neon[6] =\
{\
x264_mc_weight_w4##func##_neon,\
x264_mc_weight_w4##func##_neon,\
@@ -90,51 +131,67 @@
MC_WEIGHT(_offsetsub)
#endif
+#define x264_mc_copy_w4_neon x264_template(mc_copy_w4_neon)
void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w8_neon x264_template(mc_copy_w8_neon)
void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_neon x264_template(mc_copy_w16_neon)
void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_neon x264_template(mc_copy_w16_aligned_neon)
void x264_mc_copy_w16_aligned_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_chroma_neon x264_template(mc_chroma_neon)
void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int );
+#define x264_frame_init_lowres_core_neon x264_template(frame_init_lowres_core_neon)
void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int );
+#define x264_hpel_filter_v_neon x264_template(hpel_filter_v_neon)
void x264_hpel_filter_v_neon( uint8_t *, uint8_t *, int16_t *, intptr_t, int );
+#define x264_hpel_filter_c_neon x264_template(hpel_filter_c_neon)
void x264_hpel_filter_c_neon( uint8_t *, int16_t *, int );
+#define x264_hpel_filter_h_neon x264_template(hpel_filter_h_neon)
void x264_hpel_filter_h_neon( uint8_t *, uint8_t *, int );
+#define x264_integral_init4h_neon x264_template(integral_init4h_neon)
void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init4v_neon x264_template(integral_init4v_neon)
void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t );
+#define x264_integral_init8h_neon x264_template(integral_init8h_neon)
void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init8v_neon x264_template(integral_init8v_neon)
void x264_integral_init8v_neon( uint16_t *, intptr_t );
+#define x264_mbtree_propagate_cost_neon x264_template(mbtree_propagate_cost_neon)
void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int );
+#define x264_mbtree_fix8_pack_neon x264_template(mbtree_fix8_pack_neon)
void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_neon x264_template(mbtree_fix8_unpack_neon)
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
-static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w )
+static void weight_cache_neon( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
if( w->i_offset < 0 )
{
- w->weightfn = x264_mc_offsetsub_wtab_neon;
+ w->weightfn = mc_offsetsub_wtab_neon;
w->cachea[0] = -w->i_offset;
}
else
{
- w->weightfn = x264_mc_offsetadd_wtab_neon;
+ w->weightfn = mc_offsetadd_wtab_neon;
w->cachea[0] = w->i_offset;
}
}
else if( !w->i_denom )
- w->weightfn = x264_mc_nodenom_wtab_neon;
+ w->weightfn = mc_nodenom_wtab_neon;
else
- w->weightfn = x264_mc_wtab_neon;
+ w->weightfn = mc_wtab_neon;
}
-static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
+static void (* const pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) =
{
NULL,
x264_pixel_avg2_w4_neon,
@@ -144,7 +201,7 @@
x264_pixel_avg2_w20_neon,
};
-static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
+static void (* const mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) =
{
NULL,
x264_mc_copy_w4_neon,
@@ -167,7 +224,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
@@ -176,7 +233,7 @@
else if( weight->weightfn )
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );
else
- x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
+ mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height );
}
static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride,
@@ -193,7 +250,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */
{
uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);
- x264_pixel_avg_wtab_neon[i_width>>2](
+ pixel_avg_wtab_neon[i_width>>2](
dst, *i_dst_stride, src1, i_src_stride,
src2, i_height );
if( weight->weightfn )
@@ -236,11 +293,10 @@
PLANE_COPY(16, neon)
PLANE_COPY_SWAP(16, neon)
PLANE_INTERLEAVE(neon)
-#endif // !HIGH_BIT_DEPTH
-
PROPAGATE_LIST(neon)
+#endif // !HIGH_BIT_DEPTH
-void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf )
+void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
@@ -260,11 +316,11 @@
pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon;
pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon;
- pf->plane_copy = x264_plane_copy_neon;
+ pf->plane_copy = plane_copy_neon;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon;
- pf->plane_copy_interleave = x264_plane_copy_interleave_neon;
- pf->plane_copy_swap = x264_plane_copy_swap_neon;
+ pf->plane_copy_interleave = plane_copy_interleave_neon;
+ pf->plane_copy_swap = plane_copy_swap_neon;
pf->store_interleave_chroma = x264_store_interleave_chroma_neon;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon;
@@ -280,10 +336,10 @@
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon;
- pf->weight = x264_mc_wtab_neon;
- pf->offsetadd = x264_mc_offsetadd_wtab_neon;
- pf->offsetsub = x264_mc_offsetsub_wtab_neon;
- pf->weight_cache = x264_weight_cache_neon;
+ pf->weight = mc_wtab_neon;
+ pf->offsetadd = mc_offsetadd_wtab_neon;
+ pf->offsetsub = mc_offsetsub_wtab_neon;
+ pf->weight_cache = weight_cache_neon;
pf->mc_chroma = x264_mc_chroma_neon;
pf->mc_luma = mc_luma_neon;
@@ -297,7 +353,7 @@
pf->integral_init8v = x264_integral_init8v_neon;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon;
+ pf->mbtree_propagate_list = mbtree_propagate_list_neon;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon;
#endif // !HIGH_BIT_DEPTH
diff -ur x264-go/x264c/external/x264/common/arm/mc.h x264-go.new/x264c/external/x264/common/arm/mc.h
--- x264-go/x264c/external/x264/common/arm/mc.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/mc.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc.h: arm motion compensation
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -26,6 +26,7 @@
#ifndef X264_ARM_MC_H
#define X264_ARM_MC_H
-void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf );
+#define x264_mc_init_arm x264_template(mc_init_arm)
+void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf );
#endif
Only in x264-go.new/x264c/external/x264/common/arm: pixel-a.S
diff -ur x264-go/x264c/external/x264/common/arm/pixel.h x264-go.new/x264c/external/x264/common/arm/pixel.h
--- x264-go/x264c/external/x264/common/arm/pixel.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/pixel.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* pixel.h: arm pixel metrics
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -26,6 +26,68 @@
#ifndef X264_ARM_PIXEL_H
#define X264_ARM_PIXEL_H
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
+#define x264_pixel_sad_16x16_neon x264_template(pixel_sad_16x16_neon)
+#define x264_pixel_sad_16x8_neon x264_template(pixel_sad_16x8_neon)
+#define x264_pixel_sad_4x4_armv6 x264_template(pixel_sad_4x4_armv6)
+#define x264_pixel_sad_4x4_neon x264_template(pixel_sad_4x4_neon)
+#define x264_pixel_sad_4x8_armv6 x264_template(pixel_sad_4x8_armv6)
+#define x264_pixel_sad_4x8_neon x264_template(pixel_sad_4x8_neon)
+#define x264_pixel_sad_8x16_neon x264_template(pixel_sad_8x16_neon)
+#define x264_pixel_sad_8x4_neon x264_template(pixel_sad_8x4_neon)
+#define x264_pixel_sad_8x8_neon x264_template(pixel_sad_8x8_neon)
+#define x264_pixel_sad_aligned_16x16_neon x264_template(pixel_sad_aligned_16x16_neon)
+#define x264_pixel_sad_aligned_16x16_neon_dual x264_template(pixel_sad_aligned_16x16_neon_dual)
+#define x264_pixel_sad_aligned_16x8_neon x264_template(pixel_sad_aligned_16x8_neon)
+#define x264_pixel_sad_aligned_16x8_neon_dual x264_template(pixel_sad_aligned_16x8_neon_dual)
+#define x264_pixel_sad_aligned_4x4_neon x264_template(pixel_sad_aligned_4x4_neon)
+#define x264_pixel_sad_aligned_4x8_neon x264_template(pixel_sad_aligned_4x8_neon)
+#define x264_pixel_sad_aligned_8x16_neon x264_template(pixel_sad_aligned_8x16_neon)
+#define x264_pixel_sad_aligned_8x16_neon_dual x264_template(pixel_sad_aligned_8x16_neon_dual)
+#define x264_pixel_sad_aligned_8x4_neon x264_template(pixel_sad_aligned_8x4_neon)
+#define x264_pixel_sad_aligned_8x4_neon_dual x264_template(pixel_sad_aligned_8x4_neon_dual)
+#define x264_pixel_sad_aligned_8x8_neon x264_template(pixel_sad_aligned_8x8_neon)
+#define x264_pixel_sad_aligned_8x8_neon_dual x264_template(pixel_sad_aligned_8x8_neon_dual)
+#define x264_pixel_sad_x3_16x16_neon x264_template(pixel_sad_x3_16x16_neon)
+#define x264_pixel_sad_x3_16x8_neon x264_template(pixel_sad_x3_16x8_neon)
+#define x264_pixel_sad_x3_4x4_neon x264_template(pixel_sad_x3_4x4_neon)
+#define x264_pixel_sad_x3_4x8_neon x264_template(pixel_sad_x3_4x8_neon)
+#define x264_pixel_sad_x3_8x16_neon x264_template(pixel_sad_x3_8x16_neon)
+#define x264_pixel_sad_x3_8x4_neon x264_template(pixel_sad_x3_8x4_neon)
+#define x264_pixel_sad_x3_8x8_neon x264_template(pixel_sad_x3_8x8_neon)
+#define x264_pixel_sad_x4_16x16_neon x264_template(pixel_sad_x4_16x16_neon)
+#define x264_pixel_sad_x4_16x8_neon x264_template(pixel_sad_x4_16x8_neon)
+#define x264_pixel_sad_x4_4x4_neon x264_template(pixel_sad_x4_4x4_neon)
+#define x264_pixel_sad_x4_4x8_neon x264_template(pixel_sad_x4_4x8_neon)
+#define x264_pixel_sad_x4_8x16_neon x264_template(pixel_sad_x4_8x16_neon)
+#define x264_pixel_sad_x4_8x4_neon x264_template(pixel_sad_x4_8x4_neon)
+#define x264_pixel_sad_x4_8x8_neon x264_template(pixel_sad_x4_8x8_neon)
+#define x264_pixel_satd_16x16_neon x264_template(pixel_satd_16x16_neon)
+#define x264_pixel_satd_16x8_neon x264_template(pixel_satd_16x8_neon)
+#define x264_pixel_satd_4x4_neon x264_template(pixel_satd_4x4_neon)
+#define x264_pixel_satd_4x8_neon x264_template(pixel_satd_4x8_neon)
+#define x264_pixel_satd_8x16_neon x264_template(pixel_satd_8x16_neon)
+#define x264_pixel_satd_8x4_neon x264_template(pixel_satd_8x4_neon)
+#define x264_pixel_satd_8x8_neon x264_template(pixel_satd_8x8_neon)
+#define x264_pixel_ssd_16x16_neon x264_template(pixel_ssd_16x16_neon)
+#define x264_pixel_ssd_16x8_neon x264_template(pixel_ssd_16x8_neon)
+#define x264_pixel_ssd_4x4_neon x264_template(pixel_ssd_4x4_neon)
+#define x264_pixel_ssd_4x8_neon x264_template(pixel_ssd_4x8_neon)
+#define x264_pixel_ssd_8x16_neon x264_template(pixel_ssd_8x16_neon)
+#define x264_pixel_ssd_8x4_neon x264_template(pixel_ssd_8x4_neon)
+#define x264_pixel_ssd_8x8_neon x264_template(pixel_ssd_8x8_neon)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
@@ -52,30 +114,47 @@
DECL_X1( satd, neon )
DECL_X1( ssd, neon )
+#define x264_pixel_ssd_nv12_core_neon x264_template(pixel_ssd_nv12_core_neon)
void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * );
+#define x264_pixel_vsad_neon x264_template(pixel_vsad_neon)
int x264_pixel_vsad_neon( uint8_t *, intptr_t, int );
+#define x264_pixel_sa8d_8x8_neon x264_template(pixel_sa8d_8x8_neon)
int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_16x16_neon x264_template(pixel_sa8d_16x16_neon)
int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_satd_16x16_neon x264_template(pixel_sa8d_satd_16x16_neon)
uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_var_8x8_neon x264_template(pixel_var_8x8_neon)
uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_8x16_neon x264_template(pixel_var_8x16_neon)
uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_16x16_neon x264_template(pixel_var_16x16_neon)
uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_var2_8x8_neon x264_template(pixel_var2_8x8_neon)
int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * );
+#define x264_pixel_var2_8x16_neon x264_template(pixel_var2_8x16_neon)
int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * );
+#define x264_pixel_hadamard_ac_8x8_neon x264_template(pixel_hadamard_ac_8x8_neon)
uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_8x16_neon x264_template(pixel_hadamard_ac_8x16_neon)
uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x8_neon x264_template(pixel_hadamard_ac_16x8_neon)
uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x16_neon x264_template(pixel_hadamard_ac_16x16_neon)
uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_ssim_4x4x2_core_neon x264_template(pixel_ssim_4x4x2_core_neon)
void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t,
const uint8_t *, intptr_t,
int sums[2][4] );
+#define x264_pixel_ssim_end4_neon x264_template(pixel_ssim_end4_neon)
float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_asd8_neon x264_template(pixel_asd8_neon)
int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
#endif
Only in x264-go.new/x264c/external/x264/common/arm: predict-a.S
diff -ur x264-go/x264c/external/x264/common/arm/predict-c.c x264-go.new/x264c/external/x264/common/arm/predict-c.c
--- x264-go/x264c/external/x264/common/arm/predict-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/predict-c.c 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.c: arm intra prediction
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -27,7 +27,7 @@
#include "predict.h"
#include "pixel.h"
-void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] )
+void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
@@ -46,7 +46,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
@@ -61,7 +61,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
@@ -74,7 +74,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
+void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
@@ -92,7 +92,7 @@
#endif // !HIGH_BIT_DEPTH
}
-void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] )
+void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
diff -ur x264-go/x264c/external/x264/common/arm/predict.h x264-go.new/x264c/external/x264/common/arm/predict.h
--- x264-go/x264c/external/x264/common/arm/predict.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/predict.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.h: arm intra prediction
*****************************************************************************
- * Copyright (C) 2009-2017 x264 project
+ * Copyright (C) 2009-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -26,45 +26,80 @@
#ifndef X264_ARM_PREDICT_H
#define X264_ARM_PREDICT_H
+#define x264_predict_4x4_dc_armv6 x264_template(predict_4x4_dc_armv6)
void x264_predict_4x4_dc_armv6( uint8_t *src );
+#define x264_predict_4x4_dc_top_neon x264_template(predict_4x4_dc_top_neon)
void x264_predict_4x4_dc_top_neon( uint8_t *src );
+#define x264_predict_4x4_v_armv6 x264_template(predict_4x4_v_armv6)
void x264_predict_4x4_v_armv6( uint8_t *src );
+#define x264_predict_4x4_h_armv6 x264_template(predict_4x4_h_armv6)
void x264_predict_4x4_h_armv6( uint8_t *src );
+#define x264_predict_4x4_ddr_armv6 x264_template(predict_4x4_ddr_armv6)
void x264_predict_4x4_ddr_armv6( uint8_t *src );
+#define x264_predict_4x4_ddl_neon x264_template(predict_4x4_ddl_neon)
void x264_predict_4x4_ddl_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_neon x264_template(predict_8x8c_dc_neon)
void x264_predict_8x8c_dc_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_top_neon x264_template(predict_8x8c_dc_top_neon)
void x264_predict_8x8c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_left_neon x264_template(predict_8x8c_dc_left_neon)
void x264_predict_8x8c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x8c_h_neon x264_template(predict_8x8c_h_neon)
void x264_predict_8x8c_h_neon( uint8_t *src );
+#define x264_predict_8x8c_v_neon x264_template(predict_8x8c_v_neon)
void x264_predict_8x8c_v_neon( uint8_t *src );
+#define x264_predict_8x8c_p_neon x264_template(predict_8x8c_p_neon)
void x264_predict_8x8c_p_neon( uint8_t *src );
+#define x264_predict_8x16c_h_neon x264_template(predict_8x16c_h_neon)
void x264_predict_8x16c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_top_neon x264_template(predict_8x16c_dc_top_neon)
void x264_predict_8x16c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x16c_p_neon x264_template(predict_8x16c_p_neon)
void x264_predict_8x16c_p_neon( uint8_t *src );
+#define x264_predict_8x8_dc_neon x264_template(predict_8x8_dc_neon)
void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddl_neon x264_template(predict_8x8_ddl_neon)
void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_neon x264_template(predict_8x8_ddr_neon)
void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vl_neon x264_template(predict_8x8_vl_neon)
void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_neon x264_template(predict_8x8_vr_neon)
void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_v_neon x264_template(predict_8x8_v_neon)
void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_neon x264_template(predict_8x8_h_neon)
void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hd_neon x264_template(predict_8x8_hd_neon)
void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_neon x264_template(predict_8x8_hu_neon)
void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_16x16_dc_neon x264_template(predict_16x16_dc_neon)
void x264_predict_16x16_dc_neon( uint8_t *src );
+#define x264_predict_16x16_dc_top_neon x264_template(predict_16x16_dc_top_neon)
void x264_predict_16x16_dc_top_neon( uint8_t *src );
+#define x264_predict_16x16_dc_left_neon x264_template(predict_16x16_dc_left_neon)
void x264_predict_16x16_dc_left_neon( uint8_t *src );
+#define x264_predict_16x16_h_neon x264_template(predict_16x16_h_neon)
void x264_predict_16x16_h_neon( uint8_t *src );
+#define x264_predict_16x16_v_neon x264_template(predict_16x16_v_neon)
void x264_predict_16x16_v_neon( uint8_t *src );
+#define x264_predict_16x16_p_neon x264_template(predict_16x16_p_neon)
void x264_predict_16x16_p_neon( uint8_t *src );
-void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] );
-void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
-void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] );
-void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init_arm x264_template(predict_4x4_init_arm)
+void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_arm x264_template(predict_8x8_init_arm)
+void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
+#define x264_predict_8x8c_init_arm x264_template(predict_8x8c_init_arm)
+void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_arm x264_template(predict_8x16c_init_arm)
+void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_16x16_init_arm x264_template(predict_16x16_init_arm)
+void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#endif
Only in x264-go.new/x264c/external/x264/common/arm: quant-a.S
diff -ur x264-go/x264c/external/x264/common/arm/quant.h x264-go.new/x264c/external/x264/common/arm/quant.h
--- x264-go/x264c/external/x264/common/arm/quant.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/arm/quant.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* quant.h: arm quantization and level-run
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
@@ -26,28 +26,46 @@
#ifndef X264_ARM_QUANT_H
#define X264_ARM_QUANT_H
+#define x264_quant_2x2_dc_armv6 x264_template(quant_2x2_dc_armv6)
int x264_quant_2x2_dc_armv6( int16_t dct[4], int mf, int bias );
+#define x264_quant_2x2_dc_neon x264_template(quant_2x2_dc_neon)
int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_neon x264_template(quant_4x4_dc_neon)
int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias );
+#define x264_quant_4x4_neon x264_template(quant_4x4_neon)
int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_4x4x4_neon x264_template(quant_4x4x4_neon)
int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_8x8_neon x264_template(quant_8x8_neon)
int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] );
+#define x264_dequant_4x4_dc_neon x264_template(dequant_4x4_dc_neon)
void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4_neon x264_template(dequant_4x4_neon)
void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_neon x264_template(dequant_8x8_neon)
void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_decimate_score15_neon x264_template(decimate_score15_neon)
int x264_decimate_score15_neon( int16_t * );
+#define x264_decimate_score16_neon x264_template(decimate_score16_neon)
int x264_decimate_score16_neon( int16_t * );
+#define x264_decimate_score64_neon x264_template(decimate_score64_neon)
int x264_decimate_score64_neon( int16_t * );
+#define x264_coeff_last4_arm x264_template(coeff_last4_arm)
int x264_coeff_last4_arm( int16_t * );
+#define x264_coeff_last8_arm x264_template(coeff_last8_arm)
int x264_coeff_last8_arm( int16_t * );
+#define x264_coeff_last15_neon x264_template(coeff_last15_neon)
int x264_coeff_last15_neon( int16_t * );
+#define x264_coeff_last16_neon x264_template(coeff_last16_neon)
int x264_coeff_last16_neon( int16_t * );
+#define x264_coeff_last64_neon x264_template(coeff_last64_neon)
int x264_coeff_last64_neon( int16_t * );
+#define x264_denoise_dct_neon x264_template(denoise_dct_neon)
void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int );
#endif
Only in x264-go.new/x264c/external/x264/common: base.c
Only in x264-go.new/x264c/external/x264/common: base.h
diff -ur x264-go/x264c/external/x264/common/bitstream.c x264-go.new/x264c/external/x264/common/bitstream.c
--- x264-go/x264c/external/x264/common/bitstream.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/bitstream.c 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* bitstream.c: bitstream writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Fiona Glaser <fiona@x264.com>
@@ -26,7 +26,7 @@
#include "common.h"
-static uint8_t *x264_nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end )
+static uint8_t *nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end )
{
if( src < end ) *dst++ = *src++;
if( src < end ) *dst++ = *src++;
@@ -39,25 +39,15 @@
return dst;
}
-uint8_t *x264_nal_escape_mmx2( uint8_t *dst, uint8_t *src, uint8_t *end );
-uint8_t *x264_nal_escape_sse2( uint8_t *dst, uint8_t *src, uint8_t *end );
-uint8_t *x264_nal_escape_avx2( uint8_t *dst, uint8_t *src, uint8_t *end );
-void x264_cabac_block_residual_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_avx2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_avx512( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-
-uint8_t *x264_nal_escape_neon( uint8_t *dst, uint8_t *src, uint8_t *end );
+#if HAVE_MMX
+#include "x86/bitstream.h"
+#endif
+#if HAVE_ARMV6
+#include "arm/bitstream.h"
+#endif
+#if HAVE_AARCH64
+#include "aarch64/bitstream.h"
+#endif
/****************************************************************************
* x264_nal_encode:
@@ -113,11 +103,11 @@
x264_emms();
}
-void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf )
+void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf )
{
memset( pf, 0, sizeof(*pf) );
- pf->nal_escape = x264_nal_escape_c;
+ pf->nal_escape = nal_escape_c;
#if HAVE_MMX
#if ARCH_X86_64 && !defined( __MACH__ )
pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_sse2;
@@ -169,7 +159,7 @@
if( cpu&X264_CPU_NEON )
pf->nal_escape = x264_nal_escape_neon;
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
pf->nal_escape = x264_nal_escape_neon;
#endif
diff -ur x264-go/x264c/external/x264/common/bitstream.h x264-go.new/x264c/external/x264/common/bitstream.h
--- x264-go/x264c/external/x264/common/bitstream.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/bitstream.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* bitstream.h: bitstream writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -30,12 +30,6 @@
typedef struct
{
- uint8_t i_bits;
- uint8_t i_size;
-} vlc_t;
-
-typedef struct
-{
uint16_t i_bits;
uint8_t i_size;
/* Next level table to use */
@@ -60,12 +54,6 @@
ALIGNED_16( dctcoef level[18] );
} x264_run_level_t;
-extern const vlc_t x264_coeff0_token[6];
-extern const vlc_t x264_coeff_token[6][16][4];
-extern const vlc_t x264_total_zeros[15][16];
-extern const vlc_t x264_total_zeros_2x2_dc[3][4];
-extern const vlc_t x264_total_zeros_2x4_dc[7][8];
-
typedef struct
{
uint8_t *(*nal_escape)( uint8_t *dst, uint8_t *src, uint8_t *end );
@@ -77,7 +65,8 @@
intptr_t ctx_block_cat, x264_cabac_t *cb );
} x264_bitstream_function_t;
-void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf );
+#define x264_bitstream_init x264_template(bitstream_init)
+void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf );
/* A larger level table size theoretically could help a bit at extremely
* high bitrates, but the cost in cache is usually too high for it to be
@@ -85,11 +74,13 @@
* This size appears to be optimal for QP18 encoding on a Nehalem CPU.
* FIXME: Do further testing? */
#define LEVEL_TABLE_SIZE 128
+#define x264_level_token x264_template(level_token)
extern vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE];
/* The longest possible set of zero run codes sums to 25 bits. This leaves
* plenty of room for both the code (25 bits) and size (5 bits) in a uint32_t. */
+#define x264_run_before x264_template(run_before)
extern uint32_t x264_run_before[1<<16];
static inline void bs_init( bs_t *s, void *p_data, int i_data )
@@ -98,8 +89,13 @@
s->p = s->p_start = (uint8_t*)p_data - offset;
s->p_end = (uint8_t*)p_data + i_data;
s->i_left = (WORD_SIZE - offset)*8;
- s->cur_bits = endian_fix32( M32(s->p) );
- s->cur_bits >>= (4-offset)*8;
+ if( offset )
+ {
+ s->cur_bits = endian_fix32( M32(s->p) );
+ s->cur_bits >>= (4-offset)*8;
+ }
+ else
+ s->cur_bits = 0;
}
static inline int bs_pos( bs_t *s )
{
@@ -197,6 +193,7 @@
{
if( s->i_left&7 )
bs_write( s, s->i_left&7, 1 << ( (s->i_left&7) - 1 ) );
+ bs_flush( s );
}
/* golomb functions */
diff -ur x264-go/x264c/external/x264/common/cabac.c x264-go.new/x264c/external/x264/common/cabac.c
--- x264-go/x264c/external/x264/common/cabac.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/cabac.c 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cabac.c: arithmetic coder
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -27,1305 +27,7 @@
#include "common.h"
-
-static const int8_t x264_cabac_context_init_I[1024][2] =
-{
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 unused for I */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 },
-
- /* 24- 39 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
-
- /* 40 - 53 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
-
- /* 54 - 59 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 -> 87 */
- { 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 },
- { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 },
- { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 },
- { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 },
- { -12, 115 },{ -16, 122 },
-
- /* 88 -> 104 */
- { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 },
- { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 },
- { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 },
- { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 },
- { -22, 125 },
-
- /* 105 -> 135 */
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 },{ -15, 100 },
-
- /* 136 -> 165 */
- { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 },
- { -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 },
- { -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 },
- { 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 },
- { -4, 75 }, { 2, 72 }, { -11, 75 }, { -3, 71 },
- { 15, 46 }, { -13, 69 }, { 0, 62 }, { 0, 65 },
- { 21, 37 }, { -15, 72 }, { 9, 57 }, { 16, 54 },
- { 0, 62 }, { 12, 72 },
-
- /* 166 -> 196 */
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 },
-
- /* 197 -> 226 */
- { 26, -17 }, { 30, -25 }, { 28, -20 }, { 33, -23 },
- { 37, -27 }, { 33, -23 }, { 40, -28 }, { 38, -17 },
- { 33, -11 }, { 40, -15 }, { 41, -6 }, { 38, 1 },
- { 41, 17 }, { 30, -6 }, { 27, 3 }, { 26, 22 },
- { 37, -16 }, { 35, -4 }, { 38, -8 }, { 38, -3 },
- { 37, 3 }, { 38, 5 }, { 42, 0 }, { 35, 16 },
- { 39, 22 }, { 14, 48 }, { 27, 37 }, { 21, 60 },
- { 12, 68 }, { 2, 97 },
-
- /* 227 -> 251 */
- { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
- { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
- { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
- { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
- { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
- { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
- { -4, 65 },
-
- /* 252 -> 275 */
- { -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 },
- { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 },
- { -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 },
- { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 },
- { -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 },
- { -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 -> 307 */
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 },{ -11, 97 },
-
- /* 308 -> 337 */
- { -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 },
- { -9, 85 }, { -13, 88 }, { 4, 66 }, { -3, 77 },
- { -3, 76 }, { -6, 76 }, { 10, 58 }, { -1, 76 },
- { -1, 83 }, { -7, 99 }, { -14, 95 }, { 2, 95 },
- { 0, 76 }, { -5, 74 }, { 0, 70 }, { -11, 75 },
- { 1, 68 }, { 0, 65 }, { -14, 73 }, { 3, 62 },
- { 4, 62 }, { -1, 68 }, { -13, 75 }, { 11, 55 },
- { 5, 64 }, { 12, 70 },
-
- /* 338 -> 368 */
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 },{ 36, -35 }, { 36, -34 },
-
- /* 369 -> 398 */
- { 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 },
- { 34, -15 }, { 40, -15 }, { 33, -7 }, { 35, -5 },
- { 33, 0 }, { 38, 2 }, { 33, 13 }, { 23, 35 },
- { 13, 58 }, { 29, -3 }, { 26, 0 }, { 22, 30 },
- { 31, -7 }, { 35, -15 }, { 34, -3 }, { 34, 3 },
- { 36, -1 }, { 34, 5 }, { 32, 11 }, { 35, 5 },
- { 34, 12 }, { 39, 11 }, { 30, 29 }, { 34, 26 },
- { 29, 39 }, { 19, 66 },
-
- /* 399 -> 435 */
- { 31, 21 }, { 31, 31 }, { 25, 50 },
- { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
- { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
- { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
- { -23, 68 }, { -24, 50 }, { -11, 74 }, { 23, -13 },
- { 26, -13 }, { 40, -15 }, { 49, -14 }, { 44, 3 },
- { 45, 6 }, { 44, 34 }, { 33, 54 }, { 19, 82 },
- { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
- { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
- { 0, 68 }, { -9, 92 },
-
- /* 436 -> 459 */
- { -14, 106 }, { -13, 97 }, { -15, 90 }, { -12, 90 },
- { -18, 88 }, { -10, 73 }, { -9, 79 }, { -14, 86 },
- { -10, 73 }, { -10, 70 }, { -10, 69 }, { -5, 66 },
- { -9, 64 }, { -5, 58 }, { 2, 59 }, { 21, -10 },
- { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
- { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
-
- /* 460 -> 1024 */
- { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
- { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
- { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
- { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
- { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
- { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
- { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
- { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
- { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
- { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
- { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
- { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
- { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
- { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
- { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
- { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
- { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
- { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
- { -23, 68 }, { -24, 50 }, { -11, 74 }, { -14, 106 },
- { -13, 97 }, { -15, 90 }, { -12, 90 }, { -18, 88 },
- { -10, 73 }, { -9, 79 }, { -14, 86 }, { -10, 73 },
- { -10, 70 }, { -10, 69 }, { -5, 66 }, { -9, 64 },
- { -5, 58 }, { 2, 59 }, { 23, -13 }, { 26, -13 },
- { 40, -15 }, { 49, -14 }, { 44, 3 }, { 45, 6 },
- { 44, 34 }, { 33, 54 }, { 19, 82 }, { 21, -10 },
- { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
- { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
- { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
- { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
- { 0, 68 }, { -9, 92 }, { -17, 120 }, { -20, 112 },
- { -18, 114 }, { -11, 85 }, { -15, 92 }, { -14, 89 },
- { -26, 71 }, { -15, 81 }, { -14, 80 }, { 0, 68 },
- { -14, 70 }, { -24, 56 }, { -23, 68 }, { -24, 50 },
- { -11, 74 }, { -14, 106 }, { -13, 97 }, { -15, 90 },
- { -12, 90 }, { -18, 88 }, { -10, 73 }, { -9, 79 },
- { -14, 86 }, { -10, 73 }, { -10, 70 }, { -10, 69 },
- { -5, 66 }, { -9, 64 }, { -5, 58 }, { 2, 59 },
- { 23, -13 }, { 26, -13 }, { 40, -15 }, { 49, -14 },
- { 44, 3 }, { 45, 6 }, { 44, 34 }, { 33, 54 },
- { 19, 82 }, { 21, -10 }, { 24, -11 }, { 28, -8 },
- { 28, -1 }, { 29, 3 }, { 29, 9 }, { 35, 20 },
- { 29, 36 }, { 14, 67 }, { -3, 75 }, { -1, 23 },
- { 1, 34 }, { 1, 43 }, { 0, 54 }, { -2, 55 },
- { 0, 61 }, { 1, 64 }, { 0, 68 }, { -9, 92 },
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
- { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
- { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
- { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
- { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
- { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
- { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
- { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
- { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
- { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
- { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
- { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
- { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
- { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
- { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
- { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
- { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
- { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
- { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
- { -4, 65 }, { -12, 73 }, { -8, 76 }, { -7, 80 },
- { -9, 88 }, { -17, 110 }, { -3, 71 }, { -6, 42 },
- { -5, 50 }, { -3, 54 }, { -2, 62 }, { 0, 58 },
- { 1, 63 }, { -2, 72 }, { -1, 74 }, { -9, 91 },
- { -5, 67 }, { -5, 27 }, { -3, 39 }, { -2, 44 },
- { 0, 46 }, { -16, 64 }, { -8, 68 }, { -10, 78 },
- { -6, 77 }, { -10, 86 }, { -12, 92 }, { -15, 55 },
- { -10, 60 }, { -6, 62 }, { -4, 65 }, { -12, 73 },
- { -8, 76 }, { -7, 80 }, { -9, 88 }, { -17, 110 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }
-};
-
-static const int8_t x264_cabac_context_init_PB[3][1024][2] =
-{
- /* i_cabac_init_idc == 0 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 23, 33 }, { 23, 2 }, { 21, 0 }, { 1, 9 },
- { 0, 49 }, { -37, 118 }, { 5, 57 }, { -13, 78 },
- { -11, 65 }, { 1, 62 }, { 12, 49 }, { -4, 73 },
- { 17, 50 },
-
- /* 24 - 39 */
- { 18, 64 }, { 9, 43 }, { 29, 0 }, { 26, 67 },
- { 16, 90 }, { 9, 104 }, { -46, 127 }, { -20, 104 },
- { 1, 67 }, { -13, 78 }, { -11, 65 }, { 1, 62 },
- { -6, 86 }, { -17, 95 }, { -6, 61 }, { 9, 45 },
-
- /* 40 - 53 */
- { -3, 69 }, { -6, 81 }, { -11, 96 }, { 6, 55 },
- { 7, 67 }, { -5, 86 }, { 2, 88 }, { 0, 58 },
- { -3, 76 }, { -10, 94 }, { 5, 54 }, { 4, 69 },
- { -3, 81 }, { 0, 88 },
-
- /* 54 - 59 */
- { -7, 67 }, { -5, 74 }, { -4, 74 }, { -5, 80 },
- { -7, 72 }, { 1, 58 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 87 */
- { 0, 45 }, { -4, 78 }, { -3, 96 }, { -27, 126 },
- { -28, 98 }, { -25, 101 }, { -23, 67 }, { -28, 82 },
- { -20, 94 }, { -16, 83 }, { -22, 110 }, { -21, 91 },
- { -18, 102 }, { -13, 93 }, { -29, 127 }, { -7, 92 },
- { -5, 89 }, { -7, 96 }, { -13, 108 }, { -3, 46 },
- { -1, 65 }, { -1, 57 }, { -9, 93 }, { -3, 74 },
- { -9, 92 }, { -8, 87 }, { -23, 126 }, { 5, 54 },
- { 6, 60 }, { 6, 59 }, { 6, 69 }, { -1, 48 },
- { 0, 68 }, { -4, 69 }, { -8, 88 },
-
- /* 105 -> 165 */
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { 3, 64 }, { 1, 61 }, { 9, 63 }, { 7, 50 },
- { 16, 39 }, { 5, 44 }, { 4, 52 }, { 11, 48 },
- { -5, 60 }, { -1, 59 }, { 0, 59 }, { 22, 33 },
- { 5, 44 }, { 14, 43 }, { -1, 78 }, { 0, 60 },
- { 9, 69 },
-
- /* 166 - 226 */
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { 1, 67 }, { 5, 59 }, { 9, 67 }, { 16, 30 },
- { 18, 32 }, { 18, 35 }, { 22, 29 }, { 24, 31 },
- { 23, 38 }, { 18, 43 }, { 20, 41 }, { 11, 63 },
- { 9, 59 }, { 9, 64 }, { -1, 94 }, { -2, 89 },
- { -9, 108 },
-
- /* 227 - 275 */
- { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
- { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
- { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
- { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
- { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
- { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
- { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
- { -3, 74 }, { -10, 90 }, { 0, 70 }, { -4, 29 },
- { 5, 31 }, { 7, 42 }, { 1, 59 }, { -2, 58 },
- { -3, 72 }, { -3, 81 }, { -11, 97 }, { 0, 58 },
- { 8, 5 }, { 10, 14 }, { 14, 18 }, { 13, 27 },
- { 2, 40 }, { 0, 58 }, { -3, 70 }, { -6, 79 },
- { -8, 85 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { -2, 69 }, { -2, 59 }, { 6, 70 }, { 10, 44 },
- { 9, 31 }, { 12, 43 }, { 3, 53 }, { 14, 34 },
- { 10, 38 }, { -3, 52 }, { 13, 40 }, { 17, 32 },
- { 7, 44 }, { 7, 38 }, { 13, 50 }, { 10, 57 },
- { 26, 43 },
-
- /* 338 - 398 */
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { 8, 60 }, { 6, 63 }, { 17, 65 }, { 21, 24 },
- { 23, 20 }, { 26, 23 }, { 27, 32 }, { 28, 23 },
- { 28, 24 }, { 23, 40 }, { 24, 32 }, { 28, 29 },
- { 23, 42 }, { 19, 57 }, { 22, 53 }, { 22, 61 },
- { 11, 86 },
-
- /* 399 -> 435 */
- { 12, 40 }, { 11, 51 }, { 14, 59 },
- { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
- { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
- { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
- { -16, 66 }, { -22, 65 }, { -20, 63 }, { 9, -2 },
- { 26, -9 }, { 33, -9 }, { 39, -7 }, { 41, -2 },
- { 45, 3 }, { 49, 9 }, { 45, 27 }, { 36, 59 },
- { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
- { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
- { -8, 66 }, { -8, 76 },
-
- /* 436 -> 459 */
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { 21, -13 },
- { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
- { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
-
- /* 460 - 1024 */
- { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
- { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
- { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
- { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
- { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
- { -16, 66 }, { -22, 65 }, { -20, 63 }, { -5, 85 },
- { -6, 81 }, { -10, 77 }, { -7, 81 }, { -17, 80 },
- { -18, 73 }, { -4, 74 }, { -10, 83 }, { -9, 71 },
- { -9, 67 }, { -1, 61 }, { -8, 66 }, { -14, 66 },
- { 0, 59 }, { 2, 59 }, { 9, -2 }, { 26, -9 },
- { 33, -9 }, { 39, -7 }, { 41, -2 }, { 45, 3 },
- { 49, 9 }, { 45, 27 }, { 36, 59 }, { 21, -13 },
- { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
- { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
- { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
- { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
- { -8, 66 }, { -8, 76 }, { -4, 79 }, { -7, 71 },
- { -5, 69 }, { -9, 70 }, { -8, 66 }, { -10, 68 },
- { -19, 73 }, { -12, 69 }, { -16, 70 }, { -15, 67 },
- { -20, 62 }, { -19, 70 }, { -16, 66 }, { -22, 65 },
- { -20, 63 }, { -5, 85 }, { -6, 81 }, { -10, 77 },
- { -7, 81 }, { -17, 80 }, { -18, 73 }, { -4, 74 },
- { -10, 83 }, { -9, 71 }, { -9, 67 }, { -1, 61 },
- { -8, 66 }, { -14, 66 }, { 0, 59 }, { 2, 59 },
- { 9, -2 }, { 26, -9 }, { 33, -9 }, { 39, -7 },
- { 41, -2 }, { 45, 3 }, { 49, 9 }, { 45, 27 },
- { 36, 59 }, { 21, -13 }, { 33, -14 }, { 39, -7 },
- { 46, -2 }, { 51, 2 }, { 60, 6 }, { 61, 17 },
- { 55, 34 }, { 42, 62 }, { -6, 66 }, { -7, 35 },
- { -7, 42 }, { -8, 45 }, { -5, 48 }, { -12, 56 },
- { -6, 60 }, { -5, 62 }, { -8, 66 }, { -8, 76 },
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
- { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
- { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
- { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
- { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
- { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
- { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
- { -3, 74 }, { -10, 90 }, { -6, 76 }, { -2, 44 },
- { 0, 45 }, { 0, 52 }, { -3, 64 }, { -2, 59 },
- { -4, 70 }, { -4, 75 }, { -8, 82 }, { -17, 102 },
- { -9, 77 }, { 3, 24 }, { 0, 42 }, { 0, 48 },
- { 0, 55 }, { -6, 59 }, { -7, 71 }, { -12, 83 },
- { -11, 87 }, { -30, 119 }, { 1, 58 }, { -3, 29 },
- { -1, 36 }, { 1, 38 }, { 2, 43 }, { -6, 55 },
- { 0, 58 }, { 0, 64 }, { -3, 74 }, { -10, 90 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }
- },
-
- /* i_cabac_init_idc == 1 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 22, 25 }, { 34, 0 }, { 16, 0 }, { -2, 9 },
- { 4, 41 }, { -29, 118 }, { 2, 65 }, { -6, 71 },
- { -13, 79 }, { 5, 52 }, { 9, 50 }, { -3, 70 },
- { 10, 54 },
-
- /* 24 - 39 */
- { 26, 34 }, { 19, 22 }, { 40, 0 }, { 57, 2 },
- { 41, 36 }, { 26, 69 }, { -45, 127 }, { -15, 101 },
- { -4, 76 }, { -6, 71 }, { -13, 79 }, { 5, 52 },
- { 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 },
-
- /* 40 - 53 */
- { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 },
- { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 },
- { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 },
- { -7, 86 },{ -5, 95 },
-
- /* 54 - 59 */
- { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 },
- { -5, 72 },{ 0, 61 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 104 */
- { 13, 15 }, { 7, 51 }, { 2, 80 }, { -39, 127 },
- { -18, 91 }, { -17, 96 }, { -26, 81 }, { -35, 98 },
- { -24, 102 }, { -23, 97 }, { -27, 119 }, { -24, 99 },
- { -21, 110 }, { -18, 102 }, { -36, 127 }, { 0, 80 },
- { -5, 89 }, { -7, 94 }, { -4, 92 }, { 0, 39 },
- { 0, 65 }, { -15, 84 }, { -35, 127 }, { -2, 73 },
- { -12, 104 }, { -9, 91 }, { -31, 127 }, { 3, 55 },
- { 7, 56 }, { 7, 55 }, { 8, 61 }, { -3, 53 },
- { 0, 68 }, { -7, 74 }, { -9, 88 },
-
- /* 105 -> 165 */
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { -4, 71 }, { 0, 58 }, { 7, 61 }, { 9, 41 },
- { 18, 25 }, { 9, 32 }, { 5, 43 }, { 9, 47 },
- { 0, 44 }, { 0, 51 }, { 2, 46 }, { 19, 38 },
- { -4, 66 }, { 15, 38 }, { 12, 42 }, { 9, 34 },
- { 0, 89 },
-
- /* 166 - 226 */
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { 0, 75 }, { 2, 72 }, { 8, 77 }, { 14, 35 },
- { 18, 31 }, { 17, 35 }, { 21, 30 }, { 17, 45 },
- { 20, 42 }, { 18, 45 }, { 27, 26 }, { 16, 54 },
- { 7, 66 }, { 16, 56 }, { 11, 73 }, { 10, 67 },
- { -10, 116 },
-
- /* 227 - 275 */
- { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
- { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
- { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
- { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
- { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
- { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
- { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
- { -5, 74 }, { -9, 86 }, { 2, 66 }, { -9, 34 },
- { 1, 32 }, { 11, 31 }, { 5, 52 }, { -2, 55 },
- { -2, 67 }, { 0, 73 }, { -8, 89 }, { 3, 52 },
- { 7, 4 }, { 10, 8 }, { 17, 8 }, { 16, 19 },
- { 3, 37 }, { -1, 61 }, { -5, 73 }, { -1, 70 },
- { -4, 78 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { -1, 70 }, { -9, 72 }, { 14, 60 }, { 16, 37 },
- { 0, 47 }, { 18, 35 }, { 11, 37 }, { 12, 41 },
- { 10, 41 }, { 2, 48 }, { 12, 41 }, { 13, 41 },
- { 0, 59 }, { 3, 50 }, { 19, 40 }, { 3, 66 },
- { 18, 50 },
-
- /* 338 - 398 */
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { 12, 48 }, { 11, 49 }, { 26, 45 }, { 22, 22 },
- { 23, 22 }, { 27, 21 }, { 33, 20 }, { 26, 28 },
- { 30, 24 }, { 27, 34 }, { 18, 42 }, { 25, 39 },
- { 18, 50 }, { 12, 70 }, { 21, 54 }, { 14, 71 },
- { 11, 83 },
-
- /* 399 -> 435 */
- { 25, 32 }, { 21, 49 }, { 21, 54 },
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
- { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
- { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
- { -4, 67 }, { -7, 82 },
-
- /* 436 -> 459 */
- { -3, 81 }, { -3, 76 }, { -7, 72 }, { -6, 78 },
- { -12, 72 }, { -14, 68 }, { -3, 70 }, { -6, 76 },
- { -5, 66 }, { -5, 62 }, { 0, 57 }, { -4, 61 },
- { -9, 60 }, { 1, 54 }, { 2, 58 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
-
- /* 460 - 1024 */
- { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
- { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
- { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { -3, 81 },
- { -3, 76 }, { -7, 72 }, { -6, 78 }, { -12, 72 },
- { -14, 68 }, { -3, 70 }, { -6, 76 }, { -5, 66 },
- { -5, 62 }, { 0, 57 }, { -4, 61 }, { -9, 60 },
- { 1, 54 }, { 2, 58 }, { 17, -10 }, { 32, -13 },
- { 42, -9 }, { 49, -5 }, { 53, 0 }, { 64, 3 },
- { 68, 10 }, { 66, 27 }, { 47, 57 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
- { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
- { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
- { -4, 67 }, { -7, 82 }, { -5, 85 }, { -6, 81 },
- { -10, 77 }, { -7, 81 }, { -17, 80 }, { -18, 73 },
- { -4, 74 }, { -10, 83 }, { -9, 71 }, { -9, 67 },
- { -1, 61 }, { -8, 66 }, { -14, 66 }, { 0, 59 },
- { 2, 59 }, { -3, 81 }, { -3, 76 }, { -7, 72 },
- { -6, 78 }, { -12, 72 }, { -14, 68 }, { -3, 70 },
- { -6, 76 }, { -5, 66 }, { -5, 62 }, { 0, 57 },
- { -4, 61 }, { -9, 60 }, { 1, 54 }, { 2, 58 },
- { 17, -10 }, { 32, -13 }, { 42, -9 }, { 49, -5 },
- { 53, 0 }, { 64, 3 }, { 68, 10 }, { 66, 27 },
- { 47, 57 }, { 17, -10 }, { 32, -13 }, { 42, -9 },
- { 49, -5 }, { 53, 0 }, { 64, 3 }, { 68, 10 },
- { 66, 27 }, { 47, 57 }, { -5, 71 }, { 0, 24 },
- { -1, 36 }, { -2, 42 }, { -2, 52 }, { -9, 57 },
- { -6, 63 }, { -4, 65 }, { -4, 67 }, { -7, 82 },
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
- { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
- { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
- { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
- { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
- { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
- { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
- { -5, 74 }, { -9, 86 }, { -23, 112 }, { -15, 71 },
- { -7, 61 }, { 0, 53 }, { -5, 66 }, { -11, 77 },
- { -9, 80 }, { -9, 84 }, { -10, 87 }, { -34, 127 },
- { -21, 101 }, { -3, 39 }, { -5, 53 }, { -7, 61 },
- { -11, 75 }, { -15, 77 }, { -17, 91 }, { -25, 107 },
- { -25, 111 }, { -28, 122 }, { -11, 76 }, { -10, 44 },
- { -10, 52 }, { -10, 57 }, { -9, 58 }, { -16, 72 },
- { -7, 69 }, { -4, 69 }, { -5, 74 }, { -9, 86 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }
- },
-
- /* i_cabac_init_idc == 2 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 29, 16 }, { 25, 0 }, { 14, 0 }, { -10, 51 },
- { -3, 62 }, { -27, 99 }, { 26, 16 }, { -4, 85 },
- { -24, 102 }, { 5, 57 }, { 6, 57 }, { -17, 73 },
- { 14, 57 },
-
- /* 24 - 39 */
- { 20, 40 }, { 20, 10 }, { 29, 0 }, { 54, 0 },
- { 37, 42 }, { 12, 97 }, { -32, 127 }, { -22, 117 },
- { -2, 74 }, { -4, 85 }, { -24, 102 }, { 5, 57 },
- { -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 },
-
- /* 40 - 53 */
- { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 },
- { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 },
- { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 },
- { -3, 90 },{ -1, 101 },
-
- /* 54 - 59 */
- { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 },
- { -7, 50 },{ 1, 60 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 104 */
- { 7, 34 }, { -9, 88 }, { -20, 127 }, { -36, 127 },
- { -17, 91 }, { -14, 95 }, { -25, 84 }, { -25, 86 },
- { -12, 89 }, { -17, 91 }, { -31, 127 }, { -14, 76 },
- { -18, 103 }, { -13, 90 }, { -37, 127 }, { 11, 80 },
- { 5, 76 }, { 2, 84 }, { 5, 78 }, { -6, 55 },
- { 4, 61 }, { -14, 83 }, { -37, 127 }, { -5, 79 },
- { -11, 104 }, { -11, 91 }, { -30, 127 }, { 0, 65 },
- { -2, 79 }, { 0, 72 }, { -4, 92 }, { -6, 56 },
- { 3, 68 }, { -8, 71 }, { -13, 98 },
-
- /* 105 -> 165 */
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { 3, 65 }, { -7, 69 }, { 8, 77 }, { -10, 66 },
- { 3, 62 }, { -3, 68 }, { -20, 81 }, { 0, 30 },
- { 1, 7 }, { -3, 23 }, { -21, 74 }, { 16, 66 },
- { -23, 124 }, { 17, 37 }, { 44, -18 }, { 50, -34 },
- { -22, 127 },
-
- /* 166 - 226 */
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { 20, 34 }, { 19, 31 }, { 27, 44 }, { 19, 16 },
- { 15, 36 }, { 15, 36 }, { 21, 28 }, { 25, 21 },
- { 30, 20 }, { 31, 12 }, { 27, 16 }, { 24, 42 },
- { 0, 93 }, { 14, 56 }, { 15, 57 }, { 26, 38 },
- { -24, 127 },
-
- /* 227 - 275 */
- { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
- { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
- { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
- { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
- { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
- { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
- { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
- { -12, 92 }, { -18, 108 }, { -4, 79 }, { -22, 69 },
- { -16, 75 }, { -2, 58 }, { 1, 58 }, { -13, 78 },
- { -9, 83 }, { -4, 81 }, { -13, 99 }, { -13, 81 },
- { -6, 38 }, { -13, 62 }, { -6, 58 }, { -2, 59 },
- { -16, 73 }, { -10, 76 }, { -13, 86 }, { -9, 83 },
- { -10, 87 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { -2, 76 }, { -18, 86 }, { 12, 70 }, { 5, 64 },
- { -12, 70 }, { 11, 55 }, { 5, 56 }, { 0, 69 },
- { 2, 65 }, { -6, 74 }, { 5, 54 }, { 7, 54 },
- { -6, 76 }, { -11, 82 }, { -2, 77 }, { -2, 77 },
- { 25, 42 },
-
- /* 338 - 398 */
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { 18, 31 }, { 19, 26 }, { 36, 24 }, { 24, 23 },
- { 27, 16 }, { 24, 30 }, { 31, 29 }, { 22, 41 },
- { 22, 42 }, { 16, 60 }, { 15, 52 }, { 14, 60 },
- { 3, 78 }, { -16, 123 }, { 21, 53 }, { 22, 56 },
- { 25, 61 },
-
- /* 399 -> 435 */
- { 21, 33 }, { 19, 50 }, { 17, 61 },
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
- { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
- { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
- { -6, 68 }, { -10, 79 },
-
- /* 436 -> 459 */
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
-
- /* 460 - 1024 */
- { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
- { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
- { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { -3, 78 },
- { -8, 74 }, { -9, 72 }, { -10, 72 }, { -18, 75 },
- { -12, 71 }, { -11, 63 }, { -5, 70 }, { -17, 75 },
- { -14, 72 }, { -16, 67 }, { -8, 53 }, { -14, 59 },
- { -9, 52 }, { -11, 68 }, { 9, -2 }, { 30, -10 },
- { 31, -4 }, { 33, -1 }, { 33, 7 }, { 31, 12 },
- { 37, 23 }, { 31, 38 }, { 20, 64 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
- { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
- { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
- { -6, 68 }, { -10, 79 }, { -3, 78 }, { -8, 74 },
- { -9, 72 }, { -10, 72 }, { -18, 75 }, { -12, 71 },
- { -11, 63 }, { -5, 70 }, { -17, 75 }, { -14, 72 },
- { -16, 67 }, { -8, 53 }, { -14, 59 }, { -9, 52 },
- { -11, 68 }, { -3, 78 }, { -8, 74 }, { -9, 72 },
- { -10, 72 }, { -18, 75 }, { -12, 71 }, { -11, 63 },
- { -5, 70 }, { -17, 75 }, { -14, 72 }, { -16, 67 },
- { -8, 53 }, { -14, 59 }, { -9, 52 }, { -11, 68 },
- { 9, -2 }, { 30, -10 }, { 31, -4 }, { 33, -1 },
- { 33, 7 }, { 31, 12 }, { 37, 23 }, { 31, 38 },
- { 20, 64 }, { 9, -2 }, { 30, -10 }, { 31, -4 },
- { 33, -1 }, { 33, 7 }, { 31, 12 }, { 37, 23 },
- { 31, 38 }, { 20, 64 }, { -9, 71 }, { -7, 37 },
- { -8, 44 }, { -11, 49 }, { -10, 56 }, { -12, 59 },
- { -8, 63 }, { -9, 67 }, { -6, 68 }, { -10, 79 },
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
- { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
- { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
- { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
- { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
- { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
- { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
- { -12, 92 }, { -18, 108 }, { -24, 115 }, { -22, 82 },
- { -9, 62 }, { 0, 53 }, { 0, 59 }, { -14, 85 },
- { -13, 89 }, { -13, 94 }, { -11, 92 }, { -29, 127 },
- { -21, 100 }, { -14, 57 }, { -12, 67 }, { -11, 71 },
- { -10, 77 }, { -21, 85 }, { -16, 88 }, { -23, 104 },
- { -15, 98 }, { -37, 127 }, { -10, 82 }, { -8, 48 },
- { -8, 61 }, { -8, 66 }, { -7, 70 }, { -14, 75 },
- { -10, 79 }, { -9, 83 }, { -12, 92 }, { -18, 108 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }
- }
-};
-
-const uint8_t x264_cabac_range_lps[64][4] =
-{
- { 2, 2, 2, 2}, { 6, 7, 8, 9}, { 6, 7, 9, 10}, { 6, 8, 9, 11},
- { 7, 8, 10, 11}, { 7, 9, 10, 12}, { 7, 9, 11, 12}, { 8, 9, 11, 13},
- { 8, 10, 12, 14}, { 9, 11, 12, 14}, { 9, 11, 13, 15}, { 10, 12, 14, 16},
- { 10, 12, 15, 17}, { 11, 13, 15, 18}, { 11, 14, 16, 19}, { 12, 14, 17, 20},
- { 12, 15, 18, 21}, { 13, 16, 19, 22}, { 14, 17, 20, 23}, { 14, 18, 21, 24},
- { 15, 19, 22, 25}, { 16, 20, 23, 27}, { 17, 21, 25, 28}, { 18, 22, 26, 30},
- { 19, 23, 27, 31}, { 20, 24, 29, 33}, { 21, 26, 30, 35}, { 22, 27, 32, 37},
- { 23, 28, 33, 39}, { 24, 30, 35, 41}, { 26, 31, 37, 43}, { 27, 33, 39, 45},
- { 29, 35, 41, 48}, { 30, 37, 43, 50}, { 32, 39, 46, 53}, { 33, 41, 48, 56},
- { 35, 43, 51, 59}, { 37, 45, 54, 62}, { 39, 48, 56, 65}, { 41, 50, 59, 69},
- { 43, 53, 63, 72}, { 46, 56, 66, 76}, { 48, 59, 69, 80}, { 51, 62, 73, 85},
- { 53, 65, 77, 89}, { 56, 69, 81, 94}, { 59, 72, 86, 99}, { 62, 76, 90, 104},
- { 66, 80, 95, 110}, { 69, 85, 100, 116}, { 73, 89, 105, 122}, { 77, 94, 111, 128},
- { 81, 99, 117, 135}, { 85, 104, 123, 142}, { 90, 110, 130, 150}, { 95, 116, 137, 158},
- {100, 122, 144, 166}, {105, 128, 152, 175}, {111, 135, 160, 185}, {116, 142, 169, 195},
- {123, 150, 178, 205}, {128, 158, 187, 216}, {128, 167, 197, 227}, {128, 176, 208, 240}
-};
-
-const uint8_t x264_cabac_transition[128][2] =
-{
- { 0, 0}, { 1, 1}, { 2, 50}, { 51, 3}, { 2, 50}, { 51, 3}, { 4, 52}, { 53, 5},
- { 6, 52}, { 53, 7}, { 8, 52}, { 53, 9}, { 10, 54}, { 55, 11}, { 12, 54}, { 55, 13},
- { 14, 54}, { 55, 15}, { 16, 56}, { 57, 17}, { 18, 56}, { 57, 19}, { 20, 56}, { 57, 21},
- { 22, 58}, { 59, 23}, { 24, 58}, { 59, 25}, { 26, 60}, { 61, 27}, { 28, 60}, { 61, 29},
- { 30, 60}, { 61, 31}, { 32, 62}, { 63, 33}, { 34, 62}, { 63, 35}, { 36, 64}, { 65, 37},
- { 38, 66}, { 67, 39}, { 40, 66}, { 67, 41}, { 42, 66}, { 67, 43}, { 44, 68}, { 69, 45},
- { 46, 68}, { 69, 47}, { 48, 70}, { 71, 49}, { 50, 72}, { 73, 51}, { 52, 72}, { 73, 53},
- { 54, 74}, { 75, 55}, { 56, 74}, { 75, 57}, { 58, 76}, { 77, 59}, { 60, 78}, { 79, 61},
- { 62, 78}, { 79, 63}, { 64, 80}, { 81, 65}, { 66, 82}, { 83, 67}, { 68, 82}, { 83, 69},
- { 70, 84}, { 85, 71}, { 72, 84}, { 85, 73}, { 74, 88}, { 89, 75}, { 76, 88}, { 89, 77},
- { 78, 90}, { 91, 79}, { 80, 90}, { 91, 81}, { 82, 94}, { 95, 83}, { 84, 94}, { 95, 85},
- { 86, 96}, { 97, 87}, { 88, 96}, { 97, 89}, { 90, 100}, {101, 91}, { 92, 100}, {101, 93},
- { 94, 102}, {103, 95}, { 96, 104}, {105, 97}, { 98, 104}, {105, 99}, {100, 108}, {109, 101},
- {102, 108}, {109, 103}, {104, 110}, {111, 105}, {106, 112}, {113, 107}, {108, 114}, {115, 109},
- {110, 116}, {117, 111}, {112, 118}, {119, 113}, {114, 118}, {119, 115}, {116, 122}, {123, 117},
- {118, 122}, {123, 119}, {120, 124}, {125, 121}, {122, 126}, {127, 123}, {124, 127}, {126, 125}
-};
-
-const uint8_t x264_cabac_renorm_shift[64] =
-{
- 6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-/* -ln2(probability) */
-const uint16_t x264_cabac_entropy[128] =
-{
- FIX8(0.0273), FIX8(5.7370), FIX8(0.0288), FIX8(5.6618),
- FIX8(0.0303), FIX8(5.5866), FIX8(0.0320), FIX8(5.5114),
- FIX8(0.0337), FIX8(5.4362), FIX8(0.0355), FIX8(5.3610),
- FIX8(0.0375), FIX8(5.2859), FIX8(0.0395), FIX8(5.2106),
- FIX8(0.0416), FIX8(5.1354), FIX8(0.0439), FIX8(5.0602),
- FIX8(0.0463), FIX8(4.9851), FIX8(0.0488), FIX8(4.9099),
- FIX8(0.0515), FIX8(4.8347), FIX8(0.0543), FIX8(4.7595),
- FIX8(0.0572), FIX8(4.6843), FIX8(0.0604), FIX8(4.6091),
- FIX8(0.0637), FIX8(4.5339), FIX8(0.0671), FIX8(4.4588),
- FIX8(0.0708), FIX8(4.3836), FIX8(0.0747), FIX8(4.3083),
- FIX8(0.0788), FIX8(4.2332), FIX8(0.0832), FIX8(4.1580),
- FIX8(0.0878), FIX8(4.0828), FIX8(0.0926), FIX8(4.0076),
- FIX8(0.0977), FIX8(3.9324), FIX8(0.1032), FIX8(3.8572),
- FIX8(0.1089), FIX8(3.7820), FIX8(0.1149), FIX8(3.7068),
- FIX8(0.1214), FIX8(3.6316), FIX8(0.1282), FIX8(3.5565),
- FIX8(0.1353), FIX8(3.4813), FIX8(0.1429), FIX8(3.4061),
- FIX8(0.1510), FIX8(3.3309), FIX8(0.1596), FIX8(3.2557),
- FIX8(0.1686), FIX8(3.1805), FIX8(0.1782), FIX8(3.1053),
- FIX8(0.1884), FIX8(3.0301), FIX8(0.1992), FIX8(2.9549),
- FIX8(0.2107), FIX8(2.8797), FIX8(0.2229), FIX8(2.8046),
- FIX8(0.2358), FIX8(2.7294), FIX8(0.2496), FIX8(2.6542),
- FIX8(0.2642), FIX8(2.5790), FIX8(0.2798), FIX8(2.5038),
- FIX8(0.2964), FIX8(2.4286), FIX8(0.3142), FIX8(2.3534),
- FIX8(0.3331), FIX8(2.2782), FIX8(0.3532), FIX8(2.2030),
- FIX8(0.3748), FIX8(2.1278), FIX8(0.3979), FIX8(2.0527),
- FIX8(0.4226), FIX8(1.9775), FIX8(0.4491), FIX8(1.9023),
- FIX8(0.4776), FIX8(1.8271), FIX8(0.5082), FIX8(1.7519),
- FIX8(0.5412), FIX8(1.6767), FIX8(0.5768), FIX8(1.6015),
- FIX8(0.6152), FIX8(1.5263), FIX8(0.6568), FIX8(1.4511),
- FIX8(0.7020), FIX8(1.3759), FIX8(0.7513), FIX8(1.3008),
- FIX8(0.8050), FIX8(1.2256), FIX8(0.8638), FIX8(1.1504),
- FIX8(0.9285), FIX8(1.0752), FIX8(1.0000), FIX8(1.0000)
-};
-
-uint8_t x264_cabac_contexts[4][QP_MAX_SPEC+1][1024];
+static uint8_t cabac_contexts[4][QP_MAX_SPEC+1][1024];
void x264_cabac_init( x264_t *h )
{
@@ -1338,17 +40,14 @@
for( int j = 0; j < ctx_count; j++ )
{
int state = x264_clip3( (((*cabac_context_init)[j][0] * qp) >> 4) + (*cabac_context_init)[j][1], 1, 126 );
- x264_cabac_contexts[i][qp][j] = (X264_MIN( state, 127-state ) << 1) | (state >> 6);
+ cabac_contexts[i][qp][j] = (X264_MIN( state, 127-state ) << 1) | (state >> 6);
}
}
}
-/*****************************************************************************
- *
- *****************************************************************************/
void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model )
{
- memcpy( cb->state, x264_cabac_contexts[i_slice_type == SLICE_TYPE_I ? 0 : i_model + 1][i_qp], CHROMA444 ? 1024 : 460 );
+ memcpy( cb->state, cabac_contexts[i_slice_type == SLICE_TYPE_I ? 0 : i_model + 1][i_qp], CHROMA444 ? 1024 : 460 );
}
void x264_cabac_encode_init_core( x264_cabac_t *cb )
@@ -1367,7 +66,7 @@
cb->p_end = p_end;
}
-static inline void x264_cabac_putbyte( x264_cabac_t *cb )
+static inline void cabac_putbyte( x264_cabac_t *cb )
{
if( cb->i_queue >= 0 )
{
@@ -1399,13 +98,13 @@
}
}
-static inline void x264_cabac_encode_renorm( x264_cabac_t *cb )
+static inline void cabac_encode_renorm( x264_cabac_t *cb )
{
int shift = x264_cabac_renorm_shift[cb->i_range>>3];
cb->i_range <<= shift;
cb->i_low <<= shift;
cb->i_queue += shift;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
}
/* Making custom versions of this function, even in asm, for the cases where
@@ -1422,7 +121,7 @@
cb->i_range = i_range_lps;
}
cb->state[i_ctx] = x264_cabac_transition[i_state][b];
- x264_cabac_encode_renorm( cb );
+ cabac_encode_renorm( cb );
}
/* Note: b is negated for this function */
@@ -1431,7 +130,7 @@
cb->i_low <<= 1;
cb->i_low += b & cb->i_range;
cb->i_queue += 1;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
}
static const int bypass_lut[16] =
@@ -1452,7 +151,7 @@
cb->i_low <<= i;
cb->i_low += ((x>>k)&0xff) * cb->i_range;
cb->i_queue += i;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
i = 8;
} while( k > 0 );
}
@@ -1460,7 +159,7 @@
void x264_cabac_encode_terminal_c( x264_cabac_t *cb )
{
cb->i_range -= 2;
- x264_cabac_encode_renorm( cb );
+ cabac_encode_renorm( cb );
}
void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb )
@@ -1469,12 +168,12 @@
cb->i_low |= 1;
cb->i_low <<= 9;
cb->i_queue += 9;
- x264_cabac_putbyte( cb );
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
+ cabac_putbyte( cb );
cb->i_low <<= -cb->i_queue;
cb->i_low |= (0x35a4e4f5 >> (h->i_frame & 31) & 1) << 10;
cb->i_queue = 0;
- x264_cabac_putbyte( cb );
+ cabac_putbyte( cb );
while( cb->i_bytes_outstanding > 0 )
{
diff -ur x264-go/x264c/external/x264/common/cabac.h x264-go.new/x264c/external/x264/common/cabac.h
--- x264-go/x264c/external/x264/common/cabac.h 2020-06-05 14:39:42.416697080 +0200
+++ x264-go.new/x264c/external/x264/common/cabac.h 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cabac.h: arithmetic coder
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -51,36 +51,44 @@
uint8_t padding[12];
} x264_cabac_t;
-extern const uint8_t x264_cabac_transition[128][2];
-extern const uint16_t x264_cabac_entropy[128];
-
/* init the contexts given i_slice_type, the quantif and the model */
+#define x264_cabac_context_init x264_template(cabac_context_init)
void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model );
+#define x264_cabac_encode_init_core x264_template(cabac_encode_init_core)
void x264_cabac_encode_init_core( x264_cabac_t *cb );
+#define x264_cabac_encode_init x264_template(cabac_encode_init)
void x264_cabac_encode_init( x264_cabac_t *cb, uint8_t *p_data, uint8_t *p_end );
+#define x264_cabac_encode_decision_c x264_template(cabac_encode_decision_c)
void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b );
+#define x264_cabac_encode_decision_asm x264_template(cabac_encode_decision_asm)
void x264_cabac_encode_decision_asm( x264_cabac_t *cb, int i_ctx, int b );
+#define x264_cabac_encode_bypass_c x264_template(cabac_encode_bypass_c)
void x264_cabac_encode_bypass_c( x264_cabac_t *cb, int b );
+#define x264_cabac_encode_bypass_asm x264_template(cabac_encode_bypass_asm)
void x264_cabac_encode_bypass_asm( x264_cabac_t *cb, int b );
+#define x264_cabac_encode_terminal_c x264_template(cabac_encode_terminal_c)
void x264_cabac_encode_terminal_c( x264_cabac_t *cb );
+#define x264_cabac_encode_terminal_asm x264_template(cabac_encode_terminal_asm)
void x264_cabac_encode_terminal_asm( x264_cabac_t *cb );
+#define x264_cabac_encode_ue_bypass x264_template(cabac_encode_ue_bypass)
void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val );
+#define x264_cabac_encode_flush x264_template(cabac_encode_flush)
void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb );
-//#if HAVE_MMX
-//#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
-//#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
-//#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
-//#elif defined(ARCH_AARCH64)
-//#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
-//#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
-//#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
-//#else
+#if HAVE_MMX
+#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
+#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
+#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
+#elif HAVE_AARCH64
+#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
+#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
+#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
+#else
#define x264_cabac_encode_decision x264_cabac_encode_decision_c
#define x264_cabac_encode_bypass x264_cabac_encode_bypass_c
#define x264_cabac_encode_terminal x264_cabac_encode_terminal_c
-//#endif
+#endif
#define x264_cabac_encode_decision_noup x264_cabac_encode_decision
static ALWAYS_INLINE int x264_cabac_pos( x264_cabac_t *cb )
diff -ur x264-go/x264c/external/x264/common/common.c x264-go.new/x264c/external/x264/common/common.c
--- x264-go/x264c/external/x264/common/common.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/common.c 2020-06-06 15:20:58.686039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* common.c: misc common functions
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -26,1049 +26,6 @@
#include "common.h"
-#include <ctype.h>
-
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_THP
-#include <sys/mman.h>
-#endif
-
-const int x264_bit_depth = BIT_DEPTH;
-
-const int x264_chroma_format = X264_CHROMA_FORMAT;
-
-static void x264_log_default( void *, int, const char *, va_list );
-
-/****************************************************************************
- * x264_param_default:
- ****************************************************************************/
-void x264_param_default( x264_param_t *param )
-{
- /* */
- memset( param, 0, sizeof( x264_param_t ) );
-
- /* CPU autodetect */
- param->cpu = x264_cpu_detect();
- param->i_threads = X264_THREADS_AUTO;
- param->i_lookahead_threads = X264_THREADS_AUTO;
- param->b_deterministic = 1;
- param->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
-
- /* Video properties */
- param->i_csp = X264_CHROMA_FORMAT ? X264_CHROMA_FORMAT : X264_CSP_I420;
- param->i_width = 0;
- param->i_height = 0;
- param->vui.i_sar_width = 0;
- param->vui.i_sar_height= 0;
- param->vui.i_overscan = 0; /* undef */
- param->vui.i_vidformat = 5; /* undef */
- param->vui.b_fullrange = -1; /* default depends on input */
- param->vui.i_colorprim = 2; /* undef */
- param->vui.i_transfer = 2; /* undef */
- param->vui.i_colmatrix = -1; /* default depends on input */
- param->vui.i_chroma_loc= 0; /* left center */
- param->i_fps_num = 25;
- param->i_fps_den = 1;
- param->i_level_idc = -1;
- param->i_slice_max_size = 0;
- param->i_slice_max_mbs = 0;
- param->i_slice_count = 0;
-
- /* Encoder parameters */
- param->i_frame_reference = 3;
- param->i_keyint_max = 250;
- param->i_keyint_min = X264_KEYINT_MIN_AUTO;
- param->i_bframe = 3;
- param->i_scenecut_threshold = 40;
- param->i_bframe_adaptive = X264_B_ADAPT_FAST;
- param->i_bframe_bias = 0;
- param->i_bframe_pyramid = X264_B_PYRAMID_NORMAL;
- param->b_interlaced = 0;
- param->b_constrained_intra = 0;
-
- param->b_deblocking_filter = 1;
- param->i_deblocking_filter_alphac0 = 0;
- param->i_deblocking_filter_beta = 0;
-
- param->b_cabac = 1;
- param->i_cabac_init_idc = 0;
-
- param->rc.i_rc_method = X264_RC_CRF;
- param->rc.i_bitrate = 0;
- param->rc.f_rate_tolerance = 1.0;
- param->rc.i_vbv_max_bitrate = 0;
- param->rc.i_vbv_buffer_size = 0;
- param->rc.f_vbv_buffer_init = 0.9;
- param->rc.i_qp_constant = 23 + QP_BD_OFFSET;
- param->rc.f_rf_constant = 23;
- param->rc.i_qp_min = 0;
- param->rc.i_qp_max = QP_MAX;
- param->rc.i_qp_step = 4;
- param->rc.f_ip_factor = 1.4;
- param->rc.f_pb_factor = 1.3;
- param->rc.i_aq_mode = X264_AQ_VARIANCE;
- param->rc.f_aq_strength = 1.0;
- param->rc.i_lookahead = 40;
-
- param->rc.b_stat_write = 0;
- param->rc.psz_stat_out = "x264_2pass.log";
- param->rc.b_stat_read = 0;
- param->rc.psz_stat_in = "x264_2pass.log";
- param->rc.f_qcompress = 0.6;
- param->rc.f_qblur = 0.5;
- param->rc.f_complexity_blur = 20;
- param->rc.i_zones = 0;
- param->rc.b_mb_tree = 1;
-
- /* Log */
- param->pf_log = x264_log_default;
- param->p_log_private = NULL;
- param->i_log_level = X264_LOG_INFO;
-
- /* */
- param->analyse.intra = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8;
- param->analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8
- | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_BSUB16x16;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
- param->analyse.i_me_method = X264_ME_HEX;
- param->analyse.f_psy_rd = 1.0;
- param->analyse.b_psy = 1;
- param->analyse.f_psy_trellis = 0;
- param->analyse.i_me_range = 16;
- param->analyse.i_subpel_refine = 7;
- param->analyse.b_mixed_references = 1;
- param->analyse.b_chroma_me = 1;
- param->analyse.i_mv_range_thread = -1;
- param->analyse.i_mv_range = -1; // set from level_idc
- param->analyse.i_chroma_qp_offset = 0;
- param->analyse.b_fast_pskip = 1;
- param->analyse.b_weighted_bipred = 1;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SMART;
- param->analyse.b_dct_decimate = 1;
- param->analyse.b_transform_8x8 = 1;
- param->analyse.i_trellis = 1;
- param->analyse.i_luma_deadzone[0] = 21;
- param->analyse.i_luma_deadzone[1] = 11;
- param->analyse.b_psnr = 0;
- param->analyse.b_ssim = 0;
-
- param->i_cqm_preset = X264_CQM_FLAT;
- memset( param->cqm_4iy, 16, sizeof( param->cqm_4iy ) );
- memset( param->cqm_4py, 16, sizeof( param->cqm_4py ) );
- memset( param->cqm_4ic, 16, sizeof( param->cqm_4ic ) );
- memset( param->cqm_4pc, 16, sizeof( param->cqm_4pc ) );
- memset( param->cqm_8iy, 16, sizeof( param->cqm_8iy ) );
- memset( param->cqm_8py, 16, sizeof( param->cqm_8py ) );
- memset( param->cqm_8ic, 16, sizeof( param->cqm_8ic ) );
- memset( param->cqm_8pc, 16, sizeof( param->cqm_8pc ) );
-
- param->b_repeat_headers = 1;
- param->b_annexb = 1;
- param->b_aud = 0;
- param->b_vfr_input = 1;
- param->i_nal_hrd = X264_NAL_HRD_NONE;
- param->b_tff = 1;
- param->b_pic_struct = 0;
- param->b_fake_interlaced = 0;
- param->i_frame_packing = -1;
- param->b_opencl = 0;
- param->i_opencl_device = 0;
- param->opencl_device_id = NULL;
- param->psz_clbin_file = NULL;
-}
-
-static int x264_param_apply_preset( x264_param_t *param, const char *preset )
-{
- char *end;
- int i = strtol( preset, &end, 10 );
- if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 )
- preset = x264_preset_names[i];
-
- if( !strcasecmp( preset, "ultrafast" ) )
- {
- param->i_frame_reference = 1;
- param->i_scenecut_threshold = 0;
- param->b_deblocking_filter = 0;
- param->b_cabac = 0;
- param->i_bframe = 0;
- param->analyse.intra = 0;
- param->analyse.inter = 0;
- param->analyse.b_transform_8x8 = 0;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = 0;
- param->rc.i_aq_mode = 0;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->i_bframe_adaptive = X264_B_ADAPT_NONE;
- param->rc.b_mb_tree = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- param->analyse.b_weighted_bipred = 0;
- param->rc.i_lookahead = 0;
- }
- else if( !strcasecmp( preset, "superfast" ) )
- {
- param->analyse.inter = X264_ANALYSE_I8x8|X264_ANALYSE_I4x4;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = 1;
- param->i_frame_reference = 1;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->rc.b_mb_tree = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 0;
- }
- else if( !strcasecmp( preset, "veryfast" ) )
- {
- param->analyse.i_subpel_refine = 2;
- param->i_frame_reference = 1;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 10;
- }
- else if( !strcasecmp( preset, "faster" ) )
- {
- param->analyse.b_mixed_references = 0;
- param->i_frame_reference = 2;
- param->analyse.i_subpel_refine = 4;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 20;
- }
- else if( !strcasecmp( preset, "fast" ) )
- {
- param->i_frame_reference = 2;
- param->analyse.i_subpel_refine = 6;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 30;
- }
- else if( !strcasecmp( preset, "medium" ) )
- {
- /* Default is medium */
- }
- else if( !strcasecmp( preset, "slow" ) )
- {
- param->analyse.i_subpel_refine = 8;
- param->i_frame_reference = 5;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.i_trellis = 2;
- param->rc.i_lookahead = 50;
- }
- else if( !strcasecmp( preset, "slower" ) )
- {
- param->analyse.i_me_method = X264_ME_UMH;
- param->analyse.i_subpel_refine = 9;
- param->i_frame_reference = 8;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.i_trellis = 2;
- param->rc.i_lookahead = 60;
- }
- else if( !strcasecmp( preset, "veryslow" ) )
- {
- param->analyse.i_me_method = X264_ME_UMH;
- param->analyse.i_subpel_refine = 10;
- param->analyse.i_me_range = 24;
- param->i_frame_reference = 16;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.i_trellis = 2;
- param->i_bframe = 8;
- param->rc.i_lookahead = 60;
- }
- else if( !strcasecmp( preset, "placebo" ) )
- {
- param->analyse.i_me_method = X264_ME_TESA;
- param->analyse.i_subpel_refine = 11;
- param->analyse.i_me_range = 24;
- param->i_frame_reference = 16;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.b_fast_pskip = 0;
- param->analyse.i_trellis = 2;
- param->i_bframe = 16;
- param->rc.i_lookahead = 60;
- }
- else
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid preset '%s'\n", preset );
- return -1;
- }
- return 0;
-}
-
-static int x264_param_apply_tune( x264_param_t *param, const char *tune )
-{
- char *tmp = x264_malloc( strlen( tune ) + 1 );
- if( !tmp )
- return -1;
- tmp = strcpy( tmp, tune );
- char *s = strtok( tmp, ",./-+" );
- int psy_tuning_used = 0;
- while( s )
- {
- if( !strncasecmp( s, "film", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -1;
- param->i_deblocking_filter_beta = -1;
- param->analyse.f_psy_trellis = 0.15;
- }
- else if( !strncasecmp( s, "animation", 9 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
- param->i_deblocking_filter_alphac0 = 1;
- param->i_deblocking_filter_beta = 1;
- param->analyse.f_psy_rd = 0.4;
- param->rc.f_aq_strength = 0.6;
- param->i_bframe += 2;
- }
- else if( !strncasecmp( s, "grain", 5 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -2;
- param->i_deblocking_filter_beta = -2;
- param->analyse.f_psy_trellis = 0.25;
- param->analyse.b_dct_decimate = 0;
- param->rc.f_pb_factor = 1.1;
- param->rc.f_ip_factor = 1.1;
- param->rc.f_aq_strength = 0.5;
- param->analyse.i_luma_deadzone[0] = 6;
- param->analyse.i_luma_deadzone[1] = 6;
- param->rc.f_qcompress = 0.8;
- }
- else if( !strncasecmp( s, "stillimage", 10 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -3;
- param->i_deblocking_filter_beta = -3;
- param->analyse.f_psy_rd = 2.0;
- param->analyse.f_psy_trellis = 0.7;
- param->rc.f_aq_strength = 1.2;
- }
- else if( !strncasecmp( s, "psnr", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->rc.i_aq_mode = X264_AQ_NONE;
- param->analyse.b_psy = 0;
- }
- else if( !strncasecmp( s, "ssim", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->rc.i_aq_mode = X264_AQ_AUTOVARIANCE;
- param->analyse.b_psy = 0;
- }
- else if( !strncasecmp( s, "fastdecode", 10 ) )
- {
- param->b_deblocking_filter = 0;
- param->b_cabac = 0;
- param->analyse.b_weighted_bipred = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- }
- else if( !strncasecmp( s, "zerolatency", 11 ) )
- {
- param->rc.i_lookahead = 0;
- param->i_sync_lookahead = 0;
- param->i_bframe = 0;
- param->b_sliced_threads = 1;
- param->b_vfr_input = 0;
- param->rc.b_mb_tree = 0;
- }
- else if( !strncasecmp( s, "touhou", 6 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
- param->i_deblocking_filter_alphac0 = -1;
- param->i_deblocking_filter_beta = -1;
- param->analyse.f_psy_trellis = 0.2;
- param->rc.f_aq_strength = 1.3;
- if( param->analyse.inter & X264_ANALYSE_PSUB16x16 )
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- }
- else
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid tune '%s'\n", s );
- x264_free( tmp );
- return -1;
- }
- if( 0 )
- {
- psy_failure:
- x264_log( NULL, X264_LOG_WARNING, "only 1 psy tuning can be used: ignoring tune %s\n", s );
- }
- s = strtok( NULL, ",./-+" );
- }
- x264_free( tmp );
- return 0;
-}
-
-int x264_param_default_preset( x264_param_t *param, const char *preset, const char *tune )
-{
- x264_param_default( param );
-
- if( preset && x264_param_apply_preset( param, preset ) < 0 )
- return -1;
- if( tune && x264_param_apply_tune( param, tune ) < 0 )
- return -1;
- return 0;
-}
-
-void x264_param_apply_fastfirstpass( x264_param_t *param )
-{
- /* Set faster options in case of turbo firstpass. */
- if( param->rc.b_stat_write && !param->rc.b_stat_read )
- {
- param->i_frame_reference = 1;
- param->analyse.b_transform_8x8 = 0;
- param->analyse.inter = 0;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = X264_MIN( 2, param->analyse.i_subpel_refine );
- param->analyse.i_trellis = 0;
- param->analyse.b_fast_pskip = 1;
- }
-}
-
-static int profile_string_to_int( const char *str )
-{
- if( !strcasecmp( str, "baseline" ) )
- return PROFILE_BASELINE;
- if( !strcasecmp( str, "main" ) )
- return PROFILE_MAIN;
- if( !strcasecmp( str, "high" ) )
- return PROFILE_HIGH;
- if( !strcasecmp( str, "high10" ) )
- return PROFILE_HIGH10;
- if( !strcasecmp( str, "high422" ) )
- return PROFILE_HIGH422;
- if( !strcasecmp( str, "high444" ) )
- return PROFILE_HIGH444_PREDICTIVE;
- return -1;
-}
-
-int x264_param_apply_profile( x264_param_t *param, const char *profile )
-{
- if( !profile )
- return 0;
-
- int p = profile_string_to_int( profile );
- if( p < 0 )
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid profile: %s\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH444_PREDICTIVE && ((param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) ||
- (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + QP_BD_OFFSET) <= 0)) )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH444_PREDICTIVE && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I444 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:4:4\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH422 && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I422 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:2:2\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH10 && BIT_DEPTH > 8 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support a bit depth of %d\n", profile, BIT_DEPTH );
- return -1;
- }
-
- if( p == PROFILE_BASELINE )
- {
- param->analyse.b_transform_8x8 = 0;
- param->b_cabac = 0;
- param->i_cqm_preset = X264_CQM_FLAT;
- param->psz_cqm_file = NULL;
- param->i_bframe = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- if( param->b_interlaced )
- {
- x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" );
- return -1;
- }
- if( param->b_fake_interlaced )
- {
- x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support fake interlacing\n" );
- return -1;
- }
- }
- else if( p == PROFILE_MAIN )
- {
- param->analyse.b_transform_8x8 = 0;
- param->i_cqm_preset = X264_CQM_FLAT;
- param->psz_cqm_file = NULL;
- }
- return 0;
-}
-
-static int parse_enum( const char *arg, const char * const *names, int *dst )
-{
- for( int i = 0; names[i]; i++ )
- if( !strcasecmp( arg, names[i] ) )
- {
- *dst = i;
- return 0;
- }
- return -1;
-}
-
-static int parse_cqm( const char *str, uint8_t *cqm, int length )
-{
- int i = 0;
- do {
- int coef;
- if( !sscanf( str, "%d", &coef ) || coef < 1 || coef > 255 )
- return -1;
- cqm[i++] = coef;
- } while( i < length && (str = strchr( str, ',' )) && str++ );
- return (i == length) ? 0 : -1;
-}
-
-static int x264_atobool( const char *str, int *b_error )
-{
- if( !strcmp(str, "1") ||
- !strcasecmp(str, "true") ||
- !strcasecmp(str, "yes") )
- return 1;
- if( !strcmp(str, "0") ||
- !strcasecmp(str, "false") ||
- !strcasecmp(str, "no") )
- return 0;
- *b_error = 1;
- return 0;
-}
-
-static int x264_atoi( const char *str, int *b_error )
-{
- char *end;
- int v = strtol( str, &end, 0 );
- if( end == str || *end != '\0' )
- *b_error = 1;
- return v;
-}
-
-static double x264_atof( const char *str, int *b_error )
-{
- char *end;
- double v = strtod( str, &end );
- if( end == str || *end != '\0' )
- *b_error = 1;
- return v;
-}
-
-#define atobool(str) ( name_was_bool = 1, x264_atobool( str, &b_error ) )
-#undef atoi
-#undef atof
-#define atoi(str) x264_atoi( str, &b_error )
-#define atof(str) x264_atof( str, &b_error )
-
-int x264_param_parse( x264_param_t *p, const char *name, const char *value )
-{
- char *name_buf = NULL;
- int b_error = 0;
- int errortype = X264_PARAM_BAD_VALUE;
- int name_was_bool;
- int value_was_null = !value;
-
- if( !name )
- return X264_PARAM_BAD_NAME;
- if( !value )
- value = "true";
-
- if( value[0] == '=' )
- value++;
-
- if( strchr( name, '_' ) ) // s/_/-/g
- {
- char *c;
- name_buf = strdup(name);
- if( !name_buf )
- return X264_PARAM_BAD_NAME;
- while( (c = strchr( name_buf, '_' )) )
- *c = '-';
- name = name_buf;
- }
-
- if( !strncmp( name, "no", 2 ) )
- {
- name += 2;
- if( name[0] == '-' )
- name++;
- value = atobool(value) ? "false" : "true";
- }
- name_was_bool = 0;
-
-#define OPT(STR) else if( !strcmp( name, STR ) )
-#define OPT2(STR0, STR1) else if( !strcmp( name, STR0 ) || !strcmp( name, STR1 ) )
- if( 0 );
- OPT("asm")
- {
- p->cpu = isdigit(value[0]) ? atoi(value) :
- !strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
- if( b_error )
- {
- char *buf = strdup( value );
- if( buf )
- {
- char *tok, UNUSED *saveptr=NULL, *init;
- b_error = 0;
- p->cpu = 0;
- for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
- {
- int i = 0;
- while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) )
- i++;
- p->cpu |= x264_cpu_names[i].flags;
- if( !x264_cpu_names[i].flags )
- b_error = 1;
- }
- free( buf );
- if( (p->cpu&X264_CPU_SSSE3) && !(p->cpu&X264_CPU_SSE2_IS_SLOW) )
- p->cpu |= X264_CPU_SSE2_IS_FAST;
- }
- }
- }
- OPT("threads")
- {
- if( !strcasecmp(value, "auto") )
- p->i_threads = X264_THREADS_AUTO;
- else
- p->i_threads = atoi(value);
- }
- OPT("lookahead-threads")
- {
- if( !strcasecmp(value, "auto") )
- p->i_lookahead_threads = X264_THREADS_AUTO;
- else
- p->i_lookahead_threads = atoi(value);
- }
- OPT("sliced-threads")
- p->b_sliced_threads = atobool(value);
- OPT("sync-lookahead")
- {
- if( !strcasecmp(value, "auto") )
- p->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
- else
- p->i_sync_lookahead = atoi(value);
- }
- OPT2("deterministic", "n-deterministic")
- p->b_deterministic = atobool(value);
- OPT("cpu-independent")
- p->b_cpu_independent = atobool(value);
- OPT2("level", "level-idc")
- {
- if( !strcmp(value, "1b") )
- p->i_level_idc = 9;
- else if( atof(value) < 7 )
- p->i_level_idc = (int)(10*atof(value)+.5);
- else
- p->i_level_idc = atoi(value);
- }
- OPT("bluray-compat")
- p->b_bluray_compat = atobool(value);
- OPT("avcintra-class")
- p->i_avcintra_class = atoi(value);
- OPT("sar")
- {
- b_error = ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) &&
- 2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) );
- }
- OPT("overscan")
- b_error |= parse_enum( value, x264_overscan_names, &p->vui.i_overscan );
- OPT("videoformat")
- b_error |= parse_enum( value, x264_vidformat_names, &p->vui.i_vidformat );
- OPT("fullrange")
- b_error |= parse_enum( value, x264_fullrange_names, &p->vui.b_fullrange );
- OPT("colorprim")
- b_error |= parse_enum( value, x264_colorprim_names, &p->vui.i_colorprim );
- OPT("transfer")
- b_error |= parse_enum( value, x264_transfer_names, &p->vui.i_transfer );
- OPT("colormatrix")
- b_error |= parse_enum( value, x264_colmatrix_names, &p->vui.i_colmatrix );
- OPT("chromaloc")
- {
- p->vui.i_chroma_loc = atoi(value);
- b_error = ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 );
- }
- OPT("fps")
- {
- if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
- {
- double fps = atof(value);
- if( fps > 0.0 && fps <= INT_MAX/1000.0 )
- {
- p->i_fps_num = (int)(fps * 1000.0 + .5);
- p->i_fps_den = 1000;
- }
- else
- {
- p->i_fps_num = atoi(value);
- p->i_fps_den = 1;
- }
- }
- }
- OPT2("ref", "frameref")
- p->i_frame_reference = atoi(value);
- OPT("dpb-size")
- p->i_dpb_size = atoi(value);
- OPT("keyint")
- {
- if( strstr( value, "infinite" ) )
- p->i_keyint_max = X264_KEYINT_MAX_INFINITE;
- else
- p->i_keyint_max = atoi(value);
- }
- OPT2("min-keyint", "keyint-min")
- {
- p->i_keyint_min = atoi(value);
- if( p->i_keyint_max < p->i_keyint_min )
- p->i_keyint_max = p->i_keyint_min;
- }
- OPT("scenecut")
- {
- p->i_scenecut_threshold = atobool(value);
- if( b_error || p->i_scenecut_threshold )
- {
- b_error = 0;
- p->i_scenecut_threshold = atoi(value);
- }
- }
- OPT("intra-refresh")
- p->b_intra_refresh = atobool(value);
- OPT("bframes")
- p->i_bframe = atoi(value);
- OPT("b-adapt")
- {
- p->i_bframe_adaptive = atobool(value);
- if( b_error )
- {
- b_error = 0;
- p->i_bframe_adaptive = atoi(value);
- }
- }
- OPT("b-bias")
- p->i_bframe_bias = atoi(value);
- OPT("b-pyramid")
- {
- b_error |= parse_enum( value, x264_b_pyramid_names, &p->i_bframe_pyramid );
- if( b_error )
- {
- b_error = 0;
- p->i_bframe_pyramid = atoi(value);
- }
- }
- OPT("open-gop")
- p->b_open_gop = atobool(value);
- OPT("nf")
- p->b_deblocking_filter = !atobool(value);
- OPT2("filter", "deblock")
- {
- if( 2 == sscanf( value, "%d:%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) ||
- 2 == sscanf( value, "%d,%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) )
- {
- p->b_deblocking_filter = 1;
- }
- else if( sscanf( value, "%d", &p->i_deblocking_filter_alphac0 ) )
- {
- p->b_deblocking_filter = 1;
- p->i_deblocking_filter_beta = p->i_deblocking_filter_alphac0;
- }
- else
- p->b_deblocking_filter = atobool(value);
- }
- OPT("slice-max-size")
- p->i_slice_max_size = atoi(value);
- OPT("slice-max-mbs")
- p->i_slice_max_mbs = atoi(value);
- OPT("slice-min-mbs")
- p->i_slice_min_mbs = atoi(value);
- OPT("slices")
- p->i_slice_count = atoi(value);
- OPT("slices-max")
- p->i_slice_count_max = atoi(value);
- OPT("cabac")
- p->b_cabac = atobool(value);
- OPT("cabac-idc")
- p->i_cabac_init_idc = atoi(value);
- OPT("interlaced")
- p->b_interlaced = atobool(value);
- OPT("tff")
- p->b_interlaced = p->b_tff = atobool(value);
- OPT("bff")
- {
- p->b_interlaced = atobool(value);
- p->b_tff = !p->b_interlaced;
- }
- OPT("constrained-intra")
- p->b_constrained_intra = atobool(value);
- OPT("cqm")
- {
- if( strstr( value, "flat" ) )
- p->i_cqm_preset = X264_CQM_FLAT;
- else if( strstr( value, "jvt" ) )
- p->i_cqm_preset = X264_CQM_JVT;
- else
- p->psz_cqm_file = strdup(value);
- }
- OPT("cqmfile")
- p->psz_cqm_file = strdup(value);
- OPT("cqm4")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm8")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8iy, 64 );
- b_error |= parse_cqm( value, p->cqm_8py, 64 );
- b_error |= parse_cqm( value, p->cqm_8ic, 64 );
- b_error |= parse_cqm( value, p->cqm_8pc, 64 );
- }
- OPT("cqm4i")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- }
- OPT("cqm4p")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm4iy")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- }
- OPT("cqm4ic")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- }
- OPT("cqm4py")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- }
- OPT("cqm4pc")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm8i")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8iy, 64 );
- b_error |= parse_cqm( value, p->cqm_8ic, 64 );
- }
- OPT("cqm8p")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8py, 64 );
- b_error |= parse_cqm( value, p->cqm_8pc, 64 );
- }
- OPT("log")
- p->i_log_level = atoi(value);
- OPT("dump-yuv")
- p->psz_dump_yuv = strdup(value);
- OPT2("analyse", "partitions")
- {
- p->analyse.inter = 0;
- if( strstr( value, "none" ) ) p->analyse.inter = 0;
- if( strstr( value, "all" ) ) p->analyse.inter = ~0;
-
- if( strstr( value, "i4x4" ) ) p->analyse.inter |= X264_ANALYSE_I4x4;
- if( strstr( value, "i8x8" ) ) p->analyse.inter |= X264_ANALYSE_I8x8;
- if( strstr( value, "p8x8" ) ) p->analyse.inter |= X264_ANALYSE_PSUB16x16;
- if( strstr( value, "p4x4" ) ) p->analyse.inter |= X264_ANALYSE_PSUB8x8;
- if( strstr( value, "b8x8" ) ) p->analyse.inter |= X264_ANALYSE_BSUB16x16;
- }
- OPT("8x8dct")
- p->analyse.b_transform_8x8 = atobool(value);
- OPT2("weightb", "weight-b")
- p->analyse.b_weighted_bipred = atobool(value);
- OPT("weightp")
- p->analyse.i_weighted_pred = atoi(value);
- OPT2("direct", "direct-pred")
- b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred );
- OPT("chroma-qp-offset")
- p->analyse.i_chroma_qp_offset = atoi(value);
- OPT("me")
- b_error |= parse_enum( value, x264_motion_est_names, &p->analyse.i_me_method );
- OPT2("merange", "me-range")
- p->analyse.i_me_range = atoi(value);
- OPT2("mvrange", "mv-range")
- p->analyse.i_mv_range = atoi(value);
- OPT2("mvrange-thread", "mv-range-thread")
- p->analyse.i_mv_range_thread = atoi(value);
- OPT2("subme", "subq")
- p->analyse.i_subpel_refine = atoi(value);
- OPT("psy-rd")
- {
- if( 2 == sscanf( value, "%f:%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
- 2 == sscanf( value, "%f,%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
- 2 == sscanf( value, "%f|%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ))
- { }
- else if( sscanf( value, "%f", &p->analyse.f_psy_rd ) )
- {
- p->analyse.f_psy_trellis = 0;
- }
- else
- {
- p->analyse.f_psy_rd = 0;
- p->analyse.f_psy_trellis = 0;
- }
- }
- OPT("psy")
- p->analyse.b_psy = atobool(value);
- OPT("chroma-me")
- p->analyse.b_chroma_me = atobool(value);
- OPT("mixed-refs")
- p->analyse.b_mixed_references = atobool(value);
- OPT("trellis")
- p->analyse.i_trellis = atoi(value);
- OPT("fast-pskip")
- p->analyse.b_fast_pskip = atobool(value);
- OPT("dct-decimate")
- p->analyse.b_dct_decimate = atobool(value);
- OPT("deadzone-inter")
- p->analyse.i_luma_deadzone[0] = atoi(value);
- OPT("deadzone-intra")
- p->analyse.i_luma_deadzone[1] = atoi(value);
- OPT("nr")
- p->analyse.i_noise_reduction = atoi(value);
- OPT("bitrate")
- {
- p->rc.i_bitrate = atoi(value);
- p->rc.i_rc_method = X264_RC_ABR;
- }
- OPT2("qp", "qp_constant")
- {
- p->rc.i_qp_constant = atoi(value);
- p->rc.i_rc_method = X264_RC_CQP;
- }
- OPT("crf")
- {
- p->rc.f_rf_constant = atof(value);
- p->rc.i_rc_method = X264_RC_CRF;
- }
- OPT("crf-max")
- p->rc.f_rf_constant_max = atof(value);
- OPT("rc-lookahead")
- p->rc.i_lookahead = atoi(value);
- OPT2("qpmin", "qp-min")
- p->rc.i_qp_min = atoi(value);
- OPT2("qpmax", "qp-max")
- p->rc.i_qp_max = atoi(value);
- OPT2("qpstep", "qp-step")
- p->rc.i_qp_step = atoi(value);
- OPT("ratetol")
- p->rc.f_rate_tolerance = !strncmp("inf", value, 3) ? 1e9 : atof(value);
- OPT("vbv-maxrate")
- p->rc.i_vbv_max_bitrate = atoi(value);
- OPT("vbv-bufsize")
- p->rc.i_vbv_buffer_size = atoi(value);
- OPT("vbv-init")
- p->rc.f_vbv_buffer_init = atof(value);
- OPT2("ipratio", "ip-factor")
- p->rc.f_ip_factor = atof(value);
- OPT2("pbratio", "pb-factor")
- p->rc.f_pb_factor = atof(value);
- OPT("aq-mode")
- p->rc.i_aq_mode = atoi(value);
- OPT("aq-strength")
- p->rc.f_aq_strength = atof(value);
- OPT("pass")
- {
- int pass = x264_clip3( atoi(value), 0, 3 );
- p->rc.b_stat_write = pass & 1;
- p->rc.b_stat_read = pass & 2;
- }
- OPT("stats")
- {
- p->rc.psz_stat_in = strdup(value);
- p->rc.psz_stat_out = strdup(value);
- }
- OPT("qcomp")
- p->rc.f_qcompress = atof(value);
- OPT("mbtree")
- p->rc.b_mb_tree = atobool(value);
- OPT("qblur")
- p->rc.f_qblur = atof(value);
- OPT2("cplxblur", "cplx-blur")
- p->rc.f_complexity_blur = atof(value);
- OPT("zones")
- p->rc.psz_zones = strdup(value);
- OPT("crop-rect")
- b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
- &p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
- OPT("psnr")
- p->analyse.b_psnr = atobool(value);
- OPT("ssim")
- p->analyse.b_ssim = atobool(value);
- OPT("aud")
- p->b_aud = atobool(value);
- OPT("sps-id")
- p->i_sps_id = atoi(value);
- OPT("global-header")
- p->b_repeat_headers = !atobool(value);
- OPT("repeat-headers")
- p->b_repeat_headers = atobool(value);
- OPT("annexb")
- p->b_annexb = atobool(value);
- OPT("force-cfr")
- p->b_vfr_input = !atobool(value);
- OPT("nal-hrd")
- b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd );
- OPT("filler")
- p->rc.b_filler = atobool(value);
- OPT("pic-struct")
- p->b_pic_struct = atobool(value);
- OPT("fake-interlaced")
- p->b_fake_interlaced = atobool(value);
- OPT("frame-packing")
- p->i_frame_packing = atoi(value);
- OPT("stitchable")
- p->b_stitchable = atobool(value);
- OPT("opencl")
- p->b_opencl = atobool( value );
- OPT("opencl-clbin")
- p->psz_clbin_file = strdup( value );
- OPT("opencl-device")
- p->i_opencl_device = atoi( value );
- else
- {
- b_error = 1;
- errortype = X264_PARAM_BAD_NAME;
- }
-#undef OPT
-#undef OPT2
-#undef atobool
-#undef atoi
-#undef atof
-
- if( name_buf )
- free( name_buf );
-
- b_error |= value_was_null && !name_was_bool;
- return b_error ? errortype : 0;
-}
-
/****************************************************************************
* x264_log:
****************************************************************************/
@@ -1085,362 +42,3 @@
va_end( arg );
}
}
-
-static void x264_log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg )
-{
- char *psz_prefix;
- switch( i_level )
- {
- case X264_LOG_ERROR:
- psz_prefix = "error";
- break;
- case X264_LOG_WARNING:
- psz_prefix = "warning";
- break;
- case X264_LOG_INFO:
- psz_prefix = "info";
- break;
- case X264_LOG_DEBUG:
- psz_prefix = "debug";
- break;
- default:
- psz_prefix = "unknown";
- break;
- }
- fprintf( stderr, "x264 [%s]: ", psz_prefix );
- x264_vfprintf( stderr, psz_fmt, arg );
-}
-
-/****************************************************************************
- * x264_picture_init:
- ****************************************************************************/
-void x264_picture_init( x264_picture_t *pic )
-{
- memset( pic, 0, sizeof( x264_picture_t ) );
- pic->i_type = X264_TYPE_AUTO;
- pic->i_qpplus1 = X264_QP_AUTO;
- pic->i_pic_struct = PIC_STRUCT_AUTO;
-}
-
-/****************************************************************************
- * x264_picture_alloc:
- ****************************************************************************/
-int x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height )
-{
- typedef struct
- {
- int planes;
- int width_fix8[3];
- int height_fix8[3];
- } x264_csp_tab_t;
-
- static const x264_csp_tab_t x264_csp_tab[] =
- {
- [X264_CSP_I420] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
- [X264_CSP_YV12] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
- [X264_CSP_NV12] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
- [X264_CSP_NV21] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
- [X264_CSP_I422] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_YV16] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_NV16] = { 2, { 256*1, 256*1 }, { 256*1, 256*1 }, },
- [X264_CSP_YUYV] = { 1, { 256*2 }, { 256*1 }, },
- [X264_CSP_UYVY] = { 1, { 256*2 }, { 256*1 }, },
- [X264_CSP_I444] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_YV24] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_BGR] = { 1, { 256*3 }, { 256*1 }, },
- [X264_CSP_BGRA] = { 1, { 256*4 }, { 256*1 }, },
- [X264_CSP_RGB] = { 1, { 256*3 }, { 256*1 }, },
- };
-
- int csp = i_csp & X264_CSP_MASK;
- if( csp <= X264_CSP_NONE || csp >= X264_CSP_MAX || csp == X264_CSP_V210 )
- return -1;
- x264_picture_init( pic );
- pic->img.i_csp = i_csp;
- pic->img.i_plane = x264_csp_tab[csp].planes;
- int depth_factor = i_csp & X264_CSP_HIGH_DEPTH ? 2 : 1;
- int plane_offset[3] = {0};
- int frame_size = 0;
- for( int i = 0; i < pic->img.i_plane; i++ )
- {
- int stride = (((int64_t)i_width * x264_csp_tab[csp].width_fix8[i]) >> 8) * depth_factor;
- int plane_size = (((int64_t)i_height * x264_csp_tab[csp].height_fix8[i]) >> 8) * stride;
- pic->img.i_stride[i] = stride;
- plane_offset[i] = frame_size;
- frame_size += plane_size;
- }
- pic->img.plane[0] = x264_malloc( frame_size );
- if( !pic->img.plane[0] )
- return -1;
- for( int i = 1; i < pic->img.i_plane; i++ )
- pic->img.plane[i] = pic->img.plane[0] + plane_offset[i];
- return 0;
-}
-
-/****************************************************************************
- * x264_picture_clean:
- ****************************************************************************/
-void x264_picture_clean( x264_picture_t *pic )
-{
- x264_free( pic->img.plane[0] );
-
- /* just to be safe */
- memset( pic, 0, sizeof( x264_picture_t ) );
-}
-
-/****************************************************************************
- * x264_malloc:
- ****************************************************************************/
-void *x264_malloc( int i_size )
-{
- uint8_t *align_buf = NULL;
-#if HAVE_MALLOC_H
-#if HAVE_THP
-#define HUGE_PAGE_SIZE 2*1024*1024
-#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */
- /* Attempt to allocate huge pages to reduce TLB misses. */
- if( i_size >= HUGE_PAGE_THRESHOLD )
- {
- align_buf = memalign( HUGE_PAGE_SIZE, i_size );
- if( align_buf )
- {
- /* Round up to the next huge page boundary if we are close enough. */
- size_t madv_size = (i_size + HUGE_PAGE_SIZE - HUGE_PAGE_THRESHOLD) & ~(HUGE_PAGE_SIZE-1);
- madvise( align_buf, madv_size, MADV_HUGEPAGE );
- }
- }
- else
-#undef HUGE_PAGE_SIZE
-#undef HUGE_PAGE_THRESHOLD
-#endif
- align_buf = memalign( NATIVE_ALIGN, i_size );
-#else
- uint8_t *buf = malloc( i_size + (NATIVE_ALIGN-1) + sizeof(void **) );
- if( buf )
- {
- align_buf = buf + (NATIVE_ALIGN-1) + sizeof(void **);
- align_buf -= (intptr_t) align_buf & (NATIVE_ALIGN-1);
- *( (void **) ( align_buf - sizeof(void **) ) ) = buf;
- }
-#endif
- if( !align_buf )
- x264_log( NULL, X264_LOG_ERROR, "malloc of size %d failed\n", i_size );
- return align_buf;
-}
-
-/****************************************************************************
- * x264_free:
- ****************************************************************************/
-void x264_free( void *p )
-{
- if( p )
- {
-#if HAVE_MALLOC_H
- free( p );
-#else
- free( *( ( ( void **) p ) - 1 ) );
-#endif
- }
-}
-
-/****************************************************************************
- * x264_reduce_fraction:
- ****************************************************************************/
-#define REDUCE_FRACTION( name, type )\
-void name( type *n, type *d )\
-{ \
- type a = *n; \
- type b = *d; \
- type c; \
- if( !a || !b ) \
- return; \
- c = a % b; \
- while( c ) \
- { \
- a = b; \
- b = c; \
- c = a % b; \
- } \
- *n /= b; \
- *d /= b; \
-}
-
-REDUCE_FRACTION( x264_reduce_fraction , uint32_t )
-REDUCE_FRACTION( x264_reduce_fraction64, uint64_t )
-
-/****************************************************************************
- * x264_slurp_file:
- ****************************************************************************/
-char *x264_slurp_file( const char *filename )
-{
- int b_error = 0;
- int64_t i_size;
- char *buf;
- FILE *fh = x264_fopen( filename, "rb" );
- if( !fh )
- return NULL;
-
- b_error |= fseek( fh, 0, SEEK_END ) < 0;
- b_error |= ( i_size = ftell( fh ) ) <= 0;
- if( WORD_SIZE == 4 )
- b_error |= i_size > INT32_MAX;
- b_error |= fseek( fh, 0, SEEK_SET ) < 0;
- if( b_error )
- goto error;
-
- buf = x264_malloc( i_size+2 );
- if( !buf )
- goto error;
-
- b_error |= fread( buf, 1, i_size, fh ) != i_size;
- fclose( fh );
- if( b_error )
- {
- x264_free( buf );
- return NULL;
- }
-
- if( buf[i_size-1] != '\n' )
- buf[i_size++] = '\n';
- buf[i_size] = '\0';
-
- return buf;
-error:
- fclose( fh );
- return NULL;
-}
-
-/****************************************************************************
- * x264_param2string:
- ****************************************************************************/
-char *x264_param2string( x264_param_t *p, int b_res )
-{
- int len = 1000;
- char *buf, *s;
- if( p->rc.psz_zones )
- len += strlen(p->rc.psz_zones);
- buf = s = x264_malloc( len );
- if( !buf )
- return NULL;
-
- if( b_res )
- {
- s += sprintf( s, "%dx%d ", p->i_width, p->i_height );
- s += sprintf( s, "fps=%u/%u ", p->i_fps_num, p->i_fps_den );
- s += sprintf( s, "timebase=%u/%u ", p->i_timebase_num, p->i_timebase_den );
- s += sprintf( s, "bitdepth=%d ", BIT_DEPTH );
- }
-
- if( p->b_opencl )
- s += sprintf( s, "opencl=%d ", p->b_opencl );
- s += sprintf( s, "cabac=%d", p->b_cabac );
- s += sprintf( s, " ref=%d", p->i_frame_reference );
- s += sprintf( s, " deblock=%d:%d:%d", p->b_deblocking_filter,
- p->i_deblocking_filter_alphac0, p->i_deblocking_filter_beta );
- s += sprintf( s, " analyse=%#x:%#x", p->analyse.intra, p->analyse.inter );
- s += sprintf( s, " me=%s", x264_motion_est_names[ p->analyse.i_me_method ] );
- s += sprintf( s, " subme=%d", p->analyse.i_subpel_refine );
- s += sprintf( s, " psy=%d", p->analyse.b_psy );
- if( p->analyse.b_psy )
- s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
- s += sprintf( s, " mixed_ref=%d", p->analyse.b_mixed_references );
- s += sprintf( s, " me_range=%d", p->analyse.i_me_range );
- s += sprintf( s, " chroma_me=%d", p->analyse.b_chroma_me );
- s += sprintf( s, " trellis=%d", p->analyse.i_trellis );
- s += sprintf( s, " 8x8dct=%d", p->analyse.b_transform_8x8 );
- s += sprintf( s, " cqm=%d", p->i_cqm_preset );
- s += sprintf( s, " deadzone=%d,%d", p->analyse.i_luma_deadzone[0], p->analyse.i_luma_deadzone[1] );
- s += sprintf( s, " fast_pskip=%d", p->analyse.b_fast_pskip );
- s += sprintf( s, " chroma_qp_offset=%d", p->analyse.i_chroma_qp_offset );
- s += sprintf( s, " threads=%d", p->i_threads );
- s += sprintf( s, " lookahead_threads=%d", p->i_lookahead_threads );
- s += sprintf( s, " sliced_threads=%d", p->b_sliced_threads );
- if( p->i_slice_count )
- s += sprintf( s, " slices=%d", p->i_slice_count );
- if( p->i_slice_count_max )
- s += sprintf( s, " slices_max=%d", p->i_slice_count_max );
- if( p->i_slice_max_size )
- s += sprintf( s, " slice_max_size=%d", p->i_slice_max_size );
- if( p->i_slice_max_mbs )
- s += sprintf( s, " slice_max_mbs=%d", p->i_slice_max_mbs );
- if( p->i_slice_min_mbs )
- s += sprintf( s, " slice_min_mbs=%d", p->i_slice_min_mbs );
- s += sprintf( s, " nr=%d", p->analyse.i_noise_reduction );
- s += sprintf( s, " decimate=%d", p->analyse.b_dct_decimate );
- s += sprintf( s, " interlaced=%s", p->b_interlaced ? p->b_tff ? "tff" : "bff" : p->b_fake_interlaced ? "fake" : "0" );
- s += sprintf( s, " bluray_compat=%d", p->b_bluray_compat );
- if( p->b_stitchable )
- s += sprintf( s, " stitchable=%d", p->b_stitchable );
-
- s += sprintf( s, " constrained_intra=%d", p->b_constrained_intra );
-
- s += sprintf( s, " bframes=%d", p->i_bframe );
- if( p->i_bframe )
- {
- s += sprintf( s, " b_pyramid=%d b_adapt=%d b_bias=%d direct=%d weightb=%d open_gop=%d",
- p->i_bframe_pyramid, p->i_bframe_adaptive, p->i_bframe_bias,
- p->analyse.i_direct_mv_pred, p->analyse.b_weighted_bipred, p->b_open_gop );
- }
- s += sprintf( s, " weightp=%d", p->analyse.i_weighted_pred > 0 ? p->analyse.i_weighted_pred : 0 );
-
- if( p->i_keyint_max == X264_KEYINT_MAX_INFINITE )
- s += sprintf( s, " keyint=infinite" );
- else
- s += sprintf( s, " keyint=%d", p->i_keyint_max );
- s += sprintf( s, " keyint_min=%d scenecut=%d intra_refresh=%d",
- p->i_keyint_min, p->i_scenecut_threshold, p->b_intra_refresh );
-
- if( p->rc.b_mb_tree || p->rc.i_vbv_buffer_size )
- s += sprintf( s, " rc_lookahead=%d", p->rc.i_lookahead );
-
- s += sprintf( s, " rc=%s mbtree=%d", p->rc.i_rc_method == X264_RC_ABR ?
- ( p->rc.b_stat_read ? "2pass" : p->rc.i_vbv_max_bitrate == p->rc.i_bitrate ? "cbr" : "abr" )
- : p->rc.i_rc_method == X264_RC_CRF ? "crf" : "cqp", p->rc.b_mb_tree );
- if( p->rc.i_rc_method == X264_RC_ABR || p->rc.i_rc_method == X264_RC_CRF )
- {
- if( p->rc.i_rc_method == X264_RC_CRF )
- s += sprintf( s, " crf=%.1f", p->rc.f_rf_constant );
- else
- s += sprintf( s, " bitrate=%d ratetol=%.1f",
- p->rc.i_bitrate, p->rc.f_rate_tolerance );
- s += sprintf( s, " qcomp=%.2f qpmin=%d qpmax=%d qpstep=%d",
- p->rc.f_qcompress, p->rc.i_qp_min, p->rc.i_qp_max, p->rc.i_qp_step );
- if( p->rc.b_stat_read )
- s += sprintf( s, " cplxblur=%.1f qblur=%.1f",
- p->rc.f_complexity_blur, p->rc.f_qblur );
- if( p->rc.i_vbv_buffer_size )
- {
- s += sprintf( s, " vbv_maxrate=%d vbv_bufsize=%d",
- p->rc.i_vbv_max_bitrate, p->rc.i_vbv_buffer_size );
- if( p->rc.i_rc_method == X264_RC_CRF )
- s += sprintf( s, " crf_max=%.1f", p->rc.f_rf_constant_max );
- }
- }
- else if( p->rc.i_rc_method == X264_RC_CQP )
- s += sprintf( s, " qp=%d", p->rc.i_qp_constant );
-
- if( p->rc.i_vbv_buffer_size )
- s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
- if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
- s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
- p->crop_rect.i_right, p->crop_rect.i_bottom );
- if( p->i_frame_packing >= 0 )
- s += sprintf( s, " frame-packing=%d", p->i_frame_packing );
-
- if( !(p->rc.i_rc_method == X264_RC_CQP && p->rc.i_qp_constant == 0) )
- {
- s += sprintf( s, " ip_ratio=%.2f", p->rc.f_ip_factor );
- if( p->i_bframe && !p->rc.b_mb_tree )
- s += sprintf( s, " pb_ratio=%.2f", p->rc.f_pb_factor );
- s += sprintf( s, " aq=%d", p->rc.i_aq_mode );
- if( p->rc.i_aq_mode )
- s += sprintf( s, ":%.2f", p->rc.f_aq_strength );
- if( p->rc.psz_zones )
- s += sprintf( s, " zones=%s", p->rc.psz_zones );
- else if( p->rc.i_zones )
- s += sprintf( s, " zones" );
- }
-
- return buf;
-}
-
diff -ur x264-go/x264c/external/x264/common/common.h x264-go.new/x264c/external/x264/common/common.h
--- x264-go/x264c/external/x264/common/common.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/common.h 2020-06-06 15:29:13.027052466 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* common.h: misc common functions
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -27,101 +27,46 @@
#ifndef X264_COMMON_H
#define X264_COMMON_H
+#include "base.h"
+
+/* Macros for templating function calls according to bit depth */
+#define x264_template(w) x264_glue3(x264, BIT_DEPTH, w)
+
+/****************************************************************************
+ * API Templates
+ ****************************************************************************/
+//#define x264_nal_encode x264_template(nal_encode)
+//#define x264_encoder_reconfig x264_template(encoder_reconfig)
+//#define x264_encoder_parameters x264_template(encoder_parameters)
+//#define x264_encoder_headers x264_template(encoder_headers)
+//#define x264_encoder_encode x264_template(encoder_encode)
+//#define x264_encoder_close x264_template(encoder_close)
+//#define x264_encoder_delayed_frames x264_template(encoder_delayed_frames)
+//#define x264_encoder_maximum_delayed_frames x264_template(encoder_maximum_delayed_frames)
+//#define x264_encoder_intra_refresh x264_template(encoder_intra_refresh)
+//#define x264_encoder_invalidate_reference x264_template(encoder_invalidate_reference)
+
+/* This undef allows to rename the external symbol and force link failure in case
+ * of incompatible libraries. Then the define enables templating as above. */
+//#undef x264_encoder_open
+//#define x264_encoder_open x264_template(encoder_open)
+
/****************************************************************************
* Macros
****************************************************************************/
-#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
-#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
-#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
-#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c)))
-#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
-#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d)))
-#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
-#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
-#define FIX8(f) ((int)(f*(1<<8)+.5))
-#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
-#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
-
-#define CHECKED_MALLOC( var, size )\
-do {\
- var = x264_malloc( size );\
- if( !var )\
- goto fail;\
-} while( 0 )
-#define CHECKED_MALLOCZERO( var, size )\
-do {\
- CHECKED_MALLOC( var, size );\
- memset( var, 0, size );\
-} while( 0 )
-
-/* Macros for merging multiple allocations into a single large malloc, for improved
- * use with huge pages. */
-
-/* Needs to be enough to contain any set of buffers that use combined allocations */
-#define PREALLOC_BUF_SIZE 1024
-
-#define PREALLOC_INIT\
- int prealloc_idx = 0;\
- size_t prealloc_size = 0;\
- uint8_t **preallocs[PREALLOC_BUF_SIZE];
-
-#define PREALLOC( var, size )\
-do {\
- var = (void*)prealloc_size;\
- preallocs[prealloc_idx++] = (uint8_t**)&var;\
- prealloc_size += ALIGN(size, NATIVE_ALIGN);\
-} while( 0 )
-
-#define PREALLOC_END( ptr )\
-do {\
- CHECKED_MALLOC( ptr, prealloc_size );\
- while( prealloc_idx-- )\
- *preallocs[prealloc_idx] += (intptr_t)ptr;\
-} while( 0 )
-
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
-
-#define X264_BFRAME_MAX 16
-#define X264_REF_MAX 16
-#define X264_THREAD_MAX 128
-#define X264_LOOKAHEAD_THREAD_MAX 16
#define X264_PCM_COST (FRAME_SIZE(256*BIT_DEPTH)+16)
-#define X264_LOOKAHEAD_MAX 250
#define QP_BD_OFFSET (6*(BIT_DEPTH-8))
#define QP_MAX_SPEC (51+QP_BD_OFFSET)
#define QP_MAX (QP_MAX_SPEC+18)
-#define QP_MAX_MAX (51+2*6+18)
#define PIXEL_MAX ((1 << BIT_DEPTH)-1)
// arbitrary, but low because SATD scores are 1/4 normal
#define X264_LOOKAHEAD_QP (12+QP_BD_OFFSET)
#define SPEC_QP(x) X264_MIN((x), QP_MAX_SPEC)
-// number of pixels (per thread) in progress at any given time.
-// 16 for the macroblock in progress + 3 for deblocking + 3 for motion compensation filter + 2 for extra safety
-#define X264_THREAD_HEIGHT 24
-
-/* WEIGHTP_FAKE is set when mb_tree & psy are enabled, but normal weightp is disabled
- * (such as in baseline). It checks for fades in lookahead and adjusts qp accordingly
- * to increase quality. Defined as (-1) so that if(i_weighted_pred > 0) is true only when
- * real weights are being used. */
-
-#define X264_WEIGHTP_FAKE (-1)
-
#define NALU_OVERHEAD 5 // startcode + NAL type costs 5 bytes per frame
#define FILLER_OVERHEAD (NALU_OVERHEAD+1)
#define SEI_OVERHEAD (NALU_OVERHEAD - (h->param.b_annexb && !h->param.i_avcintra_class && (h->out.i_nal-1)))
-/****************************************************************************
- * Includes
- ****************************************************************************/
-#include "osdep.h"
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-
#if HAVE_INTERLACED
# define MB_INTERLACED h->mb.b_interlaced
# define SLICE_MBAFF h->sh.b_mbaff
@@ -141,29 +86,10 @@
# define CHROMA_V_SHIFT h->mb.chroma_v_shift
#endif
-#define CHROMA_SIZE(s) ((s)>>(CHROMA_H_SHIFT+CHROMA_V_SHIFT))
+#define CHROMA_SIZE(s) (CHROMA_FORMAT ? (s)>>(CHROMA_H_SHIFT+CHROMA_V_SHIFT) : 0)
#define FRAME_SIZE(s) ((s)+2*CHROMA_SIZE(s))
#define CHROMA444 (CHROMA_FORMAT == CHROMA_444)
-/* Unions for type-punning.
- * Mn: load or store n bits, aligned, native-endian
- * CPn: copy n bits, aligned, native-endian
- * we don't use memcpy for CPn because memcpy's args aren't assumed to be aligned */
-typedef union { uint16_t i; uint8_t c[2]; } MAY_ALIAS x264_union16_t;
-typedef union { uint32_t i; uint16_t b[2]; uint8_t c[4]; } MAY_ALIAS x264_union32_t;
-typedef union { uint64_t i; uint32_t a[2]; uint16_t b[4]; uint8_t c[8]; } MAY_ALIAS x264_union64_t;
-typedef struct { uint64_t i[2]; } x264_uint128_t;
-typedef union { x264_uint128_t i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_t;
-#define M16(src) (((x264_union16_t*)(src))->i)
-#define M32(src) (((x264_union32_t*)(src))->i)
-#define M64(src) (((x264_union64_t*)(src))->i)
-#define M128(src) (((x264_union128_t*)(src))->i)
-#define M128_ZERO ((x264_uint128_t){{0,0}})
-#define CP16(dst,src) M16(dst) = M16(src)
-#define CP32(dst,src) M32(dst) = M32(src)
-#define CP64(dst,src) M64(dst) = M64(src)
-#define CP128(dst,src) M128(dst) = M128(src)
-
#if HIGH_BIT_DEPTH
typedef uint16_t pixel;
typedef uint64_t pixel4;
@@ -182,55 +108,13 @@
# define MPIXEL_X4(src) M32(src)
#endif
-#define BIT_DEPTH X264_BIT_DEPTH
+#define SIZEOF_PIXEL ((int)sizeof(pixel))
#define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src)
-#define X264_SCAN8_LUMA_SIZE (5*8)
-#define X264_SCAN8_SIZE (X264_SCAN8_LUMA_SIZE*3)
-#define X264_SCAN8_0 (4+1*8)
-
-/* Scan8 organization:
- * 0 1 2 3 4 5 6 7
- * 0 DY y y y y y
- * 1 y Y Y Y Y
- * 2 y Y Y Y Y
- * 3 y Y Y Y Y
- * 4 y Y Y Y Y
- * 5 DU u u u u u
- * 6 u U U U U
- * 7 u U U U U
- * 8 u U U U U
- * 9 u U U U U
- * 10 DV v v v v v
- * 11 v V V V V
- * 12 v V V V V
- * 13 v V V V V
- * 14 v V V V V
- * DY/DU/DV are for luma/chroma DC.
- */
-
-#define LUMA_DC 48
-#define CHROMA_DC 49
-
-static const uint8_t x264_scan8[16*3 + 3] =
-{
- 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8,
- 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8,
- 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8,
- 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8,
- 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8,
- 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8,
- 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8,
- 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8,
- 4+11*8, 5+11*8, 4+12*8, 5+12*8,
- 6+11*8, 7+11*8, 6+12*8, 7+12*8,
- 4+13*8, 5+13*8, 4+14*8, 5+14*8,
- 6+13*8, 7+13*8, 6+14*8, 7+14*8,
- 0+ 0*8, 0+ 5*8, 0+10*8
-};
-
-#include "x264.h"
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
#if HAVE_OPENCL
#include "opencl.h"
#endif
@@ -243,30 +127,19 @@
#include "frame.h"
#include "dct.h"
#include "quant.h"
-#include "cpu.h"
#include "threadpool.h"
/****************************************************************************
* General functions
****************************************************************************/
-/* x264_malloc : will do or emulate a memalign
- * you have to use x264_free for buffers allocated with x264_malloc */
-void *x264_malloc( int );
-void x264_free( void * );
-
-/* x264_slurp_file: malloc space for the whole file and read it */
-char *x264_slurp_file( const char *filename );
-
-/* x264_param2string: return a (malloced) string containing most of
- * the encoding options */
-char *x264_param2string( x264_param_t *p, int b_res );
/* log */
+#define x264_log x264_template(log)
void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... );
-void x264_reduce_fraction( uint32_t *n, uint32_t *d );
-void x264_reduce_fraction64( uint64_t *n, uint64_t *d );
+#define x264_cavlc_init x264_template(cavlc_init)
void x264_cavlc_init( x264_t *h );
+#define x264_cabac_init x264_template(cabac_init)
void x264_cabac_init( x264_t *h );
static ALWAYS_INLINE pixel x264_clip_pixel( int x )
@@ -274,97 +147,9 @@
return ( (x & ~PIXEL_MAX) ? (-x)>>31 & PIXEL_MAX : x );
}
-static ALWAYS_INLINE int x264_clip3( int v, int i_min, int i_max )
-{
- return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v );
-}
-
-static ALWAYS_INLINE double x264_clip3f( double v, double f_min, double f_max )
-{
- return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v );
-}
-
-static ALWAYS_INLINE int x264_median( int a, int b, int c )
-{
- int t = (a-b)&((a-b)>>31);
- a -= t;
- b += t;
- b -= (b-c)&((b-c)>>31);
- b += (a-b)&((a-b)>>31);
- return b;
-}
-
-static ALWAYS_INLINE void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
-{
- dst[0] = x264_median( a[0], b[0], c[0] );
- dst[1] = x264_median( a[1], b[1], c[1] );
-}
-
-static ALWAYS_INLINE int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
-{
- int sum = 0;
- for( int i = 0; i < i_mvc-1; i++ )
- {
- sum += abs( mvc[i][0] - mvc[i+1][0] )
- + abs( mvc[i][1] - mvc[i+1][1] );
- }
- return sum;
-}
-
-static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop )
-{
- int amvd0 = mvdleft[0] + mvdtop[0];
- int amvd1 = mvdleft[1] + mvdtop[1];
- amvd0 = (amvd0 > 2) + (amvd0 > 32);
- amvd1 = (amvd1 > 2) + (amvd1 > 32);
- return amvd0 + (amvd1<<8);
-}
-
-extern const uint8_t x264_exp2_lut[64];
-extern const float x264_log2_lut[128];
-extern const float x264_log2_lz_lut[32];
-
-/* Not a general-purpose function; multiplies input by -1/6 to convert
- * qp to qscale. */
-static ALWAYS_INLINE int x264_exp2fix8( float x )
-{
- int i = x*(-64.f/6.f) + 512.5f;
- if( i < 0 ) return 0;
- if( i > 1023 ) return 0xffff;
- return (x264_exp2_lut[i&63]+256) << (i>>6) >> 8;
-}
-
-static ALWAYS_INLINE float x264_log2( uint32_t x )
-{
- int lz = x264_clz( x );
- return x264_log2_lut[(x<<lz>>24)&0x7f] + x264_log2_lz_lut[lz];
-}
-
/****************************************************************************
*
****************************************************************************/
-enum slice_type_e
-{
- SLICE_TYPE_P = 0,
- SLICE_TYPE_B = 1,
- SLICE_TYPE_I = 2,
-};
-
-static const char slice_type_to_char[] = { 'P', 'B', 'I' };
-
-enum sei_payload_type_e
-{
- SEI_BUFFERING_PERIOD = 0,
- SEI_PIC_TIMING = 1,
- SEI_PAN_SCAN_RECT = 2,
- SEI_FILLER = 3,
- SEI_USER_DATA_REGISTERED = 4,
- SEI_USER_DATA_UNREGISTERED = 5,
- SEI_RECOVERY_POINT = 6,
- SEI_DEC_REF_PIC_MARKING = 7,
- SEI_FRAME_PACKING = 45,
-};
-
typedef struct
{
x264_sps_t *sps;
@@ -560,9 +345,14 @@
udctcoef (*quant8_bias0[4])[64]; /* [4][QP_MAX_SPEC+1][64] */
udctcoef (*nr_offset_emergency)[4][64];
- /* mv/ref cost arrays. */
+ /* mv/ref/mode cost arrays. */
uint16_t *cost_mv[QP_MAX+1];
uint16_t *cost_mv_fpel[QP_MAX+1][4];
+ struct
+ {
+ uint16_t ref[QP_MAX+1][3][33];
+ uint16_t i4x4_mode[QP_MAX+1][17];
+ } *cost_table;
const uint8_t *chroma_qp_table; /* includes both the nonlinear luma->chroma mapping and chroma_qp_offset */
@@ -740,7 +530,7 @@
int16_t (*mvr[2][X264_REF_MAX*2])[2];/* 16x16 mv for each possible ref */
int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */
- uint32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
+ int32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
uint8_t *field;
/* buffer for weighted versions of the reference frames */
@@ -781,16 +571,16 @@
ALIGNED_64( pixel fdec_buf[54*FDEC_STRIDE] );
/* i4x4 and i8x8 backup data, for skipping the encode stage when possible */
- ALIGNED_16( pixel i4x4_fdec_buf[16*16] );
- ALIGNED_16( pixel i8x8_fdec_buf[16*16] );
+ ALIGNED_32( pixel i4x4_fdec_buf[16*16] );
+ ALIGNED_32( pixel i8x8_fdec_buf[16*16] );
ALIGNED_64( dctcoef i8x8_dct_buf[3][64] );
ALIGNED_64( dctcoef i4x4_dct_buf[15][16] );
uint32_t i4x4_nnz_buf[4];
uint32_t i8x8_nnz_buf[4];
/* Psy trellis DCT data */
- ALIGNED_16( dctcoef fenc_dct8[4][64] );
- ALIGNED_16( dctcoef fenc_dct4[16][16] );
+ ALIGNED_64( dctcoef fenc_dct8[4][64] );
+ ALIGNED_64( dctcoef fenc_dct4[16][16] );
/* Psy RD SATD/SA8D scores cache */
ALIGNED_64( uint32_t fenc_satd_cache[32] );
@@ -979,7 +769,7 @@
// included at the end because it needs x264_t
#include "macroblock.h"
-static int ALWAYS_INLINE x264_predictor_roundclip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
+static ALWAYS_INLINE int x264_predictor_roundclip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
{
int cnt = 0;
for( int i = 0; i < i_mvc; i++ )
@@ -995,7 +785,7 @@
return cnt;
}
-static int ALWAYS_INLINE x264_predictor_clip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
+static ALWAYS_INLINE int x264_predictor_clip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
{
int cnt = 0;
int qpel_limit[4] = {mv_limit[0][0] << 2, mv_limit[0][1] << 2, mv_limit[1][0] << 2, mv_limit[1][1] << 2};
@@ -1019,4 +809,3 @@
#include "rectangle.h"
#endif
-
diff -ur x264-go/x264c/external/x264/common/cpu.c x264-go.new/x264c/external/x264/common/cpu.c
--- x264-go/x264c/external/x264/common/cpu.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/cpu.c 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cpu.c: cpu detection
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -25,7 +25,7 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#include "common.h"
+#include "base.h"
#if HAVE_POSIXTHREAD && SYS_LINUX
#include <sched.h>
@@ -45,7 +45,7 @@
const x264_cpu_name_t x264_cpu_names[] =
{
-#if HAVE_MMX
+#if ARCH_X86 || ARCH_X86_64
// {"MMX", X264_CPU_MMX}, // we don't support asm on mmx1 cpus anymore
#define MMX2 X264_CPU_MMX|X264_CPU_MMX2
{"MMX2", MMX2},
@@ -97,7 +97,7 @@
{"", 0},
};
-#if (ARCH_PPC && SYS_LINUX) || (ARCH_ARM && !HAVE_NEON)
+#if (HAVE_ALTIVEC && SYS_LINUX) || (HAVE_ARMV6 && !HAVE_NEON)
#include <signal.h>
#include <setjmp.h>
static sigjmp_buf jmpbuf;
@@ -235,16 +235,8 @@
int model = ((eax>>4)&0xf) + ((eax>>12)&0xf0);
if( family == 6 )
{
- /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah")
- * theoretically support sse2, but it's significantly slower than mmx for
- * almost all of x264's functions, so let's just pretend they don't. */
- if( model == 9 || model == 13 || model == 14 )
- {
- cpu &= ~(X264_CPU_SSE2|X264_CPU_SSE3);
- assert(!(cpu&(X264_CPU_SSSE3|X264_CPU_SSE4)));
- }
/* Detect Atom CPU */
- else if( model == 28 )
+ if( model == 28 )
{
cpu |= X264_CPU_SLOW_ATOM;
cpu |= X264_CPU_SLOW_PSHUFB;
@@ -296,7 +288,7 @@
else if( cache == 64 )
cpu |= X264_CPU_CACHELINE_64;
else
- x264_log( NULL, X264_LOG_WARNING, "unable to determine cacheline size\n" );
+ x264_log_internal( X264_LOG_WARNING, "unable to determine cacheline size\n" );
}
#if STACK_ALIGNMENT < 16
@@ -306,7 +298,7 @@
return cpu;
}
-#elif ARCH_PPC && HAVE_ALTIVEC
+#elif HAVE_ALTIVEC
#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
#include <sys/sysctl.h>
@@ -363,15 +355,14 @@
}
#endif
-#elif ARCH_ARM
+#elif HAVE_ARMV6
void x264_cpu_neon_test( void );
int x264_cpu_fast_neon_mrc_test( void );
uint32_t x264_cpu_detect( void )
{
- int flags = 0;
-#if HAVE_ARMV6
+ uint32_t flags = 0;
flags |= X264_CPU_ARMV6;
// don't do this hack if compiled with -mfpu=neon
@@ -404,26 +395,25 @@
flags |= x264_cpu_fast_neon_mrc_test() ? X264_CPU_FAST_NEON_MRC : 0;
#endif
// TODO: write dual issue test? currently it's A8 (dual issue) vs. A9 (fast mrc)
-#endif
return flags;
}
-#elif ARCH_AARCH64
+#elif HAVE_AARCH64
uint32_t x264_cpu_detect( void )
{
+#if HAVE_NEON
return X264_CPU_ARMV8 | X264_CPU_NEON;
+#else
+ return X264_CPU_ARMV8;
+#endif
}
-#elif ARCH_MIPS
+#elif HAVE_MSA
uint32_t x264_cpu_detect( void )
{
- uint32_t flags = 0;
-#if HAVE_MSA
- flags |= X264_CPU_MSA;
-#endif
- return flags;
+ return X264_CPU_MSA;
}
#else
@@ -459,7 +449,7 @@
return CPU_COUNT(&p_aff);
#else
int np = 0;
- for( unsigned int bit = 0; bit < 8 * sizeof(p_aff); bit++ )
+ for( size_t bit = 0; bit < 8 * sizeof(p_aff); bit++ )
np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1;
return np;
#endif
diff -ur x264-go/x264c/external/x264/common/cpu.h x264-go.new/x264c/external/x264/common/cpu.h
--- x264-go/x264c/external/x264/common/cpu.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/cpu.h 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cpu.h: cpu detection
*****************************************************************************
- * Copyright (C) 2004-2017 x264 project
+ * Copyright (C) 2004-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
@@ -26,8 +26,8 @@
#ifndef X264_CPU_H
#define X264_CPU_H
-uint32_t x264_cpu_detect( void );
-int x264_cpu_num_processors( void );
+X264_API uint32_t x264_cpu_detect( void );
+X264_API int x264_cpu_num_processors( void );
void x264_cpu_emms( void );
void x264_cpu_sfence( void );
#if HAVE_MMX
@@ -46,28 +46,11 @@
#endif
#define x264_sfence x264_cpu_sfence
-/* kludge:
- * gcc can't give variables any greater alignment than the stack frame has.
- * We need 32 byte alignment for AVX2, so here we make sure that the stack is
- * aligned to 32 bytes.
- * gcc 4.2 introduced __attribute__((force_align_arg_pointer)) to fix this
- * problem, but I don't want to require such a new version.
- * aligning to 32 bytes only works if the compiler supports keeping that
- * alignment between functions (osdep.h handles manual alignment of arrays
- * if it doesn't).
- */
-#if HAVE_MMX && (STACK_ALIGNMENT > 16 || (ARCH_X86 && STACK_ALIGNMENT > 4))
-intptr_t x264_stack_align( void (*func)(), ... );
-#define x264_stack_align(func,...) x264_stack_align((void (*)())func, __VA_ARGS__)
-#else
-#define x264_stack_align(func,...) func(__VA_ARGS__)
-#endif
-
typedef struct
{
const char *name;
uint32_t flags;
} x264_cpu_name_t;
-extern const x264_cpu_name_t x264_cpu_names[];
+X264_API extern const x264_cpu_name_t x264_cpu_names[];
#endif
diff -ur x264-go/x264c/external/x264/common/dct.c x264-go.new/x264c/external/x264/common/dct.c
--- x264-go/x264c/external/x264/common/dct.c 2018-02-15 14:44:18.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/dct.c 2020-06-06 15:39:30.345068735 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* dct.c: transform and zigzag
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -29,83 +29,19 @@
#if HAVE_MMX
# include "x86/dct.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/dct.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/dct.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/dct.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/dct.h"
#endif
-/* the inverse of the scaling factors introduced by 8x8 fdct */
-/* uint32 is for the asm implementation of trellis. the actual values fit in uint16. */
-#define W(i) (i==0 ? FIX8(1.0000) :\
- i==1 ? FIX8(0.8859) :\
- i==2 ? FIX8(1.6000) :\
- i==3 ? FIX8(0.9415) :\
- i==4 ? FIX8(1.2651) :\
- i==5 ? FIX8(1.1910) :0)
-const uint32_t x264_dct8_weight_tab[64] = {
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
-
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
-};
-#undef W
-
-#define W(i) (i==0 ? FIX8(1.76777) :\
- i==1 ? FIX8(1.11803) :\
- i==2 ? FIX8(0.70711) :0)
-const uint32_t x264_dct4_weight_tab[16] = {
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2),
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2)
-};
-#undef W
-
-/* inverse squared */
-#define W(i) (i==0 ? FIX8(3.125) :\
- i==1 ? FIX8(1.25) :\
- i==2 ? FIX8(0.5) :0)
-const uint32_t x264_dct4_weight2_tab[16] = {
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2),
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2)
-};
-#undef W
-
-#define W(i) (i==0 ? FIX8(1.00000) :\
- i==1 ? FIX8(0.78487) :\
- i==2 ? FIX8(2.56132) :\
- i==3 ? FIX8(0.88637) :\
- i==4 ? FIX8(1.60040) :\
- i==5 ? FIX8(1.41850) :0)
-const uint32_t x264_dct8_weight2_tab[64] = {
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
-
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
-};
-#undef W
-
-
static void dct4x4dc( dctcoef d[16] )
{
dctcoef tmp[16];
@@ -502,7 +438,7 @@
add8x8_idct8( &dst[8*FDEC_STRIDE+8], dct[3] );
}
-static void inline add4x4_idct_dc( pixel *p_dst, dctcoef dc )
+static inline void add4x4_idct_dc( pixel *p_dst, dctcoef dc )
{
dc = (dc + 32) >> 6;
for( int i = 0; i < 4; i++, p_dst += FDEC_STRIDE )
@@ -537,7 +473,7 @@
/****************************************************************************
* x264_dct_init:
****************************************************************************/
-void x264_dct_init( int cpu, x264_dct_function_t *dctf )
+void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf )
{
dctf->sub4x4_dct = sub4x4_dct;
dctf->add4x4_idct = add4x4_idct;
@@ -732,6 +668,7 @@
dctf->sub16x16_dct = x264_sub16x16_dct_altivec;
dctf->add8x8_idct_dc = x264_add8x8_idct_dc_altivec;
+ dctf->add16x16_idct_dc = x264_add16x16_idct_dc_altivec;
dctf->add4x4_idct = x264_add4x4_idct_altivec;
dctf->add8x8_idct = x264_add8x8_idct_altivec;
@@ -746,7 +683,7 @@
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
dctf->sub4x4_dct = x264_sub4x4_dct_neon;
@@ -965,7 +902,7 @@
}
}
-void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
+void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
{
pf_interlaced->scan_8x8 = zigzag_scan_8x8_field;
pf_progressive->scan_8x8 = zigzag_scan_8x8_frame;
@@ -1060,11 +997,11 @@
pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_altivec;
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_neon;
-#if ARCH_AARCH64
+#if HAVE_AARCH64
pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_neon;
pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_neon;
pf_interlaced->sub_4x4 = x264_zigzag_sub_4x4_field_neon;
@@ -1074,9 +1011,9 @@
pf_progressive->sub_4x4 = x264_zigzag_sub_4x4_frame_neon;
pf_progressive->sub_4x4ac = x264_zigzag_sub_4x4ac_frame_neon;
pf_progressive->sub_8x8 = x264_zigzag_sub_8x8_frame_neon;
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
}
-#endif // HAVE_ARMV6 || ARCH_AARCH64
+#endif // HAVE_ARMV6 || HAVE_AARCH64
#endif // HIGH_BIT_DEPTH
pf_interlaced->interleave_8x8_cavlc =
@@ -1129,13 +1066,13 @@
#endif // HIGH_BIT_DEPTH
#endif
#if !HIGH_BIT_DEPTH
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf_interlaced->interleave_8x8_cavlc =
pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_neon;
}
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
#if HAVE_ALTIVEC
if( cpu&X264_CPU_ALTIVEC )
diff -ur x264-go/x264c/external/x264/common/dct.h x264-go.new/x264c/external/x264/common/dct.h
--- x264-go/x264c/external/x264/common/dct.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/dct.h 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* dct.h: transform and zigzag
*****************************************************************************
- * Copyright (C) 2004-2017 x264 project
+ * Copyright (C) 2004-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
@@ -26,11 +26,6 @@
#ifndef X264_DCT_H
#define X264_DCT_H
-extern const uint32_t x264_dct4_weight_tab[16];
-extern const uint32_t x264_dct8_weight_tab[64];
-extern const uint32_t x264_dct4_weight2_tab[16];
-extern const uint32_t x264_dct8_weight2_tab[64];
-
typedef struct
{
// pix1 stride = FENC_STRIDE
@@ -74,7 +69,9 @@
} x264_zigzag_function_t;
-void x264_dct_init( int cpu, x264_dct_function_t *dctf );
-void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
+#define x264_dct_init x264_template(dct_init)
+void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf );
+#define x264_zigzag_init x264_template(zigzag_init)
+void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
#endif
diff -ur x264-go/x264c/external/x264/common/deblock.c x264-go.new/x264c/external/x264/common/deblock.c
--- x264-go/x264c/external/x264/common/deblock.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/deblock.c 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* deblock.c: deblocking
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -337,7 +337,7 @@
pf_intra( pix, i_stride, alpha, beta );
}
-static ALWAYS_INLINE void x264_macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
+static ALWAYS_INLINE void macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
{
int deblock_on_slice_edges = h->sh.i_disable_deblocking_filter_idc != 2;
@@ -383,6 +383,7 @@
int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset );
int stridey = h->fdec->i_stride[0];
int strideuv = h->fdec->i_stride[1];
+ int chroma_format = CHROMA_FORMAT;
int chroma444 = CHROMA444;
int chroma_height = 16 >> CHROMA_V_SHIFT;
intptr_t uvdiff = chroma444 ? h->fdec->plane[2] - h->fdec->plane[1] : 1;
@@ -390,7 +391,7 @@
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
{
x264_prefetch_fenc( h, h->fdec, mb_x, mb_y );
- x264_macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
+ macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
int mb_xy = h->mb.i_mb_xy;
int transform_8x8 = h->mb.mb_transform_size[mb_xy];
@@ -398,12 +399,13 @@
uint8_t (*bs)[8][4] = h->deblock_strength[mb_y&1][h->param.b_sliced_threads?mb_xy:mb_x];
pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey + 16*mb_x;
- pixel *pixuv = h->fdec->plane[1] + chroma_height*mb_y*strideuv + 16*mb_x;
+ pixel *pixuv = CHROMA_FORMAT ? h->fdec->plane[1] + chroma_height*mb_y*strideuv + 16*mb_x : NULL;
if( mb_y & MB_INTERLACED )
{
pixy -= 15*stridey;
- pixuv -= (chroma_height-1)*strideuv;
+ if( CHROMA_FORMAT )
+ pixuv -= (chroma_height-1)*strideuv;
}
int stride2y = stridey << MB_INTERLACED;
@@ -420,7 +422,7 @@
deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1),\
stride2y, bs[dir][edge], qp, a, b, 0,\
h->loopf.deblock_luma##intra[dir] );\
- if( CHROMA_FORMAT == CHROMA_444 )\
+ if( chroma_format == CHROMA_444 )\
{\
deblock_edge##intra( h, pixuv + 4*edge*(dir?stride2uv:1),\
stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
@@ -429,14 +431,14 @@
stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
h->loopf.deblock_luma##intra[dir] );\
}\
- else if( CHROMA_FORMAT == CHROMA_420 && !(edge & 1) )\
+ else if( chroma_format == CHROMA_420 && !(edge & 1) )\
{\
deblock_edge##intra( h, pixuv + edge*(dir?2*stride2uv:4),\
stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
h->loopf.deblock_chroma##intra[dir] );\
}\
}\
- if( CHROMA_FORMAT == CHROMA_422 && (dir || !(edge & 1)) )\
+ if( chroma_format == CHROMA_422 && (dir || !(edge & 1)) )\
{\
deblock_edge##intra( h, pixuv + edge*(dir?4*stride2uv:4),\
stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
@@ -463,16 +465,22 @@
if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[0]] ) )
{
deblock_edge_intra( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_intra_deblock );
- deblock_edge_intra( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
- if( chroma444 )
- deblock_edge_intra( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
+ if( chroma_format )
+ {
+ deblock_edge_intra( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
+ if( chroma444 )
+ deblock_edge_intra( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
+ }
}
else
{
deblock_edge( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_deblock );
- deblock_edge( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
- if( chroma444 )
- deblock_edge( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
+ if( chroma_format )
+ {
+ deblock_edge( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
+ if( chroma444 )
+ deblock_edge( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
+ }
}
int offy = MB_INTERLACED ? 4 : 0;
@@ -483,16 +491,22 @@
if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[1]] ) )
{
deblock_edge_intra( h, pixy + (stridey<<offy), 2*stridey, bs[0][4], luma_qp[1], a, b, 0, luma_intra_deblock );
- deblock_edge_intra( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
- if( chroma444 )
- deblock_edge_intra( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
+ if( chroma_format )
+ {
+ deblock_edge_intra( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
+ if( chroma444 )
+ deblock_edge_intra( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
+ }
}
else
{
deblock_edge( h, pixy + (stridey<<offy), 2*stridey, bs[0][4], luma_qp[1], a, b, 0, luma_deblock );
- deblock_edge( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
- if( chroma444 )
- deblock_edge( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
+ if( chroma_format )
+ {
+ deblock_edge( h, pixuv + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
+ if( chroma444 )
+ deblock_edge( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
+ }
}
}
else
@@ -548,7 +562,7 @@
deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
deblock_edge( h, pixuv + uvdiff + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
}
- else
+ else if( chroma_format )
deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 1, h->loopf.deblock_chroma[1] );
}
}
@@ -652,120 +666,22 @@
}
#if HAVE_MMX
-void x264_deblock_v_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_strength_sse2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_ssse3 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx512( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-
-void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-#if ARCH_X86
-void x264_deblock_h_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v8_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v8_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-
-#if HIGH_BIT_DEPTH
-void x264_deblock_v_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-#else
-// FIXME this wrapper has a significant cpu cost
-static void x264_deblock_v_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
-{
- x264_deblock_v8_luma_mmx2( pix, stride, alpha, beta, tc0 );
- x264_deblock_v8_luma_mmx2( pix+8, stride, alpha, beta, tc0+2 );
-}
-static void x264_deblock_v_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta )
-{
- x264_deblock_v8_luma_intra_mmx2( pix, stride, alpha, beta );
- x264_deblock_v8_luma_intra_mmx2( pix+8, stride, alpha, beta );
-}
-#endif // HIGH_BIT_DEPTH
+#include "x86/deblock.h"
#endif
+#if HAVE_ALTIVEC
+#include "ppc/deblock.h"
#endif
-
-#if ARCH_PPC
-void x264_deblock_v_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-#endif // ARCH_PPC
-
-#if HAVE_ARMV6 || ARCH_AARCH64
-void x264_deblock_v_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_strength_neon( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_h_chroma_422_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_intra_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#if HAVE_ARMV6
+#include "arm/deblock.h"
#endif
-
-#if !HIGH_BIT_DEPTH
-#if HAVE_MSA
-void x264_deblock_v_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_strength_msa( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit,
- int bframe );
+#if HAVE_AARCH64
+#include "aarch64/deblock.h"
#endif
+#if HAVE_MSA
+#include "mips/deblock.h"
#endif
-void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff )
+void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff )
{
pf->deblock_luma[1] = deblock_v_luma_c;
pf->deblock_luma[0] = deblock_h_luma_c;
@@ -867,7 +783,7 @@
}
#endif // HAVE_ALTIVEC
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf->deblock_luma[1] = x264_deblock_v_luma_neon;
diff -ur x264-go/x264c/external/x264/common/frame.c x264-go.new/x264c/external/x264/common/frame.c
--- x264-go/x264c/external/x264/common/frame.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/frame.c 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* frame.c: frame handling
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -42,37 +42,24 @@
return x;
}
-static int x264_frame_internal_csp( int external_csp )
+static int frame_internal_csp( int external_csp )
{
- switch( external_csp & X264_CSP_MASK )
- {
- case X264_CSP_NV12:
- case X264_CSP_NV21:
- case X264_CSP_I420:
- case X264_CSP_YV12:
- return X264_CSP_NV12;
- case X264_CSP_NV16:
- case X264_CSP_I422:
- case X264_CSP_YV16:
- case X264_CSP_YUYV:
- case X264_CSP_UYVY:
- case X264_CSP_V210:
- return X264_CSP_NV16;
- case X264_CSP_I444:
- case X264_CSP_YV24:
- case X264_CSP_BGR:
- case X264_CSP_BGRA:
- case X264_CSP_RGB:
- return X264_CSP_I444;
- default:
- return X264_CSP_NONE;
- }
+ int csp = external_csp & X264_CSP_MASK;
+ if( csp == X264_CSP_I400 )
+ return X264_CSP_I400;
+ if( csp >= X264_CSP_I420 && csp < X264_CSP_I422 )
+ return X264_CSP_NV12;
+ if( csp >= X264_CSP_I422 && csp < X264_CSP_I444 )
+ return X264_CSP_NV16;
+ if( csp >= X264_CSP_I444 && csp <= X264_CSP_RGB )
+ return X264_CSP_I444;
+ return X264_CSP_NONE;
}
-static x264_frame_t *x264_frame_new( x264_t *h, int b_fdec )
+static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
x264_frame_t *frame;
- int i_csp = x264_frame_internal_csp( h->param.i_csp );
+ int i_csp = frame_internal_csp( h->param.i_csp );
int i_mb_count = h->mb.i_mb_count;
int i_stride, i_width, i_lines, luma_plane_count;
int i_padv = PADV << PARAM_INTERLACED;
@@ -89,6 +76,9 @@
int disalign = 1<<10;
#endif
+ /* ensure frame alignment after PADH is added */
+ int padh_align = X264_MAX( align - PADH * SIZEOF_PIXEL, 0 ) / SIZEOF_PIXEL;
+
CHECKED_MALLOCZERO( frame, sizeof(x264_frame_t) );
PREALLOC_INIT
@@ -119,6 +109,14 @@
frame->i_stride[i] = i_stride;
}
}
+ else if( i_csp == X264_CSP_I400 )
+ {
+ luma_plane_count = 1;
+ frame->i_plane = 1;
+ frame->i_width[0] = i_width;
+ frame->i_lines[0] = i_lines;
+ frame->i_stride[0] = i_stride;
+ }
else
goto fail;
@@ -154,9 +152,9 @@
{
int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12);
int chroma_plane_size = (frame->i_stride[1] * (frame->i_lines[1] + 2*chroma_padv));
- PREALLOC( frame->buffer[1], chroma_plane_size * sizeof(pixel) );
+ PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
if( PARAM_INTERLACED )
- PREALLOC( frame->buffer_fld[1], chroma_plane_size * sizeof(pixel) );
+ PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
}
/* all 4 luma planes allocated together, since the cacheline split code
@@ -164,20 +162,14 @@
for( int p = 0; p < luma_plane_count; p++ )
{
- int luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign );
+ int64_t luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign );
if( h->param.analyse.i_subpel_refine && b_fdec )
- {
- /* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */
- PREALLOC( frame->buffer[p], 4*luma_plane_size * sizeof(pixel) );
- if( PARAM_INTERLACED )
- PREALLOC( frame->buffer_fld[p], 4*luma_plane_size * sizeof(pixel) );
- }
- else
- {
- PREALLOC( frame->buffer[p], luma_plane_size * sizeof(pixel) );
- if( PARAM_INTERLACED )
- PREALLOC( frame->buffer_fld[p], luma_plane_size * sizeof(pixel) );
- }
+ luma_plane_size *= 4;
+
+ /* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */
+ PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
+ if( PARAM_INTERLACED )
+ PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
}
frame->b_duplicate = 0;
@@ -213,9 +205,9 @@
{
if( h->frames.b_have_lowres )
{
- int luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
+ int64_t luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
- PREALLOC( frame->buffer_lowres[0], 4 * luma_plane_size * sizeof(pixel) );
+ PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * SIZEOF_PIXEL );
for( int j = 0; j <= !!h->param.i_bframe; j++ )
for( int i = 0; i <= h->param.i_bframe; i++ )
@@ -245,28 +237,30 @@
if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 )
{
int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12);
- frame->plane[1] = frame->buffer[1] + frame->i_stride[1] * chroma_padv + PADH;
+ frame->plane[1] = frame->buffer[1] + frame->i_stride[1] * chroma_padv + PADH + padh_align;
if( PARAM_INTERLACED )
- frame->plane_fld[1] = frame->buffer_fld[1] + frame->i_stride[1] * chroma_padv + PADH;
+ frame->plane_fld[1] = frame->buffer_fld[1] + frame->i_stride[1] * chroma_padv + PADH + padh_align;
}
for( int p = 0; p < luma_plane_count; p++ )
{
- int luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign );
+ int64_t luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign );
if( h->param.analyse.i_subpel_refine && b_fdec )
{
for( int i = 0; i < 4; i++ )
{
- frame->filtered[p][i] = frame->buffer[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH;
- frame->filtered_fld[p][i] = frame->buffer_fld[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH;
+ frame->filtered[p][i] = frame->buffer[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH + padh_align;
+ if( PARAM_INTERLACED )
+ frame->filtered_fld[p][i] = frame->buffer_fld[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH + padh_align;
}
frame->plane[p] = frame->filtered[p][0];
frame->plane_fld[p] = frame->filtered_fld[p][0];
}
else
{
- frame->filtered[p][0] = frame->plane[p] = frame->buffer[p] + frame->i_stride[p] * i_padv + PADH;
- frame->filtered_fld[p][0] = frame->plane_fld[p] = frame->buffer_fld[p] + frame->i_stride[p] * i_padv + PADH;
+ frame->filtered[p][0] = frame->plane[p] = frame->buffer[p] + frame->i_stride[p] * i_padv + PADH + padh_align;
+ if( PARAM_INTERLACED )
+ frame->filtered_fld[p][0] = frame->plane_fld[p] = frame->buffer_fld[p] + frame->i_stride[p] * i_padv + PADH + padh_align;
}
}
@@ -282,9 +276,9 @@
{
if( h->frames.b_have_lowres )
{
- int luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
+ int64_t luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
for( int i = 0; i < 4; i++ )
- frame->lowres[i] = frame->buffer_lowres[0] + (frame->i_stride_lowres * PADV + PADH) + i * luma_plane_size;
+ frame->lowres[i] = frame->buffer_lowres + frame->i_stride_lowres * PADV + PADH + padh_align + i * luma_plane_size;
for( int j = 0; j <= !!h->param.i_bframe; j++ )
for( int i = 0; i <= h->param.i_bframe; i++ )
@@ -366,7 +360,7 @@
int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
{
int i_csp = src->img.i_csp & X264_CSP_MASK;
- if( dst->i_csp != x264_frame_internal_csp( i_csp ) )
+ if( dst->i_csp != frame_internal_csp( i_csp ) )
{
x264_log( h, X264_LOG_ERROR, "Invalid input colorspace\n" );
return -1;
@@ -425,7 +419,7 @@
h->mc.plane_copy_deinterleave_v210( dst->plane[0], dst->i_stride[0],
dst->plane[1], dst->i_stride[1],
- (uint32_t *)pix[0], stride[0]/sizeof(uint32_t), h->param.i_width, h->param.i_height );
+ (uint32_t *)pix[0], stride[0]/(int)sizeof(uint32_t), h->param.i_width, h->param.i_height );
}
else if( i_csp >= X264_CSP_BGR )
{
@@ -440,25 +434,25 @@
h->mc.plane_copy_deinterleave_rgb( dst->plane[1+b], dst->i_stride[1+b],
dst->plane[0], dst->i_stride[0],
dst->plane[2-b], dst->i_stride[2-b],
- (pixel*)pix[0], stride[0]/sizeof(pixel), i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
+ (pixel*)pix[0], stride[0]/SIZEOF_PIXEL, i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
}
else
{
int v_shift = CHROMA_V_SHIFT;
get_plane_ptr( h, src, &pix[0], &stride[0], 0, 0, 0 );
h->mc.plane_copy( dst->plane[0], dst->i_stride[0], (pixel*)pix[0],
- stride[0]/sizeof(pixel), h->param.i_width, h->param.i_height );
+ stride[0]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
- stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );
+ stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_NV21 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy_swap( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
- stride[1]/sizeof(pixel), h->param.i_width>>1, h->param.i_height>>v_shift );
+ stride[1]/SIZEOF_PIXEL, h->param.i_width>>1, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_I420 || i_csp == X264_CSP_I422 || i_csp == X264_CSP_YV12 || i_csp == X264_CSP_YV16 )
{
@@ -466,24 +460,24 @@
get_plane_ptr( h, src, &pix[1], &stride[1], uv_swap ? 2 : 1, 1, v_shift );
get_plane_ptr( h, src, &pix[2], &stride[2], uv_swap ? 1 : 2, 1, v_shift );
h->mc.plane_copy_interleave( dst->plane[1], dst->i_stride[1],
- (pixel*)pix[1], stride[1]/sizeof(pixel),
- (pixel*)pix[2], stride[2]/sizeof(pixel),
+ (pixel*)pix[1], stride[1]/SIZEOF_PIXEL,
+ (pixel*)pix[2], stride[2]/SIZEOF_PIXEL,
h->param.i_width>>1, h->param.i_height>>v_shift );
}
- else //if( i_csp == X264_CSP_I444 || i_csp == X264_CSP_YV24 )
+ else if( i_csp == X264_CSP_I444 || i_csp == X264_CSP_YV24 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], i_csp==X264_CSP_I444 ? 1 : 2, 0, 0 );
get_plane_ptr( h, src, &pix[2], &stride[2], i_csp==X264_CSP_I444 ? 2 : 1, 0, 0 );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
- stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height );
+ stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
h->mc.plane_copy( dst->plane[2], dst->i_stride[2], (pixel*)pix[2],
- stride[2]/sizeof(pixel), h->param.i_width, h->param.i_height );
+ stride[2]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
}
}
return 0;
}
-static void ALWAYS_INLINE pixel_memset( pixel *dst, pixel *src, int len, int size )
+static ALWAYS_INLINE void pixel_memset( pixel *dst, pixel *src, int len, int size )
{
uint8_t *dstp = (uint8_t*)dst;
uint32_t v1 = *src;
@@ -535,24 +529,24 @@
}
}
-static void ALWAYS_INLINE plane_expand_border( pixel *pix, int i_stride, int i_width, int i_height, int i_padh, int i_padv, int b_pad_top, int b_pad_bottom, int b_chroma )
+static ALWAYS_INLINE void plane_expand_border( pixel *pix, int i_stride, int i_width, int i_height, int i_padh, int i_padv, int b_pad_top, int b_pad_bottom, int b_chroma )
{
#define PPIXEL(x, y) ( pix + (x) + (y)*i_stride )
for( int y = 0; y < i_height; y++ )
{
/* left band */
- pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
+ pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
/* right band */
- pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
+ pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
}
/* upper band */
if( b_pad_top )
for( int y = 0; y < i_padv; y++ )
- memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * sizeof(pixel) );
+ memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * SIZEOF_PIXEL );
/* lower band */
if( b_pad_bottom )
for( int y = 0; y < i_padv; y++ )
- memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * sizeof(pixel) );
+ memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * SIZEOF_PIXEL );
#undef PPIXEL
}
@@ -656,14 +650,14 @@
for( int y = 0; y < i_height; y++ )
pixel_memset( &frame->plane[i][y*frame->i_stride[i] + i_width],
&frame->plane[i][y*frame->i_stride[i] + i_width - 1-h_shift],
- i_padx>>h_shift, sizeof(pixel)<<h_shift );
+ i_padx>>h_shift, SIZEOF_PIXEL<<h_shift );
}
if( i_pady )
{
for( int y = i_height; y < i_height + i_pady; y++ )
memcpy( &frame->plane[i][y*frame->i_stride[i]],
&frame->plane[i][(i_height-(~y&PARAM_INTERLACED)-1)*frame->i_stride[i]],
- (i_width + i_padx) * sizeof(pixel) );
+ (i_width + i_padx) * SIZEOF_PIXEL );
}
}
}
@@ -678,7 +672,7 @@
int pady = (h->mb.i_mb_height * 16 - h->param.i_height) >> v_shift;
pixel *fenc = h->fenc->plane[i] + 16*mb_x;
for( int y = height; y < height + pady; y++ )
- memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*sizeof(pixel) );
+ memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*SIZEOF_PIXEL );
}
}
@@ -784,7 +778,7 @@
if( h->frames.unused[b_fdec][0] )
frame = x264_frame_pop( h->frames.unused[b_fdec] );
else
- frame = x264_frame_new( h, b_fdec );
+ frame = frame_new( h, b_fdec );
if( !frame )
return NULL;
frame->b_last_minigop_bframe = 0;
diff -ur x264-go/x264c/external/x264/common/frame.h x264-go.new/x264c/external/x264/common/frame.h
--- x264-go/x264c/external/x264/common/frame.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/frame.h 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* frame.h: frame handling
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -86,7 +86,7 @@
* allocated data are stored in buffer */
pixel *buffer[4];
pixel *buffer_fld[4];
- pixel *buffer_lowres[4];
+ pixel *buffer_lowres;
x264_weight_t weight[X264_REF_MAX][3]; /* [ref_index][plane] */
pixel *weighted[X264_REF_MAX]; /* plane[0] weighted of the reference frames */
@@ -216,47 +216,80 @@
int bframe );
} x264_deblock_function_t;
+#define x264_frame_delete x264_template(frame_delete)
void x264_frame_delete( x264_frame_t *frame );
+#define x264_frame_copy_picture x264_template(frame_copy_picture)
int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src );
+#define x264_frame_expand_border x264_template(frame_expand_border)
void x264_frame_expand_border( x264_t *h, x264_frame_t *frame, int mb_y );
+#define x264_frame_expand_border_filtered x264_template(frame_expand_border_filtered)
void x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
+#define x264_frame_expand_border_lowres x264_template(frame_expand_border_lowres)
void x264_frame_expand_border_lowres( x264_frame_t *frame );
+#define x264_frame_expand_border_chroma x264_template(frame_expand_border_chroma)
void x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane );
+#define x264_frame_expand_border_mod16 x264_template(frame_expand_border_mod16)
void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame );
+#define x264_expand_border_mbpair x264_template(expand_border_mbpair)
void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y );
+#define x264_frame_deblock_row x264_template(frame_deblock_row)
void x264_frame_deblock_row( x264_t *h, int mb_y );
+#define x264_macroblock_deblock x264_template(macroblock_deblock)
void x264_macroblock_deblock( x264_t *h );
+#define x264_frame_filter x264_template(frame_filter)
void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
+#define x264_frame_init_lowres x264_template(frame_init_lowres)
void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame );
-void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff );
+#define x264_deblock_init x264_template(deblock_init)
+void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff );
+#define x264_frame_cond_broadcast x264_template(frame_cond_broadcast)
void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed );
+#define x264_frame_cond_wait x264_template(frame_cond_wait)
void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
+#define x264_frame_new_slice x264_template(frame_new_slice)
int x264_frame_new_slice( x264_t *h, x264_frame_t *frame );
+#define x264_threadslice_cond_broadcast x264_template(threadslice_cond_broadcast)
void x264_threadslice_cond_broadcast( x264_t *h, int pass );
+#define x264_threadslice_cond_wait x264_template(threadslice_cond_wait)
void x264_threadslice_cond_wait( x264_t *h, int pass );
-void x264_frame_push( x264_frame_t **list, x264_frame_t *frame );
-x264_frame_t *x264_frame_pop( x264_frame_t **list );
-void x264_frame_unshift( x264_frame_t **list, x264_frame_t *frame );
-x264_frame_t *x264_frame_shift( x264_frame_t **list );
+#define x264_frame_push x264_template(frame_push)
+X264_API void x264_frame_push( x264_frame_t **list, x264_frame_t *frame );
+#define x264_frame_pop x264_template(frame_pop)
+X264_API x264_frame_t *x264_frame_pop( x264_frame_t **list );
+#define x264_frame_unshift x264_template(frame_unshift)
+X264_API void x264_frame_unshift( x264_frame_t **list, x264_frame_t *frame );
+#define x264_frame_shift x264_template(frame_shift)
+X264_API x264_frame_t *x264_frame_shift( x264_frame_t **list );
+
+#define x264_frame_push_unused x264_template(frame_push_unused)
void x264_frame_push_unused( x264_t *h, x264_frame_t *frame );
+#define x264_frame_push_blank_unused x264_template(frame_push_blank_unused)
void x264_frame_push_blank_unused( x264_t *h, x264_frame_t *frame );
+#define x264_frame_pop_blank_unused x264_template(frame_pop_blank_unused)
x264_frame_t *x264_frame_pop_blank_unused( x264_t *h );
+#define x264_weight_scale_plane x264_template(weight_scale_plane)
void x264_weight_scale_plane( x264_t *h, pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride,
int i_width, int i_height, x264_weight_t *w );
+#define x264_frame_pop_unused x264_template(frame_pop_unused)
x264_frame_t *x264_frame_pop_unused( x264_t *h, int b_fdec );
+#define x264_frame_delete_list x264_template(frame_delete_list)
void x264_frame_delete_list( x264_frame_t **list );
+#define x264_sync_frame_list_init x264_template(sync_frame_list_init)
int x264_sync_frame_list_init( x264_sync_frame_list_t *slist, int nelem );
+#define x264_sync_frame_list_delete x264_template(sync_frame_list_delete)
void x264_sync_frame_list_delete( x264_sync_frame_list_t *slist );
+#define x264_sync_frame_list_push x264_template(sync_frame_list_push)
void x264_sync_frame_list_push( x264_sync_frame_list_t *slist, x264_frame_t *frame );
+#define x264_sync_frame_list_pop x264_template(sync_frame_list_pop)
x264_frame_t *x264_sync_frame_list_pop( x264_sync_frame_list_t *slist );
#endif
diff -ur x264-go/x264c/external/x264/common/macroblock.c x264-go.new/x264c/external/x264/common/macroblock.c
--- x264-go/x264c/external/x264/common/macroblock.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/macroblock.c 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* macroblock.c: macroblock common functions
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -34,7 +34,7 @@
mvx, mvy, 4*width, 4*height, \
list ? x264_weight_none : &h->sh.weight[i_ref][p] );
-static NOINLINE void x264_mb_mc_0xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_0xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref = h->mb.cache.ref[0][i8];
@@ -48,7 +48,7 @@
MC_LUMA( 0, 1 );
MC_LUMA( 0, 2 );
}
- else
+ else if( CHROMA_FORMAT )
{
int v_shift = CHROMA_V_SHIFT;
// Chroma in 4:2:0 is offset if MCing from a field of opposite parity
@@ -73,7 +73,7 @@
&h->sh.weight[i_ref][2], height );
}
}
-static NOINLINE void x264_mb_mc_1xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_1xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref = h->mb.cache.ref[1][i8];
@@ -87,7 +87,7 @@
MC_LUMA( 1, 1 );
MC_LUMA( 1, 2 );
}
- else
+ else if( CHROMA_FORMAT )
{
int v_shift = CHROMA_V_SHIFT;
if( v_shift & MB_INTERLACED & i_ref )
@@ -109,7 +109,7 @@
h->mc.avg[i_mode]( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \
src0, i_stride0, src1, i_stride1, weight );
-static NOINLINE void x264_mb_mc_01xywh( x264_t *h, int x, int y, int width, int height )
+static NOINLINE void mb_mc_01xywh( x264_t *h, int x, int y, int width, int height )
{
int i8 = x264_scan8[0]+x+8*y;
int i_ref0 = h->mb.cache.ref[0][i8];
@@ -132,7 +132,7 @@
MC_LUMA_BI( 1 );
MC_LUMA_BI( 2 );
}
- else
+ else if( CHROMA_FORMAT )
{
int v_shift = CHROMA_V_SHIFT;
if( v_shift & MB_INTERLACED & i_ref0 )
@@ -165,21 +165,21 @@
switch( h->mb.i_sub_partition[i8] )
{
case D_L0_8x8:
- x264_mb_mc_0xywh( h, x, y, 2, 2 );
+ mb_mc_0xywh( h, x, y, 2, 2 );
break;
case D_L0_8x4:
- x264_mb_mc_0xywh( h, x, y+0, 2, 1 );
- x264_mb_mc_0xywh( h, x, y+1, 2, 1 );
+ mb_mc_0xywh( h, x, y+0, 2, 1 );
+ mb_mc_0xywh( h, x, y+1, 2, 1 );
break;
case D_L0_4x8:
- x264_mb_mc_0xywh( h, x+0, y, 1, 2 );
- x264_mb_mc_0xywh( h, x+1, y, 1, 2 );
+ mb_mc_0xywh( h, x+0, y, 1, 2 );
+ mb_mc_0xywh( h, x+1, y, 1, 2 );
break;
case D_L0_4x4:
- x264_mb_mc_0xywh( h, x+0, y+0, 1, 1 );
- x264_mb_mc_0xywh( h, x+1, y+0, 1, 1 );
- x264_mb_mc_0xywh( h, x+0, y+1, 1, 1 );
- x264_mb_mc_0xywh( h, x+1, y+1, 1, 1 );
+ mb_mc_0xywh( h, x+0, y+0, 1, 1 );
+ mb_mc_0xywh( h, x+1, y+0, 1, 1 );
+ mb_mc_0xywh( h, x+0, y+1, 1, 1 );
+ mb_mc_0xywh( h, x+1, y+1, 1, 1 );
break;
}
}
@@ -189,11 +189,11 @@
if( h->mb.cache.ref[0][scan8] >= 0 )
if( h->mb.cache.ref[1][scan8] >= 0 )
- x264_mb_mc_01xywh( h, x, y, 2, 2 );
+ mb_mc_01xywh( h, x, y, 2, 2 );
else
- x264_mb_mc_0xywh( h, x, y, 2, 2 );
+ mb_mc_0xywh( h, x, y, 2, 2 );
else
- x264_mb_mc_1xywh( h, x, y, 2, 2 );
+ mb_mc_1xywh( h, x, y, 2, 2 );
}
}
@@ -214,33 +214,33 @@
if( h->mb.i_partition == D_16x16 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 4 );
- else x264_mb_mc_0xywh ( h, 0, 0, 4, 4 );
- else x264_mb_mc_1xywh ( h, 0, 0, 4, 4 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 4, 4 );
+ else mb_mc_0xywh ( h, 0, 0, 4, 4 );
+ else mb_mc_1xywh ( h, 0, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 2 );
- else x264_mb_mc_0xywh ( h, 0, 0, 4, 2 );
- else x264_mb_mc_1xywh ( h, 0, 0, 4, 2 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 4, 2 );
+ else mb_mc_0xywh ( h, 0, 0, 4, 2 );
+ else mb_mc_1xywh ( h, 0, 0, 4, 2 );
if( ref0b >= 0 )
- if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 0, 2, 4, 2 );
- else x264_mb_mc_0xywh ( h, 0, 2, 4, 2 );
- else x264_mb_mc_1xywh ( h, 0, 2, 4, 2 );
+ if( ref1b >= 0 ) mb_mc_01xywh( h, 0, 2, 4, 2 );
+ else mb_mc_0xywh ( h, 0, 2, 4, 2 );
+ else mb_mc_1xywh ( h, 0, 2, 4, 2 );
}
else if( h->mb.i_partition == D_8x16 )
{
if( ref0a >= 0 )
- if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 2, 4 );
- else x264_mb_mc_0xywh ( h, 0, 0, 2, 4 );
- else x264_mb_mc_1xywh ( h, 0, 0, 2, 4 );
+ if( ref1a >= 0 ) mb_mc_01xywh( h, 0, 0, 2, 4 );
+ else mb_mc_0xywh ( h, 0, 0, 2, 4 );
+ else mb_mc_1xywh ( h, 0, 0, 2, 4 );
if( ref0b >= 0 )
- if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 2, 0, 2, 4 );
- else x264_mb_mc_0xywh ( h, 2, 0, 2, 4 );
- else x264_mb_mc_1xywh ( h, 2, 0, 2, 4 );
+ if( ref1b >= 0 ) mb_mc_01xywh( h, 2, 0, 2, 4 );
+ else mb_mc_0xywh ( h, 2, 0, 2, 4 );
+ else mb_mc_1xywh ( h, 2, 0, 2, 4 );
}
}
}
@@ -260,7 +260,7 @@
PREALLOC( h->mb.qp, i_mb_count * sizeof(int8_t) );
PREALLOC( h->mb.cbp, i_mb_count * sizeof(int16_t) );
PREALLOC( h->mb.mb_transform_size, i_mb_count * sizeof(int8_t) );
- PREALLOC( h->mb.slice_table, i_mb_count * sizeof(uint32_t) );
+ PREALLOC( h->mb.slice_table, i_mb_count * sizeof(int32_t) );
/* 0 -> 3 top(4), 4 -> 6 : left(3) */
PREALLOC( h->mb.intra4x4_pred_mode, i_mb_count * 8 * sizeof(int8_t) );
@@ -321,12 +321,12 @@
}
for( int i = 0; i < numweightbuf; i++ )
- PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * sizeof(pixel) );
+ PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * SIZEOF_PIXEL );
}
PREALLOC_END( h->mb.base );
- memset( h->mb.slice_table, -1, i_mb_count * sizeof(uint32_t) );
+ memset( h->mb.slice_table, -1, i_mb_count * sizeof(int32_t) );
for( int i = 0; i < 2; i++ )
{
@@ -357,7 +357,7 @@
for( int i = 0; i < (PARAM_INTERLACED ? 5 : 2); i++ )
for( int j = 0; j < (CHROMA444 ? 3 : 2); j++ )
{
- CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * sizeof(pixel) );
+ CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * SIZEOF_PIXEL );
h->intra_border_backup[i][j] += 16;
}
for( int i = 0; i <= PARAM_INTERLACED; i++ )
@@ -531,17 +531,20 @@
*/
h->mb.pic.p_fenc[0] = h->mb.pic.fenc_buf;
h->mb.pic.p_fdec[0] = h->mb.pic.fdec_buf + 2*FDEC_STRIDE;
- h->mb.pic.p_fenc[1] = h->mb.pic.fenc_buf + 16*FENC_STRIDE;
- h->mb.pic.p_fdec[1] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE;
- if( CHROMA444 )
+ if( CHROMA_FORMAT )
{
- h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 32*FENC_STRIDE;
- h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 38*FDEC_STRIDE;
- }
- else
- {
- h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 16*FENC_STRIDE + 8;
- h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE + 16;
+ h->mb.pic.p_fenc[1] = h->mb.pic.fenc_buf + 16*FENC_STRIDE;
+ h->mb.pic.p_fdec[1] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE;
+ if( CHROMA444 )
+ {
+ h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 32*FENC_STRIDE;
+ h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 38*FDEC_STRIDE;
+ }
+ else
+ {
+ h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 16*FENC_STRIDE + 8;
+ h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE + 16;
+ }
}
}
@@ -552,7 +555,7 @@
int off_y = 16 * i_mb_x + 16 * i_mb_y * stride_y;
int off_uv = 16 * i_mb_x + (16 * i_mb_y * stride_uv >> CHROMA_V_SHIFT);
h->mc.prefetch_fenc( fenc->plane[0]+off_y, stride_y,
- fenc->plane[1]+off_uv, stride_uv, i_mb_x );
+ fenc->plane[1] != NULL ? fenc->plane[1]+off_uv : NULL, stride_uv, i_mb_x );
}
NOINLINE void x264_copy_column8( pixel *dst, pixel *src )
@@ -562,7 +565,7 @@
dst[i*FDEC_STRIDE] = src[i*FDEC_STRIDE];
}
-static void ALWAYS_INLINE x264_macroblock_load_pic_pointers( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
+static ALWAYS_INLINE void macroblock_load_pic_pointers( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
{
int mb_interlaced = b_mbaff && MB_INTERLACED;
int height = b_chroma ? 16 >> CHROMA_V_SHIFT : 16;
@@ -583,15 +586,15 @@
if( b_chroma )
{
h->mc.load_deinterleave_chroma_fenc( h->mb.pic.p_fenc[1], h->mb.pic.p_fenc_plane[1], i_stride2, height );
- memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*sizeof(pixel) );
- memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*sizeof(pixel) );
+ memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*SIZEOF_PIXEL );
+ memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*SIZEOF_PIXEL );
h->mb.pic.p_fdec[1][-FDEC_STRIDE-1] = intra_fdec[-1-8];
h->mb.pic.p_fdec[2][-FDEC_STRIDE-1] = intra_fdec[-1];
}
else
{
h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[i], FENC_STRIDE, h->mb.pic.p_fenc_plane[i], i_stride2, 16 );
- memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*sizeof(pixel) );
+ memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*SIZEOF_PIXEL );
h->mb.pic.p_fdec[i][-FDEC_STRIDE-1] = intra_fdec[-1];
}
if( b_mbaff || h->mb.b_reencode_mb )
@@ -623,8 +626,9 @@
if( !b_chroma )
{
- for( int k = 1; k < 4; k++ )
- h->mb.pic.p_fref[0][j][i*4+k] = filtered_src[k] + ref_pix_offset[j&1];
+ if( h->param.analyse.i_subpel_refine )
+ for( int k = 1; k < 4; k++ )
+ h->mb.pic.p_fref[0][j][i*4+k] = filtered_src[k] + ref_pix_offset[j&1];
if( !i )
{
if( h->sh.weight[j][0].weightfn )
@@ -649,7 +653,7 @@
}
h->mb.pic.p_fref[1][j][i*4] = plane_src + ref_pix_offset[j&1];
- if( !b_chroma )
+ if( !b_chroma && h->param.analyse.i_subpel_refine )
for( int k = 1; k < 4; k++ )
h->mb.pic.p_fref[1][j][i*4+k] = filtered_src[k] + ref_pix_offset[j&1];
}
@@ -666,7 +670,7 @@
{{ 4, 5, 6, 3}, { 3, 7, 11, 15}, {16+1, 16+5, 32+1, 32+5}, {0, 1, 2, 3}, {0, 0, 1, 1}}
};
-static void ALWAYS_INLINE x264_macroblock_cache_load_neighbours( x264_t *h, int mb_x, int mb_y, int b_interlaced )
+static ALWAYS_INLINE void macroblock_cache_load_neighbours( x264_t *h, int mb_x, int mb_y, int b_interlaced )
{
const int mb_interlaced = b_interlaced && MB_INTERLACED;
int top_y = mb_y - (1 << mb_interlaced);
@@ -803,9 +807,9 @@
x264_prefetch( &h->mb.cbp[top] );
x264_prefetch( h->mb.intra4x4_pred_mode[top] );
x264_prefetch( &h->mb.non_zero_count[top][12] );
- /* These aren't always allocated, but prefetching an invalid address can't hurt. */
x264_prefetch( &h->mb.mb_transform_size[top] );
- x264_prefetch( &h->mb.skipbp[top] );
+ if( h->param.b_cabac )
+ x264_prefetch( &h->mb.skipbp[top] );
}
}
@@ -848,9 +852,9 @@
# define LBOT 0
#endif
-static void ALWAYS_INLINE x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y, int b_mbaff )
+static ALWAYS_INLINE void macroblock_cache_load( x264_t *h, int mb_x, int mb_y, int b_mbaff )
{
- x264_macroblock_cache_load_neighbours( h, mb_x, mb_y, b_mbaff );
+ macroblock_cache_load_neighbours( h, mb_x, mb_y, b_mbaff );
int *left = h->mb.i_mb_left_xy;
int top = h->mb.i_mb_top_xy;
@@ -891,7 +895,8 @@
* once every 4 MBs, so one extra prefetch is worthwhile */
x264_prefetch( &h->mb.mv[l][top_4x4+4] );
x264_prefetch( &h->mb.ref[l][top_8x8-1] );
- x264_prefetch( &h->mb.mvd[l][top] );
+ if( h->param.b_cabac )
+ x264_prefetch( &h->mb.mvd[l][top] );
}
}
else
@@ -996,17 +1001,17 @@
{
x264_copy_column8( h->mb.pic.p_fdec[0]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[0]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+12*FDEC_STRIDE );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 0 );
if( CHROMA444 )
{
x264_copy_column8( h->mb.pic.p_fdec[1]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+12*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+12*FDEC_STRIDE );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 0 );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 0 );
}
- else
+ else if( CHROMA_FORMAT )
{
x264_copy_column8( h->mb.pic.p_fdec[1]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+ 7+ 4*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+ 7+ 4*FDEC_STRIDE );
@@ -1015,19 +1020,19 @@
x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+ 7+12*FDEC_STRIDE );
x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+ 7+12*FDEC_STRIDE );
}
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 0 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 0 );
}
}
else
{
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 1 );
if( CHROMA444 )
{
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 1 );
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 1 );
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 1 );
}
- else
- x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 1 );
+ else if( CHROMA_FORMAT )
+ macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 1 );
}
if( h->fdec->integral )
@@ -1348,15 +1353,15 @@
void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y )
{
- x264_macroblock_cache_load( h, mb_x, mb_y, 0 );
+ macroblock_cache_load( h, mb_x, mb_y, 0 );
}
void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y )
{
- x264_macroblock_cache_load( h, mb_x, mb_y, 1 );
+ macroblock_cache_load( h, mb_x, mb_y, 1 );
}
-static void x264_macroblock_deblock_strength_mbaff( x264_t *h, uint8_t (*bs)[8][4] )
+static void macroblock_deblock_strength_mbaff( x264_t *h, uint8_t (*bs)[8][4] )
{
if( (h->mb.i_neighbour & MB_LEFT) && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED )
{
@@ -1613,10 +1618,10 @@
bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B );
if( SLICE_MBAFF )
- x264_macroblock_deblock_strength_mbaff( h, bs );
+ macroblock_deblock_strength_mbaff( h, bs );
}
-static void ALWAYS_INLINE x264_macroblock_store_pic( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
+static ALWAYS_INLINE void macroblock_store_pic( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff )
{
int height = b_chroma ? 16>>CHROMA_V_SHIFT : 16;
int i_stride = h->fdec->i_stride[i];
@@ -1630,24 +1635,24 @@
h->mc.copy[PIXEL_16x16]( &h->fdec->plane[i][i_pix_offset], i_stride2, h->mb.pic.p_fdec[i], FDEC_STRIDE, 16 );
}
-static void ALWAYS_INLINE x264_macroblock_backup_intra( x264_t *h, int mb_x, int mb_y, int b_mbaff )
+static ALWAYS_INLINE void macroblock_backup_intra( x264_t *h, int mb_x, int mb_y, int b_mbaff )
{
/* In MBAFF we store the last two rows in intra_border_backup[0] and [1].
* For progressive mbs this is the bottom two rows, and for interlaced the
* bottom row of each field. We also store samples needed for the next
* mbpair in intra_border_backup[2]. */
int backup_dst = !b_mbaff ? (mb_y&1) : (mb_y&1) ? 1 : MB_INTERLACED ? 0 : 2;
- memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*sizeof(pixel) );
- memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
+ memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
}
- else
+ else if( CHROMA_FORMAT )
{
int backup_src = (15>>CHROMA_V_SHIFT) * FDEC_STRIDE;
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) );
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*SIZEOF_PIXEL );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*SIZEOF_PIXEL );
}
if( b_mbaff )
{
@@ -1655,18 +1660,18 @@
{
int backup_src = (MB_INTERLACED ? 7 : 14) * FDEC_STRIDE;
backup_dst = MB_INTERLACED ? 2 : 0;
- memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*sizeof(pixel) );
- memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*SIZEOF_PIXEL );
+ memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*SIZEOF_PIXEL );
}
- else
+ else if( CHROMA_FORMAT )
{
if( CHROMA_FORMAT == CHROMA_420 )
backup_src = (MB_INTERLACED ? 3 : 6) * FDEC_STRIDE;
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) );
- memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*SIZEOF_PIXEL );
+ memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*SIZEOF_PIXEL );
}
}
}
@@ -1688,27 +1693,27 @@
if( SLICE_MBAFF )
{
- x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 1 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 1 );
+ macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 1 );
if( CHROMA444 )
{
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 1 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 1 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 1 );
}
- else
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 1 );
+ else if( CHROMA_FORMAT )
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 1 );
}
else
{
- x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 0 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 0 );
+ macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 0 );
if( CHROMA444 )
{
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 0 );
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 0 );
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 0 );
}
- else
- x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 0 );
+ else if( CHROMA_FORMAT )
+ macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 0 );
}
x264_prefetch_fenc( h, h->fdec, h->mb.i_mb_x, h->mb.i_mb_y );
@@ -1776,9 +1781,7 @@
if( h->sh.i_type != SLICE_TYPE_I )
{
int16_t (*mv0)[2] = &h->mb.mv[0][i_mb_4x4];
- int16_t (*mv1)[2] = &h->mb.mv[1][i_mb_4x4];
int8_t *ref0 = &h->mb.ref[0][i_mb_8x8];
- int8_t *ref1 = &h->mb.ref[1][i_mb_8x8];
if( !IS_INTRA( i_mb_type ) )
{
ref0[0+0*s8x8] = h->mb.cache.ref[0][x264_scan8[0]];
@@ -1791,6 +1794,8 @@
CP128( &mv0[3*s4x4], h->mb.cache.mv[0][x264_scan8[0]+8*3] );
if( h->sh.i_type == SLICE_TYPE_B )
{
+ int16_t (*mv1)[2] = &h->mb.mv[1][i_mb_4x4];
+ int8_t *ref1 = &h->mb.ref[1][i_mb_8x8];
ref1[0+0*s8x8] = h->mb.cache.ref[1][x264_scan8[0]];
ref1[1+0*s8x8] = h->mb.cache.ref[1][x264_scan8[4]];
ref1[0+1*s8x8] = h->mb.cache.ref[1][x264_scan8[8]];
@@ -1811,6 +1816,8 @@
M128( &mv0[3*s4x4] ) = M128_ZERO;
if( h->sh.i_type == SLICE_TYPE_B )
{
+ int16_t (*mv1)[2] = &h->mb.mv[1][i_mb_4x4];
+ int8_t *ref1 = &h->mb.ref[1][i_mb_8x8];
M16( &ref1[0*s8x8] ) = (uint8_t)(-1) * 0x0101;
M16( &ref1[1*s8x8] ) = (uint8_t)(-1) * 0x0101;
M128( &mv1[0*s4x4] ) = M128_ZERO;
@@ -1824,7 +1831,6 @@
if( h->param.b_cabac )
{
uint8_t (*mvd0)[2] = h->mb.mvd[0][i_mb_xy];
- uint8_t (*mvd1)[2] = h->mb.mvd[1][i_mb_xy];
if( IS_INTRA(i_mb_type) && i_mb_type != I_PCM )
h->mb.chroma_pred_mode[i_mb_xy] = x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode];
else
@@ -1838,6 +1844,7 @@
CP16( mvd0[6], h->mb.cache.mvd[0][x264_scan8[13]] );
if( h->sh.i_type == SLICE_TYPE_B )
{
+ uint8_t (*mvd1)[2] = h->mb.mvd[1][i_mb_xy];
CP64( mvd1[0], h->mb.cache.mvd[1][x264_scan8[10]] );
CP16( mvd1[4], h->mb.cache.mvd[1][x264_scan8[5 ]] );
CP16( mvd1[5], h->mb.cache.mvd[1][x264_scan8[7 ]] );
@@ -1848,7 +1855,10 @@
{
M128( mvd0[0] ) = M128_ZERO;
if( h->sh.i_type == SLICE_TYPE_B )
+ {
+ uint8_t (*mvd1)[2] = h->mb.mvd[1][i_mb_xy];
M128( mvd1[0] ) = M128_ZERO;
+ }
}
if( h->sh.i_type == SLICE_TYPE_B )
diff -ur x264-go/x264c/external/x264/common/macroblock.h x264-go.new/x264c/external/x264/common/macroblock.h
--- x264-go/x264c/external/x264/common/macroblock.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/macroblock.h 2020-06-06 15:20:58.687039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* macroblock.h: macroblock common functions
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -299,38 +299,54 @@
};
/* Per-frame allocation: is allocated per-thread only in frame-threads mode. */
+#define x264_macroblock_cache_allocate x264_template(macroblock_cache_allocate)
int x264_macroblock_cache_allocate( x264_t *h );
+#define x264_macroblock_cache_free x264_template(macroblock_cache_free)
void x264_macroblock_cache_free( x264_t *h );
/* Per-thread allocation: is allocated per-thread even in sliced-threads mode. */
+#define x264_macroblock_thread_allocate x264_template(macroblock_thread_allocate)
int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead );
+#define x264_macroblock_thread_free x264_template(macroblock_thread_free)
void x264_macroblock_thread_free( x264_t *h, int b_lookahead );
+#define x264_macroblock_slice_init x264_template(macroblock_slice_init)
void x264_macroblock_slice_init( x264_t *h );
+#define x264_macroblock_thread_init x264_template(macroblock_thread_init)
void x264_macroblock_thread_init( x264_t *h );
+#define x264_macroblock_cache_load_interlaced x264_template(macroblock_cache_load_interlaced)
void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y );
+#define x264_macroblock_cache_load_progressive x264_template(macroblock_cache_load_progressive)
void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y );
+#define x264_macroblock_deblock_strength x264_template(macroblock_deblock_strength)
void x264_macroblock_deblock_strength( x264_t *h );
+#define x264_macroblock_cache_save x264_template(macroblock_cache_save)
void x264_macroblock_cache_save( x264_t *h );
+#define x264_macroblock_bipred_init x264_template(macroblock_bipred_init)
void x264_macroblock_bipred_init( x264_t *h );
+#define x264_prefetch_fenc x264_template(prefetch_fenc)
void x264_prefetch_fenc( x264_t *h, x264_frame_t *fenc, int i_mb_x, int i_mb_y );
+#define x264_copy_column8 x264_template(copy_column8)
void x264_copy_column8( pixel *dst, pixel *src );
/* x264_mb_predict_mv_16x16:
* set mvp with predicted mv for D_16x16 block
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_16x16 x264_template(mb_predict_mv_16x16)
void x264_mb_predict_mv_16x16( x264_t *h, int i_list, int i_ref, int16_t mvp[2] );
/* x264_mb_predict_mv_pskip:
* set mvp with predicted mv for P_SKIP
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_pskip x264_template(mb_predict_mv_pskip)
void x264_mb_predict_mv_pskip( x264_t *h, int16_t mv[2] );
/* x264_mb_predict_mv:
* set mvp with predicted mv for all blocks except SKIP and DIRECT
* h->mb. need valid ref/partition/sub of current block to be valid
* and valid mv/ref from other blocks. */
+#define x264_mb_predict_mv x264_template(mb_predict_mv)
void x264_mb_predict_mv( x264_t *h, int i_list, int idx, int i_width, int16_t mvp[2] );
/* x264_mb_predict_mv_direct16x16:
* set h->mb.cache.mv and h->mb.cache.ref for B_SKIP or B_DIRECT
@@ -338,14 +354,18 @@
* return 1 on success, 0 on failure.
* if b_changed != NULL, set it to whether refs or mvs differ from
* before this functioncall. */
+#define x264_mb_predict_mv_direct16x16 x264_template(mb_predict_mv_direct16x16)
int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed );
/* x264_mb_predict_mv_ref16x16:
* set mvc with D_16x16 prediction.
* uses all neighbors, even those that didn't end up using this ref.
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_ref16x16 x264_template(mb_predict_mv_ref16x16)
void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[8][2], int *i_mvc );
+#define x264_mb_mc x264_template(mb_mc)
void x264_mb_mc( x264_t *h );
+#define x264_mb_mc_8x8 x264_template(mb_mc_8x8)
void x264_mb_mc_8x8( x264_t *h, int i8 );
static ALWAYS_INLINE uint32_t pack16to32( uint32_t a, uint32_t b )
@@ -441,4 +461,3 @@
}
#endif
-
diff -ur x264-go/x264c/external/x264/common/mc.c x264-go.new/x264c/external/x264/common/mc.c
--- x264-go/x264c/external/x264/common/mc.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/mc.c 2020-06-06 15:20:58.688039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc.c: motion compensation
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -29,16 +29,16 @@
#if HAVE_MMX
#include "x86/mc.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
#include "ppc/mc.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
#include "arm/mc.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
#include "aarch64/mc.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
#include "mips/mc.h"
#endif
@@ -107,7 +107,7 @@
PIXEL_AVG_C( pixel_avg_2x4, 2, 4 )
PIXEL_AVG_C( pixel_avg_2x2, 2, 2 )
-static void x264_weight_cache( x264_t *h, x264_weight_t *w )
+static void weight_cache( x264_t *h, x264_weight_t *w )
{
w->weightfn = h->mc.weight;
}
@@ -134,7 +134,7 @@
}
#define MC_WEIGHT_C( name, width ) \
- static void name( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, const x264_weight_t *weight, int height ) \
+static void name( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, const x264_weight_t *weight, int height ) \
{ \
mc_weight( dst, i_dst_stride, src, i_src_stride, weight, width, height );\
}
@@ -146,7 +146,7 @@
MC_WEIGHT_C( mc_weight_w4, 4 )
MC_WEIGHT_C( mc_weight_w2, 2 )
-static weight_fn_t x264_mc_weight_wtab[6] =
+static weight_fn_t mc_weight_wtab[6] =
{
mc_weight_w2,
mc_weight_w4,
@@ -155,12 +155,12 @@
mc_weight_w16,
mc_weight_w20,
};
-const x264_weight_t x264_weight_none[3] = { {{0}} };
+
static void mc_copy( pixel *src, intptr_t i_src_stride, pixel *dst, intptr_t i_dst_stride, int i_width, int i_height )
{
for( int y = 0; y < i_height; y++ )
{
- memcpy( dst, src, i_width * sizeof(pixel) );
+ memcpy( dst, src, i_width * SIZEOF_PIXEL );
src += i_src_stride;
dst += i_dst_stride;
@@ -192,9 +192,6 @@
}
}
-const uint8_t x264_hpel_ref0[16] = {0,1,1,1,0,1,1,1,2,3,3,3,0,1,1,1};
-const uint8_t x264_hpel_ref1[16] = {0,0,1,0,2,2,3,2,2,2,3,2,2,2,3,2};
-
static void mc_luma( pixel *dst, intptr_t i_dst_stride,
pixel *src[4], intptr_t i_src_stride,
int mvx, int mvy,
@@ -296,7 +293,7 @@
{
while( h-- )
{
- memcpy( dst, src, w * sizeof(pixel) );
+ memcpy( dst, src, w * SIZEOF_PIXEL );
dst += i_dst;
src += i_src;
}
@@ -336,10 +333,10 @@
}
}
-static void x264_plane_copy_deinterleave_rgb_c( pixel *dsta, intptr_t i_dsta,
- pixel *dstb, intptr_t i_dstb,
- pixel *dstc, intptr_t i_dstc,
- pixel *src, intptr_t i_src, int pw, int w, int h )
+static void plane_copy_deinterleave_rgb_c( pixel *dsta, intptr_t i_dsta,
+ pixel *dstb, intptr_t i_dstb,
+ pixel *dstc, intptr_t i_dstc,
+ pixel *src, intptr_t i_src, int pw, int w, int h )
{
for( int y=0; y<h; y++, dsta+=i_dsta, dstb+=i_dstb, dstc+=i_dstc, src+=i_src )
{
@@ -361,9 +358,9 @@
#define v210_endian_fix32(x) (x)
#endif
-static void x264_plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
- pixel *dstc, intptr_t i_dstc,
- uint32_t *src, intptr_t i_src, int w, int h )
+static void plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
+ pixel *dstc, intptr_t i_dstc,
+ uint32_t *src, intptr_t i_src, int w, int h )
{
for( int l = 0; l < h; l++ )
{
@@ -465,7 +462,7 @@
// duplicate last row and column so that their interpolation doesn't have to be special-cased
for( int y = 0; y < i_height; y++ )
src[i_width+y*i_stride] = src[i_width-1+y*i_stride];
- memcpy( src+i_stride*i_height, src+i_stride*(i_height-1), (i_width+1) * sizeof(pixel) );
+ memcpy( src+i_stride*i_height, src+i_stride*(i_height-1), (i_width+1) * SIZEOF_PIXEL );
h->mc.frame_init_lowres_core( src, frame->lowres[0], frame->lowres[1], frame->lowres[2], frame->lowres[3],
i_stride, frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres );
x264_frame_expand_border_lowres( frame );
@@ -532,7 +529,7 @@
unsigned width = h->mb.i_mb_width;
unsigned height = h->mb.i_mb_height;
- for( unsigned i = 0; i < len; i++ )
+ for( int i = 0; i < len; i++ )
{
int lists_used = lowres_costs[i]>>LOWRES_COST_SHIFT;
@@ -610,7 +607,7 @@
dst[i] = (int16_t)endian_fix16( src[i] ) * (1.0f/256.0f);
}
-void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent )
+void x264_mc_init( uint32_t cpu, x264_mc_functions_t *pf, int cpu_independent )
{
pf->mc_luma = mc_luma;
pf->get_ref = get_ref;
@@ -630,10 +627,10 @@
pf->avg[PIXEL_2x4] = pixel_avg_2x4;
pf->avg[PIXEL_2x2] = pixel_avg_2x2;
- pf->weight = x264_mc_weight_wtab;
- pf->offsetadd = x264_mc_weight_wtab;
- pf->offsetsub = x264_mc_weight_wtab;
- pf->weight_cache = x264_weight_cache;
+ pf->weight = mc_weight_wtab;
+ pf->offsetadd = mc_weight_wtab;
+ pf->offsetsub = mc_weight_wtab;
+ pf->weight_cache = weight_cache;
pf->copy_16x16_unaligned = mc_copy_w16;
pf->copy[PIXEL_16x16] = mc_copy_w16;
@@ -647,13 +644,15 @@
pf->plane_copy = x264_plane_copy_c;
pf->plane_copy_swap = x264_plane_copy_swap_c;
pf->plane_copy_interleave = x264_plane_copy_interleave_c;
+
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_c;
pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_c;
- pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_c;
- pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_c;
+ pf->plane_copy_deinterleave_rgb = plane_copy_deinterleave_rgb_c;
+ pf->plane_copy_deinterleave_v210 = plane_copy_deinterleave_v210_c;
pf->hpel_filter = hpel_filter;
+ pf->prefetch_fenc_400 = prefetch_fenc_null;
pf->prefetch_fenc_420 = prefetch_fenc_null;
pf->prefetch_fenc_422 = prefetch_fenc_null;
pf->prefetch_ref = prefetch_ref_null;
@@ -681,7 +680,7 @@
#if HAVE_ARMV6
x264_mc_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_mc_init_aarch64( cpu, pf );
#endif
#if HAVE_MSA
diff -ur x264-go/x264c/external/x264/common/mc.h x264-go.new/x264c/external/x264/common/mc.h
--- x264-go/x264c/external/x264/common/mc.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/mc.h 2020-06-06 15:20:58.688039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc.h: motion compensation
*****************************************************************************
- * Copyright (C) 2004-2017 x264 project
+ * Copyright (C) 2004-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
@@ -34,14 +34,15 @@
MC_CLIP_ADD((s)[1], (x)[1]);\
} while( 0 )
+#define x264_mbtree_propagate_list_internal_neon x264_template(mbtree_propagate_list_internal_neon)
#define PROPAGATE_LIST(cpu)\
void x264_mbtree_propagate_list_internal_##cpu( int16_t (*mvs)[2], int16_t *propagate_amount,\
uint16_t *lowres_costs, int16_t *output,\
int bipred_weight, int mb_y, int len );\
\
-static void x264_mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],\
- int16_t *propagate_amount, uint16_t *lowres_costs,\
- int bipred_weight, int mb_y, int len, int list )\
+static void mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],\
+ int16_t *propagate_amount, uint16_t *lowres_costs,\
+ int bipred_weight, int mb_y, int len, int list )\
{\
int16_t *current = h->scratch_buffer2;\
\
@@ -52,7 +53,7 @@
unsigned width = h->mb.i_mb_width;\
unsigned height = h->mb.i_mb_height;\
\
- for( unsigned i = 0; i < len; current += 32 )\
+ for( int i = 0; i < len; current += 32 )\
{\
int end = X264_MIN( i+8, len );\
for( ; i < end; i++, current += 2 )\
@@ -100,12 +101,13 @@
}\
}
+#define x264_plane_copy_c x264_template(plane_copy_c)
void x264_plane_copy_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY(align, cpu)\
-static void x264_plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
{\
- int c_w = (align) / sizeof(pixel) - 1;\
+ int c_w = (align) / SIZEOF_PIXEL - 1;\
if( w < 256 ) /* tiny resolutions don't want non-temporal hints. dunno the exact threshold. */\
x264_plane_copy_c( dst, i_dst, src, i_src, w, h );\
else if( !(w&c_w) )\
@@ -124,16 +126,17 @@
x264_plane_copy_core_##cpu( dst+i_dst, i_dst, src+i_src, i_src, (w+c_w)&~c_w, h );\
}\
/* use plain memcpy on the last line (in memory order) to avoid overreading src. */\
- memcpy( dst, src, w*sizeof(pixel) );\
+ memcpy( dst, src, w*SIZEOF_PIXEL );\
}\
}
+#define x264_plane_copy_swap_c x264_template(plane_copy_swap_c)
void x264_plane_copy_swap_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY_SWAP(align, cpu)\
-static void x264_plane_copy_swap_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_swap_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\
{\
- int c_w = (align>>1) / sizeof(pixel) - 1;\
+ int c_w = (align>>1) / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_swap_core_##cpu( dst, i_dst, src, i_src, w, h );\
else if( w > c_w )\
@@ -160,16 +163,17 @@
x264_plane_copy_swap_c( dst, i_dst, src, i_src, w, h );\
}
+#define x264_plane_copy_deinterleave_c x264_template(plane_copy_deinterleave_c)
void x264_plane_copy_deinterleave_c( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
/* We can utilize existing plane_copy_deinterleave() functions for YUYV/UYUV
* input with the additional constraint that we cannot overread src. */
#define PLANE_COPY_YUYV(align, cpu)\
-static void x264_plane_copy_deinterleave_yuyv_##cpu( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,\
- pixel *src, intptr_t i_src, int w, int h )\
+static void plane_copy_deinterleave_yuyv_##cpu( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,\
+ pixel *src, intptr_t i_src, int w, int h )\
{\
- int c_w = (align>>1) / sizeof(pixel) - 1;\
+ int c_w = (align>>1) / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_deinterleave_##cpu( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\
else if( w > c_w )\
@@ -193,16 +197,17 @@
x264_plane_copy_deinterleave_c( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\
}
+#define x264_plane_copy_interleave_c x264_template(plane_copy_interleave_c)
void x264_plane_copy_interleave_c( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
#define PLANE_INTERLEAVE(cpu) \
-static void x264_plane_copy_interleave_##cpu( pixel *dst, intptr_t i_dst,\
- pixel *srcu, intptr_t i_srcu,\
- pixel *srcv, intptr_t i_srcv, int w, int h )\
+static void plane_copy_interleave_##cpu( pixel *dst, intptr_t i_dst,\
+ pixel *srcu, intptr_t i_srcu,\
+ pixel *srcv, intptr_t i_srcv, int w, int h )\
{\
- int c_w = 16 / sizeof(pixel) - 1;\
+ int c_w = 16 / SIZEOF_PIXEL - 1;\
if( !(w&c_w) )\
x264_plane_copy_interleave_core_##cpu( dst, i_dst, srcu, i_srcu, srcv, i_srcv, w, h );\
else if( w > c_w && (i_srcu ^ i_srcv) >= 0 ) /* only works correctly for strides with identical signs */\
@@ -239,9 +244,7 @@
weight_fn_t *weightfn;
} ALIGNED_16( x264_weight_t );
-extern const x264_weight_t x264_weight_none[3];
-extern const uint8_t x264_hpel_ref0[16];
-extern const uint8_t x264_hpel_ref1[16];
+#define x264_weight_none ((const x264_weight_t*)x264_zero)
#define SET_WEIGHT( w, b, s, d, o )\
{\
@@ -305,6 +308,7 @@
/* prefetch the next few macroblocks of fenc or fdec */
void (*prefetch_fenc) ( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x );
+ void (*prefetch_fenc_400)( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x );
void (*prefetch_fenc_420)( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x );
void (*prefetch_fenc_422)( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x );
/* prefetch the next few macroblocks of a hpel reference frame */
@@ -335,6 +339,7 @@
void (*mbtree_fix8_unpack)( float *dst, uint16_t *src, int count );
} x264_mc_functions_t;
-void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent );
+#define x264_mc_init x264_template(mc_init)
+void x264_mc_init( uint32_t cpu, x264_mc_functions_t *pf, int cpu_independent );
#endif
Only in x264-go.new/x264c/external/x264/common: mips
diff -ur x264-go/x264c/external/x264/common/mvpred.c x264-go.new/x264c/external/x264/common/mvpred.c
--- x264-go/x264c/external/x264/common/mvpred.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/mvpred.c 2020-06-06 15:20:58.689039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mvpred.c: motion vector prediction
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -180,7 +180,7 @@
x264_mb_predict_mv_16x16( h, 0, 0, mv );
}
-static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
+static int mb_predict_mv_direct16x16_temporal( x264_t *h )
{
int mb_x = h->mb.i_mb_x;
int mb_y = h->mb.i_mb_y;
@@ -286,7 +286,7 @@
return 1;
}
-static ALWAYS_INLINE int x264_mb_predict_mv_direct16x16_spatial( x264_t *h, int b_interlaced )
+static ALWAYS_INLINE int mb_predict_mv_direct16x16_spatial( x264_t *h, int b_interlaced )
{
int8_t ref[2];
ALIGNED_ARRAY_8( int16_t, mv,[2],[2] );
@@ -441,14 +441,14 @@
}
-static int x264_mb_predict_mv_direct16x16_spatial_interlaced( x264_t *h )
+static int mb_predict_mv_direct16x16_spatial_interlaced( x264_t *h )
{
- return x264_mb_predict_mv_direct16x16_spatial( h, 1 );
+ return mb_predict_mv_direct16x16_spatial( h, 1 );
}
-static int x264_mb_predict_mv_direct16x16_spatial_progressive( x264_t *h )
+static int mb_predict_mv_direct16x16_spatial_progressive( x264_t *h )
{
- return x264_mb_predict_mv_direct16x16_spatial( h, 0 );
+ return mb_predict_mv_direct16x16_spatial( h, 0 );
}
int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed )
@@ -459,12 +459,12 @@
else if( h->sh.b_direct_spatial_mv_pred )
{
if( SLICE_MBAFF )
- b_available = x264_mb_predict_mv_direct16x16_spatial_interlaced( h );
+ b_available = mb_predict_mv_direct16x16_spatial_interlaced( h );
else
- b_available = x264_mb_predict_mv_direct16x16_spatial_progressive( h );
+ b_available = mb_predict_mv_direct16x16_spatial_progressive( h );
}
else
- b_available = x264_mb_predict_mv_direct16x16_temporal( h );
+ b_available = mb_predict_mv_direct16x16_temporal( h );
if( b_changed != NULL && b_available )
{
Only in x264-go.new/x264c/external/x264/common: opencl
diff -ur x264-go/x264c/external/x264/common/opencl.c x264-go.new/x264c/external/x264/common/opencl.c
--- x264-go/x264c/external/x264/common/opencl.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/opencl.c 2020-06-06 15:20:58.689039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* opencl.c: OpenCL initialization and kernel compilation
*****************************************************************************
- * Copyright (C) 2012-2017 x264 project
+ * Copyright (C) 2012-2020 x264 project
*
* Authors: Steve Borho <sborho@multicorewareinc.com>
* Anton Mitrofanov <BugMaster@narod.ru>
@@ -115,11 +115,11 @@
/* Requires full include path in case of out-of-tree builds */
#include "common/oclobj.h"
-static int x264_detect_switchable_graphics( void );
+static int detect_switchable_graphics( void );
/* Try to load the cached compiled program binary, verify the device context is
* still valid before reuse */
-static cl_program x264_opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version )
+static cl_program opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version )
{
/* try to load cached program binary */
FILE *fp = x264_fopen( h->param.psz_clbin_file, "rb" );
@@ -131,8 +131,11 @@
uint8_t *binary = NULL;
fseek( fp, 0, SEEK_END );
- size_t size = ftell( fp );
- rewind( fp );
+ int64_t file_size = ftell( fp );
+ fseek( fp, 0, SEEK_SET );
+ if( file_size < 0 || (uint64_t)file_size > SIZE_MAX )
+ goto fail;
+ size_t size = file_size;
CHECKED_MALLOC( binary, size );
if( fread( binary, 1, size, fp ) != size )
@@ -168,7 +171,7 @@
/* Save the compiled program binary to a file for later reuse. Device context
* is also saved in the cache file so we do not reuse stale binaries */
-static void x264_opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version )
+static void opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version )
{
FILE *fp = x264_fopen( h->param.psz_clbin_file, "wb" );
if( !fp )
@@ -216,7 +219,7 @@
* the Makefile. It defines a x264_opencl_source byte array which we will pass
* to clCreateProgramWithSource(). We also attempt to use a cache file for the
* compiled binary, stored in the current working folder. */
-static cl_program x264_opencl_compile( x264_t *h )
+static cl_program opencl_compile( x264_t *h )
{
x264_opencl_function_t *ocl = h->opencl.ocl;
cl_program program = NULL;
@@ -239,7 +242,7 @@
if( vectorize )
{
/* Disable OpenCL on Intel/AMD switchable graphics devices */
- if( x264_detect_switchable_graphics() )
+ if( detect_switchable_graphics() )
{
x264_log( h, X264_LOG_INFO, "OpenCL acceleration disabled, switchable graphics detected\n" );
return NULL;
@@ -257,7 +260,7 @@
x264_log( h, X264_LOG_INFO, "OpenCL acceleration enabled with %s %s %s\n", dev_vendor, dev_name, h->opencl.b_device_AMD_SI ? "(SI)" : "" );
- program = x264_opencl_cache_load( h, dev_name, dev_vendor, driver_version );
+ program = opencl_cache_load( h, dev_name, dev_vendor, driver_version );
if( !program )
{
/* clCreateProgramWithSource() requires a pointer variable, you cannot just use &x264_opencl_source */
@@ -277,7 +280,7 @@
status = ocl->clBuildProgram( program, 1, &h->opencl.device, buildopts, NULL, NULL );
if( status == CL_SUCCESS )
{
- x264_opencl_cache_save( h, program, dev_name, dev_vendor, driver_version );
+ opencl_cache_save( h, program, dev_name, dev_vendor, driver_version );
return program;
}
@@ -322,7 +325,7 @@
return NULL;
}
-static int x264_opencl_lookahead_alloc( x264_t *h )
+static int opencl_lookahead_alloc( x264_t *h )
{
if( !h->param.rc.i_lookahead )
return -1;
@@ -360,11 +363,11 @@
x264_opencl_function_t *ocl = h->opencl.ocl;
cl_int status;
- h->opencl.lookahead_program = x264_opencl_compile( h );
+ h->opencl.lookahead_program = opencl_compile( h );
if( !h->opencl.lookahead_program )
goto fail;
- for( int i = 0; i < ARRAY_SIZE(kernelnames); i++ )
+ for( int i = 0; i < ARRAY_ELEMS(kernelnames); i++ )
{
*kernels[i] = ocl->clCreateKernel( h->opencl.lookahead_program, kernelnames[i], &status );
if( status != CL_SUCCESS )
@@ -394,7 +397,7 @@
return -1;
}
-static void CL_CALLBACK x264_opencl_error_notify( const char *errinfo, const void *private_info, size_t cb, void *user_data )
+static void CL_CALLBACK opencl_error_notify( const char *errinfo, const void *private_info, size_t cb, void *user_data )
{
/* Any error notification can be assumed to be fatal to the OpenCL context.
* We need to stop using it immediately to prevent further damage. */
@@ -470,7 +473,7 @@
if( context )
ocl->clReleaseContext( context );
- context = ocl->clCreateContext( NULL, 1, &h->opencl.device, (void*)x264_opencl_error_notify, (void*)h, &status );
+ context = ocl->clCreateContext( NULL, 1, &h->opencl.device, (void*)opencl_error_notify, (void*)h, &status );
if( status != CL_SUCCESS || !context )
continue;
@@ -540,7 +543,7 @@
if( ret )
x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to find a compatible device\n" );
else
- ret = x264_opencl_lookahead_alloc( h );
+ ret = opencl_lookahead_alloc( h );
fail:
if( context )
@@ -551,7 +554,7 @@
return ret;
}
-static void x264_opencl_lookahead_free( x264_t *h )
+static void opencl_lookahead_free( x264_t *h )
{
x264_opencl_function_t *ocl = h->opencl.ocl;
@@ -600,7 +603,7 @@
if( h->opencl.queue )
ocl->clFinish( h->opencl.queue );
- x264_opencl_lookahead_free( h );
+ opencl_lookahead_free( h );
if( h->opencl.queue )
{
@@ -663,7 +666,7 @@
return x264_malloc( iSize );
}
-static int x264_detect_switchable_graphics( void )
+static int detect_switchable_graphics( void )
{
void *hDLL;
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
diff -ur x264-go/x264c/external/x264/common/opencl.h x264-go.new/x264c/external/x264/common/opencl.h
--- x264-go/x264c/external/x264/common/opencl.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/opencl.h 2020-06-06 15:20:58.689039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* opencl.h: OpenCL structures and defines
*****************************************************************************
- * Copyright (C) 2012-2017 x264 project
+ * Copyright (C) 2012-2020 x264 project
*
* Authors: Steve Borho <sborho@multicorewareinc.com>
* Anton Mitrofanov <BugMaster@narod.ru>
@@ -793,12 +793,17 @@
typedef struct x264_frame x264_frame;
+#define x264_opencl_load_library x264_template(opencl_load_library)
x264_opencl_function_t *x264_opencl_load_library( void );
+#define x264_opencl_close_library x264_template(opencl_close_library)
void x264_opencl_close_library( x264_opencl_function_t *ocl );
+#define x264_opencl_lookahead_init x264_template(opencl_lookahead_init)
int x264_opencl_lookahead_init( x264_t *h );
+#define x264_opencl_lookahead_delete x264_template(opencl_lookahead_delete)
void x264_opencl_lookahead_delete( x264_t *h );
+#define x264_opencl_frame_delete x264_template(opencl_frame_delete)
void x264_opencl_frame_delete( x264_frame *frame );
#endif
diff -ur x264-go/x264c/external/x264/common/osdep.c x264-go.new/x264c/external/x264/common/osdep.c
--- x264-go/x264c/external/x264/common/osdep.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/osdep.c 2020-06-06 15:20:58.690039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* osdep.c: platform-specific code
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -25,12 +25,7 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#include "common.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <io.h>
-#endif
+#include "osdep.h"
#if SYS_WINDOWS
#include <sys/types.h>
@@ -51,6 +46,10 @@
struct timeb tb;
ftime( &tb );
return ((int64_t)tb.time * 1000 + (int64_t)tb.millitm) * 1000;
+#elif HAVE_CLOCK_GETTIME
+ struct timespec ts;
+ clock_gettime( CLOCK_MONOTONIC, &ts );
+ return (int64_t)ts.tv_sec * 1000000 + (int64_t)ts.tv_nsec / 1000;
#else
struct timeval tv_date;
gettimeofday( &tv_date, NULL );
@@ -60,9 +59,9 @@
#if HAVE_WIN32THREAD || PTW32_STATIC_LIB
/* state of the threading library being initialized */
-static volatile LONG x264_threading_is_init = 0;
+static volatile LONG threading_is_init = 0;
-static void x264_threading_destroy( void )
+static void threading_destroy( void )
{
#if PTW32_STATIC_LIB
pthread_win32_thread_detach_np();
@@ -72,11 +71,8 @@
#endif
}
-int x264_threading_init( void )
+static int threading_init( void )
{
- /* if already init, then do nothing */
- if( InterlockedCompareExchange( &x264_threading_is_init, 1, 0 ) )
- return 0;
#if PTW32_STATIC_LIB
/* if static pthread-win32 is already initialized, then do nothing */
if( ptw32_processInitialized )
@@ -88,119 +84,25 @@
return -1;
#endif
/* register cleanup to run at process termination */
- atexit( x264_threading_destroy );
-
+ atexit( threading_destroy );
return 0;
}
-#endif
-
-#ifdef _WIN32
-/* Functions for dealing with Unicode on Windows. */
-FILE *x264_fopen( const char *filename, const char *mode )
-{
- wchar_t filename_utf16[MAX_PATH];
- wchar_t mode_utf16[16];
- if( utf8_to_utf16( filename, filename_utf16 ) && utf8_to_utf16( mode, mode_utf16 ) )
- return _wfopen( filename_utf16, mode_utf16 );
- return NULL;
-}
-int x264_rename( const char *oldname, const char *newname )
+int x264_threading_init( void )
{
- wchar_t oldname_utf16[MAX_PATH];
- wchar_t newname_utf16[MAX_PATH];
- if( utf8_to_utf16( oldname, oldname_utf16 ) && utf8_to_utf16( newname, newname_utf16 ) )
+ LONG state;
+ while( (state = InterlockedCompareExchange( &threading_is_init, -1, 0 )) != 0 )
{
- /* POSIX says that rename() removes the destination, but Win32 doesn't. */
- _wunlink( newname_utf16 );
- return _wrename( oldname_utf16, newname_utf16 );
+ /* if already init, then do nothing */
+ if( state > 0 )
+ return 0;
}
- return -1;
-}
-
-int x264_stat( const char *path, x264_struct_stat *buf )
-{
- wchar_t path_utf16[MAX_PATH];
- if( utf8_to_utf16( path, path_utf16 ) )
- return _wstati64( path_utf16, buf );
- return -1;
-}
-
-#if !HAVE_WINRT
-int x264_vfprintf( FILE *stream, const char *format, va_list arg )
-{
- HANDLE console = NULL;
- DWORD mode;
-
- if( stream == stdout )
- console = GetStdHandle( STD_OUTPUT_HANDLE );
- else if( stream == stderr )
- console = GetStdHandle( STD_ERROR_HANDLE );
-
- /* Only attempt to convert to UTF-16 when writing to a non-redirected console screen buffer. */
- if( GetConsoleMode( console, &mode ) )
+ if( threading_init() < 0 )
{
- char buf[4096];
- wchar_t buf_utf16[4096];
- va_list arg2;
-
- va_copy( arg2, arg );
- int length = vsnprintf( buf, sizeof(buf), format, arg2 );
- va_end( arg2 );
-
- if( length > 0 && length < sizeof(buf) )
- {
- /* WriteConsoleW is the most reliable way to output Unicode to a console. */
- int length_utf16 = MultiByteToWideChar( CP_UTF8, 0, buf, length, buf_utf16, sizeof(buf_utf16)/sizeof(wchar_t) );
- DWORD written;
- WriteConsoleW( console, buf_utf16, length_utf16, &written, NULL );
- return length;
- }
+ InterlockedExchange( &threading_is_init, 0 );
+ return -1;
}
- return vfprintf( stream, format, arg );
-}
-
-int x264_is_pipe( const char *path )
-{
- wchar_t path_utf16[MAX_PATH];
- if( utf8_to_utf16( path, path_utf16 ) )
- return WaitNamedPipeW( path_utf16, 0 );
+ InterlockedExchange( &threading_is_init, 1 );
return 0;
}
#endif
-
-#if defined(_MSC_VER) && _MSC_VER < 1900
-/* MSVC pre-VS2015 has broken snprintf/vsnprintf implementations which are incompatible with C99. */
-int x264_snprintf( char *s, size_t n, const char *fmt, ... )
-{
- va_list arg;
- va_start( arg, fmt );
- int length = x264_vsnprintf( s, n, fmt, arg );
- va_end( arg );
- return length;
-}
-
-int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg )
-{
- int length = -1;
-
- if( n )
- {
- va_list arg2;
- va_copy( arg2, arg );
- length = _vsnprintf( s, n, fmt, arg2 );
- va_end( arg2 );
-
- /* _(v)snprintf adds a null-terminator only if the length is less than the buffer size. */
- if( length < 0 || length >= n )
- s[n-1] = '\0';
- }
-
- /* _(v)snprintf returns a negative number if the length is greater than the buffer size. */
- if( length < 0 )
- return _vscprintf( fmt, arg );
-
- return length;
-}
-#endif
-#endif
diff -ur x264-go/x264c/external/x264/common/osdep.h x264-go.new/x264c/external/x264/common/osdep.h
--- x264-go/x264c/external/x264/common/osdep.h 2018-02-15 14:40:34.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/osdep.h 2020-06-06 15:27:52.459050342 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* osdep.h: platform-specific code
*****************************************************************************
- * Copyright (C) 2007-2017 x264 project
+ * Copyright (C) 2007-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -43,6 +43,13 @@
#include <math.h>
#endif
+#ifdef _WIN32
+#include <windows.h>
+#include <io.h>
+#endif
+
+#include "x264.h"
+
#if !HAVE_LOG2F
#define log2f(x) (logf(x)/0.693147180559945f)
#define log2(x) (log(x)/0.693147180559945)
@@ -54,12 +61,6 @@
#define strncasecmp _strnicmp
#define strtok_r strtok_s
#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
-#if _MSC_VER < 1900
-int x264_snprintf( char *s, size_t n, const char *fmt, ... );
-int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg );
-#define snprintf x264_snprintf
-#define vsnprintf x264_vsnprintf
-#endif
#else
#include <strings.h>
#endif
@@ -72,18 +73,85 @@
#define isfinite finite
#endif
-#ifdef _WIN32
-#ifndef strtok_r
+#if !HAVE_STRTOK_R && !defined(strtok_r)
#define strtok_r(str,delim,save) strtok(str,delim)
#endif
+#if defined(_MSC_VER) && _MSC_VER < 1900
+/* MSVC pre-VS2015 has broken snprintf/vsnprintf implementations which are incompatible with C99. */
+static inline int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg )
+{
+ int length = -1;
+
+ if( n )
+ {
+ va_list arg2;
+ va_copy( arg2, arg );
+ length = _vsnprintf( s, n, fmt, arg2 );
+ va_end( arg2 );
+
+ /* _(v)snprintf adds a null-terminator only if the length is less than the buffer size. */
+ if( length < 0 || length >= n )
+ s[n-1] = '\0';
+ }
+
+ /* _(v)snprintf returns a negative number if the length is greater than the buffer size. */
+ if( length < 0 )
+ return _vscprintf( fmt, arg );
+
+ return length;
+}
+
+static inline int x264_snprintf( char *s, size_t n, const char *fmt, ... )
+{
+ va_list arg;
+ va_start( arg, fmt );
+ int length = x264_vsnprintf( s, n, fmt, arg );
+ va_end( arg );
+ return length;
+}
+
+#define snprintf x264_snprintf
+#define vsnprintf x264_vsnprintf
+#endif
+
+#ifdef _WIN32
#define utf8_to_utf16( utf8, utf16 )\
MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, utf16, sizeof(utf16)/sizeof(wchar_t) )
-FILE *x264_fopen( const char *filename, const char *mode );
-int x264_rename( const char *oldname, const char *newname );
+
+/* Functions for dealing with Unicode on Windows. */
+static inline FILE *x264_fopen( const char *filename, const char *mode )
+{
+ wchar_t filename_utf16[MAX_PATH];
+ wchar_t mode_utf16[16];
+ if( utf8_to_utf16( filename, filename_utf16 ) && utf8_to_utf16( mode, mode_utf16 ) )
+ return _wfopen( filename_utf16, mode_utf16 );
+ return NULL;
+}
+
+static inline int x264_rename( const char *oldname, const char *newname )
+{
+ wchar_t oldname_utf16[MAX_PATH];
+ wchar_t newname_utf16[MAX_PATH];
+ if( utf8_to_utf16( oldname, oldname_utf16 ) && utf8_to_utf16( newname, newname_utf16 ) )
+ {
+ /* POSIX says that rename() removes the destination, but Win32 doesn't. */
+ _wunlink( newname_utf16 );
+ return _wrename( oldname_utf16, newname_utf16 );
+ }
+ return -1;
+}
+
#define x264_struct_stat struct _stati64
#define x264_fstat _fstati64
-int x264_stat( const char *path, x264_struct_stat *buf );
+
+static inline int x264_stat( const char *path, x264_struct_stat *buf )
+{
+ wchar_t path_utf16[MAX_PATH];
+ if( utf8_to_utf16( path, path_utf16 ) )
+ return _wstati64( path_utf16, buf );
+ return -1;
+}
#else
#define x264_fopen fopen
#define x264_rename rename
@@ -93,16 +161,57 @@
#endif
/* mdate: return the current date in microsecond */
-int64_t x264_mdate( void );
+X264_API int64_t x264_mdate( void );
#if defined(_WIN32) && !HAVE_WINRT
-int x264_vfprintf( FILE *stream, const char *format, va_list arg );
-int x264_is_pipe( const char *path );
+static inline int x264_vfprintf( FILE *stream, const char *format, va_list arg )
+{
+ HANDLE console = NULL;
+ DWORD mode;
+
+ if( stream == stdout )
+ console = GetStdHandle( STD_OUTPUT_HANDLE );
+ else if( stream == stderr )
+ console = GetStdHandle( STD_ERROR_HANDLE );
+
+ /* Only attempt to convert to UTF-16 when writing to a non-redirected console screen buffer. */
+ if( GetConsoleMode( console, &mode ) )
+ {
+ char buf[4096];
+ wchar_t buf_utf16[4096];
+ va_list arg2;
+
+ va_copy( arg2, arg );
+ int length = vsnprintf( buf, sizeof(buf), format, arg2 );
+ va_end( arg2 );
+
+ if( length > 0 && (unsigned)length < sizeof(buf) )
+ {
+ /* WriteConsoleW is the most reliable way to output Unicode to a console. */
+ int length_utf16 = MultiByteToWideChar( CP_UTF8, 0, buf, length, buf_utf16, sizeof(buf_utf16)/sizeof(wchar_t) );
+ DWORD written;
+ WriteConsoleW( console, buf_utf16, length_utf16, &written, NULL );
+ return length;
+ }
+ }
+ return vfprintf( stream, format, arg );
+}
+
+static inline int x264_is_pipe( const char *path )
+{
+ wchar_t path_utf16[MAX_PATH];
+ if( utf8_to_utf16( path, path_utf16 ) )
+ return WaitNamedPipeW( path_utf16, 0 );
+ return 0;
+}
#else
#define x264_vfprintf vfprintf
#define x264_is_pipe(x) 0
#endif
+#define x264_glue3_expand(x,y,z) x##_##y##_##z
+#define x264_glue3(x,y,z) x264_glue3_expand(x,y,z)
+
#ifdef _MSC_VER
#define DECLARE_ALIGNED( var, n ) __declspec(align(n)) var
#else
@@ -160,6 +269,12 @@
#define ALIGNED_ARRAY_64 ALIGNED_ARRAY_16
#endif
+#if STACK_ALIGNMENT > 16 || (ARCH_X86 && STACK_ALIGNMENT > 4)
+#define REALIGN_STACK __attribute__((force_align_arg_pointer))
+#else
+#define REALIGN_STACK
+#endif
+
#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
#define UNUSED __attribute__((unused))
#define ALWAYS_INLINE __attribute__((always_inline)) inline
@@ -244,7 +359,7 @@
#endif
#if HAVE_WIN32THREAD || PTW32_STATIC_LIB
-int x264_threading_init( void );
+X264_API int x264_threading_init( void );
#else
#define x264_threading_init() 0
#endif
@@ -308,7 +423,7 @@
return endian_fix32(x>>32) + ((uint64_t)endian_fix32(x)<<32);
}
#endif
-static ALWAYS_INLINE intptr_t endian_fix( intptr_t x )
+static ALWAYS_INLINE uintptr_t endian_fix( uintptr_t x )
{
return WORD_SIZE == 8 ? endian_fix64(x) : endian_fix32(x);
}
@@ -319,7 +434,7 @@
#endif
/* For values with 4 bits or less. */
-static int ALWAYS_INLINE x264_ctz_4bit( uint32_t x )
+static ALWAYS_INLINE int x264_ctz_4bit( uint32_t x )
{
static uint8_t lut[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
return lut[x];
@@ -329,7 +444,7 @@
#define x264_clz(x) __builtin_clz(x)
#define x264_ctz(x) __builtin_ctz(x)
#else
-static int ALWAYS_INLINE x264_clz( uint32_t x )
+static ALWAYS_INLINE int x264_clz( uint32_t x )
{
static uint8_t lut[16] = {4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
int y, z = (((x >> 16) - 1) >> 27) & 16;
@@ -341,7 +456,7 @@
return z + lut[x];
}
-static int ALWAYS_INLINE x264_ctz( uint32_t x )
+static ALWAYS_INLINE int x264_ctz( uint32_t x )
{
static uint8_t lut[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
int y, z = (((x & 0xffff) - 1) >> 27) & 16;
diff -ur x264-go/x264c/external/x264/common/pixel.c x264-go.new/x264c/external/x264/common/pixel.c
--- x264-go/x264c/external/x264/common/pixel.c 2020-06-05 14:33:54.745687917 +0200
+++ x264-go.new/x264c/external/x264/common/pixel.c 2020-06-06 15:20:58.690039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* pixel.c: pixel metrics
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -31,18 +31,18 @@
# include "x86/pixel.h"
# include "x86/predict.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/pixel.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/pixel.h"
# include "arm/predict.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/pixel.h"
# include "aarch64/predict.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/pixel.h"
#endif
@@ -194,9 +194,9 @@
return sum + ((uint64_t)sqr << 32); \
}
-PIXEL_VAR_C( x264_pixel_var_16x16, 16, 16 )
-PIXEL_VAR_C( x264_pixel_var_8x16, 8, 16 )
-PIXEL_VAR_C( x264_pixel_var_8x8, 8, 8 )
+PIXEL_VAR_C( pixel_var_16x16, 16, 16 )
+PIXEL_VAR_C( pixel_var_8x16, 8, 16 )
+PIXEL_VAR_C( pixel_var_8x8, 8, 8 )
/****************************************************************************
* pixel_var2_wxh
@@ -225,8 +225,8 @@
sqr_v - ((int64_t)sum_v * sum_v >> shift); \
}
-PIXEL_VAR2_C( x264_pixel_var2_8x16, 16, 7 )
-PIXEL_VAR2_C( x264_pixel_var2_8x8, 8, 6 )
+PIXEL_VAR2_C( pixel_var2_8x16, 16, 7 )
+PIXEL_VAR2_C( pixel_var2_8x8, 8, 6 )
#if BIT_DEPTH > 8
typedef uint32_t sum_t;
@@ -503,17 +503,18 @@
SATD_X_DECL7( _sse4 )
SATD_X_DECL7( _avx )
SATD_X_DECL7( _xop )
+SATD_X_DECL7( _avx512 )
#endif // !HIGH_BIT_DEPTH
#endif
#if !HIGH_BIT_DEPTH
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
SATD_X_DECL7( _neon )
#endif
#endif // !HIGH_BIT_DEPTH
#define INTRA_MBCMP_8x8( mbcmp, cpu, cpu2 )\
-void x264_intra_##mbcmp##_x3_8x8##cpu( pixel *fenc, pixel edge[36], int res[3] )\
+static void intra_##mbcmp##_x3_8x8##cpu( pixel *fenc, pixel edge[36], int res[3] )\
{\
ALIGNED_ARRAY_16( pixel, pix, [8*FDEC_STRIDE] );\
x264_predict_8x8_v##cpu2( pix, edge );\
@@ -531,13 +532,13 @@
INTRA_MBCMP_8x8( sad, _mmx2, _c )
INTRA_MBCMP_8x8(sa8d, _sse2, _sse2 )
#endif
-#if !HIGH_BIT_DEPTH && (HAVE_ARMV6 || ARCH_AARCH64)
+#if !HIGH_BIT_DEPTH && (HAVE_ARMV6 || HAVE_AARCH64)
INTRA_MBCMP_8x8( sad, _neon, _neon )
INTRA_MBCMP_8x8(sa8d, _neon, _neon )
#endif
#define INTRA_MBCMP( mbcmp, size, pred1, pred2, pred3, chroma, cpu, cpu2 )\
-void x264_intra_##mbcmp##_x3_##size##chroma##cpu( pixel *fenc, pixel *fdec, int res[3] )\
+static void intra_##mbcmp##_x3_##size##chroma##cpu( pixel *fenc, pixel *fdec, int res[3] )\
{\
x264_predict_##size##chroma##_##pred1##cpu2( fdec );\
res[0] = x264_pixel_##mbcmp##_##size##cpu( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\
@@ -601,7 +602,7 @@
INTRA_MBCMP( sad, 16x16, v, h, dc, , _neon, _neon )
INTRA_MBCMP(satd, 16x16, v, h, dc, , _neon, _neon )
#endif
-#if !HIGH_BIT_DEPTH && ARCH_AARCH64
+#if !HIGH_BIT_DEPTH && HAVE_AARCH64
INTRA_MBCMP( sad, 4x4, v, h, dc, , _neon, _neon )
INTRA_MBCMP(satd, 4x4, v, h, dc, , _neon, _neon )
INTRA_MBCMP( sad, 8x8, dc, h, v, c, _neon, _neon )
@@ -613,7 +614,7 @@
#endif
// No C implementation of intra_satd_x9. See checkasm for its behavior,
-// or see x264_mb_analyse_intra for the entirely different algorithm we
+// or see mb_analyse_intra for the entirely different algorithm we
// use when lacking an asm implementation of it.
@@ -803,7 +804,7 @@
/****************************************************************************
* x264_pixel_init:
****************************************************************************/
-void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
+void x264_pixel_init( uint32_t cpu, x264_pixel_function_t *pixf )
{
memset( pixf, 0, sizeof(*pixf) );
@@ -851,11 +852,11 @@
pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8;
- pixf->var[PIXEL_16x16] = x264_pixel_var_16x16;
- pixf->var[PIXEL_8x16] = x264_pixel_var_8x16;
- pixf->var[PIXEL_8x8] = x264_pixel_var_8x8;
- pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16;
- pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8;
+ pixf->var[PIXEL_16x16] = pixel_var_16x16;
+ pixf->var[PIXEL_8x16] = pixel_var_8x16;
+ pixf->var[PIXEL_8x8] = pixel_var_8x8;
+ pixf->var2[PIXEL_8x16] = pixel_var2_8x16;
+ pixf->var2[PIXEL_8x8] = pixel_var2_8x8;
pixf->ssd_nv12_core = pixel_ssd_nv12_core;
pixf->ssim_4x4x2_core = ssim_4x4x2_core;
@@ -863,16 +864,16 @@
pixf->vsad = pixel_vsad;
pixf->asd8 = pixel_asd8;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16;
#if HIGH_BIT_DEPTH
#if HAVE_MMX
@@ -889,14 +890,14 @@
INIT8( ssd, _mmx2 );
INIT_ADS( _mmx2 );
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_mmx2;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_mmx2;
pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_mmx2;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_mmx2;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_mmx2;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_mmx2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_mmx2;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_mmx2;
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2;
}
if( cpu&X264_CPU_SSE2 )
@@ -906,21 +907,22 @@
INIT6( satd, _sse2 );
pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_sse2;
- pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2;
- pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2;
-#if ARCH_X86_64
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_sse2;
- pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2;
-#endif
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_sse2;
- pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2;
+ pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_sse2;
pixf->ssim_end4 = x264_pixel_ssim_end4_sse2;
pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_sse2;
pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2;
pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_sse2;
pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_sse2;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
+
+ pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2;
+ pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2;
+#if ARCH_X86_64
+ pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2;
+#endif
+ pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_sse2;
+ pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_sse2;
}
if( (cpu&X264_CPU_SSE2) && !(cpu&X264_CPU_SSE2_IS_SLOW) )
{
@@ -936,10 +938,10 @@
pixf->vsad = x264_pixel_vsad_sse2;
pixf->asd8 = x264_pixel_asd8_sse2;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_sse2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_sse2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_sse2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse2;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_sse2;
}
if( cpu&X264_CPU_SSE2_IS_FAST )
{
@@ -971,7 +973,6 @@
}
pixf->vsad = x264_pixel_vsad_ssse3;
pixf->asd8 = x264_pixel_asd8_ssse3;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3;
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_ssse3;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_ssse3;
#if ARCH_X86_64
@@ -979,10 +980,10 @@
#endif
pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_ssse3;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_ssse3;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_ssse3;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_ssse3;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_ssse3;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_ssse3;
}
if( cpu&X264_CPU_SSE4 )
{
@@ -997,7 +998,7 @@
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4;
#endif
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse4;
}
if( cpu&X264_CPU_AVX )
{
@@ -1022,7 +1023,7 @@
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_avx;
#endif
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_avx;
}
if( cpu&X264_CPU_XOP )
{
@@ -1108,8 +1109,8 @@
#endif
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2;
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_mmx2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_mmx2;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2;
pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2;
pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2;
@@ -1151,8 +1152,8 @@
pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2;
pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_sse2;
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse2;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_sse2;
if( cpu&X264_CPU_CACHELINE_64 )
{
INIT2( ssd, _sse2); /* faster for width 16 on p4 */
@@ -1231,7 +1232,7 @@
pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_ssse3;
if( !(cpu&X264_CPU_SLOW_PSHUFB) )
pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_ssse3;
pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_ssse3;
pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3;
pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_ssse3;
@@ -1271,7 +1272,7 @@
}
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_sse4;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse4;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_sse4;
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4;
#endif
@@ -1301,7 +1302,7 @@
INIT5( ssd, _avx );
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_avx;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_avx;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx;
pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx;
pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx;
@@ -1326,7 +1327,7 @@
INIT5( ssd, _xop );
pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_xop;
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_xop;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_xop;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_xop;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_xop;
#if ARCH_X86_64
pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_xop;
@@ -1363,6 +1364,8 @@
INIT7( sad_x3, _avx512 );
INIT7( sad_x4, _avx512 );
INIT8( satd, _avx512 );
+ INIT7( satd_x3, _avx512 );
+ INIT7( satd_x4, _avx512 );
pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx512;
pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_avx512;
pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx512;
@@ -1402,16 +1405,16 @@
pixf->vsad = x264_pixel_vsad_neon;
pixf->asd8 = x264_pixel_asd8_neon;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_neon;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4_neon;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_neon;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_neon;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_neon;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c_neon;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_neon;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_neon;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_neon;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16_neon;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon;
@@ -1431,7 +1434,7 @@
}
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
INIT8( sad, _neon );
@@ -1457,22 +1460,22 @@
pixf->vsad = x264_pixel_vsad_neon;
pixf->asd8 = x264_pixel_asd8_neon;
- pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon;
- pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon;
- pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon;
- pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon;
- pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon;
- pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon;
- pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon;
- pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon;
- pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon;
- pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon;
+ pixf->intra_sad_x3_4x4 = intra_sad_x3_4x4_neon;
+ pixf->intra_satd_x3_4x4 = intra_satd_x3_4x4_neon;
+ pixf->intra_sad_x3_8x8 = intra_sad_x3_8x8_neon;
+ pixf->intra_sa8d_x3_8x8 = intra_sa8d_x3_8x8_neon;
+ pixf->intra_sad_x3_8x8c = intra_sad_x3_8x8c_neon;
+ pixf->intra_satd_x3_8x8c = intra_satd_x3_8x8c_neon;
+ pixf->intra_sad_x3_8x16c = intra_sad_x3_8x16c_neon;
+ pixf->intra_satd_x3_8x16c = intra_satd_x3_8x16c_neon;
+ pixf->intra_sad_x3_16x16 = intra_sad_x3_16x16_neon;
+ pixf->intra_satd_x3_16x16 = intra_satd_x3_16x16_neon;
pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon;
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon;
pixf->ssim_end4 = x264_pixel_ssim_end4_neon;
}
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
#if HAVE_MSA
if( cpu&X264_CPU_MSA )
diff -ur x264-go/x264c/external/x264/common/pixel.h x264-go.new/x264c/external/x264/common/pixel.h
--- x264-go/x264c/external/x264/common/pixel.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/pixel.h 2020-06-06 15:20:58.690039437 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* pixel.c: pixel metrics
*****************************************************************************
- * Copyright (C) 2004-2017 x264 project
+ * Copyright (C) 2004-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -143,13 +143,18 @@
int (*intra_sad_x9_8x8) ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds );
} x264_pixel_function_t;
-void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
+#define x264_pixel_init x264_template(pixel_init)
+void x264_pixel_init( uint32_t cpu, x264_pixel_function_t *pixf );
+#define x264_pixel_ssd_nv12 x264_template(pixel_ssd_nv12)
void x264_pixel_ssd_nv12 ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_wxh x264_template(pixel_ssd_wxh)
uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height );
+#define x264_pixel_ssim_wxh x264_template(pixel_ssim_wxh)
float x264_pixel_ssim_wxh ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height, void *buf, int *cnt );
+#define x264_field_vsad x264_template(field_vsad)
int x264_field_vsad( x264_t *h, int mb_x, int mb_y );
#endif
Only in x264-go.new/x264c/external/x264/common: ppc
diff -ur x264-go/x264c/external/x264/common/predict.c x264-go.new/x264c/external/x264/common/predict.c
--- x264-go/x264c/external/x264/common/predict.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/predict.c 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.c: intra prediction
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -34,16 +34,16 @@
#if HAVE_MMX
# include "x86/predict.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/predict.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/predict.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/predict.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/predict.h"
#endif
@@ -74,7 +74,7 @@
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_left_c( pixel *src )
+static void predict_16x16_dc_left_c( pixel *src )
{
int dc = 0;
@@ -84,7 +84,7 @@
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_top_c( pixel *src )
+static void predict_16x16_dc_top_c( pixel *src )
{
int dc = 0;
@@ -94,7 +94,7 @@
PREDICT_16x16_DC( dcsplat );
}
-static void x264_predict_16x16_dc_128_c( pixel *src )
+static void predict_16x16_dc_128_c( pixel *src )
{
PREDICT_16x16_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
@@ -161,7 +161,7 @@
* 8x8 prediction for intra chroma block (4:2:0)
****************************************************************************/
-static void x264_predict_8x8c_dc_128_c( pixel *src )
+static void predict_8x8c_dc_128_c( pixel *src )
{
for( int y = 0; y < 8; y++ )
{
@@ -170,7 +170,7 @@
src += FDEC_STRIDE;
}
}
-static void x264_predict_8x8c_dc_left_c( pixel *src )
+static void predict_8x8c_dc_left_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
@@ -196,7 +196,7 @@
}
}
-static void x264_predict_8x8c_dc_top_c( pixel *src )
+static void predict_8x8c_dc_top_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
@@ -308,7 +308,7 @@
* 8x16 prediction for intra chroma block (4:2:2)
****************************************************************************/
-static void x264_predict_8x16c_dc_128_c( pixel *src )
+static void predict_8x16c_dc_128_c( pixel *src )
{
for( int y = 0; y < 16; y++ )
{
@@ -317,7 +317,7 @@
src += FDEC_STRIDE;
}
}
-static void x264_predict_8x16c_dc_left_c( pixel *src )
+static void predict_8x16c_dc_left_c( pixel *src )
{
for( int i = 0; i < 4; i++ )
{
@@ -336,7 +336,7 @@
}
}
}
-static void x264_predict_8x16c_dc_top_c( pixel *src )
+static void predict_8x16c_dc_top_c( pixel *src )
{
int dc0 = 0, dc1 = 0;
@@ -475,16 +475,16 @@
#define PREDICT_4x4_DC(v)\
SRC_X4(0,0) = SRC_X4(0,1) = SRC_X4(0,2) = SRC_X4(0,3) = v;
-static void x264_predict_4x4_dc_128_c( pixel *src )
+static void predict_4x4_dc_128_c( pixel *src )
{
PREDICT_4x4_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
-static void x264_predict_4x4_dc_left_c( pixel *src )
+static void predict_4x4_dc_left_c( pixel *src )
{
pixel4 dc = PIXEL_SPLAT_X4( (SRC(-1,0) + SRC(-1,1) + SRC(-1,2) + SRC(-1,3) + 2) >> 2 );
PREDICT_4x4_DC( dc );
}
-static void x264_predict_4x4_dc_top_c( pixel *src )
+static void predict_4x4_dc_top_c( pixel *src )
{
pixel4 dc = PIXEL_SPLAT_X4( (SRC(0,-1) + SRC(1,-1) + SRC(2,-1) + SRC(3,-1) + 2) >> 2 );
PREDICT_4x4_DC( dc );
@@ -528,7 +528,7 @@
#define F1(a,b) (((a)+(b)+1)>>1)
#define F2(a,b,c) (((a)+2*(b)+(c)+2)>>2)
-static void x264_predict_4x4_ddl_c( pixel *src )
+static void predict_4x4_ddl_c( pixel *src )
{
PREDICT_4x4_LOAD_TOP
PREDICT_4x4_LOAD_TOP_RIGHT
@@ -540,7 +540,7 @@
SRC(3,2)=SRC(2,3)= F2(t5,t6,t7);
SRC(3,3)= F2(t6,t7,t7);
}
-static void x264_predict_4x4_ddr_c( pixel *src )
+static void predict_4x4_ddr_c( pixel *src )
{
int lt = SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
@@ -554,7 +554,7 @@
SRC(0,3)= F2(l1,l2,l3);
}
-static void x264_predict_4x4_vr_c( pixel *src )
+static void predict_4x4_vr_c( pixel *src )
{
int lt = SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
@@ -571,7 +571,7 @@
SRC(3,0)= F1(t2,t3);
}
-static void x264_predict_4x4_hd_c( pixel *src )
+static void predict_4x4_hd_c( pixel *src )
{
int lt= SRC(-1,-1);
PREDICT_4x4_LOAD_LEFT
@@ -588,7 +588,7 @@
SRC(3,0)= F2(t2,t1,t0);
}
-static void x264_predict_4x4_vl_c( pixel *src )
+static void predict_4x4_vl_c( pixel *src )
{
PREDICT_4x4_LOAD_TOP
PREDICT_4x4_LOAD_TOP_RIGHT
@@ -604,7 +604,7 @@
SRC(3,3)= F2(t4,t5,t6);
}
-static void x264_predict_4x4_hu_c( pixel *src )
+static void predict_4x4_hu_c( pixel *src )
{
PREDICT_4x4_LOAD_LEFT
SRC(0,0)= F1(l0,l1);
@@ -626,7 +626,7 @@
#define PT(x) \
edge[16+x] = F2(SRC(x-1,-1), SRC(x,-1), SRC(x+1,-1));
-static void x264_predict_8x8_filter_c( pixel *src, pixel edge[36], int i_neighbor, int i_filters )
+static void predict_8x8_filter_c( pixel *src, pixel edge[36], int i_neighbor, int i_filters )
{
/* edge[7..14] = l7..l0
* edge[15] = lt
@@ -694,17 +694,17 @@
src += FDEC_STRIDE; \
}
-static void x264_predict_8x8_dc_128_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_128_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) );
}
-static void x264_predict_8x8_dc_left_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_left_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_LEFT
pixel4 dc = PIXEL_SPLAT_X4( (l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3 );
PREDICT_8x8_DC( dc );
}
-static void x264_predict_8x8_dc_top_c( pixel *src, pixel edge[36] )
+static void predict_8x8_dc_top_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
pixel4 dc = PIXEL_SPLAT_X4( (t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3 );
@@ -735,7 +735,7 @@
MPIXEL_X4( src+y*FDEC_STRIDE+4 ) = top[1];
}
}
-static void x264_predict_8x8_ddl_c( pixel *src, pixel edge[36] )
+static void predict_8x8_ddl_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_TOPRIGHT
@@ -755,7 +755,7 @@
SRC(6,7)=SRC(7,6)= F2(t13,t14,t15);
SRC(7,7)= F2(t14,t15,t15);
}
-static void x264_predict_8x8_ddr_c( pixel *src, pixel edge[36] )
+static void predict_8x8_ddr_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
@@ -777,7 +777,7 @@
SRC(7,0)= F2(t5,t6,t7);
}
-static void x264_predict_8x8_vr_c( pixel *src, pixel edge[36] )
+static void predict_8x8_vr_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
@@ -805,7 +805,7 @@
SRC(7,1)= F2(t5,t6,t7);
SRC(7,0)= F1(t6,t7);
}
-static void x264_predict_8x8_hd_c( pixel *src, pixel edge[36] )
+static void predict_8x8_hd_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_LEFT
@@ -832,7 +832,7 @@
SRC_X4(4,1)= pack_pixel_2to4(p9,p10);
SRC_X4(4,0)= pack_pixel_2to4(p10,p11);
}
-static void x264_predict_8x8_vl_c( pixel *src, pixel edge[36] )
+static void predict_8x8_vl_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_TOP
PREDICT_8x8_LOAD_TOPRIGHT
@@ -859,7 +859,7 @@
SRC(7,6)= F1(t10,t11);
SRC(7,7)= F2(t10,t11,t12);
}
-static void x264_predict_8x8_hu_c( pixel *src, pixel edge[36] )
+static void predict_8x8_hu_c( pixel *src, pixel edge[36] )
{
PREDICT_8x8_LOAD_LEFT
int p1 = pack_pixel_1to2(F1(l0,l1), F2(l0,l1,l2));
@@ -883,15 +883,15 @@
/****************************************************************************
* Exported functions:
****************************************************************************/
-void x264_predict_16x16_init( int cpu, x264_predict_t pf[7] )
+void x264_predict_16x16_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_16x16_V ] = x264_predict_16x16_v_c;
pf[I_PRED_16x16_H ] = x264_predict_16x16_h_c;
pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_c;
pf[I_PRED_16x16_P ] = x264_predict_16x16_p_c;
- pf[I_PRED_16x16_DC_LEFT]= x264_predict_16x16_dc_left_c;
- pf[I_PRED_16x16_DC_TOP ]= x264_predict_16x16_dc_top_c;
- pf[I_PRED_16x16_DC_128 ]= x264_predict_16x16_dc_128_c;
+ pf[I_PRED_16x16_DC_LEFT]= predict_16x16_dc_left_c;
+ pf[I_PRED_16x16_DC_TOP ]= predict_16x16_dc_top_c;
+ pf[I_PRED_16x16_DC_128 ]= predict_16x16_dc_128_c;
#if HAVE_MMX
x264_predict_16x16_init_mmx( cpu, pf );
@@ -906,7 +906,7 @@
x264_predict_16x16_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_16x16_init_aarch64( cpu, pf );
#endif
@@ -926,15 +926,15 @@
#endif
}
-void x264_predict_8x8c_init( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x8c_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_CHROMA_V ] = x264_predict_8x8c_v_c;
pf[I_PRED_CHROMA_H ] = x264_predict_8x8c_h_c;
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_c;
pf[I_PRED_CHROMA_P ] = x264_predict_8x8c_p_c;
- pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x8c_dc_left_c;
- pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x8c_dc_top_c;
- pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x8c_dc_128_c;
+ pf[I_PRED_CHROMA_DC_LEFT]= predict_8x8c_dc_left_c;
+ pf[I_PRED_CHROMA_DC_TOP ]= predict_8x8c_dc_top_c;
+ pf[I_PRED_CHROMA_DC_128 ]= predict_8x8c_dc_128_c;
#if HAVE_MMX
x264_predict_8x8c_init_mmx( cpu, pf );
@@ -949,7 +949,7 @@
x264_predict_8x8c_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x8c_init_aarch64( cpu, pf );
#endif
@@ -963,15 +963,15 @@
#endif
}
-void x264_predict_8x16c_init( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x16c_init( uint32_t cpu, x264_predict_t pf[7] )
{
pf[I_PRED_CHROMA_V ] = x264_predict_8x16c_v_c;
pf[I_PRED_CHROMA_H ] = x264_predict_8x16c_h_c;
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_c;
pf[I_PRED_CHROMA_P ] = x264_predict_8x16c_p_c;
- pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x16c_dc_left_c;
- pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x16c_dc_top_c;
- pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x16c_dc_128_c;
+ pf[I_PRED_CHROMA_DC_LEFT]= predict_8x16c_dc_left_c;
+ pf[I_PRED_CHROMA_DC_TOP ]= predict_8x16c_dc_top_c;
+ pf[I_PRED_CHROMA_DC_128 ]= predict_8x16c_dc_128_c;
#if HAVE_MMX
x264_predict_8x16c_init_mmx( cpu, pf );
@@ -981,26 +981,26 @@
x264_predict_8x16c_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x16c_init_aarch64( cpu, pf );
#endif
}
-void x264_predict_8x8_init( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
+void x264_predict_8x8_init( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
pf[I_PRED_8x8_V] = x264_predict_8x8_v_c;
pf[I_PRED_8x8_H] = x264_predict_8x8_h_c;
pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_c;
- pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_c;
- pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_c;
- pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_c;
- pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_c;
- pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_c;
- pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_c;
- pf[I_PRED_8x8_DC_LEFT]= x264_predict_8x8_dc_left_c;
- pf[I_PRED_8x8_DC_TOP] = x264_predict_8x8_dc_top_c;
- pf[I_PRED_8x8_DC_128] = x264_predict_8x8_dc_128_c;
- *predict_filter = x264_predict_8x8_filter_c;
+ pf[I_PRED_8x8_DDL] = predict_8x8_ddl_c;
+ pf[I_PRED_8x8_DDR] = predict_8x8_ddr_c;
+ pf[I_PRED_8x8_VR] = predict_8x8_vr_c;
+ pf[I_PRED_8x8_HD] = predict_8x8_hd_c;
+ pf[I_PRED_8x8_VL] = predict_8x8_vl_c;
+ pf[I_PRED_8x8_HU] = predict_8x8_hu_c;
+ pf[I_PRED_8x8_DC_LEFT]= predict_8x8_dc_left_c;
+ pf[I_PRED_8x8_DC_TOP] = predict_8x8_dc_top_c;
+ pf[I_PRED_8x8_DC_128] = predict_8x8_dc_128_c;
+ *predict_filter = predict_8x8_filter_c;
#if HAVE_MMX
x264_predict_8x8_init_mmx( cpu, pf, predict_filter );
@@ -1010,7 +1010,7 @@
x264_predict_8x8_init_arm( cpu, pf, predict_filter );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x8_init_aarch64( cpu, pf, predict_filter );
#endif
@@ -1024,20 +1024,20 @@
#endif
}
-void x264_predict_4x4_init( int cpu, x264_predict_t pf[12] )
+void x264_predict_4x4_init( uint32_t cpu, x264_predict_t pf[12] )
{
pf[I_PRED_4x4_V] = x264_predict_4x4_v_c;
pf[I_PRED_4x4_H] = x264_predict_4x4_h_c;
pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_c;
- pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_c;
- pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_c;
- pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_c;
- pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_c;
- pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_c;
- pf[I_PRED_4x4_HU] = x264_predict_4x4_hu_c;
- pf[I_PRED_4x4_DC_LEFT]= x264_predict_4x4_dc_left_c;
- pf[I_PRED_4x4_DC_TOP] = x264_predict_4x4_dc_top_c;
- pf[I_PRED_4x4_DC_128] = x264_predict_4x4_dc_128_c;
+ pf[I_PRED_4x4_DDL] = predict_4x4_ddl_c;
+ pf[I_PRED_4x4_DDR] = predict_4x4_ddr_c;
+ pf[I_PRED_4x4_VR] = predict_4x4_vr_c;
+ pf[I_PRED_4x4_HD] = predict_4x4_hd_c;
+ pf[I_PRED_4x4_VL] = predict_4x4_vl_c;
+ pf[I_PRED_4x4_HU] = predict_4x4_hu_c;
+ pf[I_PRED_4x4_DC_LEFT]= predict_4x4_dc_left_c;
+ pf[I_PRED_4x4_DC_TOP] = predict_4x4_dc_top_c;
+ pf[I_PRED_4x4_DC_128] = predict_4x4_dc_128_c;
#if HAVE_MMX
x264_predict_4x4_init_mmx( cpu, pf );
@@ -1047,7 +1047,7 @@
x264_predict_4x4_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_4x4_init_aarch64( cpu, pf );
#endif
}
diff -ur x264-go/x264c/external/x264/common/predict.h x264-go.new/x264c/external/x264/common/predict.h
--- x264-go/x264c/external/x264/common/predict.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/predict.h 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.h: intra prediction
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -109,30 +109,52 @@
I_PRED_8x8_DC_128 = 11,
};
+#define x264_predict_8x8_dc_c x264_template(predict_8x8_dc_c)
void x264_predict_8x8_dc_c ( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_h_c x264_template(predict_8x8_h_c)
void x264_predict_8x8_h_c ( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_v_c x264_template(predict_8x8_v_c)
void x264_predict_8x8_v_c ( pixel *src, pixel edge[36] );
+#define x264_predict_4x4_dc_c x264_template(predict_4x4_dc_c)
void x264_predict_4x4_dc_c ( pixel *src );
+#define x264_predict_4x4_h_c x264_template(predict_4x4_h_c)
void x264_predict_4x4_h_c ( pixel *src );
+#define x264_predict_4x4_v_c x264_template(predict_4x4_v_c)
void x264_predict_4x4_v_c ( pixel *src );
+#define x264_predict_16x16_dc_c x264_template(predict_16x16_dc_c)
void x264_predict_16x16_dc_c( pixel *src );
+#define x264_predict_16x16_h_c x264_template(predict_16x16_h_c)
void x264_predict_16x16_h_c ( pixel *src );
+#define x264_predict_16x16_v_c x264_template(predict_16x16_v_c)
void x264_predict_16x16_v_c ( pixel *src );
+#define x264_predict_16x16_p_c x264_template(predict_16x16_p_c)
void x264_predict_16x16_p_c ( pixel *src );
+#define x264_predict_8x8c_dc_c x264_template(predict_8x8c_dc_c)
void x264_predict_8x8c_dc_c ( pixel *src );
+#define x264_predict_8x8c_h_c x264_template(predict_8x8c_h_c)
void x264_predict_8x8c_h_c ( pixel *src );
+#define x264_predict_8x8c_v_c x264_template(predict_8x8c_v_c)
void x264_predict_8x8c_v_c ( pixel *src );
+#define x264_predict_8x8c_p_c x264_template(predict_8x8c_p_c)
void x264_predict_8x8c_p_c ( pixel *src );
+#define x264_predict_8x16c_dc_c x264_template(predict_8x16c_dc_c)
void x264_predict_8x16c_dc_c( pixel *src );
+#define x264_predict_8x16c_h_c x264_template(predict_8x16c_h_c)
void x264_predict_8x16c_h_c ( pixel *src );
+#define x264_predict_8x16c_v_c x264_template(predict_8x16c_v_c)
void x264_predict_8x16c_v_c ( pixel *src );
+#define x264_predict_8x16c_p_c x264_template(predict_8x16c_p_c)
void x264_predict_8x16c_p_c ( pixel *src );
-void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x8c_init ( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x16c_init ( int cpu, x264_predict_t pf[7] );
-void x264_predict_4x4_init ( int cpu, x264_predict_t pf[12] );
-void x264_predict_8x8_init ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
-
+#define x264_predict_16x16_init x264_template(predict_16x16_init)
+void x264_predict_16x16_init ( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x8c_init x264_template(predict_8x8c_init)
+void x264_predict_8x8c_init ( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init x264_template(predict_8x16c_init)
+void x264_predict_8x16c_init ( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init x264_template(predict_4x4_init)
+void x264_predict_4x4_init ( uint32_t cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init x264_template(predict_8x8_init)
+void x264_predict_8x8_init ( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#endif
diff -ur x264-go/x264c/external/x264/common/quant.c x264-go.new/x264c/external/x264/common/quant.c
--- x264-go/x264c/external/x264/common/quant.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/quant.c 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* quant.c: quantization and level-run
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -31,16 +31,16 @@
#if HAVE_MMX
#include "x86/quant.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/quant.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/quant.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/quant.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/quant.h"
#endif
@@ -298,7 +298,7 @@
return optimize_chroma_dc_internal( dct, dequant_mf, 1 );
}
-static void x264_denoise_dct( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size )
+static void denoise_dct( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size )
{
for( int i = 0; i < size; i++ )
{
@@ -320,19 +320,7 @@
* chroma: for the complete mb: if score < 7 -> null
*/
-const uint8_t x264_decimate_table4[16] =
-{
- 3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0
-};
-const uint8_t x264_decimate_table8[64] =
-{
- 3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,
- 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-};
-
-static int ALWAYS_INLINE x264_decimate_score_internal( dctcoef *dct, int i_max )
+static ALWAYS_INLINE int decimate_score_internal( dctcoef *dct, int i_max )
{
const uint8_t *ds_table = (i_max == 64) ? x264_decimate_table8 : x264_decimate_table4;
int i_score = 0;
@@ -359,21 +347,21 @@
return i_score;
}
-static int x264_decimate_score15( dctcoef *dct )
+static int decimate_score15( dctcoef *dct )
{
- return x264_decimate_score_internal( dct+1, 15 );
+ return decimate_score_internal( dct+1, 15 );
}
-static int x264_decimate_score16( dctcoef *dct )
+static int decimate_score16( dctcoef *dct )
{
- return x264_decimate_score_internal( dct, 16 );
+ return decimate_score_internal( dct, 16 );
}
-static int x264_decimate_score64( dctcoef *dct )
+static int decimate_score64( dctcoef *dct )
{
- return x264_decimate_score_internal( dct, 64 );
+ return decimate_score_internal( dct, 64 );
}
#define last(num)\
-static int x264_coeff_last##num( dctcoef *l )\
+static int coeff_last##num( dctcoef *l )\
{\
int i_last = num-1;\
while( i_last >= 0 && l[i_last] == 0 )\
@@ -388,9 +376,9 @@
last(64)
#define level_run(num)\
-static int x264_coeff_level_run##num( dctcoef *dct, x264_run_level_t *runlevel )\
+static int coeff_level_run##num( dctcoef *dct, x264_run_level_t *runlevel )\
{\
- int i_last = runlevel->last = x264_coeff_last##num(dct);\
+ int i_last = runlevel->last = coeff_last##num(dct);\
int i_total = 0;\
int mask = 0;\
do\
@@ -420,7 +408,7 @@
#define INIT_TRELLIS(...)
#endif
-void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf )
+void x264_quant_init( x264_t *h, uint32_t cpu, x264_quant_function_t *pf )
{
pf->quant_8x8 = quant_8x8;
pf->quant_4x4 = quant_4x4;
@@ -438,20 +426,20 @@
pf->optimize_chroma_2x2_dc = optimize_chroma_2x2_dc;
pf->optimize_chroma_2x4_dc = optimize_chroma_2x4_dc;
- pf->denoise_dct = x264_denoise_dct;
- pf->decimate_score15 = x264_decimate_score15;
- pf->decimate_score16 = x264_decimate_score16;
- pf->decimate_score64 = x264_decimate_score64;
-
- pf->coeff_last4 = x264_coeff_last4;
- pf->coeff_last8 = x264_coeff_last8;
- pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15;
- pf->coeff_last[ DCT_LUMA_4x4] = x264_coeff_last16;
- pf->coeff_last[ DCT_LUMA_8x8] = x264_coeff_last64;
- pf->coeff_level_run4 = x264_coeff_level_run4;
- pf->coeff_level_run8 = x264_coeff_level_run8;
- pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15;
- pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16;
+ pf->denoise_dct = denoise_dct;
+ pf->decimate_score15 = decimate_score15;
+ pf->decimate_score16 = decimate_score16;
+ pf->decimate_score64 = decimate_score64;
+
+ pf->coeff_last4 = coeff_last4;
+ pf->coeff_last8 = coeff_last8;
+ pf->coeff_last[ DCT_LUMA_AC] = coeff_last15;
+ pf->coeff_last[ DCT_LUMA_4x4] = coeff_last16;
+ pf->coeff_last[ DCT_LUMA_8x8] = coeff_last64;
+ pf->coeff_level_run4 = coeff_level_run4;
+ pf->coeff_level_run8 = coeff_level_run8;
+ pf->coeff_level_run[ DCT_LUMA_AC] = coeff_level_run15;
+ pf->coeff_level_run[ DCT_LUMA_4x4] = coeff_level_run16;
#if HIGH_BIT_DEPTH
#if HAVE_MMX
@@ -753,6 +741,7 @@
pf->quant_2x2_dc = x264_quant_2x2_dc_altivec;
pf->quant_4x4_dc = x264_quant_4x4_dc_altivec;
pf->quant_4x4 = x264_quant_4x4_altivec;
+ pf->quant_4x4x4 = x264_quant_4x4x4_altivec;
pf->quant_8x8 = x264_quant_8x8_altivec;
pf->dequant_4x4 = x264_dequant_4x4_altivec;
@@ -767,7 +756,7 @@
pf->coeff_last8 = x264_coeff_last8_arm;
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf->quant_2x2_dc = x264_quant_2x2_dc_neon;
@@ -787,7 +776,7 @@
pf->decimate_score64 = x264_decimate_score64_neon;
}
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_ARMV8 )
{
pf->coeff_last4 = x264_coeff_last4_aarch64;
diff -ur x264-go/x264c/external/x264/common/quant.h x264-go.new/x264c/external/x264/common/quant.h
--- x264-go/x264c/external/x264/common/quant.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/quant.h 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* quant.h: quantization and level-run
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -69,6 +69,7 @@
int (*trellis_cabac_chroma_422_dc)( TRELLIS_PARAMS );
} x264_quant_function_t;
-void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf );
+#define x264_quant_init x264_template(quant_init)
+void x264_quant_init( x264_t *h, uint32_t cpu, x264_quant_function_t *pf );
#endif
diff -ur x264-go/x264c/external/x264/common/rectangle.c x264-go.new/x264c/external/x264/common/rectangle.c
--- x264-go/x264c/external/x264/common/rectangle.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/rectangle.c 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* rectangle.c: rectangle filling
*****************************************************************************
- * Copyright (C) 2010-2017 x264 project
+ * Copyright (C) 2010-2020 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
*
@@ -26,7 +26,7 @@
#include "common.h"
#define CACHE_FUNC(name,size,width,height)\
-static void x264_macroblock_cache_##name##_##width##_##height( void *target, uint32_t val )\
+static void macroblock_cache_##name##_##width##_##height( void *target, uint32_t val )\
{\
x264_macroblock_cache_rect( target, width*size, height, size, val );\
}
@@ -41,16 +41,16 @@
CACHE_FUNC(name,size,1,1)\
void (*x264_cache_##name##_func_table[10])(void *, uint32_t) =\
{\
- x264_macroblock_cache_##name##_1_1,\
- x264_macroblock_cache_##name##_2_1,\
- x264_macroblock_cache_##name##_1_2,\
- x264_macroblock_cache_##name##_2_2,\
+ macroblock_cache_##name##_1_1,\
+ macroblock_cache_##name##_2_1,\
+ macroblock_cache_##name##_1_2,\
+ macroblock_cache_##name##_2_2,\
NULL,\
- x264_macroblock_cache_##name##_4_2,\
+ macroblock_cache_##name##_4_2,\
NULL,\
- x264_macroblock_cache_##name##_2_4,\
+ macroblock_cache_##name##_2_4,\
NULL,\
- x264_macroblock_cache_##name##_4_4\
+ macroblock_cache_##name##_4_4\
};\
CACHE_FUNCS(mv, 4)
diff -ur x264-go/x264c/external/x264/common/rectangle.h x264-go.new/x264c/external/x264/common/rectangle.h
--- x264-go/x264c/external/x264/common/rectangle.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/rectangle.h 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* rectangle.h: rectangle filling
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
* Loren Merritt <lorenm@u.washington.edu>
@@ -118,9 +118,12 @@
assert(0);
}
-extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);\
-extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);\
-extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);\
+#define x264_cache_mv_func_table x264_template(cache_mv_func_table)
+extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);
+#define x264_cache_mvd_func_table x264_template(cache_mvd_func_table)
+extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);
+#define x264_cache_ref_func_table x264_template(cache_ref_func_table)
+extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);
#define x264_macroblock_cache_mv_ptr( a, x, y, w, h, l, mv ) x264_macroblock_cache_mv( a, x, y, w, h, l, M32( mv ) )
static ALWAYS_INLINE void x264_macroblock_cache_mv( x264_t *h, int x, int y, int width, int height, int i_list, uint32_t mv )
diff -ur x264-go/x264c/external/x264/common/set.c x264-go.new/x264c/external/x264/common/set.c
--- x264-go/x264c/external/x264/common/set.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/set.c 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* set.c: quantization init
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
*
@@ -94,7 +94,7 @@
int start = w == 8 ? 4 : 0;\
int j;\
for( j = 0; j < i; j++ )\
- if( !memcmp( h->pps->scaling_list[i+start], h->pps->scaling_list[j+start], size*sizeof(uint8_t) ) )\
+ if( !memcmp( h->sps->scaling_list[i+start], h->sps->scaling_list[j+start], size*sizeof(uint8_t) ) )\
break;\
if( j < i )\
{\
@@ -110,7 +110,7 @@
}\
for( j = 0; j < i; j++ )\
if( deadzone[j] == deadzone[i] &&\
- !memcmp( h->pps->scaling_list[i+start], h->pps->scaling_list[j+start], size*sizeof(uint8_t) ) )\
+ !memcmp( h->sps->scaling_list[i+start], h->sps->scaling_list[j+start], size*sizeof(uint8_t) ) )\
break;\
if( j < i )\
{\
@@ -148,14 +148,14 @@
for( int i_list = 0; i_list < 4; i_list++ )
for( int i = 0; i < 16; i++ )
{
- h->dequant4_mf[i_list][q][i] = def_dequant4[q][i] * h->pps->scaling_list[i_list][i];
- quant4_mf[i_list][q][i] = DIV(def_quant4[q][i] * 16, h->pps->scaling_list[i_list][i]);
+ h->dequant4_mf[i_list][q][i] = def_dequant4[q][i] * h->sps->scaling_list[i_list][i];
+ quant4_mf[i_list][q][i] = DIV(def_quant4[q][i] * 16, h->sps->scaling_list[i_list][i]);
}
for( int i_list = 0; i_list < num_8x8_lists; i_list++ )
for( int i = 0; i < 64; i++ )
{
- h->dequant8_mf[i_list][q][i] = def_dequant8[q][i] * h->pps->scaling_list[4+i_list][i];
- quant8_mf[i_list][q][i] = DIV(def_quant8[q][i] * 16, h->pps->scaling_list[4+i_list][i]);
+ h->dequant8_mf[i_list][q][i] = def_dequant8[q][i] * h->sps->scaling_list[4+i_list][i];
+ quant8_mf[i_list][q][i] = DIV(def_quant8[q][i] * 16, h->sps->scaling_list[4+i_list][i]);
}
}
for( int q = 0; q <= QP_MAX_SPEC; q++ )
@@ -300,8 +300,8 @@
x264_free( h->nr_offset_emergency );
}
-static int x264_cqm_parse_jmlist( x264_t *h, const char *buf, const char *name,
- uint8_t *cqm, const uint8_t *jvt, int length )
+static int cqm_parse_jmlist( x264_t *h, const char *buf, const char *name,
+ uint8_t *cqm, const uint8_t *jvt, int length )
{
int i;
@@ -361,16 +361,16 @@
while( (p = strchr( buf, '#' )) != NULL )
memset( p, ' ', strcspn( p, "\n" ) );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_LUMA", h->param.cqm_4iy, x264_cqm_jvt4i, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_LUMA", h->param.cqm_4py, x264_cqm_jvt4p, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_CHROMA", h->param.cqm_4ic, x264_cqm_jvt4i, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_CHROMA", h->param.cqm_4pc, x264_cqm_jvt4p, 16 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_LUMA", h->param.cqm_8iy, x264_cqm_jvt8i, 64 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_LUMA", h->param.cqm_8py, x264_cqm_jvt8p, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA4X4_LUMA", h->param.cqm_4iy, x264_cqm_jvt4i, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER4X4_LUMA", h->param.cqm_4py, x264_cqm_jvt4p, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA4X4_CHROMA", h->param.cqm_4ic, x264_cqm_jvt4i, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER4X4_CHROMA", h->param.cqm_4pc, x264_cqm_jvt4p, 16 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA8X8_LUMA", h->param.cqm_8iy, x264_cqm_jvt8i, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER8X8_LUMA", h->param.cqm_8py, x264_cqm_jvt8p, 64 );
if( CHROMA444 )
{
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_CHROMA", h->param.cqm_8ic, x264_cqm_jvt8i, 64 );
- b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_CHROMA", h->param.cqm_8pc, x264_cqm_jvt8p, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTRA8X8_CHROMA", h->param.cqm_8ic, x264_cqm_jvt8i, 64 );
+ b_error |= cqm_parse_jmlist( h, buf, "INTER8X8_CHROMA", h->param.cqm_8pc, x264_cqm_jvt8p, 64 );
}
x264_free( buf );
diff -ur x264-go/x264c/external/x264/common/set.h x264-go.new/x264c/external/x264/common/set.h
--- x264-go/x264c/external/x264/common/set.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/set.h 2020-06-06 15:20:58.691039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* set.h: quantization init
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -27,24 +27,6 @@
#ifndef X264_SET_H
#define X264_SET_H
-enum profile_e
-{
- PROFILE_BASELINE = 66,
- PROFILE_MAIN = 77,
- PROFILE_HIGH = 100,
- PROFILE_HIGH10 = 110,
- PROFILE_HIGH422 = 122,
- PROFILE_HIGH444_PREDICTIVE = 244,
-};
-
-enum chroma_format_e
-{
- CHROMA_400 = 0,
- CHROMA_420 = 1,
- CHROMA_422 = 2,
- CHROMA_444 = 3,
-};
-
enum cqm4_e
{
CQM_4IY = 0,
@@ -158,6 +140,10 @@
int b_qpprime_y_zero_transform_bypass;
int i_chroma_format_idc;
+ int b_avcintra;
+ int i_cqm_preset;
+ const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */
+
} x264_sps_t;
typedef struct
@@ -187,161 +173,13 @@
int b_transform_8x8_mode;
- int i_cqm_preset;
- const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */
-
} x264_pps_t;
-/* default quant matrices */
-static const uint8_t x264_cqm_jvt4i[16] =
-{
- 6,13,20,28,
- 13,20,28,32,
- 20,28,32,37,
- 28,32,37,42
-};
-static const uint8_t x264_cqm_jvt4p[16] =
-{
- 10,14,20,24,
- 14,20,24,27,
- 20,24,27,30,
- 24,27,30,34
-};
-static const uint8_t x264_cqm_jvt8i[64] =
-{
- 6,10,13,16,18,23,25,27,
- 10,11,16,18,23,25,27,29,
- 13,16,18,23,25,27,29,31,
- 16,18,23,25,27,29,31,33,
- 18,23,25,27,29,31,33,36,
- 23,25,27,29,31,33,36,38,
- 25,27,29,31,33,36,38,40,
- 27,29,31,33,36,38,40,42
-};
-static const uint8_t x264_cqm_jvt8p[64] =
-{
- 9,13,15,17,19,21,22,24,
- 13,13,17,19,21,22,24,25,
- 15,17,19,21,22,24,25,27,
- 17,19,21,22,24,25,27,28,
- 19,21,22,24,25,27,28,30,
- 21,22,24,25,27,28,30,32,
- 22,24,25,27,28,30,32,33,
- 24,25,27,28,30,32,33,35
-};
-static const uint8_t x264_cqm_flat16[64] =
-{
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16
-};
-static const uint8_t * const x264_cqm_jvt[8] =
-{
- x264_cqm_jvt4i, x264_cqm_jvt4p,
- x264_cqm_jvt4i, x264_cqm_jvt4p,
- x264_cqm_jvt8i, x264_cqm_jvt8p,
- x264_cqm_jvt8i, x264_cqm_jvt8p
-};
-
-// 1080i25_avci50, 1080p25_avci50
-static const uint8_t x264_cqm_avci50_4ic[16] =
-{
- 16,22,28,40,
- 22,28,40,44,
- 28,40,44,48,
- 40,44,48,60
-};
-
-// 1080i25_avci50,
-static const uint8_t x264_cqm_avci50_1080i_8iy[64] =
-{
- 16,18,19,21,27,33,81,87,
- 18,19,21,24,30,33,81,87,
- 19,21,24,27,30,78,84,90,
- 21,24,27,30,33,78,84,90,
- 24,27,30,33,78,81,84,90,
- 24,27,30,33,78,81,84,93,
- 27,30,33,78,78,81,87,93,
- 30,33,33,78,81,84,87,96
-};
-
-// 1080p25_avci50, 720p25_avci50, 720p50_avci50
-static const uint8_t x264_cqm_avci50_p_8iy[64] =
-{
- 16,18,19,21,24,27,30,33,
- 18,19,21,24,27,30,33,78,
- 19,21,24,27,30,33,78,81,
- 21,24,27,30,33,78,81,84,
- 24,27,30,33,78,81,84,87,
- 27,30,33,78,81,84,87,90,
- 30,33,78,81,84,87,90,93,
- 33,78,81,84,87,90,93,96
-};
-
-// 1080i25_avci100, 1080p25_avci100
-static const uint8_t x264_cqm_avci100_1080_4ic[16] =
-{
- 16,20,26,32,
- 20,26,32,38,
- 26,32,38,44,
- 32,38,44,50
-};
-
-// 720p25_avci100, 720p50_avci100
-static const uint8_t x264_cqm_avci100_720p_4ic[16] =
-{
- 16,21,27,34,
- 21,27,34,41,
- 27,34,41,46,
- 34,41,46,54
-};
-
-// 1080i25_avci100,
-static const uint8_t x264_cqm_avci100_1080i_8iy[64] =
-{
- 16,19,20,23,24,26,32,42,
- 18,19,22,24,26,32,36,42,
- 18,20,23,24,26,32,36,63,
- 19,20,23,26,32,36,42,63,
- 20,22,24,26,32,36,59,63,
- 22,23,24,26,32,36,59,68,
- 22,23,24,26,32,42,59,68,
- 22,23,24,26,36,42,59,72
-};
-
-// 1080p25_avci100,
-static const uint8_t x264_cqm_avci100_1080p_8iy[64] =
-{
- 16,18,19,20,22,23,24,26,
- 18,19,20,22,23,24,26,32,
- 19,20,22,23,24,26,32,36,
- 20,22,23,24,26,32,36,42,
- 22,23,24,26,32,36,42,59,
- 23,24,26,32,36,42,59,63,
- 24,26,32,36,42,59,63,68,
- 26,32,36,42,59,63,68,72
-};
-
-// 720p25_avci100, 720p50_avci100
-static const uint8_t x264_cqm_avci100_720p_8iy[64] =
-{
- 16,18,19,21,22,24,26,32,
- 18,19,19,21,22,24,26,32,
- 19,19,21,22,22,24,26,32,
- 21,21,22,22,23,24,26,34,
- 22,22,22,23,24,25,26,34,
- 24,24,24,24,25,26,34,36,
- 26,26,26,26,26,34,36,38,
- 32,32,32,34,34,36,38,42
-};
-
+#define x264_cqm_init x264_template(cqm_init)
int x264_cqm_init( x264_t *h );
+#define x264_cqm_delete x264_template(cqm_delete)
void x264_cqm_delete( x264_t *h );
+#define x264_cqm_parse_file x264_template(cqm_parse_file)
int x264_cqm_parse_file( x264_t *h, const char *filename );
#endif
Only in x264-go.new/x264c/external/x264/common: tables.c
Only in x264-go.new/x264c/external/x264/common: tables.h
diff -ur x264-go/x264c/external/x264/common/threadpool.c x264-go.new/x264c/external/x264/common/threadpool.c
--- x264-go/x264c/external/x264/common/threadpool.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/threadpool.c 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* threadpool.c: thread pooling
*****************************************************************************
- * Copyright (C) 2010-2017 x264 project
+ * Copyright (C) 2010-2020 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
*
@@ -34,7 +34,7 @@
struct x264_threadpool_t
{
- int exit;
+ volatile int exit;
int threads;
x264_pthread_t *thread_handle;
void (*init_func)(void *);
@@ -47,7 +47,7 @@
x264_sync_frame_list_t done; /* list of jobs that have finished processing */
};
-static void *x264_threadpool_thread( x264_threadpool_t *pool )
+REALIGN_STACK static void *threadpool_thread( x264_threadpool_t *pool )
{
if( pool->init_func )
pool->init_func( pool->init_arg );
@@ -66,7 +66,7 @@
x264_pthread_mutex_unlock( &pool->run.mutex );
if( !job )
continue;
- job->ret = (void*)x264_stack_align( job->func, job->arg ); /* execute the function */
+ job->ret = job->func( job->arg );
x264_sync_frame_list_push( &pool->done, (void*)job );
}
return NULL;
@@ -78,6 +78,9 @@
if( threads <= 0 )
return -1;
+ if( x264_threading_init() < 0 )
+ return -1;
+
x264_threadpool_t *pool;
CHECKED_MALLOCZERO( pool, sizeof(x264_threadpool_t) );
*p_pool = pool;
@@ -100,7 +103,7 @@
x264_sync_frame_list_push( &pool->uninit, (void*)job );
}
for( int i = 0; i < pool->threads; i++ )
- if( x264_pthread_create( pool->thread_handle+i, NULL, (void*)x264_threadpool_thread, pool ) )
+ if( x264_pthread_create( pool->thread_handle+i, NULL, (void*)threadpool_thread, pool ) )
goto fail;
return 0;
@@ -137,7 +140,7 @@
}
}
-static void x264_threadpool_list_delete( x264_sync_frame_list_t *slist )
+static void threadpool_list_delete( x264_sync_frame_list_t *slist )
{
for( int i = 0; slist->list[i]; i++ )
{
@@ -156,9 +159,9 @@
for( int i = 0; i < pool->threads; i++ )
x264_pthread_join( pool->thread_handle[i], NULL );
- x264_threadpool_list_delete( &pool->uninit );
- x264_threadpool_list_delete( &pool->run );
- x264_threadpool_list_delete( &pool->done );
+ threadpool_list_delete( &pool->uninit );
+ threadpool_list_delete( &pool->run );
+ threadpool_list_delete( &pool->done );
x264_free( pool->thread_handle );
x264_free( pool );
}
diff -ur x264-go/x264c/external/x264/common/threadpool.h x264-go.new/x264c/external/x264/common/threadpool.h
--- x264-go/x264c/external/x264/common/threadpool.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/threadpool.h 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* threadpool.h: thread pooling
*****************************************************************************
- * Copyright (C) 2010-2017 x264 project
+ * Copyright (C) 2010-2020 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
*
@@ -29,11 +29,15 @@
typedef struct x264_threadpool_t x264_threadpool_t;
#if HAVE_THREAD
-int x264_threadpool_init( x264_threadpool_t **p_pool, int threads,
- void (*init_func)(void *), void *init_arg );
-void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg );
-void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg );
-void x264_threadpool_delete( x264_threadpool_t *pool );
+#define x264_threadpool_init x264_template(threadpool_init)
+X264_API int x264_threadpool_init( x264_threadpool_t **p_pool, int threads,
+ void (*init_func)(void *), void *init_arg );
+#define x264_threadpool_run x264_template(threadpool_run)
+X264_API void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg );
+#define x264_threadpool_wait x264_template(threadpool_wait)
+X264_API void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg );
+#define x264_threadpool_delete x264_template(threadpool_delete)
+X264_API void x264_threadpool_delete( x264_threadpool_t *pool );
#else
#define x264_threadpool_init(p,t,f,a) -1
#define x264_threadpool_run(p,f,a)
diff -ur x264-go/x264c/external/x264/common/vlc.c x264-go.new/x264c/external/x264/common/vlc.c
--- x264-go/x264c/external/x264/common/vlc.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/vlc.c 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* vlc.c : vlc tables
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Fiona Glaser <fiona@x264.com>
@@ -27,777 +27,6 @@
#include "common.h"
-/* [nC] */
-const vlc_t x264_coeff0_token[6] =
-{
- { 0x1, 1 }, /* str=1 */
- { 0x3, 2 }, /* str=11 */
- { 0xf, 4 }, /* str=1111 */
- { 0x3, 6 }, /* str=000011 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
-};
-
-/* [nC][i_total_coeff-1][i_trailing] */
-const vlc_t x264_coeff_token[6][16][4] =
-{
- { /* table 0 */
- { /* i_total 1 */
- { 0x5, 6 }, /* str=000101 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 2 */
- { 0x7, 8 }, /* str=00000111 */
- { 0x4, 6 }, /* str=000100 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x6, 8 }, /* str=00000110 */
- { 0x5, 7 }, /* str=0000101 */
- { 0x3, 5 }, /* str=00011 */
- },
- { /* i_total 4 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 8 }, /* str=00000101 */
- { 0x3, 6 }, /* str=000011 */
- },
- { /* i_total 5 */
- { 0x7, 11 }, /* str=00000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0x4, 7 }, /* str=0000100 */
- },
- { /* i_total 6 */
- { 0xf, 13 }, /* str=0000000001111 */
- { 0x6, 11 }, /* str=00000000110 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x4, 8 }, /* str=00000100 */
- },
- { /* i_total 7 */
- { 0xb, 13 }, /* str=0000000001011 */
- { 0xe, 13 }, /* str=0000000001110 */
- { 0x5, 11 }, /* str=00000000101 */
- { 0x4, 9 }, /* str=000000100 */
- },
- { /* i_total 8 */
- { 0x8, 13 }, /* str=0000000001000 */
- { 0xa, 13 }, /* str=0000000001010 */
- { 0xd, 13 }, /* str=0000000001101 */
- { 0x4, 10 }, /* str=0000000100 */
- },
- { /* i_total 9 */
- { 0xf, 14 }, /* str=00000000001111 */
- { 0xe, 14 }, /* str=00000000001110 */
- { 0x9, 13 }, /* str=0000000001001 */
- { 0x4, 11 }, /* str=00000000100 */
- },
- { /* i_total 10 */
- { 0xb, 14 }, /* str=00000000001011 */
- { 0xa, 14 }, /* str=00000000001010 */
- { 0xd, 14 }, /* str=00000000001101 */
- { 0xc, 13 }, /* str=0000000001100 */
- },
- { /* i_total 14 */
- { 0xf, 15 }, /* str=000000000001111 */
- { 0xe, 15 }, /* str=000000000001110 */
- { 0x9, 14 }, /* str=00000000001001 */
- { 0xc, 14 }, /* str=00000000001100 */
- },
- { /* i_total 12 */
- { 0xb, 15 }, /* str=000000000001011 */
- { 0xa, 15 }, /* str=000000000001010 */
- { 0xd, 15 }, /* str=000000000001101 */
- { 0x8, 14 }, /* str=00000000001000 */
- },
- { /* i_total 13 */
- { 0xf, 16 }, /* str=0000000000001111 */
- { 0x1, 15 }, /* str=000000000000001 */
- { 0x9, 15 }, /* str=000000000001001 */
- { 0xc, 15 }, /* str=000000000001100 */
- },
- { /* i_total 14 */
- { 0xb, 16 }, /* str=0000000000001011 */
- { 0xe, 16 }, /* str=0000000000001110 */
- { 0xd, 16 }, /* str=0000000000001101 */
- { 0x8, 15 }, /* str=000000000001000 */
- },
- { /* i_total 15 */
- { 0x7, 16 }, /* str=0000000000000111 */
- { 0xa, 16 }, /* str=0000000000001010 */
- { 0x9, 16 }, /* str=0000000000001001 */
- { 0xc, 16 }, /* str=0000000000001100 */
- },
- { /* i_total 16 */
- { 0x4, 16 }, /* str=0000000000000100 */
- { 0x6, 16 }, /* str=0000000000000110 */
- { 0x5, 16 }, /* str=0000000000000101 */
- { 0x8, 16 }, /* str=0000000000001000 */
- },
- },
- { /* table 1 */
- { /* i_total 1 */
- { 0xb, 6 }, /* str=001011 */
- { 0x2, 2 }, /* str=10 */
- },
- { /* i_total 2 */
- { 0x7, 6 }, /* str=000111 */
- { 0x7, 5 }, /* str=00111 */
- { 0x3, 3 }, /* str=011 */
- },
- { /* i_total 3 */
- { 0x7, 7 }, /* str=0000111 */
- { 0xa, 6 }, /* str=001010 */
- { 0x9, 6 }, /* str=001001 */
- { 0x5, 4 }, /* str=0101 */
- },
- { /* i_total 4 */
- { 0x7, 8 }, /* str=00000111 */
- { 0x6, 6 }, /* str=000110 */
- { 0x5, 6 }, /* str=000101 */
- { 0x4, 4 }, /* str=0100 */
- },
- { /* i_total 5 */
- { 0x4, 8 }, /* str=00000100 */
- { 0x6, 7 }, /* str=0000110 */
- { 0x5, 7 }, /* str=0000101 */
- { 0x6, 5 }, /* str=00110 */
- },
- { /* i_total 6 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x6, 8 }, /* str=00000110 */
- { 0x5, 8 }, /* str=00000101 */
- { 0x8, 6 }, /* str=001000 */
- },
- { /* i_total 7 */
- { 0xf, 11 }, /* str=00000001111 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0x4, 6 }, /* str=000100 */
- },
- { /* i_total 8 */
- { 0xb, 11 }, /* str=00000001011 */
- { 0xe, 11 }, /* str=00000001110 */
- { 0xd, 11 }, /* str=00000001101 */
- { 0x4, 7 }, /* str=0000100 */
- },
- { /* i_total 9 */
- { 0xf, 12 }, /* str=000000001111 */
- { 0xa, 11 }, /* str=00000001010 */
- { 0x9, 11 }, /* str=00000001001 */
- { 0x4, 9 }, /* str=000000100 */
- },
- { /* i_total 10 */
- { 0xb, 12 }, /* str=000000001011 */
- { 0xe, 12 }, /* str=000000001110 */
- { 0xd, 12 }, /* str=000000001101 */
- { 0xc, 11 }, /* str=00000001100 */
- },
- { /* i_total 11 */
- { 0x8, 12 }, /* str=000000001000 */
- { 0xa, 12 }, /* str=000000001010 */
- { 0x9, 12 }, /* str=000000001001 */
- { 0x8, 11 }, /* str=00000001000 */
- },
- { /* i_total 12 */
- { 0xf, 13 }, /* str=0000000001111 */
- { 0xe, 13 }, /* str=0000000001110 */
- { 0xd, 13 }, /* str=0000000001101 */
- { 0xc, 12 }, /* str=000000001100 */
- },
- { /* i_total 13 */
- { 0xb, 13 }, /* str=0000000001011 */
- { 0xa, 13 }, /* str=0000000001010 */
- { 0x9, 13 }, /* str=0000000001001 */
- { 0xc, 13 }, /* str=0000000001100 */
- },
- { /* i_total 14 */
- { 0x7, 13 }, /* str=0000000000111 */
- { 0xb, 14 }, /* str=00000000001011 */
- { 0x6, 13 }, /* str=0000000000110 */
- { 0x8, 13 }, /* str=0000000001000 */
- },
- { /* i_total 15 */
- { 0x9, 14 }, /* str=00000000001001 */
- { 0x8, 14 }, /* str=00000000001000 */
- { 0xa, 14 }, /* str=00000000001010 */
- { 0x1, 13 }, /* str=0000000000001 */
- },
- { /* i_total 16 */
- { 0x7, 14 }, /* str=00000000000111 */
- { 0x6, 14 }, /* str=00000000000110 */
- { 0x5, 14 }, /* str=00000000000101 */
- { 0x4, 14 }, /* str=00000000000100 */
- },
- },
- { /* table 2 */
- { /* i_total 1 */
- { 0xf, 6 }, /* str=001111 */
- { 0xe, 4 }, /* str=1110 */
- },
- { /* i_total 2 */
- { 0xb, 6 }, /* str=001011 */
- { 0xf, 5 }, /* str=01111 */
- { 0xd, 4 }, /* str=1101 */
- },
- { /* i_total 3 */
- { 0x8, 6 }, /* str=001000 */
- { 0xc, 5 }, /* str=01100 */
- { 0xe, 5 }, /* str=01110 */
- { 0xc, 4 }, /* str=1100 */
- },
- { /* i_total 4 */
- { 0xf, 7 }, /* str=0001111 */
- { 0xa, 5 }, /* str=01010 */
- { 0xb, 5 }, /* str=01011 */
- { 0xb, 4 }, /* str=1011 */
- },
- { /* i_total 5 */
- { 0xb, 7 }, /* str=0001011 */
- { 0x8, 5 }, /* str=01000 */
- { 0x9, 5 }, /* str=01001 */
- { 0xa, 4 }, /* str=1010 */
- },
- { /* i_total 6 */
- { 0x9, 7 }, /* str=0001001 */
- { 0xe, 6 }, /* str=001110 */
- { 0xd, 6 }, /* str=001101 */
- { 0x9, 4 }, /* str=1001 */
- },
- { /* i_total 7 */
- { 0x8, 7 }, /* str=0001000 */
- { 0xa, 6 }, /* str=001010 */
- { 0x9, 6 }, /* str=001001 */
- { 0x8, 4 }, /* str=1000 */
- },
- { /* i_total 8 */
- { 0xf, 8 }, /* str=00001111 */
- { 0xe, 7 }, /* str=0001110 */
- { 0xd, 7 }, /* str=0001101 */
- { 0xd, 5 }, /* str=01101 */
- },
- { /* i_total 9 */
- { 0xb, 8 }, /* str=00001011 */
- { 0xe, 8 }, /* str=00001110 */
- { 0xa, 7 }, /* str=0001010 */
- { 0xc, 6 }, /* str=001100 */
- },
- { /* i_total 10 */
- { 0xf, 9 }, /* str=000001111 */
- { 0xa, 8 }, /* str=00001010 */
- { 0xd, 8 }, /* str=00001101 */
- { 0xc, 7 }, /* str=0001100 */
- },
- { /* i_total 11 */
- { 0xb, 9 }, /* str=000001011 */
- { 0xe, 9 }, /* str=000001110 */
- { 0x9, 8 }, /* str=00001001 */
- { 0xc, 8 }, /* str=00001100 */
- },
- { /* i_total 12 */
- { 0x8, 9 }, /* str=000001000 */
- { 0xa, 9 }, /* str=000001010 */
- { 0xd, 9 }, /* str=000001101 */
- { 0x8, 8 }, /* str=00001000 */
- },
- { /* i_total 13 */
- { 0xd, 10 }, /* str=0000001101 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x9, 9 }, /* str=000001001 */
- { 0xc, 9 }, /* str=000001100 */
- },
- { /* i_total 14 */
- { 0x9, 10 }, /* str=0000001001 */
- { 0xc, 10 }, /* str=0000001100 */
- { 0xb, 10 }, /* str=0000001011 */
- { 0xa, 10 }, /* str=0000001010 */
- },
- { /* i_total 15 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x8, 10 }, /* str=0000001000 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- },
- { /* i_total 16 */
- { 0x1, 10 }, /* str=0000000001 */
- { 0x4, 10 }, /* str=0000000100 */
- { 0x3, 10 }, /* str=0000000011 */
- { 0x2, 10 }, /* str=0000000010 */
- },
- },
- { /* table 3 */
- { /* i_total 1 */
- { 0x0, 6 }, /* str=000000 */
- { 0x1, 6 }, /* str=000001 */
- },
- { /* i_total 2 */
- { 0x4, 6 }, /* str=000100 */
- { 0x5, 6 }, /* str=000101 */
- { 0x6, 6 }, /* str=000110 */
- },
- { /* i_total 3 */
- { 0x8, 6 }, /* str=001000 */
- { 0x9, 6 }, /* str=001001 */
- { 0xa, 6 }, /* str=001010 */
- { 0xb, 6 }, /* str=001011 */
- },
- { /* i_total 4 */
- { 0xc, 6 }, /* str=001100 */
- { 0xd, 6 }, /* str=001101 */
- { 0xe, 6 }, /* str=001110 */
- { 0xf, 6 }, /* str=001111 */
- },
- { /* i_total 5 */
- { 0x10, 6 }, /* str=010000 */
- { 0x11, 6 }, /* str=010001 */
- { 0x12, 6 }, /* str=010010 */
- { 0x13, 6 }, /* str=010011 */
- },
- { /* i_total 6 */
- { 0x14, 6 }, /* str=010100 */
- { 0x15, 6 }, /* str=010101 */
- { 0x16, 6 }, /* str=010110 */
- { 0x17, 6 }, /* str=010111 */
- },
- { /* i_total 7 */
- { 0x18, 6 }, /* str=011000 */
- { 0x19, 6 }, /* str=011001 */
- { 0x1a, 6 }, /* str=011010 */
- { 0x1b, 6 }, /* str=011011 */
- },
- { /* i_total 8 */
- { 0x1c, 6 }, /* str=011100 */
- { 0x1d, 6 }, /* str=011101 */
- { 0x1e, 6 }, /* str=011110 */
- { 0x1f, 6 }, /* str=011111 */
- },
- { /* i_total 9 */
- { 0x20, 6 }, /* str=100000 */
- { 0x21, 6 }, /* str=100001 */
- { 0x22, 6 }, /* str=100010 */
- { 0x23, 6 }, /* str=100011 */
- },
- { /* i_total 10 */
- { 0x24, 6 }, /* str=100100 */
- { 0x25, 6 }, /* str=100101 */
- { 0x26, 6 }, /* str=100110 */
- { 0x27, 6 }, /* str=100111 */
- },
- { /* i_total 11 */
- { 0x28, 6 }, /* str=101000 */
- { 0x29, 6 }, /* str=101001 */
- { 0x2a, 6 }, /* str=101010 */
- { 0x2b, 6 }, /* str=101011 */
- },
- { /* i_total 12 */
- { 0x2c, 6 }, /* str=101100 */
- { 0x2d, 6 }, /* str=101101 */
- { 0x2e, 6 }, /* str=101110 */
- { 0x2f, 6 }, /* str=101111 */
- },
- { /* i_total 13 */
- { 0x30, 6 }, /* str=110000 */
- { 0x31, 6 }, /* str=110001 */
- { 0x32, 6 }, /* str=110010 */
- { 0x33, 6 }, /* str=110011 */
- },
- { /* i_total 14 */
- { 0x34, 6 }, /* str=110100 */
- { 0x35, 6 }, /* str=110101 */
- { 0x36, 6 }, /* str=110110 */
- { 0x37, 6 }, /* str=110111 */
- },
- { /* i_total 15 */
- { 0x38, 6 }, /* str=111000 */
- { 0x39, 6 }, /* str=111001 */
- { 0x3a, 6 }, /* str=111010 */
- { 0x3b, 6 }, /* str=111011 */
- },
- { /* i_total 16 */
- { 0x3c, 6 }, /* str=111100 */
- { 0x3d, 6 }, /* str=111101 */
- { 0x3e, 6 }, /* str=111110 */
- { 0x3f, 6 }, /* str=111111 */
- },
- },
- { /* table 4 */
- { /* i_total 1 */
- { 0x7, 6 }, /* str=000111 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 2 */
- { 0x4, 6 }, /* str=000100 */
- { 0x6, 6 }, /* str=000110 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x3, 6 }, /* str=000011 */
- { 0x3, 7 }, /* str=0000011 */
- { 0x2, 7 }, /* str=0000010 */
- { 0x5, 6 }, /* str=000101 */
- },
- { /* i_total 4 */
- { 0x2, 6 }, /* str=000010 */
- { 0x3, 8 }, /* str=00000011 */
- { 0x2, 8 }, /* str=00000010 */
- { 0x0, 7 }, /* str=0000000 */
- },
- },
- { /* table 5 */
- { /* i_total 1 */
- { 0xf, 7 }, /* str=0001111 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 2 */
- { 0xe, 7 }, /* str=0001110 */
- { 0xd, 7 }, /* str=0001101 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x7, 9 }, /* str=000000111 */
- { 0xc, 7 }, /* str=0001100 */
- { 0xb, 7 }, /* str=0001011 */
- { 0x1, 5 }, /* str=00001 */
- },
- { /* i_total 4 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0xa, 7 }, /* str=0001010 */
- { 0x1, 6 }, /* str=000001 */
- },
- { /* i_total 5 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- { 0x4, 9 }, /* str=000000100 */
- { 0x9, 7 }, /* str=0001001 */
- },
- { /* i_total 6 */
- { 0x7, 11 }, /* str=00000000111 */
- { 0x6, 11 }, /* str=00000000110 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x8, 7 }, /* str=0001000 */
- },
- { /* i_total 7 */
- { 0x7, 12 }, /* str=000000000111 */
- { 0x6, 12 }, /* str=000000000110 */
- { 0x5, 11 }, /* str=00000000101 */
- { 0x4, 10 }, /* str=0000000100 */
- },
- { /* i_total 8 */
- { 0x7, 13 }, /* str=0000000000111 */
- { 0x5, 12 }, /* str=000000000101 */
- { 0x4, 12 }, /* str=000000000100 */
- { 0x4, 11 }, /* str=00000000100 */
- },
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros[15][16] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x3, 4 }, /* str=0011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x3, 6 }, /* str=000011 */
- { 0x2, 6 }, /* str=000010 */
- { 0x3, 7 }, /* str=0000011 */
- { 0x2, 7 }, /* str=0000010 */
- { 0x3, 8 }, /* str=00000011 */
- { 0x2, 8 }, /* str=00000010 */
- { 0x3, 9 }, /* str=000000011 */
- { 0x2, 9 }, /* str=000000010 */
- { 0x1, 9 }, /* str=000000001 */
- },
- { /* i_total 2 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x3, 6 }, /* str=000011 */
- { 0x2, 6 }, /* str=000010 */
- { 0x1, 6 }, /* str=000001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 3 */
- { 0x5, 4 }, /* str=0101 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 4 */
- { 0x3, 5 }, /* str=00011 */
- { 0x7, 3 }, /* str=111 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x2, 5 }, /* str=00010 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 5 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x1, 5 }, /* str=00001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 6 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 7 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 8 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x3, 3 }, /* str=011 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 9 */
- { 0x1, 6 }, /* str=000001 */
- { 0x0, 6 }, /* str=000000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 5 }, /* str=00001 */
- },
- { /* i_total 10 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- { 0x1, 3 }, /* str=001 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 4 }, /* str=0001 */
- },
- { /* i_total 11 */
- { 0x0, 4 }, /* str=0000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 1 }, /* str=1 */
- { 0x3, 3 }, /* str=011 */
- },
- { /* i_total 12 */
- { 0x0, 4 }, /* str=0000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 13 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 14 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 15 */
- { 0x0, 1 }, /* str=0 */
- { 0x1, 1 }, /* str=1 */
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros_2x2_dc[3][4] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 } /* str=000 */
- },
- { /* i_total 2 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_total 3 */
- { 0x1, 1 }, /* str=1 */
- { 0x0, 1 }, /* str=0 */
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros_2x4_dc[7][8] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x2, 3 }, /* str=010 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 4 }, /* str=0011 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 2 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x4, 3 }, /* str=100 */
- { 0x5, 3 }, /* str=101 */
- { 0x6, 3 }, /* str=110 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 3 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x6, 3 }, /* str=110 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 4 */
- { 0x6, 3 }, /* str=110 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 5 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x3, 2 }, /* str=11 */
- },
- { /* i_total 6 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 7 */
- { 0x0, 1 }, /* str=0 */
- { 0x1, 1 }, /* str=1 */
- }
-};
-
-/* [MIN( i_zero_left-1, 6 )][run_before] */
-static const vlc_t run_before[7][16] =
-{
- { /* i_zero_left 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x0, 1 }, /* str=0 */
- },
- { /* i_zero_left 2 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_zero_left 3 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_zero_left 4 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 }, /* str=000 */
- },
- { /* i_zero_left 5 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 }, /* str=000 */
- },
- { /* i_zero_left 6 */
- { 0x3, 2 }, /* str=11 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- },
- { /* i_zero_left >6 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 7 }, /* str=0000001 */
- { 0x1, 8 }, /* str=00000001 */
- { 0x1, 9 }, /* str=000000001 */
- { 0x1, 10 }, /* str=0000000001 */
- { 0x1, 11 }, /* str=00000000001 */
- },
-};
-
vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE];
uint32_t x264_run_before[1<<16];
@@ -842,7 +71,9 @@
vlc->i_next = i_next;
}
- for( int i = 1; i < (1<<16); i++ )
+ x264_run_before[0] = 0;
+ x264_run_before[1] = 0;
+ for( uint32_t i = 2; i < (1<<16); i++ )
{
x264_run_level_t runlevel;
ALIGNED_ARRAY_16( dctcoef, dct, [16] );
@@ -857,10 +88,10 @@
{
int idx = X264_MIN(zeros, 7) - 1;
int run = x264_clz( mask );
- int len = run_before[idx][run].i_size;
+ int len = x264_run_before_init[idx][run].i_size;
size += len;
bits <<= len;
- bits |= run_before[idx][run].i_bits;
+ bits |= x264_run_before_init[idx][run].i_bits;
zeros -= run;
mask <<= run + 1;
}
diff -ur x264-go/x264c/external/x264/common/win32thread.c x264-go.new/x264c/external/x264/common/win32thread.c
--- x264-go/x264c/external/x264/common/win32thread.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/win32thread.c 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* win32thread.c: windows threading
*****************************************************************************
- * Copyright (C) 2010-2017 x264 project
+ * Copyright (C) 2010-2020 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
* Pegasys Inc. <http://www.pegasys-inc.com>
@@ -31,7 +31,7 @@
/* Based on the agreed standing that x264 does not need to utilize >64 logical cpus,
* this API does not detect nor utilize more than 64 cpus for systems that have them. */
-#include "common.h"
+#include "base.h"
#if HAVE_WINRT
/* _beginthreadex() is technically the correct option, but it's only available for Desktop applications.
@@ -51,7 +51,7 @@
static x264_pthread_mutex_t static_mutex;
/* _beginthreadex requires that the start routine is __stdcall */
-static unsigned __stdcall x264_win32thread_worker( void *arg )
+static unsigned __stdcall win32thread_worker( void *arg )
{
x264_pthread_t *h = arg;
*h->p_ret = h->func( h->arg );
@@ -65,7 +65,7 @@
thread->arg = arg;
thread->p_ret = &thread->ret;
thread->ret = NULL;
- thread->handle = (void*)_beginthreadex( NULL, 0, x264_win32thread_worker, thread, 0, NULL );
+ thread->handle = (void*)_beginthreadex( NULL, 0, win32thread_worker, thread, 0, NULL );
return !thread->handle;
}
@@ -95,7 +95,15 @@
{
static const x264_pthread_mutex_t init = X264_PTHREAD_MUTEX_INITIALIZER;
if( !memcmp( mutex, &init, sizeof(x264_pthread_mutex_t) ) )
- *mutex = static_mutex;
+ {
+ int ret = 0;
+ EnterCriticalSection( &static_mutex );
+ if( !memcmp( mutex, &init, sizeof(x264_pthread_mutex_t) ) )
+ ret = x264_pthread_mutex_init( mutex, NULL );
+ LeaveCriticalSection( &static_mutex );
+ if( ret )
+ return ret;
+ }
EnterCriticalSection( mutex );
return 0;
}
diff -ur x264-go/x264c/external/x264/common/win32thread.h x264-go.new/x264c/external/x264/common/win32thread.h
--- x264-go/x264c/external/x264/common/win32thread.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/win32thread.h 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* win32thread.h: windows threading
*****************************************************************************
- * Copyright (C) 2010-2017 x264 project
+ * Copyright (C) 2010-2020 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
*
Only in x264-go.new/x264c/external/x264/common/x86: bitstream-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: bitstream.h
Only in x264-go.new/x264c/external/x264/common/x86: cabac-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: const-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: cpu-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: dct-32.asm
Only in x264-go.new/x264c/external/x264/common/x86: dct-64.asm
Only in x264-go.new/x264c/external/x264/common/x86: dct-a.asm
diff -ur x264-go/x264c/external/x264/common/x86/dct.h x264-go.new/x264c/external/x264/common/x86/dct.h
--- x264-go/x264c/external/x264/common/x86/dct.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/dct.h 2020-06-06 15:20:58.692039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* dct.h: x86 transform and zigzag
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -25,120 +25,225 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_I386_DCT_H
-#define X264_I386_DCT_H
+#ifndef X264_X86_DCT_H
+#define X264_X86_DCT_H
+#define x264_sub4x4_dct_mmx x264_template(sub4x4_dct_mmx)
void x264_sub4x4_dct_mmx ( dctcoef dct [16], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_mmx x264_template(sub8x8_dct_mmx)
void x264_sub8x8_dct_mmx ( dctcoef dct[ 4][16], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct_mmx x264_template(sub16x16_dct_mmx)
void x264_sub16x16_dct_mmx ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_sse2 x264_template(sub8x8_dct_sse2)
void x264_sub8x8_dct_sse2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_sse2 x264_template(sub16x16_dct_sse2)
void x264_sub16x16_dct_sse2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub4x4_dct_ssse3 x264_template(sub4x4_dct_ssse3)
void x264_sub4x4_dct_ssse3 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub4x4_dct_avx512 x264_template(sub4x4_dct_avx512)
void x264_sub4x4_dct_avx512 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_ssse3 x264_template(sub8x8_dct_ssse3)
void x264_sub8x8_dct_ssse3 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_ssse3 x264_template(sub16x16_dct_ssse3)
void x264_sub16x16_dct_ssse3( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx x264_template(sub8x8_dct_avx)
void x264_sub8x8_dct_avx ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx x264_template(sub16x16_dct_avx)
void x264_sub16x16_dct_avx ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_xop x264_template(sub8x8_dct_xop)
void x264_sub8x8_dct_xop ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_xop x264_template(sub16x16_dct_xop)
void x264_sub16x16_dct_xop ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx2 x264_template(sub8x8_dct_avx2)
void x264_sub8x8_dct_avx2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx512 x264_template(sub8x8_dct_avx512)
void x264_sub8x8_dct_avx512 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx2 x264_template(sub16x16_dct_avx2)
void x264_sub16x16_dct_avx2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx512 x264_template(sub16x16_dct_avx512)
void x264_sub16x16_dct_avx512( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_dc_mmx2 x264_template(sub8x8_dct_dc_mmx2)
void x264_sub8x8_dct_dc_mmx2 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_dc_sse2 x264_template(sub8x8_dct_dc_sse2)
void x264_sub8x8_dct_dc_sse2 ( dctcoef dct [ 4], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_dc_avx512 x264_template(sub8x8_dct_dc_avx512)
void x264_sub8x8_dct_dc_avx512 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_sse2 x264_template(sub8x16_dct_dc_sse2)
void x264_sub8x16_dct_dc_sse2 ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 );
+#define x264_sub8x16_dct_dc_ssse3 x264_template(sub8x16_dct_dc_ssse3)
void x264_sub8x16_dct_dc_ssse3 ( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_avx x264_template(sub8x16_dct_dc_avx)
void x264_sub8x16_dct_dc_avx ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 );
+#define x264_sub8x16_dct_dc_avx512 x264_template(sub8x16_dct_dc_avx512)
void x264_sub8x16_dct_dc_avx512( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_mmx x264_template(add4x4_idct_mmx)
void x264_add4x4_idct_mmx ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add4x4_idct_sse2 x264_template(add4x4_idct_sse2)
void x264_add4x4_idct_sse2 ( uint16_t *p_dst, int32_t dct [16] );
+#define x264_add4x4_idct_sse4 x264_template(add4x4_idct_sse4)
void x264_add4x4_idct_sse4 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add4x4_idct_avx x264_template(add4x4_idct_avx)
void x264_add4x4_idct_avx ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add8x8_idct_mmx x264_template(add8x8_idct_mmx)
void x264_add8x8_idct_mmx ( uint8_t *p_dst, int16_t dct[ 4][16] );
+#define x264_add8x8_idct_dc_mmx2 x264_template(add8x8_idct_dc_mmx2)
void x264_add8x8_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [ 4] );
+#define x264_add16x16_idct_mmx x264_template(add16x16_idct_mmx)
void x264_add16x16_idct_mmx ( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add16x16_idct_dc_mmx2 x264_template(add16x16_idct_dc_mmx2)
void x264_add16x16_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add8x8_idct_sse2 x264_template(add8x8_idct_sse2)
void x264_add8x8_idct_sse2 ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx x264_template(add8x8_idct_avx)
void x264_add8x8_idct_avx ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx2 x264_template(add8x8_idct_avx2)
void x264_add8x8_idct_avx2 ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx512 x264_template(add8x8_idct_avx512)
void x264_add8x8_idct_avx512 ( uint8_t *p_dst, int16_t dct[ 4][16] );
+#define x264_add16x16_idct_sse2 x264_template(add16x16_idct_sse2)
void x264_add16x16_idct_sse2 ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add16x16_idct_avx x264_template(add16x16_idct_avx)
void x264_add16x16_idct_avx ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add16x16_idct_avx2 x264_template(add16x16_idct_avx2)
void x264_add16x16_idct_avx2 ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add8x8_idct_dc_sse2 x264_template(add8x8_idct_dc_sse2)
void x264_add8x8_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [ 4] );
+#define x264_add16x16_idct_dc_sse2 x264_template(add16x16_idct_dc_sse2)
void x264_add16x16_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add8x8_idct_dc_ssse3 x264_template(add8x8_idct_dc_ssse3)
void x264_add8x8_idct_dc_ssse3 ( uint8_t *p_dst, int16_t dct [ 4] );
+#define x264_add16x16_idct_dc_ssse3 x264_template(add16x16_idct_dc_ssse3)
void x264_add16x16_idct_dc_ssse3( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add8x8_idct_dc_avx x264_template(add8x8_idct_dc_avx)
void x264_add8x8_idct_dc_avx ( pixel *p_dst, dctcoef dct [ 4] );
+#define x264_add16x16_idct_dc_avx x264_template(add16x16_idct_dc_avx)
void x264_add16x16_idct_dc_avx ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add16x16_idct_dc_avx2 x264_template(add16x16_idct_dc_avx2)
void x264_add16x16_idct_dc_avx2 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_dct4x4dc_mmx2 x264_template(dct4x4dc_mmx2)
void x264_dct4x4dc_mmx2 ( int16_t d[16] );
+#define x264_dct4x4dc_sse2 x264_template(dct4x4dc_sse2)
void x264_dct4x4dc_sse2 ( int32_t d[16] );
+#define x264_dct4x4dc_avx x264_template(dct4x4dc_avx)
void x264_dct4x4dc_avx ( int32_t d[16] );
+#define x264_idct4x4dc_mmx x264_template(idct4x4dc_mmx)
void x264_idct4x4dc_mmx ( int16_t d[16] );
+#define x264_idct4x4dc_sse2 x264_template(idct4x4dc_sse2)
void x264_idct4x4dc_sse2 ( int32_t d[16] );
+#define x264_idct4x4dc_avx x264_template(idct4x4dc_avx)
void x264_idct4x4dc_avx ( int32_t d[16] );
+#define x264_dct2x4dc_mmx2 x264_template(dct2x4dc_mmx2)
void x264_dct2x4dc_mmx2( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_dct2x4dc_sse2 x264_template(dct2x4dc_sse2)
void x264_dct2x4dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_dct2x4dc_avx x264_template(dct2x4dc_avx)
void x264_dct2x4dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_sub8x8_dct8_mmx x264_template(sub8x8_dct8_mmx)
void x264_sub8x8_dct8_mmx ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_mmx x264_template(sub16x16_dct8_mmx)
void x264_sub16x16_dct8_mmx ( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_sse2 x264_template(sub8x8_dct8_sse2)
void x264_sub8x8_dct8_sse2 ( dctcoef dct [64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_sse2 x264_template(sub16x16_dct8_sse2)
void x264_sub16x16_dct8_sse2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct8_ssse3 x264_template(sub8x8_dct8_ssse3)
void x264_sub8x8_dct8_ssse3 ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_ssse3 x264_template(sub16x16_dct8_ssse3)
void x264_sub16x16_dct8_ssse3( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_sse4 x264_template(sub8x8_dct8_sse4)
void x264_sub8x8_dct8_sse4 ( int32_t dct [64], uint16_t *pix1, uint16_t *pix2 );
+#define x264_sub16x16_dct8_sse4 x264_template(sub16x16_dct8_sse4)
void x264_sub16x16_dct8_sse4 ( int32_t dct[4][64], uint16_t *pix1, uint16_t *pix2 );
+#define x264_sub8x8_dct8_avx x264_template(sub8x8_dct8_avx)
void x264_sub8x8_dct8_avx ( dctcoef dct [64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_avx x264_template(sub16x16_dct8_avx)
void x264_sub16x16_dct8_avx ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_avx2 x264_template(sub16x16_dct8_avx2)
void x264_sub16x16_dct8_avx2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_add8x8_idct8_mmx x264_template(add8x8_idct8_mmx)
void x264_add8x8_idct8_mmx ( uint8_t *dst, int16_t dct [64] );
+#define x264_add16x16_idct8_mmx x264_template(add16x16_idct8_mmx)
void x264_add16x16_idct8_mmx ( uint8_t *dst, int16_t dct[4][64] );
+#define x264_add8x8_idct8_sse2 x264_template(add8x8_idct8_sse2)
void x264_add8x8_idct8_sse2 ( pixel *dst, dctcoef dct [64] );
+#define x264_add16x16_idct8_sse2 x264_template(add16x16_idct8_sse2)
void x264_add16x16_idct8_sse2( pixel *dst, dctcoef dct[4][64] );
+#define x264_add8x8_idct8_avx x264_template(add8x8_idct8_avx)
void x264_add8x8_idct8_avx ( pixel *dst, dctcoef dct [64] );
+#define x264_add16x16_idct8_avx x264_template(add16x16_idct8_avx)
void x264_add16x16_idct8_avx ( pixel *dst, dctcoef dct[4][64] );
+#define x264_zigzag_scan_8x8_frame_mmx2 x264_template(zigzag_scan_8x8_frame_mmx2)
void x264_zigzag_scan_8x8_frame_mmx2 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_sse2 x264_template(zigzag_scan_8x8_frame_sse2)
void x264_zigzag_scan_8x8_frame_sse2 ( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_8x8_frame_ssse3 x264_template(zigzag_scan_8x8_frame_ssse3)
void x264_zigzag_scan_8x8_frame_ssse3 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_avx x264_template(zigzag_scan_8x8_frame_avx)
void x264_zigzag_scan_8x8_frame_avx ( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_8x8_frame_xop x264_template(zigzag_scan_8x8_frame_xop)
void x264_zigzag_scan_8x8_frame_xop ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_avx512 x264_template(zigzag_scan_8x8_frame_avx512)
void x264_zigzag_scan_8x8_frame_avx512( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_4x4_frame_mmx x264_template(zigzag_scan_4x4_frame_mmx)
void x264_zigzag_scan_4x4_frame_mmx ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_sse2 x264_template(zigzag_scan_4x4_frame_sse2)
void x264_zigzag_scan_4x4_frame_sse2 ( int32_t level[16], int32_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_ssse3 x264_template(zigzag_scan_4x4_frame_ssse3)
void x264_zigzag_scan_4x4_frame_ssse3 ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_avx x264_template(zigzag_scan_4x4_frame_avx)
void x264_zigzag_scan_4x4_frame_avx ( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_frame_xop x264_template(zigzag_scan_4x4_frame_xop)
void x264_zigzag_scan_4x4_frame_xop ( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_frame_avx512 x264_template(zigzag_scan_4x4_frame_avx512)
void x264_zigzag_scan_4x4_frame_avx512( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_field_sse x264_template(zigzag_scan_4x4_field_sse)
void x264_zigzag_scan_4x4_field_sse ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_field_sse2 x264_template(zigzag_scan_4x4_field_sse2)
void x264_zigzag_scan_4x4_field_sse2 ( int32_t level[16], int32_t dct[16] );
+#define x264_zigzag_scan_4x4_field_avx512 x264_template(zigzag_scan_4x4_field_avx512)
void x264_zigzag_scan_4x4_field_avx512( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_8x8_field_mmx2 x264_template(zigzag_scan_8x8_field_mmx2)
void x264_zigzag_scan_8x8_field_mmx2 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_sse4 x264_template(zigzag_scan_8x8_field_sse4)
void x264_zigzag_scan_8x8_field_sse4 ( int32_t level[64], int32_t dct[64] );
+#define x264_zigzag_scan_8x8_field_avx x264_template(zigzag_scan_8x8_field_avx)
void x264_zigzag_scan_8x8_field_avx ( int32_t level[64], int32_t dct[64] );
+#define x264_zigzag_scan_8x8_field_xop x264_template(zigzag_scan_8x8_field_xop)
void x264_zigzag_scan_8x8_field_xop ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_avx512 x264_template(zigzag_scan_8x8_field_avx512)
void x264_zigzag_scan_8x8_field_avx512( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_sub_4x4_frame_avx x264_template(zigzag_sub_4x4_frame_avx)
int x264_zigzag_sub_4x4_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4_frame_ssse3 x264_template(zigzag_sub_4x4_frame_ssse3)
int x264_zigzag_sub_4x4_frame_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4ac_frame_avx x264_template(zigzag_sub_4x4ac_frame_avx)
int x264_zigzag_sub_4x4ac_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4ac_frame_ssse3 x264_template(zigzag_sub_4x4ac_frame_ssse3)
int x264_zigzag_sub_4x4ac_frame_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4_field_avx x264_template(zigzag_sub_4x4_field_avx)
int x264_zigzag_sub_4x4_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4_field_ssse3 x264_template(zigzag_sub_4x4_field_ssse3)
int x264_zigzag_sub_4x4_field_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4ac_field_avx x264_template(zigzag_sub_4x4ac_field_avx)
int x264_zigzag_sub_4x4ac_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4ac_field_ssse3 x264_template(zigzag_sub_4x4ac_field_ssse3)
int x264_zigzag_sub_4x4ac_field_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_interleave_8x8_cavlc_mmx x264_template(zigzag_interleave_8x8_cavlc_mmx)
void x264_zigzag_interleave_8x8_cavlc_mmx ( int16_t *dst, int16_t *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_sse2 x264_template(zigzag_interleave_8x8_cavlc_sse2)
void x264_zigzag_interleave_8x8_cavlc_sse2 ( dctcoef *dst, dctcoef *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx x264_template(zigzag_interleave_8x8_cavlc_avx)
void x264_zigzag_interleave_8x8_cavlc_avx ( dctcoef *dst, dctcoef *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx2 x264_template(zigzag_interleave_8x8_cavlc_avx2)
void x264_zigzag_interleave_8x8_cavlc_avx2 ( int16_t *dst, int16_t *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx512 x264_template(zigzag_interleave_8x8_cavlc_avx512)
void x264_zigzag_interleave_8x8_cavlc_avx512( dctcoef *dst, dctcoef *src, uint8_t *nnz );
#endif
Only in x264-go.new/x264c/external/x264/common/x86: deblock-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: deblock.h
Only in x264-go.new/x264c/external/x264/common/x86: mc-a2.asm
Only in x264-go.new/x264c/external/x264/common/x86: mc-a.asm
diff -ur x264-go/x264c/external/x264/common/x86/mc-c.c x264-go.new/x264c/external/x264/common/x86/mc-c.c
--- x264-go/x264c/external/x264/common/x86/mc-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/mc-c.c 2020-06-06 15:20:58.693039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc-c.c: x86 motion compensation
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -28,6 +28,40 @@
#include "common/common.h"
#include "mc.h"
+#define x264_pixel_avg_16x16_avx2 x264_template(pixel_avg_16x16_avx2)
+#define x264_pixel_avg_16x16_avx512 x264_template(pixel_avg_16x16_avx512)
+#define x264_pixel_avg_16x16_mmx2 x264_template(pixel_avg_16x16_mmx2)
+#define x264_pixel_avg_16x16_sse2 x264_template(pixel_avg_16x16_sse2)
+#define x264_pixel_avg_16x16_ssse3 x264_template(pixel_avg_16x16_ssse3)
+#define x264_pixel_avg_16x8_avx2 x264_template(pixel_avg_16x8_avx2)
+#define x264_pixel_avg_16x8_avx512 x264_template(pixel_avg_16x8_avx512)
+#define x264_pixel_avg_16x8_mmx2 x264_template(pixel_avg_16x8_mmx2)
+#define x264_pixel_avg_16x8_sse2 x264_template(pixel_avg_16x8_sse2)
+#define x264_pixel_avg_16x8_ssse3 x264_template(pixel_avg_16x8_ssse3)
+#define x264_pixel_avg_4x16_mmx2 x264_template(pixel_avg_4x16_mmx2)
+#define x264_pixel_avg_4x16_sse2 x264_template(pixel_avg_4x16_sse2)
+#define x264_pixel_avg_4x16_ssse3 x264_template(pixel_avg_4x16_ssse3)
+#define x264_pixel_avg_4x2_mmx2 x264_template(pixel_avg_4x2_mmx2)
+#define x264_pixel_avg_4x2_sse2 x264_template(pixel_avg_4x2_sse2)
+#define x264_pixel_avg_4x2_ssse3 x264_template(pixel_avg_4x2_ssse3)
+#define x264_pixel_avg_4x4_mmx2 x264_template(pixel_avg_4x4_mmx2)
+#define x264_pixel_avg_4x4_sse2 x264_template(pixel_avg_4x4_sse2)
+#define x264_pixel_avg_4x4_ssse3 x264_template(pixel_avg_4x4_ssse3)
+#define x264_pixel_avg_4x8_mmx2 x264_template(pixel_avg_4x8_mmx2)
+#define x264_pixel_avg_4x8_sse2 x264_template(pixel_avg_4x8_sse2)
+#define x264_pixel_avg_4x8_ssse3 x264_template(pixel_avg_4x8_ssse3)
+#define x264_pixel_avg_8x16_avx512 x264_template(pixel_avg_8x16_avx512)
+#define x264_pixel_avg_8x16_mmx2 x264_template(pixel_avg_8x16_mmx2)
+#define x264_pixel_avg_8x16_sse2 x264_template(pixel_avg_8x16_sse2)
+#define x264_pixel_avg_8x16_ssse3 x264_template(pixel_avg_8x16_ssse3)
+#define x264_pixel_avg_8x4_avx512 x264_template(pixel_avg_8x4_avx512)
+#define x264_pixel_avg_8x4_mmx2 x264_template(pixel_avg_8x4_mmx2)
+#define x264_pixel_avg_8x4_sse2 x264_template(pixel_avg_8x4_sse2)
+#define x264_pixel_avg_8x4_ssse3 x264_template(pixel_avg_8x4_ssse3)
+#define x264_pixel_avg_8x8_avx512 x264_template(pixel_avg_8x8_avx512)
+#define x264_pixel_avg_8x8_mmx2 x264_template(pixel_avg_8x8_mmx2)
+#define x264_pixel_avg_8x8_sse2 x264_template(pixel_avg_8x8_sse2)
+#define x264_pixel_avg_8x8_ssse3 x264_template(pixel_avg_8x8_ssse3)
#define DECL_SUF( func, args )\
void func##_mmx2 args;\
void func##_sse2 args;\
@@ -44,10 +78,43 @@
DECL_SUF( x264_pixel_avg_4x8, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int ))
DECL_SUF( x264_pixel_avg_4x4, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int ))
DECL_SUF( x264_pixel_avg_4x2, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int ))
+#undef DECL_SUF
+#define x264_mc_weight_w12_mmx2 x264_template(mc_weight_w12_mmx2)
+#define x264_mc_weight_w12_sse2 x264_template(mc_weight_w12_sse2)
+#define x264_mc_weight_w16_avx2 x264_template(mc_weight_w16_avx2)
+#define x264_mc_weight_w16_mmx2 x264_template(mc_weight_w16_mmx2)
+#define x264_mc_weight_w16_sse2 x264_template(mc_weight_w16_sse2)
+#define x264_mc_weight_w16_ssse3 x264_template(mc_weight_w16_ssse3)
+#define x264_mc_weight_w20_avx2 x264_template(mc_weight_w20_avx2)
+#define x264_mc_weight_w20_mmx2 x264_template(mc_weight_w20_mmx2)
+#define x264_mc_weight_w20_sse2 x264_template(mc_weight_w20_sse2)
+#define x264_mc_weight_w20_ssse3 x264_template(mc_weight_w20_ssse3)
+#define x264_mc_weight_w4_mmx2 x264_template(mc_weight_w4_mmx2)
+#define x264_mc_weight_w4_ssse3 x264_template(mc_weight_w4_ssse3)
+#define x264_mc_weight_w8_avx2 x264_template(mc_weight_w8_avx2)
+#define x264_mc_weight_w8_mmx2 x264_template(mc_weight_w8_mmx2)
+#define x264_mc_weight_w8_sse2 x264_template(mc_weight_w8_sse2)
+#define x264_mc_weight_w8_ssse3 x264_template(mc_weight_w8_ssse3)
#define MC_WEIGHT(w,type) \
void x264_mc_weight_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int );
+#define x264_mc_offsetadd_w12_mmx2 x264_template(mc_offsetadd_w12_mmx2)
+#define x264_mc_offsetadd_w16_mmx2 x264_template(mc_offsetadd_w16_mmx2)
+#define x264_mc_offsetadd_w16_sse2 x264_template(mc_offsetadd_w16_sse2)
+#define x264_mc_offsetadd_w20_mmx2 x264_template(mc_offsetadd_w20_mmx2)
+#define x264_mc_offsetadd_w20_sse2 x264_template(mc_offsetadd_w20_sse2)
+#define x264_mc_offsetadd_w4_mmx2 x264_template(mc_offsetadd_w4_mmx2)
+#define x264_mc_offsetadd_w8_mmx2 x264_template(mc_offsetadd_w8_mmx2)
+#define x264_mc_offsetadd_w8_sse2 x264_template(mc_offsetadd_w8_sse2)
+#define x264_mc_offsetsub_w12_mmx2 x264_template(mc_offsetsub_w12_mmx2)
+#define x264_mc_offsetsub_w16_mmx2 x264_template(mc_offsetsub_w16_mmx2)
+#define x264_mc_offsetsub_w16_sse2 x264_template(mc_offsetsub_w16_sse2)
+#define x264_mc_offsetsub_w20_mmx2 x264_template(mc_offsetsub_w20_mmx2)
+#define x264_mc_offsetsub_w20_sse2 x264_template(mc_offsetsub_w20_sse2)
+#define x264_mc_offsetsub_w4_mmx2 x264_template(mc_offsetsub_w4_mmx2)
+#define x264_mc_offsetsub_w8_mmx2 x264_template(mc_offsetsub_w8_mmx2)
+#define x264_mc_offsetsub_w8_sse2 x264_template(mc_offsetsub_w8_sse2)
#define MC_WEIGHT_OFFSET(w,type) \
void x264_mc_offsetadd_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \
void x264_mc_offsetsub_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \
@@ -73,113 +140,200 @@
MC_WEIGHT( 8, avx2 )
MC_WEIGHT( 16, avx2 )
MC_WEIGHT( 20, avx2 )
-#undef MC_OFFSET
+#undef MC_WEIGHT_OFFSET
#undef MC_WEIGHT
+#define x264_mc_copy_w4_mmx x264_template(mc_copy_w4_mmx)
void x264_mc_copy_w4_mmx ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w8_mmx x264_template(mc_copy_w8_mmx)
void x264_mc_copy_w8_mmx ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w8_sse x264_template(mc_copy_w8_sse)
void x264_mc_copy_w8_sse ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_mmx x264_template(mc_copy_w16_mmx)
void x264_mc_copy_w16_mmx( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_sse x264_template(mc_copy_w16_sse)
void x264_mc_copy_w16_sse( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_sse x264_template(mc_copy_w16_aligned_sse)
void x264_mc_copy_w16_aligned_sse( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_avx x264_template(mc_copy_w16_avx)
void x264_mc_copy_w16_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_avx x264_template(mc_copy_w16_aligned_avx)
void x264_mc_copy_w16_aligned_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int );
+#define x264_prefetch_fenc_400_mmx2 x264_template(prefetch_fenc_400_mmx2)
+void x264_prefetch_fenc_400_mmx2( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_prefetch_fenc_420_mmx2 x264_template(prefetch_fenc_420_mmx2)
void x264_prefetch_fenc_420_mmx2( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_prefetch_fenc_422_mmx2 x264_template(prefetch_fenc_422_mmx2)
void x264_prefetch_fenc_422_mmx2( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_prefetch_ref_mmx2 x264_template(prefetch_ref_mmx2)
void x264_prefetch_ref_mmx2( pixel *, intptr_t, int );
+#define x264_plane_copy_core_sse x264_template(plane_copy_core_sse)
void x264_plane_copy_core_sse( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_core_avx x264_template(plane_copy_core_avx)
void x264_plane_copy_core_avx( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_avx512 x264_template(plane_copy_avx512)
+void x264_plane_copy_avx512( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_swap_core_ssse3 x264_template(plane_copy_swap_core_ssse3)
void x264_plane_copy_swap_core_ssse3( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_swap_core_avx2 x264_template(plane_copy_swap_core_avx2)
void x264_plane_copy_swap_core_avx2 ( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_swap_avx512 x264_template(plane_copy_swap_avx512)
+void x264_plane_copy_swap_avx512( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_interleave_core_mmx2 x264_template(plane_copy_interleave_core_mmx2)
void x264_plane_copy_interleave_core_mmx2( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_interleave_core_sse2 x264_template(plane_copy_interleave_core_sse2)
void x264_plane_copy_interleave_core_sse2( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_interleave_core_avx x264_template(plane_copy_interleave_core_avx)
void x264_plane_copy_interleave_core_avx( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_deinterleave_sse2 x264_template(plane_copy_deinterleave_sse2)
void x264_plane_copy_deinterleave_sse2( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_ssse3 x264_template(plane_copy_deinterleave_ssse3)
void x264_plane_copy_deinterleave_ssse3( uint8_t *dsta, intptr_t i_dsta,
uint8_t *dstb, intptr_t i_dstb,
uint8_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_avx x264_template(plane_copy_deinterleave_avx)
void x264_plane_copy_deinterleave_avx( uint16_t *dsta, intptr_t i_dsta,
uint16_t *dstb, intptr_t i_dstb,
uint16_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_avx2 x264_template(plane_copy_deinterleave_avx2)
void x264_plane_copy_deinterleave_avx2( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_sse2 x264_template(plane_copy_deinterleave_rgb_sse2)
void x264_plane_copy_deinterleave_rgb_sse2 ( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_ssse3 x264_template(plane_copy_deinterleave_rgb_ssse3)
void x264_plane_copy_deinterleave_rgb_ssse3( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_avx2 x264_template(plane_copy_deinterleave_rgb_avx2)
void x264_plane_copy_deinterleave_rgb_avx2 ( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_v210_ssse3 x264_template(plane_copy_deinterleave_v210_ssse3)
void x264_plane_copy_deinterleave_v210_ssse3 ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx x264_template(plane_copy_deinterleave_v210_avx)
void x264_plane_copy_deinterleave_v210_avx ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx2 x264_template(plane_copy_deinterleave_v210_avx2)
void x264_plane_copy_deinterleave_v210_avx2 ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx512 x264_template(plane_copy_deinterleave_v210_avx512)
void x264_plane_copy_deinterleave_v210_avx512( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_store_interleave_chroma_mmx2 x264_template(store_interleave_chroma_mmx2)
void x264_store_interleave_chroma_mmx2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_store_interleave_chroma_sse2 x264_template(store_interleave_chroma_sse2)
void x264_store_interleave_chroma_sse2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_store_interleave_chroma_avx x264_template(store_interleave_chroma_avx)
void x264_store_interleave_chroma_avx ( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fenc_sse2 x264_template(load_deinterleave_chroma_fenc_sse2)
void x264_load_deinterleave_chroma_fenc_sse2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_ssse3 x264_template(load_deinterleave_chroma_fenc_ssse3)
void x264_load_deinterleave_chroma_fenc_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_avx x264_template(load_deinterleave_chroma_fenc_avx)
void x264_load_deinterleave_chroma_fenc_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_avx2 x264_template(load_deinterleave_chroma_fenc_avx2)
void x264_load_deinterleave_chroma_fenc_avx2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_avx512 x264_template(load_deinterleave_chroma_fenc_avx512)
+void x264_load_deinterleave_chroma_fenc_avx512( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_sse2 x264_template(load_deinterleave_chroma_fdec_sse2)
void x264_load_deinterleave_chroma_fdec_sse2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_ssse3 x264_template(load_deinterleave_chroma_fdec_ssse3)
void x264_load_deinterleave_chroma_fdec_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_avx x264_template(load_deinterleave_chroma_fdec_avx)
void x264_load_deinterleave_chroma_fdec_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_avx2 x264_template(load_deinterleave_chroma_fdec_avx2)
void x264_load_deinterleave_chroma_fdec_avx2( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_avx512 x264_template(load_deinterleave_chroma_fdec_avx512)
+void x264_load_deinterleave_chroma_fdec_avx512( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_memcpy_aligned_sse x264_template(memcpy_aligned_sse)
void *x264_memcpy_aligned_sse ( void *dst, const void *src, size_t n );
+#define x264_memcpy_aligned_avx x264_template(memcpy_aligned_avx)
void *x264_memcpy_aligned_avx ( void *dst, const void *src, size_t n );
+#define x264_memcpy_aligned_avx512 x264_template(memcpy_aligned_avx512)
void *x264_memcpy_aligned_avx512( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_sse x264_template(memzero_aligned_sse)
void x264_memzero_aligned_sse ( void *dst, size_t n );
+#define x264_memzero_aligned_avx x264_template(memzero_aligned_avx)
void x264_memzero_aligned_avx ( void *dst, size_t n );
+#define x264_memzero_aligned_avx512 x264_template(memzero_aligned_avx512)
void x264_memzero_aligned_avx512( void *dst, size_t n );
+#define x264_integral_init4h_sse4 x264_template(integral_init4h_sse4)
void x264_integral_init4h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init4h_avx2 x264_template(integral_init4h_avx2)
void x264_integral_init4h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_sse4 x264_template(integral_init8h_sse4)
void x264_integral_init8h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_avx x264_template(integral_init8h_avx)
void x264_integral_init8h_avx ( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_avx2 x264_template(integral_init8h_avx2)
void x264_integral_init8h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init4v_mmx x264_template(integral_init4v_mmx)
void x264_integral_init4v_mmx ( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_sse2 x264_template(integral_init4v_sse2)
void x264_integral_init4v_sse2 ( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_ssse3 x264_template(integral_init4v_ssse3)
void x264_integral_init4v_ssse3( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_avx2 x264_template(integral_init4v_avx2)
void x264_integral_init4v_avx2( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init8v_mmx x264_template(integral_init8v_mmx)
void x264_integral_init8v_mmx ( uint16_t *sum8, intptr_t stride );
+#define x264_integral_init8v_sse2 x264_template(integral_init8v_sse2)
void x264_integral_init8v_sse2( uint16_t *sum8, intptr_t stride );
+#define x264_integral_init8v_avx2 x264_template(integral_init8v_avx2)
void x264_integral_init8v_avx2( uint16_t *sum8, intptr_t stride );
+#define x264_mbtree_propagate_cost_sse2 x264_template(mbtree_propagate_cost_sse2)
void x264_mbtree_propagate_cost_sse2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx x264_template(mbtree_propagate_cost_avx)
void x264_mbtree_propagate_cost_avx ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_fma4 x264_template(mbtree_propagate_cost_fma4)
void x264_mbtree_propagate_cost_fma4 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx2 x264_template(mbtree_propagate_cost_avx2)
void x264_mbtree_propagate_cost_avx2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx512 x264_template(mbtree_propagate_cost_avx512)
void x264_mbtree_propagate_cost_avx512( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_fix8_pack_ssse3 x264_template(mbtree_fix8_pack_ssse3)
void x264_mbtree_fix8_pack_ssse3( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_pack_avx2 x264_template(mbtree_fix8_pack_avx2)
void x264_mbtree_fix8_pack_avx2 ( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_pack_avx512 x264_template(mbtree_fix8_pack_avx512)
+void x264_mbtree_fix8_pack_avx512( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_ssse3 x264_template(mbtree_fix8_unpack_ssse3)
void x264_mbtree_fix8_unpack_ssse3( float *dst, uint16_t *src, int count );
+#define x264_mbtree_fix8_unpack_avx2 x264_template(mbtree_fix8_unpack_avx2)
void x264_mbtree_fix8_unpack_avx2 ( float *dst, uint16_t *src, int count );
+#define x264_mbtree_fix8_unpack_avx512 x264_template(mbtree_fix8_unpack_avx512)
+void x264_mbtree_fix8_unpack_avx512( float *dst, uint16_t *src, int count );
+#define x264_mc_chroma_avx x264_template(mc_chroma_avx)
+#define x264_mc_chroma_avx2 x264_template(mc_chroma_avx2)
+#define x264_mc_chroma_cache64_ssse3 x264_template(mc_chroma_cache64_ssse3)
+#define x264_mc_chroma_mmx2 x264_template(mc_chroma_mmx2)
+#define x264_mc_chroma_sse2 x264_template(mc_chroma_sse2)
+#define x264_mc_chroma_ssse3 x264_template(mc_chroma_ssse3)
#define MC_CHROMA(cpu)\
void x264_mc_chroma_##cpu( pixel *dstu, pixel *dstv, intptr_t i_dst, pixel *src, intptr_t i_src,\
int dx, int dy, int i_width, int i_height );
@@ -189,7 +343,15 @@
MC_CHROMA(cache64_ssse3)
MC_CHROMA(avx)
MC_CHROMA(avx2)
+#undef MC_CHROMA
+#define x264_frame_init_lowres_core_avx x264_template(frame_init_lowres_core_avx)
+#define x264_frame_init_lowres_core_avx2 x264_template(frame_init_lowres_core_avx2)
+#define x264_frame_init_lowres_core_mmx2 x264_template(frame_init_lowres_core_mmx2)
+#define x264_frame_init_lowres_core_cache32_mmx2 x264_template(frame_init_lowres_core_cache32_mmx2)
+#define x264_frame_init_lowres_core_sse2 x264_template(frame_init_lowres_core_sse2)
+#define x264_frame_init_lowres_core_ssse3 x264_template(frame_init_lowres_core_ssse3)
+#define x264_frame_init_lowres_core_xop x264_template(frame_init_lowres_core_xop)
#define LOWRES(cpu)\
void x264_frame_init_lowres_core_##cpu( pixel *src0, pixel *dst0, pixel *dsth, pixel *dstv, pixel *dstc,\
intptr_t src_stride, intptr_t dst_stride, int width, int height );
@@ -200,7 +362,34 @@
LOWRES(avx)
LOWRES(xop)
LOWRES(avx2)
+#undef LOWRES
+#define x264_pixel_avg2_w10_mmx2 x264_template(pixel_avg2_w10_mmx2)
+#define x264_pixel_avg2_w10_sse2 x264_template(pixel_avg2_w10_sse2)
+#define x264_pixel_avg2_w12_cache32_mmx2 x264_template(pixel_avg2_w12_cache32_mmx2)
+#define x264_pixel_avg2_w12_cache64_mmx2 x264_template(pixel_avg2_w12_cache64_mmx2)
+#define x264_pixel_avg2_w12_mmx2 x264_template(pixel_avg2_w12_mmx2)
+#define x264_pixel_avg2_w16_avx2 x264_template(pixel_avg2_w16_avx2)
+#define x264_pixel_avg2_w16_cache32_mmx2 x264_template(pixel_avg2_w16_cache32_mmx2)
+#define x264_pixel_avg2_w16_cache64_mmx2 x264_template(pixel_avg2_w16_cache64_mmx2)
+#define x264_pixel_avg2_w16_cache64_sse2 x264_template(pixel_avg2_w16_cache64_sse2)
+#define x264_pixel_avg2_w16_cache64_ssse3 x264_template(pixel_avg2_w16_cache64_ssse3)
+#define x264_pixel_avg2_w16_mmx2 x264_template(pixel_avg2_w16_mmx2)
+#define x264_pixel_avg2_w16_sse2 x264_template(pixel_avg2_w16_sse2)
+#define x264_pixel_avg2_w18_avx2 x264_template(pixel_avg2_w18_avx2)
+#define x264_pixel_avg2_w18_mmx2 x264_template(pixel_avg2_w18_mmx2)
+#define x264_pixel_avg2_w18_sse2 x264_template(pixel_avg2_w18_sse2)
+#define x264_pixel_avg2_w20_avx2 x264_template(pixel_avg2_w20_avx2)
+#define x264_pixel_avg2_w20_cache32_mmx2 x264_template(pixel_avg2_w20_cache32_mmx2)
+#define x264_pixel_avg2_w20_cache64_mmx2 x264_template(pixel_avg2_w20_cache64_mmx2)
+#define x264_pixel_avg2_w20_cache64_sse2 x264_template(pixel_avg2_w20_cache64_sse2)
+#define x264_pixel_avg2_w20_mmx2 x264_template(pixel_avg2_w20_mmx2)
+#define x264_pixel_avg2_w20_sse2 x264_template(pixel_avg2_w20_sse2)
+#define x264_pixel_avg2_w4_mmx2 x264_template(pixel_avg2_w4_mmx2)
+#define x264_pixel_avg2_w8_cache32_mmx2 x264_template(pixel_avg2_w8_cache32_mmx2)
+#define x264_pixel_avg2_w8_cache64_mmx2 x264_template(pixel_avg2_w8_cache64_mmx2)
+#define x264_pixel_avg2_w8_mmx2 x264_template(pixel_avg2_w8_mmx2)
+#define x264_pixel_avg2_w8_sse2 x264_template(pixel_avg2_w8_sse2)
#define PIXEL_AVG_W(width,cpu)\
void x264_pixel_avg2_w##width##_##cpu( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t );
/* This declares some functions that don't exist, but that isn't a problem. */
@@ -214,9 +403,11 @@
PIXEL_AVG_WALL(sse2)
PIXEL_AVG_WALL(cache64_ssse3)
PIXEL_AVG_WALL(avx2)
+#undef PIXEL_AVG_W
+#undef PIXEL_AVG_WALL
#define PIXEL_AVG_WTAB(instr, name1, name2, name3, name4, name5)\
-static void (* const x264_pixel_avg_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ) =\
+static void (* const pixel_avg_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ) =\
{\
NULL,\
x264_pixel_avg2_w4_##name1,\
@@ -228,6 +419,10 @@
#if HIGH_BIT_DEPTH
/* we can replace w12/w20 with w10/w18 as only 9/17 pixels in fact are important */
+#undef x264_pixel_avg2_w12_mmx2
+#undef x264_pixel_avg2_w20_mmx2
+#undef x264_pixel_avg2_w20_sse2
+#undef x264_pixel_avg2_w20_avx2
#define x264_pixel_avg2_w12_mmx2 x264_pixel_avg2_w10_mmx2
#define x264_pixel_avg2_w20_mmx2 x264_pixel_avg2_w18_mmx2
#define x264_pixel_avg2_w12_sse2 x264_pixel_avg2_w10_sse2
@@ -259,7 +454,7 @@
#endif // HIGH_BIT_DEPTH
#define MC_COPY_WTAB(instr, name1, name2, name3)\
-static void (* const x264_mc_copy_wtab_##instr[5])( pixel *, intptr_t, pixel *, intptr_t, int ) =\
+static void (* const mc_copy_wtab_##instr[5])( pixel *, intptr_t, pixel *, intptr_t, int ) =\
{\
NULL,\
x264_mc_copy_w4_##name1,\
@@ -277,7 +472,7 @@
#endif
#define MC_WEIGHT_WTAB(function, instr, name1, name2, w12version)\
- static void (* x264_mc_##function##_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ) =\
+static void (* mc_##function##_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ) =\
{\
x264_mc_##function##_w4_##name1,\
x264_mc_##function##_w4_##name1,\
@@ -295,7 +490,7 @@
MC_WEIGHT_WTAB(offsetadd,sse2,mmx2,sse2,16)
MC_WEIGHT_WTAB(offsetsub,sse2,mmx2,sse2,16)
-static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w )
+static void weight_cache_mmx2( x264_t *h, x264_weight_t *w )
{
if( w->i_scale == 1<<w->i_denom )
{
@@ -327,7 +522,7 @@
MC_WEIGHT_WTAB(weight,ssse3,ssse3,ssse3,16)
MC_WEIGHT_WTAB(weight,avx2,ssse3,avx2,16)
-static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w )
+static void weight_cache_mmx2( x264_t *h, x264_weight_t *w )
{
int i;
int16_t den1;
@@ -342,7 +537,7 @@
return;
}
w->weightfn = h->mc.weight;
- den1 = 1 << (w->i_denom - 1) | w->i_offset << w->i_denom;
+ den1 = w->i_offset << w->i_denom | (w->i_denom ? 1 << (w->i_denom - 1) : 0);
for( i = 0; i < 8; i++ )
{
w->cachea[i] = w->i_scale;
@@ -350,7 +545,7 @@
}
}
-static void x264_weight_cache_ssse3( x264_t *h, x264_weight_t *w )
+static void weight_cache_ssse3( x264_t *h, x264_weight_t *w )
{
int i, den1;
if( w->i_scale == 1<<w->i_denom )
@@ -385,7 +580,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */\
{\
pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\
- x264_pixel_avg_wtab_##instr1[i_width>>2](\
+ pixel_avg_wtab_##instr1[i_width>>2](\
dst, i_dst_stride, src1, i_src_stride,\
src2, i_height );\
if( weight->weightfn )\
@@ -394,7 +589,7 @@
else if( weight->weightfn )\
weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );\
else\
- x264_mc_copy_wtab_##instr2[i_width>>2](dst, i_dst_stride, src1, i_src_stride, i_height );\
+ mc_copy_wtab_##instr2[i_width>>2](dst, i_dst_stride, src1, i_src_stride, i_height );\
}
MC_LUMA(mmx2,mmx2,mmx)
@@ -423,7 +618,7 @@
if( qpel_idx & 5 ) /* qpel interpolation needed */\
{\
pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\
- x264_pixel_avg_wtab_##name[i_width>>2](\
+ pixel_avg_wtab_##name[i_width>>2](\
dst, *i_dst_stride, src1, i_src_stride,\
src2, i_height );\
if( weight->weightfn )\
@@ -455,6 +650,25 @@
GET_REF(cache64_ssse3_atom)
#endif // !HIGH_BIT_DEPTH
+#define x264_hpel_filter_avx x264_template(hpel_filter_avx)
+#define x264_hpel_filter_avx2 x264_template(hpel_filter_avx2)
+#define x264_hpel_filter_c_mmx2 x264_template(hpel_filter_c_mmx2)
+#define x264_hpel_filter_c_sse2 x264_template(hpel_filter_c_sse2)
+#define x264_hpel_filter_c_ssse3 x264_template(hpel_filter_c_ssse3)
+#define x264_hpel_filter_c_avx x264_template(hpel_filter_c_avx)
+#define x264_hpel_filter_c_avx2 x264_template(hpel_filter_c_avx2)
+#define x264_hpel_filter_h_mmx2 x264_template(hpel_filter_h_mmx2)
+#define x264_hpel_filter_h_sse2 x264_template(hpel_filter_h_sse2)
+#define x264_hpel_filter_h_ssse3 x264_template(hpel_filter_h_ssse3)
+#define x264_hpel_filter_h_avx x264_template(hpel_filter_h_avx)
+#define x264_hpel_filter_h_avx2 x264_template(hpel_filter_h_avx2)
+#define x264_hpel_filter_sse2 x264_template(hpel_filter_sse2)
+#define x264_hpel_filter_ssse3 x264_template(hpel_filter_ssse3)
+#define x264_hpel_filter_v_mmx2 x264_template(hpel_filter_v_mmx2)
+#define x264_hpel_filter_v_sse2 x264_template(hpel_filter_v_sse2)
+#define x264_hpel_filter_v_ssse3 x264_template(hpel_filter_v_ssse3)
+#define x264_hpel_filter_v_avx x264_template(hpel_filter_v_avx)
+#define x264_hpel_filter_v_avx2 x264_template(hpel_filter_v_avx2)
#define HPEL(align, cpu, cpuv, cpuc, cpuh)\
void x264_hpel_filter_v_##cpuv( pixel *dst, pixel *src, int16_t *buf, intptr_t stride, intptr_t width);\
void x264_hpel_filter_c_##cpuc( pixel *dst, int16_t *buf, intptr_t width );\
@@ -525,43 +739,51 @@
#define MC_CLIP_ADD(s,x)\
do\
{\
- int temp;\
+ int temp_s = s;\
+ int temp_x = x;\
asm("movd %0, %%xmm0 \n"\
- "movd %2, %%xmm1 \n"\
+ "movd %1, %%xmm1 \n"\
"paddsw %%xmm1, %%xmm0 \n"\
- "movd %%xmm0, %1 \n"\
- :"+m"(s), "=&r"(temp)\
- :"m"(x)\
+ "movd %%xmm0, %0 \n"\
+ :"+&r"(temp_s)\
+ :"r"(temp_x)\
);\
- s = temp;\
+ s = temp_s;\
} while( 0 )
#undef MC_CLIP_ADD2
#define MC_CLIP_ADD2(s,x)\
do\
{\
+ x264_union32_t temp = { .w={ (s)[0], (s)[1] } };\
asm("movd %0, %%xmm0 \n"\
"movd %1, %%xmm1 \n"\
"paddsw %%xmm1, %%xmm0 \n"\
"movd %%xmm0, %0 \n"\
- :"+m"(M32(s))\
+ :"+&r"(temp)\
:"m"(M32(x))\
);\
+ (s)[0] = temp.w[0];\
+ (s)[1] = temp.w[1];\
} while( 0 )
#endif
+#define x264_mbtree_propagate_list_internal_ssse3 x264_template(mbtree_propagate_list_internal_ssse3)
PROPAGATE_LIST(ssse3)
+#define x264_mbtree_propagate_list_internal_avx x264_template(mbtree_propagate_list_internal_avx)
PROPAGATE_LIST(avx)
+#define x264_mbtree_propagate_list_internal_avx2 x264_template(mbtree_propagate_list_internal_avx2)
PROPAGATE_LIST(avx2)
#if ARCH_X86_64
+#define x264_mbtree_propagate_list_internal_avx512 x264_template(mbtree_propagate_list_internal_avx512)
void x264_mbtree_propagate_list_internal_avx512( size_t len, uint16_t *ref_costs, int16_t (*mvs)[2], int16_t *propagate_amount,
uint16_t *lowres_costs, int bipred_weight, int mb_y,
int width, int height, int stride, int list_mask );
-static void x264_mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],
- int16_t *propagate_amount, uint16_t *lowres_costs,
- int bipred_weight, int mb_y, int len, int list )
+static void mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],
+ int16_t *propagate_amount, uint16_t *lowres_costs,
+ int bipred_weight, int mb_y, int len, int list )
{
x264_mbtree_propagate_list_internal_avx512( len, ref_costs, mvs, propagate_amount, lowres_costs, bipred_weight << 9,
mb_y << 16, h->mb.i_mb_width, h->mb.i_mb_height, h->mb.i_mb_stride,
@@ -569,7 +791,7 @@
}
#endif
-void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf )
+void x264_mc_init_mmx( uint32_t cpu, x264_mc_functions_t *pf )
{
if( !(cpu&X264_CPU_MMX) )
return;
@@ -584,11 +806,12 @@
if( !(cpu&X264_CPU_MMX2) )
return;
+ pf->prefetch_fenc_400 = x264_prefetch_fenc_400_mmx2;
pf->prefetch_fenc_420 = x264_prefetch_fenc_420_mmx2;
pf->prefetch_fenc_422 = x264_prefetch_fenc_422_mmx2;
pf->prefetch_ref = x264_prefetch_ref_mmx2;
- pf->plane_copy_interleave = x264_plane_copy_interleave_mmx2;
+ pf->plane_copy_interleave = plane_copy_interleave_mmx2;
pf->store_interleave_chroma = x264_store_interleave_chroma_mmx2;
pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_mmx2;
@@ -605,10 +828,10 @@
pf->get_ref = get_ref_mmx2;
pf->mc_chroma = x264_mc_chroma_mmx2;
pf->hpel_filter = x264_hpel_filter_mmx2;
- pf->weight = x264_mc_weight_wtab_mmx2;
- pf->weight_cache = x264_weight_cache_mmx2;
- pf->offsetadd = x264_mc_offsetadd_wtab_mmx2;
- pf->offsetsub = x264_mc_offsetsub_wtab_mmx2;
+ pf->weight = mc_weight_wtab_mmx2;
+ pf->weight_cache = weight_cache_mmx2;
+ pf->offsetadd = mc_offsetadd_wtab_mmx2;
+ pf->offsetsub = mc_offsetsub_wtab_mmx2;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_mmx2;
@@ -616,7 +839,7 @@
{
pf->memcpy_aligned = x264_memcpy_aligned_sse;
pf->memzero_aligned = x264_memzero_aligned_sse;
- pf->plane_copy = x264_plane_copy_sse;
+ pf->plane_copy = plane_copy_sse;
}
#if HIGH_BIT_DEPTH
@@ -633,9 +856,9 @@
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2;
- pf->plane_copy_interleave = x264_plane_copy_interleave_sse2;
+ pf->plane_copy_interleave = plane_copy_interleave_sse2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_sse2;
if( cpu&X264_CPU_SSE2_IS_FAST )
{
@@ -648,8 +871,8 @@
pf->integral_init8v = x264_integral_init8v_sse2;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2;
pf->store_interleave_chroma = x264_store_interleave_chroma_sse2;
- pf->offsetadd = x264_mc_offsetadd_wtab_sse2;
- pf->offsetsub = x264_mc_offsetsub_wtab_sse2;
+ pf->offsetadd = mc_offsetadd_wtab_sse2;
+ pf->offsetsub = mc_offsetsub_wtab_sse2;
if( cpu&X264_CPU_SSE2_IS_SLOW )
return;
@@ -665,7 +888,7 @@
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_sse2;
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse;
- pf->weight = x264_mc_weight_wtab_sse2;
+ pf->weight = mc_weight_wtab_sse2;
if( !(cpu&X264_CPU_STACK_MOD4) )
pf->mc_chroma = x264_mc_chroma_sse2;
@@ -674,9 +897,9 @@
return;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_ssse3;
- pf->plane_copy_swap = x264_plane_copy_swap_ssse3;
+ pf->plane_copy_swap = plane_copy_swap_ssse3;
pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_ssse3;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3;
+ pf->mbtree_propagate_list = mbtree_propagate_list_ssse3;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3;
@@ -689,9 +912,9 @@
pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx;
- pf->plane_copy_interleave = x264_plane_copy_interleave_avx;
+ pf->plane_copy_interleave = plane_copy_interleave_avx;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_avx;
pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx;
pf->store_interleave_chroma = x264_store_interleave_chroma_avx;
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_avx;
@@ -706,6 +929,7 @@
{
pf->mc_luma = mc_luma_avx2;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx2;
+ pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx2;
pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx2;
}
@@ -738,18 +962,18 @@
pf->hpel_filter = x264_hpel_filter_sse2_amd;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_sse2;
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_sse2;
if( !(cpu&X264_CPU_SSE2_IS_SLOW) )
{
- pf->weight = x264_mc_weight_wtab_sse2;
+ pf->weight = mc_weight_wtab_sse2;
if( !(cpu&X264_CPU_SLOW_ATOM) )
{
- pf->offsetadd = x264_mc_offsetadd_wtab_sse2;
- pf->offsetsub = x264_mc_offsetsub_wtab_sse2;
+ pf->offsetadd = mc_offsetadd_wtab_sse2;
+ pf->offsetsub = mc_offsetsub_wtab_sse2;
}
pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse;
@@ -766,7 +990,7 @@
if( cpu&X264_CPU_SSE2_IS_FAST )
{
pf->store_interleave_chroma = x264_store_interleave_chroma_sse2; // FIXME sse2fast? sse2medium?
- pf->plane_copy_interleave = x264_plane_copy_interleave_sse2;
+ pf->plane_copy_interleave = plane_copy_interleave_sse2;
pf->mc_luma = mc_luma_sse2;
pf->get_ref = get_ref_sse2;
if( cpu&X264_CPU_CACHELINE_64 )
@@ -789,9 +1013,9 @@
pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_ssse3;
pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_ssse3;
pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_ssse3;
- pf->plane_copy_swap = x264_plane_copy_swap_ssse3;
+ pf->plane_copy_swap = plane_copy_swap_ssse3;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_ssse3;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3;
+ pf->mbtree_propagate_list = mbtree_propagate_list_ssse3;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3;
@@ -800,7 +1024,7 @@
pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_ssse3;
pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_ssse3;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_ssse3;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_ssse3;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_ssse3;
}
if( !(cpu&X264_CPU_SLOW_PALIGNR) )
@@ -827,8 +1051,8 @@
}
}
- pf->weight_cache = x264_weight_cache_ssse3;
- pf->weight = x264_mc_weight_wtab_ssse3;
+ pf->weight_cache = weight_cache_ssse3;
+ pf->weight = mc_weight_wtab_ssse3;
if( !(cpu&(X264_CPU_SLOW_SHUFFLE|X264_CPU_SLOW_ATOM|X264_CPU_SLOW_PALIGNR)) )
pf->integral_init4v = x264_integral_init4v_ssse3;
@@ -856,7 +1080,7 @@
{
pf->hpel_filter = x264_hpel_filter_avx2;
pf->mc_chroma = x264_mc_chroma_avx2;
- pf->weight = x264_mc_weight_wtab_avx2;
+ pf->weight = mc_weight_wtab_avx2;
pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_avx2;
pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_avx2;
pf->integral_init8v = x264_integral_init8v_avx2;
@@ -865,6 +1089,7 @@
pf->integral_init4h = x264_integral_init4h_avx2;
pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx2;
pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_avx2;
+ pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx2;
}
if( cpu&X264_CPU_AVX512 )
@@ -874,6 +1099,8 @@
pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_avx512;
pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_avx512;
pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_avx512;
+ pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx512;
+ pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx512;
}
#endif // HIGH_BIT_DEPTH
@@ -881,22 +1108,21 @@
return;
pf->memcpy_aligned = x264_memcpy_aligned_avx;
pf->memzero_aligned = x264_memzero_aligned_avx;
- pf->plane_copy = x264_plane_copy_avx;
+ pf->plane_copy = plane_copy_avx;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx;
if( cpu&X264_CPU_FMA4 )
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_fma4;
if( !(cpu&X264_CPU_AVX2) )
return;
- pf->plane_copy_swap = x264_plane_copy_swap_avx2;
+ pf->plane_copy_swap = plane_copy_swap_avx2;
pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx2;
- pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx2;
- pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx2;
+ pf->plane_copy_deinterleave_yuyv = plane_copy_deinterleave_yuyv_avx2;
pf->get_ref = get_ref_avx2;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx2;
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx2;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx2;
pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_avx2;
pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_avx2;
@@ -904,8 +1130,12 @@
return;
pf->memcpy_aligned = x264_memcpy_aligned_avx512;
pf->memzero_aligned = x264_memzero_aligned_avx512;
+ pf->plane_copy = x264_plane_copy_avx512;
+ pf->plane_copy_swap = x264_plane_copy_swap_avx512;
pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx512;
#if ARCH_X86_64
- pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx512;
+ pf->mbtree_propagate_list = mbtree_propagate_list_avx512;
#endif
+ pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_avx512;
+ pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_avx512;
}
diff -ur x264-go/x264c/external/x264/common/x86/mc.h x264-go.new/x264c/external/x264/common/x86/mc.h
--- x264-go/x264c/external/x264/common/x86/mc.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/mc.h 2020-06-06 15:20:58.693039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* mc.h: x86 motion compensation
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -24,9 +24,10 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_I386_MC_H
-#define X264_I386_MC_H
+#ifndef X264_X86_MC_H
+#define X264_X86_MC_H
-void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf );
+#define x264_mc_init_mmx x264_template(mc_init_mmx)
+void x264_mc_init_mmx( uint32_t cpu, x264_mc_functions_t *pf );
#endif
Only in x264-go.new/x264c/external/x264/common/x86: pixel-32.asm
Only in x264-go.new/x264c/external/x264/common/x86: pixel-a.asm
diff -ur x264-go/x264c/external/x264/common/x86/pixel.h x264-go.new/x264c/external/x264/common/x86/pixel.h
--- x264-go/x264c/external/x264/common/x86/pixel.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/pixel.h 2020-06-06 15:20:58.694039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* pixel.h: x86 pixel metrics
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -25,9 +25,345 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_I386_PIXEL_H
-#define X264_I386_PIXEL_H
+#ifndef X264_X86_PIXEL_H
+#define X264_X86_PIXEL_H
+#define x264_pixel_ads1_avx x264_template(pixel_ads1_avx)
+#define x264_pixel_ads1_avx2 x264_template(pixel_ads1_avx2)
+#define x264_pixel_ads1_mmx2 x264_template(pixel_ads1_mmx2)
+#define x264_pixel_ads1_sse2 x264_template(pixel_ads1_sse2)
+#define x264_pixel_ads1_ssse3 x264_template(pixel_ads1_ssse3)
+#define x264_pixel_ads2_avx x264_template(pixel_ads2_avx)
+#define x264_pixel_ads2_avx2 x264_template(pixel_ads2_avx2)
+#define x264_pixel_ads2_mmx2 x264_template(pixel_ads2_mmx2)
+#define x264_pixel_ads2_sse2 x264_template(pixel_ads2_sse2)
+#define x264_pixel_ads2_ssse3 x264_template(pixel_ads2_ssse3)
+#define x264_pixel_ads4_avx x264_template(pixel_ads4_avx)
+#define x264_pixel_ads4_avx2 x264_template(pixel_ads4_avx2)
+#define x264_pixel_ads4_mmx2 x264_template(pixel_ads4_mmx2)
+#define x264_pixel_ads4_sse2 x264_template(pixel_ads4_sse2)
+#define x264_pixel_ads4_ssse3 x264_template(pixel_ads4_ssse3)
+#define x264_pixel_hadamard_ac_16x16_avx x264_template(pixel_hadamard_ac_16x16_avx)
+#define x264_pixel_hadamard_ac_16x16_avx2 x264_template(pixel_hadamard_ac_16x16_avx2)
+#define x264_pixel_hadamard_ac_16x16_mmx2 x264_template(pixel_hadamard_ac_16x16_mmx2)
+#define x264_pixel_hadamard_ac_16x16_sse2 x264_template(pixel_hadamard_ac_16x16_sse2)
+#define x264_pixel_hadamard_ac_16x16_sse4 x264_template(pixel_hadamard_ac_16x16_sse4)
+#define x264_pixel_hadamard_ac_16x16_ssse3 x264_template(pixel_hadamard_ac_16x16_ssse3)
+#define x264_pixel_hadamard_ac_16x16_ssse3_atom x264_template(pixel_hadamard_ac_16x16_ssse3_atom)
+#define x264_pixel_hadamard_ac_16x16_xop x264_template(pixel_hadamard_ac_16x16_xop)
+#define x264_pixel_hadamard_ac_16x8_avx x264_template(pixel_hadamard_ac_16x8_avx)
+#define x264_pixel_hadamard_ac_16x8_avx2 x264_template(pixel_hadamard_ac_16x8_avx2)
+#define x264_pixel_hadamard_ac_16x8_mmx2 x264_template(pixel_hadamard_ac_16x8_mmx2)
+#define x264_pixel_hadamard_ac_16x8_sse2 x264_template(pixel_hadamard_ac_16x8_sse2)
+#define x264_pixel_hadamard_ac_16x8_sse4 x264_template(pixel_hadamard_ac_16x8_sse4)
+#define x264_pixel_hadamard_ac_16x8_ssse3 x264_template(pixel_hadamard_ac_16x8_ssse3)
+#define x264_pixel_hadamard_ac_16x8_ssse3_atom x264_template(pixel_hadamard_ac_16x8_ssse3_atom)
+#define x264_pixel_hadamard_ac_16x8_xop x264_template(pixel_hadamard_ac_16x8_xop)
+#define x264_pixel_hadamard_ac_8x16_avx x264_template(pixel_hadamard_ac_8x16_avx)
+#define x264_pixel_hadamard_ac_8x16_mmx2 x264_template(pixel_hadamard_ac_8x16_mmx2)
+#define x264_pixel_hadamard_ac_8x16_sse2 x264_template(pixel_hadamard_ac_8x16_sse2)
+#define x264_pixel_hadamard_ac_8x16_sse4 x264_template(pixel_hadamard_ac_8x16_sse4)
+#define x264_pixel_hadamard_ac_8x16_ssse3 x264_template(pixel_hadamard_ac_8x16_ssse3)
+#define x264_pixel_hadamard_ac_8x16_ssse3_atom x264_template(pixel_hadamard_ac_8x16_ssse3_atom)
+#define x264_pixel_hadamard_ac_8x16_xop x264_template(pixel_hadamard_ac_8x16_xop)
+#define x264_pixel_hadamard_ac_8x8_avx x264_template(pixel_hadamard_ac_8x8_avx)
+#define x264_pixel_hadamard_ac_8x8_mmx2 x264_template(pixel_hadamard_ac_8x8_mmx2)
+#define x264_pixel_hadamard_ac_8x8_sse2 x264_template(pixel_hadamard_ac_8x8_sse2)
+#define x264_pixel_hadamard_ac_8x8_sse4 x264_template(pixel_hadamard_ac_8x8_sse4)
+#define x264_pixel_hadamard_ac_8x8_ssse3 x264_template(pixel_hadamard_ac_8x8_ssse3)
+#define x264_pixel_hadamard_ac_8x8_ssse3_atom x264_template(pixel_hadamard_ac_8x8_ssse3_atom)
+#define x264_pixel_hadamard_ac_8x8_xop x264_template(pixel_hadamard_ac_8x8_xop)
+#define x264_pixel_sa8d_16x16_mmx2 x264_template(pixel_sa8d_16x16_mmx2)
+#define x264_pixel_sa8d_16x16_avx x264_template(pixel_sa8d_16x16_avx)
+#define x264_pixel_sa8d_16x16_sse2 x264_template(pixel_sa8d_16x16_sse2)
+#define x264_pixel_sa8d_16x16_sse4 x264_template(pixel_sa8d_16x16_sse4)
+#define x264_pixel_sa8d_16x16_ssse3 x264_template(pixel_sa8d_16x16_ssse3)
+#define x264_pixel_sa8d_16x16_ssse3_atom x264_template(pixel_sa8d_16x16_ssse3_atom)
+#define x264_pixel_sa8d_16x16_xop x264_template(pixel_sa8d_16x16_xop)
+#define x264_pixel_sa8d_8x8_mmx2 x264_template(pixel_sa8d_8x8_mmx2)
+#define x264_pixel_sa8d_8x8_avx x264_template(pixel_sa8d_8x8_avx)
+#define x264_pixel_sa8d_8x8_avx2 x264_template(pixel_sa8d_8x8_avx2)
+#define x264_pixel_sa8d_8x8_avx512 x264_template(pixel_sa8d_8x8_avx512)
+#define x264_pixel_sa8d_8x8_sse2 x264_template(pixel_sa8d_8x8_sse2)
+#define x264_pixel_sa8d_8x8_sse4 x264_template(pixel_sa8d_8x8_sse4)
+#define x264_pixel_sa8d_8x8_ssse3 x264_template(pixel_sa8d_8x8_ssse3)
+#define x264_pixel_sa8d_8x8_ssse3_atom x264_template(pixel_sa8d_8x8_ssse3_atom)
+#define x264_pixel_sa8d_8x8_xop x264_template(pixel_sa8d_8x8_xop)
+#define x264_pixel_sad_16x16_avx2 x264_template(pixel_sad_16x16_avx2)
+#define x264_pixel_sad_16x16_avx512 x264_template(pixel_sad_16x16_avx512)
+#define x264_pixel_sad_16x16_cache32_mmx2 x264_template(pixel_sad_16x16_cache32_mmx2)
+#define x264_pixel_sad_16x16_cache64_mmx2 x264_template(pixel_sad_16x16_cache64_mmx2)
+#define x264_pixel_sad_16x16_cache64_sse2 x264_template(pixel_sad_16x16_cache64_sse2)
+#define x264_pixel_sad_16x16_cache64_ssse3 x264_template(pixel_sad_16x16_cache64_ssse3)
+#define x264_pixel_sad_16x16_mmx2 x264_template(pixel_sad_16x16_mmx2)
+#define x264_pixel_sad_16x16_sse2 x264_template(pixel_sad_16x16_sse2)
+#define x264_pixel_sad_16x16_sse2_aligned x264_template(pixel_sad_16x16_sse2_aligned)
+#define x264_pixel_sad_16x16_sse3 x264_template(pixel_sad_16x16_sse3)
+#define x264_pixel_sad_16x16_ssse3 x264_template(pixel_sad_16x16_ssse3)
+#define x264_pixel_sad_16x16_ssse3_aligned x264_template(pixel_sad_16x16_ssse3_aligned)
+#define x264_pixel_sad_16x8_avx2 x264_template(pixel_sad_16x8_avx2)
+#define x264_pixel_sad_16x8_avx512 x264_template(pixel_sad_16x8_avx512)
+#define x264_pixel_sad_16x8_cache32_mmx2 x264_template(pixel_sad_16x8_cache32_mmx2)
+#define x264_pixel_sad_16x8_cache64_mmx2 x264_template(pixel_sad_16x8_cache64_mmx2)
+#define x264_pixel_sad_16x8_cache64_sse2 x264_template(pixel_sad_16x8_cache64_sse2)
+#define x264_pixel_sad_16x8_cache64_ssse3 x264_template(pixel_sad_16x8_cache64_ssse3)
+#define x264_pixel_sad_16x8_mmx2 x264_template(pixel_sad_16x8_mmx2)
+#define x264_pixel_sad_16x8_sse2 x264_template(pixel_sad_16x8_sse2)
+#define x264_pixel_sad_16x8_sse2_aligned x264_template(pixel_sad_16x8_sse2_aligned)
+#define x264_pixel_sad_16x8_sse3 x264_template(pixel_sad_16x8_sse3)
+#define x264_pixel_sad_16x8_ssse3 x264_template(pixel_sad_16x8_ssse3)
+#define x264_pixel_sad_16x8_ssse3_aligned x264_template(pixel_sad_16x8_ssse3_aligned)
+#define x264_pixel_sad_4x16_avx512 x264_template(pixel_sad_4x16_avx512)
+#define x264_pixel_sad_4x16_mmx2 x264_template(pixel_sad_4x16_mmx2)
+#define x264_pixel_sad_4x4_avx512 x264_template(pixel_sad_4x4_avx512)
+#define x264_pixel_sad_4x4_mmx2 x264_template(pixel_sad_4x4_mmx2)
+#define x264_pixel_sad_4x4_ssse3 x264_template(pixel_sad_4x4_ssse3)
+#define x264_pixel_sad_4x8_avx512 x264_template(pixel_sad_4x8_avx512)
+#define x264_pixel_sad_4x8_mmx2 x264_template(pixel_sad_4x8_mmx2)
+#define x264_pixel_sad_4x8_ssse3 x264_template(pixel_sad_4x8_ssse3)
+#define x264_pixel_sad_8x16_avx512 x264_template(pixel_sad_8x16_avx512)
+#define x264_pixel_sad_8x16_cache32_mmx2 x264_template(pixel_sad_8x16_cache32_mmx2)
+#define x264_pixel_sad_8x16_cache64_mmx2 x264_template(pixel_sad_8x16_cache64_mmx2)
+#define x264_pixel_sad_8x16_mmx2 x264_template(pixel_sad_8x16_mmx2)
+#define x264_pixel_sad_8x16_sse2 x264_template(pixel_sad_8x16_sse2)
+#define x264_pixel_sad_8x16_sse2_aligned x264_template(pixel_sad_8x16_sse2_aligned)
+#define x264_pixel_sad_8x16_ssse3 x264_template(pixel_sad_8x16_ssse3)
+#define x264_pixel_sad_8x16_ssse3_aligned x264_template(pixel_sad_8x16_ssse3_aligned)
+#define x264_pixel_sad_8x4_avx512 x264_template(pixel_sad_8x4_avx512)
+#define x264_pixel_sad_8x4_cache32_mmx2 x264_template(pixel_sad_8x4_cache32_mmx2)
+#define x264_pixel_sad_8x4_cache64_mmx2 x264_template(pixel_sad_8x4_cache64_mmx2)
+#define x264_pixel_sad_8x4_mmx2 x264_template(pixel_sad_8x4_mmx2)
+#define x264_pixel_sad_8x4_sse2 x264_template(pixel_sad_8x4_sse2)
+#define x264_pixel_sad_8x4_ssse3 x264_template(pixel_sad_8x4_ssse3)
+#define x264_pixel_sad_8x8_avx512 x264_template(pixel_sad_8x8_avx512)
+#define x264_pixel_sad_8x8_cache32_mmx2 x264_template(pixel_sad_8x8_cache32_mmx2)
+#define x264_pixel_sad_8x8_cache64_mmx2 x264_template(pixel_sad_8x8_cache64_mmx2)
+#define x264_pixel_sad_8x8_mmx2 x264_template(pixel_sad_8x8_mmx2)
+#define x264_pixel_sad_8x8_sse2 x264_template(pixel_sad_8x8_sse2)
+#define x264_pixel_sad_8x8_sse2_aligned x264_template(pixel_sad_8x8_sse2_aligned)
+#define x264_pixel_sad_8x8_ssse3 x264_template(pixel_sad_8x8_ssse3)
+#define x264_pixel_sad_8x8_ssse3_aligned x264_template(pixel_sad_8x8_ssse3_aligned)
+#define x264_pixel_sad_x3_16x16_avx x264_template(pixel_sad_x3_16x16_avx)
+#define x264_pixel_sad_x3_16x16_avx2 x264_template(pixel_sad_x3_16x16_avx2)
+#define x264_pixel_sad_x3_16x16_avx512 x264_template(pixel_sad_x3_16x16_avx512)
+#define x264_pixel_sad_x3_16x16_cache32_mmx2 x264_template(pixel_sad_x3_16x16_cache32_mmx2)
+#define x264_pixel_sad_x3_16x16_cache64_mmx2 x264_template(pixel_sad_x3_16x16_cache64_mmx2)
+#define x264_pixel_sad_x3_16x16_cache64_sse2 x264_template(pixel_sad_x3_16x16_cache64_sse2)
+#define x264_pixel_sad_x3_16x16_cache64_ssse3 x264_template(pixel_sad_x3_16x16_cache64_ssse3)
+#define x264_pixel_sad_x3_16x16_mmx2 x264_template(pixel_sad_x3_16x16_mmx2)
+#define x264_pixel_sad_x3_16x16_sse2 x264_template(pixel_sad_x3_16x16_sse2)
+#define x264_pixel_sad_x3_16x16_sse3 x264_template(pixel_sad_x3_16x16_sse3)
+#define x264_pixel_sad_x3_16x16_ssse3 x264_template(pixel_sad_x3_16x16_ssse3)
+#define x264_pixel_sad_x3_16x16_xop x264_template(pixel_sad_x3_16x16_xop)
+#define x264_pixel_sad_x3_16x8_avx x264_template(pixel_sad_x3_16x8_avx)
+#define x264_pixel_sad_x3_16x8_avx2 x264_template(pixel_sad_x3_16x8_avx2)
+#define x264_pixel_sad_x3_16x8_avx512 x264_template(pixel_sad_x3_16x8_avx512)
+#define x264_pixel_sad_x3_16x8_cache32_mmx2 x264_template(pixel_sad_x3_16x8_cache32_mmx2)
+#define x264_pixel_sad_x3_16x8_cache64_mmx2 x264_template(pixel_sad_x3_16x8_cache64_mmx2)
+#define x264_pixel_sad_x3_16x8_cache64_sse2 x264_template(pixel_sad_x3_16x8_cache64_sse2)
+#define x264_pixel_sad_x3_16x8_cache64_ssse3 x264_template(pixel_sad_x3_16x8_cache64_ssse3)
+#define x264_pixel_sad_x3_16x8_mmx2 x264_template(pixel_sad_x3_16x8_mmx2)
+#define x264_pixel_sad_x3_16x8_sse2 x264_template(pixel_sad_x3_16x8_sse2)
+#define x264_pixel_sad_x3_16x8_sse3 x264_template(pixel_sad_x3_16x8_sse3)
+#define x264_pixel_sad_x3_16x8_ssse3 x264_template(pixel_sad_x3_16x8_ssse3)
+#define x264_pixel_sad_x3_16x8_xop x264_template(pixel_sad_x3_16x8_xop)
+#define x264_pixel_sad_x3_4x4_avx512 x264_template(pixel_sad_x3_4x4_avx512)
+#define x264_pixel_sad_x3_4x4_mmx2 x264_template(pixel_sad_x3_4x4_mmx2)
+#define x264_pixel_sad_x3_4x4_ssse3 x264_template(pixel_sad_x3_4x4_ssse3)
+#define x264_pixel_sad_x3_4x8_avx512 x264_template(pixel_sad_x3_4x8_avx512)
+#define x264_pixel_sad_x3_4x8_mmx2 x264_template(pixel_sad_x3_4x8_mmx2)
+#define x264_pixel_sad_x3_4x8_ssse3 x264_template(pixel_sad_x3_4x8_ssse3)
+#define x264_pixel_sad_x3_8x16_avx512 x264_template(pixel_sad_x3_8x16_avx512)
+#define x264_pixel_sad_x3_8x16_cache32_mmx2 x264_template(pixel_sad_x3_8x16_cache32_mmx2)
+#define x264_pixel_sad_x3_8x16_cache64_mmx2 x264_template(pixel_sad_x3_8x16_cache64_mmx2)
+#define x264_pixel_sad_x3_8x16_cache64_sse2 x264_template(pixel_sad_x3_8x16_cache64_sse2)
+#define x264_pixel_sad_x3_8x16_mmx2 x264_template(pixel_sad_x3_8x16_mmx2)
+#define x264_pixel_sad_x3_8x16_sse2 x264_template(pixel_sad_x3_8x16_sse2)
+#define x264_pixel_sad_x3_8x16_ssse3 x264_template(pixel_sad_x3_8x16_ssse3)
+#define x264_pixel_sad_x3_8x16_xop x264_template(pixel_sad_x3_8x16_xop)
+#define x264_pixel_sad_x3_8x4_avx512 x264_template(pixel_sad_x3_8x4_avx512)
+#define x264_pixel_sad_x3_8x4_mmx2 x264_template(pixel_sad_x3_8x4_mmx2)
+#define x264_pixel_sad_x3_8x4_sse2 x264_template(pixel_sad_x3_8x4_sse2)
+#define x264_pixel_sad_x3_8x4_ssse3 x264_template(pixel_sad_x3_8x4_ssse3)
+#define x264_pixel_sad_x3_8x4_xop x264_template(pixel_sad_x3_8x4_xop)
+#define x264_pixel_sad_x3_8x8_avx512 x264_template(pixel_sad_x3_8x8_avx512)
+#define x264_pixel_sad_x3_8x8_cache32_mmx2 x264_template(pixel_sad_x3_8x8_cache32_mmx2)
+#define x264_pixel_sad_x3_8x8_cache64_mmx2 x264_template(pixel_sad_x3_8x8_cache64_mmx2)
+#define x264_pixel_sad_x3_8x8_mmx2 x264_template(pixel_sad_x3_8x8_mmx2)
+#define x264_pixel_sad_x3_8x8_sse2 x264_template(pixel_sad_x3_8x8_sse2)
+#define x264_pixel_sad_x3_8x8_ssse3 x264_template(pixel_sad_x3_8x8_ssse3)
+#define x264_pixel_sad_x3_8x8_xop x264_template(pixel_sad_x3_8x8_xop)
+#define x264_pixel_sad_x4_16x16_avx x264_template(pixel_sad_x4_16x16_avx)
+#define x264_pixel_sad_x4_16x16_avx2 x264_template(pixel_sad_x4_16x16_avx2)
+#define x264_pixel_sad_x4_16x16_avx512 x264_template(pixel_sad_x4_16x16_avx512)
+#define x264_pixel_sad_x4_16x16_cache32_mmx2 x264_template(pixel_sad_x4_16x16_cache32_mmx2)
+#define x264_pixel_sad_x4_16x16_cache64_mmx2 x264_template(pixel_sad_x4_16x16_cache64_mmx2)
+#define x264_pixel_sad_x4_16x16_cache64_sse2 x264_template(pixel_sad_x4_16x16_cache64_sse2)
+#define x264_pixel_sad_x4_16x16_cache64_ssse3 x264_template(pixel_sad_x4_16x16_cache64_ssse3)
+#define x264_pixel_sad_x4_16x16_mmx2 x264_template(pixel_sad_x4_16x16_mmx2)
+#define x264_pixel_sad_x4_16x16_sse2 x264_template(pixel_sad_x4_16x16_sse2)
+#define x264_pixel_sad_x4_16x16_sse3 x264_template(pixel_sad_x4_16x16_sse3)
+#define x264_pixel_sad_x4_16x16_ssse3 x264_template(pixel_sad_x4_16x16_ssse3)
+#define x264_pixel_sad_x4_16x16_xop x264_template(pixel_sad_x4_16x16_xop)
+#define x264_pixel_sad_x4_16x8_avx x264_template(pixel_sad_x4_16x8_avx)
+#define x264_pixel_sad_x4_16x8_avx2 x264_template(pixel_sad_x4_16x8_avx2)
+#define x264_pixel_sad_x4_16x8_avx512 x264_template(pixel_sad_x4_16x8_avx512)
+#define x264_pixel_sad_x4_16x8_cache32_mmx2 x264_template(pixel_sad_x4_16x8_cache32_mmx2)
+#define x264_pixel_sad_x4_16x8_cache64_mmx2 x264_template(pixel_sad_x4_16x8_cache64_mmx2)
+#define x264_pixel_sad_x4_16x8_cache64_sse2 x264_template(pixel_sad_x4_16x8_cache64_sse2)
+#define x264_pixel_sad_x4_16x8_cache64_ssse3 x264_template(pixel_sad_x4_16x8_cache64_ssse3)
+#define x264_pixel_sad_x4_16x8_mmx2 x264_template(pixel_sad_x4_16x8_mmx2)
+#define x264_pixel_sad_x4_16x8_sse2 x264_template(pixel_sad_x4_16x8_sse2)
+#define x264_pixel_sad_x4_16x8_sse3 x264_template(pixel_sad_x4_16x8_sse3)
+#define x264_pixel_sad_x4_16x8_ssse3 x264_template(pixel_sad_x4_16x8_ssse3)
+#define x264_pixel_sad_x4_16x8_xop x264_template(pixel_sad_x4_16x8_xop)
+#define x264_pixel_sad_x4_4x4_avx512 x264_template(pixel_sad_x4_4x4_avx512)
+#define x264_pixel_sad_x4_4x4_mmx2 x264_template(pixel_sad_x4_4x4_mmx2)
+#define x264_pixel_sad_x4_4x4_ssse3 x264_template(pixel_sad_x4_4x4_ssse3)
+#define x264_pixel_sad_x4_4x8_avx512 x264_template(pixel_sad_x4_4x8_avx512)
+#define x264_pixel_sad_x4_4x8_mmx2 x264_template(pixel_sad_x4_4x8_mmx2)
+#define x264_pixel_sad_x4_4x8_ssse3 x264_template(pixel_sad_x4_4x8_ssse3)
+#define x264_pixel_sad_x4_8x16_avx512 x264_template(pixel_sad_x4_8x16_avx512)
+#define x264_pixel_sad_x4_8x16_cache32_mmx2 x264_template(pixel_sad_x4_8x16_cache32_mmx2)
+#define x264_pixel_sad_x4_8x16_cache64_mmx2 x264_template(pixel_sad_x4_8x16_cache64_mmx2)
+#define x264_pixel_sad_x4_8x16_cache64_sse2 x264_template(pixel_sad_x4_8x16_cache64_sse2)
+#define x264_pixel_sad_x4_8x16_mmx2 x264_template(pixel_sad_x4_8x16_mmx2)
+#define x264_pixel_sad_x4_8x16_sse2 x264_template(pixel_sad_x4_8x16_sse2)
+#define x264_pixel_sad_x4_8x16_ssse3 x264_template(pixel_sad_x4_8x16_ssse3)
+#define x264_pixel_sad_x4_8x16_xop x264_template(pixel_sad_x4_8x16_xop)
+#define x264_pixel_sad_x4_8x4_avx512 x264_template(pixel_sad_x4_8x4_avx512)
+#define x264_pixel_sad_x4_8x4_mmx2 x264_template(pixel_sad_x4_8x4_mmx2)
+#define x264_pixel_sad_x4_8x4_sse2 x264_template(pixel_sad_x4_8x4_sse2)
+#define x264_pixel_sad_x4_8x4_ssse3 x264_template(pixel_sad_x4_8x4_ssse3)
+#define x264_pixel_sad_x4_8x4_xop x264_template(pixel_sad_x4_8x4_xop)
+#define x264_pixel_sad_x4_8x8_avx512 x264_template(pixel_sad_x4_8x8_avx512)
+#define x264_pixel_sad_x4_8x8_cache32_mmx2 x264_template(pixel_sad_x4_8x8_cache32_mmx2)
+#define x264_pixel_sad_x4_8x8_cache64_mmx2 x264_template(pixel_sad_x4_8x8_cache64_mmx2)
+#define x264_pixel_sad_x4_8x8_mmx2 x264_template(pixel_sad_x4_8x8_mmx2)
+#define x264_pixel_sad_x4_8x8_sse2 x264_template(pixel_sad_x4_8x8_sse2)
+#define x264_pixel_sad_x4_8x8_ssse3 x264_template(pixel_sad_x4_8x8_ssse3)
+#define x264_pixel_sad_x4_8x8_xop x264_template(pixel_sad_x4_8x8_xop)
+#define x264_pixel_satd_16x16_avx x264_template(pixel_satd_16x16_avx)
+#define x264_pixel_satd_16x16_avx2 x264_template(pixel_satd_16x16_avx2)
+#define x264_pixel_satd_16x16_avx512 x264_template(pixel_satd_16x16_avx512)
+#define x264_pixel_satd_16x16_mmx2 x264_template(pixel_satd_16x16_mmx2)
+#define x264_pixel_satd_16x16_sse2 x264_template(pixel_satd_16x16_sse2)
+#define x264_pixel_satd_16x16_sse4 x264_template(pixel_satd_16x16_sse4)
+#define x264_pixel_satd_16x16_ssse3 x264_template(pixel_satd_16x16_ssse3)
+#define x264_pixel_satd_16x16_ssse3_atom x264_template(pixel_satd_16x16_ssse3_atom)
+#define x264_pixel_satd_16x16_xop x264_template(pixel_satd_16x16_xop)
+#define x264_pixel_satd_16x8_avx x264_template(pixel_satd_16x8_avx)
+#define x264_pixel_satd_16x8_avx2 x264_template(pixel_satd_16x8_avx2)
+#define x264_pixel_satd_16x8_avx512 x264_template(pixel_satd_16x8_avx512)
+#define x264_pixel_satd_16x8_mmx2 x264_template(pixel_satd_16x8_mmx2)
+#define x264_pixel_satd_16x8_sse2 x264_template(pixel_satd_16x8_sse2)
+#define x264_pixel_satd_16x8_sse4 x264_template(pixel_satd_16x8_sse4)
+#define x264_pixel_satd_16x8_ssse3 x264_template(pixel_satd_16x8_ssse3)
+#define x264_pixel_satd_16x8_ssse3_atom x264_template(pixel_satd_16x8_ssse3_atom)
+#define x264_pixel_satd_16x8_xop x264_template(pixel_satd_16x8_xop)
+#define x264_pixel_satd_4x16_avx x264_template(pixel_satd_4x16_avx)
+#define x264_pixel_satd_4x16_avx512 x264_template(pixel_satd_4x16_avx512)
+#define x264_pixel_satd_4x16_mmx2 x264_template(pixel_satd_4x16_mmx2)
+#define x264_pixel_satd_4x16_sse2 x264_template(pixel_satd_4x16_sse2)
+#define x264_pixel_satd_4x16_sse4 x264_template(pixel_satd_4x16_sse4)
+#define x264_pixel_satd_4x16_ssse3 x264_template(pixel_satd_4x16_ssse3)
+#define x264_pixel_satd_4x16_ssse3_atom x264_template(pixel_satd_4x16_ssse3_atom)
+#define x264_pixel_satd_4x4_avx x264_template(pixel_satd_4x4_avx)
+#define x264_pixel_satd_4x4_avx512 x264_template(pixel_satd_4x4_avx512)
+#define x264_pixel_satd_4x4_mmx2 x264_template(pixel_satd_4x4_mmx2)
+#define x264_pixel_satd_4x4_sse4 x264_template(pixel_satd_4x4_sse4)
+#define x264_pixel_satd_4x4_ssse3 x264_template(pixel_satd_4x4_ssse3)
+#define x264_pixel_satd_4x4_xop x264_template(pixel_satd_4x4_xop)
+#define x264_pixel_satd_4x8_avx x264_template(pixel_satd_4x8_avx)
+#define x264_pixel_satd_4x8_avx512 x264_template(pixel_satd_4x8_avx512)
+#define x264_pixel_satd_4x8_mmx2 x264_template(pixel_satd_4x8_mmx2)
+#define x264_pixel_satd_4x8_sse2 x264_template(pixel_satd_4x8_sse2)
+#define x264_pixel_satd_4x8_sse4 x264_template(pixel_satd_4x8_sse4)
+#define x264_pixel_satd_4x8_ssse3 x264_template(pixel_satd_4x8_ssse3)
+#define x264_pixel_satd_4x8_ssse3_atom x264_template(pixel_satd_4x8_ssse3_atom)
+#define x264_pixel_satd_4x8_xop x264_template(pixel_satd_4x8_xop)
+#define x264_pixel_satd_8x16_avx x264_template(pixel_satd_8x16_avx)
+#define x264_pixel_satd_8x16_avx2 x264_template(pixel_satd_8x16_avx2)
+#define x264_pixel_satd_8x16_avx512 x264_template(pixel_satd_8x16_avx512)
+#define x264_pixel_satd_8x16_mmx2 x264_template(pixel_satd_8x16_mmx2)
+#define x264_pixel_satd_8x16_sse2 x264_template(pixel_satd_8x16_sse2)
+#define x264_pixel_satd_8x16_sse4 x264_template(pixel_satd_8x16_sse4)
+#define x264_pixel_satd_8x16_ssse3 x264_template(pixel_satd_8x16_ssse3)
+#define x264_pixel_satd_8x16_ssse3_atom x264_template(pixel_satd_8x16_ssse3_atom)
+#define x264_pixel_satd_8x16_xop x264_template(pixel_satd_8x16_xop)
+#define x264_pixel_satd_8x4_avx x264_template(pixel_satd_8x4_avx)
+#define x264_pixel_satd_8x4_avx512 x264_template(pixel_satd_8x4_avx512)
+#define x264_pixel_satd_8x4_mmx2 x264_template(pixel_satd_8x4_mmx2)
+#define x264_pixel_satd_8x4_sse2 x264_template(pixel_satd_8x4_sse2)
+#define x264_pixel_satd_8x4_sse4 x264_template(pixel_satd_8x4_sse4)
+#define x264_pixel_satd_8x4_ssse3 x264_template(pixel_satd_8x4_ssse3)
+#define x264_pixel_satd_8x4_ssse3_atom x264_template(pixel_satd_8x4_ssse3_atom)
+#define x264_pixel_satd_8x4_xop x264_template(pixel_satd_8x4_xop)
+#define x264_pixel_satd_8x8_avx x264_template(pixel_satd_8x8_avx)
+#define x264_pixel_satd_8x8_avx2 x264_template(pixel_satd_8x8_avx2)
+#define x264_pixel_satd_8x8_avx512 x264_template(pixel_satd_8x8_avx512)
+#define x264_pixel_satd_8x8_mmx2 x264_template(pixel_satd_8x8_mmx2)
+#define x264_pixel_satd_8x8_sse2 x264_template(pixel_satd_8x8_sse2)
+#define x264_pixel_satd_8x8_sse4 x264_template(pixel_satd_8x8_sse4)
+#define x264_pixel_satd_8x8_ssse3 x264_template(pixel_satd_8x8_ssse3)
+#define x264_pixel_satd_8x8_ssse3_atom x264_template(pixel_satd_8x8_ssse3_atom)
+#define x264_pixel_satd_8x8_xop x264_template(pixel_satd_8x8_xop)
+#define x264_pixel_ssd_16x16_avx x264_template(pixel_ssd_16x16_avx)
+#define x264_pixel_ssd_16x16_avx2 x264_template(pixel_ssd_16x16_avx2)
+#define x264_pixel_ssd_16x16_mmx x264_template(pixel_ssd_16x16_mmx)
+#define x264_pixel_ssd_16x16_mmx2 x264_template(pixel_ssd_16x16_mmx2)
+#define x264_pixel_ssd_16x16_sse2 x264_template(pixel_ssd_16x16_sse2)
+#define x264_pixel_ssd_16x16_sse2slow x264_template(pixel_ssd_16x16_sse2slow)
+#define x264_pixel_ssd_16x16_ssse3 x264_template(pixel_ssd_16x16_ssse3)
+#define x264_pixel_ssd_16x16_xop x264_template(pixel_ssd_16x16_xop)
+#define x264_pixel_ssd_16x8_avx x264_template(pixel_ssd_16x8_avx)
+#define x264_pixel_ssd_16x8_avx2 x264_template(pixel_ssd_16x8_avx2)
+#define x264_pixel_ssd_16x8_mmx x264_template(pixel_ssd_16x8_mmx)
+#define x264_pixel_ssd_16x8_mmx2 x264_template(pixel_ssd_16x8_mmx2)
+#define x264_pixel_ssd_16x8_sse2 x264_template(pixel_ssd_16x8_sse2)
+#define x264_pixel_ssd_16x8_sse2slow x264_template(pixel_ssd_16x8_sse2slow)
+#define x264_pixel_ssd_16x8_ssse3 x264_template(pixel_ssd_16x8_ssse3)
+#define x264_pixel_ssd_16x8_xop x264_template(pixel_ssd_16x8_xop)
+#define x264_pixel_ssd_4x16_mmx x264_template(pixel_ssd_4x16_mmx)
+#define x264_pixel_ssd_4x16_mmx2 x264_template(pixel_ssd_4x16_mmx2)
+#define x264_pixel_ssd_4x16_ssse3 x264_template(pixel_ssd_4x16_ssse3)
+#define x264_pixel_ssd_4x4_mmx x264_template(pixel_ssd_4x4_mmx)
+#define x264_pixel_ssd_4x4_mmx2 x264_template(pixel_ssd_4x4_mmx2)
+#define x264_pixel_ssd_4x4_ssse3 x264_template(pixel_ssd_4x4_ssse3)
+#define x264_pixel_ssd_4x8_mmx x264_template(pixel_ssd_4x8_mmx)
+#define x264_pixel_ssd_4x8_mmx2 x264_template(pixel_ssd_4x8_mmx2)
+#define x264_pixel_ssd_4x8_ssse3 x264_template(pixel_ssd_4x8_ssse3)
+#define x264_pixel_ssd_8x16_avx x264_template(pixel_ssd_8x16_avx)
+#define x264_pixel_ssd_8x16_mmx x264_template(pixel_ssd_8x16_mmx)
+#define x264_pixel_ssd_8x16_mmx2 x264_template(pixel_ssd_8x16_mmx2)
+#define x264_pixel_ssd_8x16_sse2 x264_template(pixel_ssd_8x16_sse2)
+#define x264_pixel_ssd_8x16_sse2slow x264_template(pixel_ssd_8x16_sse2slow)
+#define x264_pixel_ssd_8x16_ssse3 x264_template(pixel_ssd_8x16_ssse3)
+#define x264_pixel_ssd_8x16_xop x264_template(pixel_ssd_8x16_xop)
+#define x264_pixel_ssd_8x4_avx x264_template(pixel_ssd_8x4_avx)
+#define x264_pixel_ssd_8x4_mmx x264_template(pixel_ssd_8x4_mmx)
+#define x264_pixel_ssd_8x4_mmx2 x264_template(pixel_ssd_8x4_mmx2)
+#define x264_pixel_ssd_8x4_sse2 x264_template(pixel_ssd_8x4_sse2)
+#define x264_pixel_ssd_8x4_sse2slow x264_template(pixel_ssd_8x4_sse2slow)
+#define x264_pixel_ssd_8x4_ssse3 x264_template(pixel_ssd_8x4_ssse3)
+#define x264_pixel_ssd_8x4_xop x264_template(pixel_ssd_8x4_xop)
+#define x264_pixel_ssd_8x8_avx x264_template(pixel_ssd_8x8_avx)
+#define x264_pixel_ssd_8x8_mmx x264_template(pixel_ssd_8x8_mmx)
+#define x264_pixel_ssd_8x8_mmx2 x264_template(pixel_ssd_8x8_mmx2)
+#define x264_pixel_ssd_8x8_sse2 x264_template(pixel_ssd_8x8_sse2)
+#define x264_pixel_ssd_8x8_sse2slow x264_template(pixel_ssd_8x8_sse2slow)
+#define x264_pixel_ssd_8x8_ssse3 x264_template(pixel_ssd_8x8_ssse3)
+#define x264_pixel_ssd_8x8_xop x264_template(pixel_ssd_8x8_xop)
+#define x264_pixel_var_16x16_avx x264_template(pixel_var_16x16_avx)
+#define x264_pixel_var_16x16_avx2 x264_template(pixel_var_16x16_avx2)
+#define x264_pixel_var_16x16_avx512 x264_template(pixel_var_16x16_avx512)
+#define x264_pixel_var_16x16_sse2 x264_template(pixel_var_16x16_sse2)
+#define x264_pixel_var_8x16_avx x264_template(pixel_var_8x16_avx)
+#define x264_pixel_var_8x16_avx512 x264_template(pixel_var_8x16_avx512)
+#define x264_pixel_var_8x16_sse2 x264_template(pixel_var_8x16_sse2)
+#define x264_pixel_var_8x8_avx x264_template(pixel_var_8x8_avx)
+#define x264_pixel_var_8x8_avx512 x264_template(pixel_var_8x8_avx512)
+#define x264_pixel_var_8x8_sse2 x264_template(pixel_var_8x8_sse2)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
@@ -110,86 +446,153 @@
DECL_PIXELS( uint64_t, hadamard_ac, avx2, ( pixel *pix, intptr_t i_stride ))
+#define x264_intra_satd_x3_4x4_mmx2 x264_template(intra_satd_x3_4x4_mmx2)
void x264_intra_satd_x3_4x4_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_avx ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_4x4_mmx2 x264_template(intra_sad_x3_4x4_mmx2)
+void x264_intra_sad_x3_4x4_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_4x4_sse2 x264_template(intra_sad_x3_4x4_sse2)
+void x264_intra_sad_x3_4x4_sse2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_4x4_ssse3 x264_template(intra_sad_x3_4x4_ssse3)
+void x264_intra_sad_x3_4x4_ssse3 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_4x4_avx x264_template(intra_sad_x3_4x4_avx)
+void x264_intra_sad_x3_4x4_avx ( uint16_t*, uint16_t*, int * );
+#define x264_intra_satd_x3_8x8c_mmx2 x264_template(intra_satd_x3_8x8c_mmx2)
void x264_intra_satd_x3_8x8c_mmx2 ( pixel *, pixel *, int * );
+#define x264_intra_satd_x3_8x8c_ssse3 x264_template(intra_satd_x3_8x8c_ssse3)
void x264_intra_satd_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * );
-void x264_intra_sad_x3_8x8c_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_avx2 ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_8x8c_mmx2 x264_template(intra_sad_x3_8x8c_mmx2)
+void x264_intra_sad_x3_8x8c_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8c_ssse3 x264_template(intra_sad_x3_8x8c_ssse3)
+void x264_intra_sad_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8c_avx2 x264_template(intra_sad_x3_8x8c_avx2)
+void x264_intra_sad_x3_8x8c_avx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_satd_x3_16x16_mmx2 x264_template(intra_satd_x3_16x16_mmx2)
void x264_intra_satd_x3_16x16_mmx2 ( pixel *, pixel *, int * );
+#define x264_intra_satd_x3_16x16_ssse3 x264_template(intra_satd_x3_16x16_ssse3)
void x264_intra_satd_x3_16x16_ssse3( uint8_t *, uint8_t *, int * );
-void x264_intra_sad_x3_16x16_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_avx2 ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_16x16_mmx2 x264_template(intra_sad_x3_16x16_mmx2)
+void x264_intra_sad_x3_16x16_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_sse2 x264_template(intra_sad_x3_16x16_sse2)
+void x264_intra_sad_x3_16x16_sse2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_ssse3 x264_template(intra_sad_x3_16x16_ssse3)
+void x264_intra_sad_x3_16x16_ssse3 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_avx2 x264_template(intra_sad_x3_16x16_avx2)
+void x264_intra_sad_x3_16x16_avx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sa8d_x3_8x8_mmx2 x264_template(intra_sa8d_x3_8x8_mmx2)
void x264_intra_sa8d_x3_8x8_mmx2 ( uint8_t *, uint8_t *, int * );
-void x264_intra_sa8d_x3_8x8_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_ssse3 ( pixel *, pixel *, int * );
+#define x264_intra_sa8d_x3_8x8_sse2 x264_template(intra_sa8d_x3_8x8_sse2)
+void x264_intra_sa8d_x3_8x8_sse2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8_mmx2 x264_template(intra_sad_x3_8x8_mmx2)
+void x264_intra_sad_x3_8x8_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8_sse2 x264_template(intra_sad_x3_8x8_sse2)
+void x264_intra_sad_x3_8x8_sse2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_8x8_ssse3 x264_template(intra_sad_x3_8x8_ssse3)
+void x264_intra_sad_x3_8x8_ssse3 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_8x8_avx2 x264_template(intra_sad_x3_8x8_avx2)
void x264_intra_sad_x3_8x8_avx2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_satd_x9_4x4_ssse3 x264_template(intra_satd_x9_4x4_ssse3)
int x264_intra_satd_x9_4x4_ssse3( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_sse4 x264_template(intra_satd_x9_4x4_sse4)
int x264_intra_satd_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_avx x264_template(intra_satd_x9_4x4_avx)
int x264_intra_satd_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_xop x264_template(intra_satd_x9_4x4_xop)
int x264_intra_satd_x9_4x4_xop ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_ssse3 x264_template(intra_sad_x9_4x4_ssse3)
int x264_intra_sad_x9_4x4_ssse3 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_sse4 x264_template(intra_sad_x9_4x4_sse4)
int x264_intra_sad_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_avx x264_template(intra_sad_x9_4x4_avx)
int x264_intra_sad_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_ssse3 x264_template(intra_sa8d_x9_8x8_ssse3)
int x264_intra_sa8d_x9_8x8_ssse3( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_sse4 x264_template(intra_sa8d_x9_8x8_sse4)
int x264_intra_sa8d_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_avx x264_template(intra_sa8d_x9_8x8_avx)
int x264_intra_sa8d_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_ssse3 x264_template(intra_sad_x9_8x8_ssse3)
int x264_intra_sad_x9_8x8_ssse3 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_sse4 x264_template(intra_sad_x9_8x8_sse4)
int x264_intra_sad_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_avx x264_template(intra_sad_x9_8x8_avx)
int x264_intra_sad_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_avx2 x264_template(intra_sad_x9_8x8_avx2)
int x264_intra_sad_x9_8x8_avx2 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_pixel_ssd_nv12_core_sse2 x264_template(pixel_ssd_nv12_core_sse2)
void x264_pixel_ssd_nv12_core_sse2( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_avx x264_template(pixel_ssd_nv12_core_avx)
void x264_pixel_ssd_nv12_core_avx ( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_xop x264_template(pixel_ssd_nv12_core_xop)
void x264_pixel_ssd_nv12_core_xop ( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_avx2 x264_template(pixel_ssd_nv12_core_avx2)
void x264_pixel_ssd_nv12_core_avx2( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssim_4x4x2_core_mmx2 x264_template(pixel_ssim_4x4x2_core_mmx2)
void x264_pixel_ssim_4x4x2_core_mmx2( const uint8_t *pix1, intptr_t stride1,
const uint8_t *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_4x4x2_core_sse2 x264_template(pixel_ssim_4x4x2_core_sse2)
void x264_pixel_ssim_4x4x2_core_sse2( const pixel *pix1, intptr_t stride1,
const pixel *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_4x4x2_core_avx x264_template(pixel_ssim_4x4x2_core_avx)
void x264_pixel_ssim_4x4x2_core_avx ( const pixel *pix1, intptr_t stride1,
const pixel *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_end4_sse2 x264_template(pixel_ssim_end4_sse2)
float x264_pixel_ssim_end4_sse2( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_ssim_end4_avx x264_template(pixel_ssim_end4_avx)
float x264_pixel_ssim_end4_avx ( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_var2_8x8_sse2 x264_template(pixel_var2_8x8_sse2)
int x264_pixel_var2_8x8_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_ssse3 x264_template(pixel_var2_8x8_ssse3)
int x264_pixel_var2_8x8_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_avx2 x264_template(pixel_var2_8x8_avx2)
int x264_pixel_var2_8x8_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_avx512 x264_template(pixel_var2_8x8_avx512)
int x264_pixel_var2_8x8_avx512 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_sse2 x264_template(pixel_var2_8x16_sse2)
int x264_pixel_var2_8x16_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_ssse3 x264_template(pixel_var2_8x16_ssse3)
int x264_pixel_var2_8x16_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_avx2 x264_template(pixel_var2_8x16_avx2)
int x264_pixel_var2_8x16_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_avx512 x264_template(pixel_var2_8x16_avx512)
int x264_pixel_var2_8x16_avx512( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_vsad_mmx2 x264_template(pixel_vsad_mmx2)
int x264_pixel_vsad_mmx2 ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_sse2 x264_template(pixel_vsad_sse2)
int x264_pixel_vsad_sse2 ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_ssse3 x264_template(pixel_vsad_ssse3)
int x264_pixel_vsad_ssse3( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_xop x264_template(pixel_vsad_xop)
int x264_pixel_vsad_xop ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_avx2 x264_template(pixel_vsad_avx2)
int x264_pixel_vsad_avx2 ( uint16_t *src, intptr_t stride, int height );
+#define x264_pixel_asd8_sse2 x264_template(pixel_asd8_sse2)
int x264_pixel_asd8_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_asd8_ssse3 x264_template(pixel_asd8_ssse3)
int x264_pixel_asd8_ssse3( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_asd8_xop x264_template(pixel_asd8_xop)
int x264_pixel_asd8_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_sa8d_satd_16x16_sse2 x264_template(pixel_sa8d_satd_16x16_sse2)
uint64_t x264_pixel_sa8d_satd_16x16_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_ssse3 x264_template(pixel_sa8d_satd_16x16_ssse3)
uint64_t x264_pixel_sa8d_satd_16x16_ssse3 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_ssse3_atom x264_template(pixel_sa8d_satd_16x16_ssse3_atom)
uint64_t x264_pixel_sa8d_satd_16x16_ssse3_atom( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_sse4 x264_template(pixel_sa8d_satd_16x16_sse4)
uint64_t x264_pixel_sa8d_satd_16x16_sse4 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_avx x264_template(pixel_sa8d_satd_16x16_avx)
uint64_t x264_pixel_sa8d_satd_16x16_avx ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_xop x264_template(pixel_sa8d_satd_16x16_xop)
uint64_t x264_pixel_sa8d_satd_16x16_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_avx2 x264_template(pixel_sa8d_satd_16x16_avx2)
uint64_t x264_pixel_sa8d_satd_16x16_avx2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
Only in x264-go.new/x264c/external/x264/common/x86: predict-a.asm
diff -ur x264-go/x264c/external/x264/common/x86/predict-c.c x264-go.new/x264c/external/x264/common/x86/predict-c.c
--- x264-go/x264c/external/x264/common/x86/predict-c.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/predict-c.c 2020-06-06 15:20:58.694039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict-c.c: intra prediction
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -70,7 +70,7 @@
x264_predict_16x16_p_core_##name( src, i00, b, c );
#define PREDICT_16x16_P(name, name2)\
-static void x264_predict_16x16_p_##name( pixel *src )\
+static void predict_16x16_p_##name( pixel *src )\
{\
PREDICT_16x16_P_CORE\
PREDICT_16x16_P_END(name2)\
@@ -128,7 +128,7 @@
+ 1 * ( src[ 8*FDEC_STRIDE-1] - src[ 6*FDEC_STRIDE-1] );
#define PREDICT_16x16_P_INLINE(name, name2)\
-static void x264_predict_16x16_p_##name( pixel *src )\
+static void predict_16x16_p_##name( pixel *src )\
{\
PREDICT_16x16_P_CORE_INLINE\
PREDICT_16x16_P_END(name2)\
@@ -174,7 +174,7 @@
#endif // HIGH_BIT_DEPTH
#define PREDICT_8x16C_P(name)\
-static void x264_predict_8x16c_p_##name( pixel *src )\
+static void predict_8x16c_p_##name( pixel *src )\
{\
PREDICT_8x16C_P_CORE\
PREDICT_8x16C_P_END(name)\
@@ -211,7 +211,7 @@
#endif // HIGH_BIT_DEPTH
#define PREDICT_8x8C_P(name, name2)\
-static void x264_predict_8x8c_p_##name( pixel *src )\
+static void predict_8x8c_p_##name( pixel *src )\
{\
PREDICT_8x8C_P_CORE\
PREDICT_8x8C_P_END(name2)\
@@ -257,7 +257,7 @@
H += -4 * src[-1*FDEC_STRIDE -1];
#define PREDICT_8x8C_P_INLINE(name, name2)\
-static void x264_predict_8x8c_p_##name( pixel *src )\
+static void predict_8x8c_p_##name( pixel *src )\
{\
PREDICT_8x8C_P_CORE_INLINE\
PREDICT_8x8C_P_END(name2)\
@@ -281,7 +281,7 @@
PREDICT_8x8C_P_INLINE( avx2, avx2 )
#if ARCH_X86_64 && !HIGH_BIT_DEPTH
-static void x264_predict_8x8c_dc_left( uint8_t *src )
+static void predict_8x8c_dc_left( uint8_t *src )
{
int y;
uint32_t s0 = 0, s1 = 0;
@@ -311,7 +311,7 @@
/****************************************************************************
* Exported functions:
****************************************************************************/
-void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] )
+void x264_predict_16x16_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX2) )
return;
@@ -327,7 +327,7 @@
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2;
pf[I_PRED_16x16_H] = x264_predict_16x16_h_sse2;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
pf[I_PRED_16x16_V] = x264_predict_16x16_v_avx;
@@ -336,7 +336,7 @@
pf[I_PRED_16x16_H] = x264_predict_16x16_h_avx2;
#else
#if !ARCH_X86_64
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_mmx2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_mmx2;
#endif
if( !(cpu&X264_CPU_SSE) )
return;
@@ -348,29 +348,29 @@
return;
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
if( !(cpu&X264_CPU_SLOW_PSHUFB) )
pf[I_PRED_16x16_H] = x264_predict_16x16_h_ssse3;
#if HAVE_X86_INLINE_ASM
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_ssse3;
+ pf[I_PRED_16x16_P] = predict_16x16_p_ssse3;
#endif
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx;
+ pf[I_PRED_16x16_P] = predict_16x16_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx2;
+ pf[I_PRED_16x16_P] = predict_16x16_p_avx2;
pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_avx2;
pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_avx2;
pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_avx2;
}
}
-void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x8c_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX) )
return;
@@ -388,16 +388,16 @@
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_sse2;
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_sse2;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_sse2;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx;
if( !(cpu&X264_CPU_AVX2) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_avx2;
#else
#if ARCH_X86_64
- pf[I_PRED_CHROMA_DC_LEFT] = x264_predict_8x8c_dc_left;
+ pf[I_PRED_CHROMA_DC_LEFT] = predict_8x8c_dc_left;
#endif
pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_mmx;
if( !(cpu&X264_CPU_MMX2) )
@@ -405,30 +405,30 @@
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_mmx2;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_mmx2;
#if !ARCH_X86_64
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_mmx2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_mmx2;
#endif
pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_mmx2;
if( !(cpu&X264_CPU_SSE2) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_ssse3;
#if HAVE_X86_INLINE_ASM
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_ssse3;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_ssse3;
#endif
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx2;
+ pf[I_PRED_CHROMA_P] = predict_8x8c_p_avx2;
}
}
-void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] )
+void x264_predict_8x16c_init_mmx( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_MMX) )
return;
@@ -445,10 +445,10 @@
pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x16c_dc_top_sse2;
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_sse2;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_sse2;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_sse2;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx;
if( !(cpu&X264_CPU_AVX2) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_avx2;
@@ -460,26 +460,26 @@
pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_mmx2;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_mmx2;
#if !ARCH_X86_64
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_mmx2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_mmx2;
#endif
if( !(cpu&X264_CPU_SSE2) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_sse2;
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_ssse3;
if( !(cpu&X264_CPU_AVX) )
return;
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx;
#endif // HIGH_BIT_DEPTH
if( cpu&X264_CPU_AVX2 )
{
- pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx2;
+ pf[I_PRED_CHROMA_P] = predict_8x16c_p_avx2;
}
}
-void x264_predict_8x8_init_mmx( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter )
+void x264_predict_8x8_init_mmx( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter )
{
if( !(cpu&X264_CPU_MMX2) )
return;
@@ -563,7 +563,7 @@
#endif // HIGH_BIT_DEPTH
}
-void x264_predict_4x4_init_mmx( int cpu, x264_predict_t pf[12] )
+void x264_predict_4x4_init_mmx( uint32_t cpu, x264_predict_t pf[12] )
{
if( !(cpu&X264_CPU_MMX2) )
return;
diff -ur x264-go/x264c/external/x264/common/x86/predict.h x264-go.new/x264c/external/x264/common/x86/predict.h
--- x264-go/x264c/external/x264/common/x86/predict.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/predict.h 2020-06-06 15:20:58.694039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* predict.h: x86 intra prediction
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -24,121 +24,233 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_I386_PREDICT_H
-#define X264_I386_PREDICT_H
+#ifndef X264_X86_PREDICT_H
+#define X264_X86_PREDICT_H
-void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] );
-void x264_predict_8x8c_init_mmx ( int cpu, x264_predict_t pf[7] );
-void x264_predict_4x4_init_mmx ( int cpu, x264_predict_t pf[12] );
-void x264_predict_8x8_init_mmx ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter );
+#define x264_predict_16x16_init_mmx x264_template(predict_16x16_init_mmx)
+void x264_predict_16x16_init_mmx( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_mmx x264_template(predict_8x16c_init_mmx)
+void x264_predict_8x16c_init_mmx( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_8x8c_init_mmx x264_template(predict_8x8c_init_mmx)
+void x264_predict_8x8c_init_mmx ( uint32_t cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init_mmx x264_template(predict_4x4_init_mmx)
+void x264_predict_4x4_init_mmx ( uint32_t cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_mmx x264_template(predict_8x8_init_mmx)
+void x264_predict_8x8_init_mmx ( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter );
+#define x264_predict_16x16_v_mmx2 x264_template(predict_16x16_v_mmx2)
void x264_predict_16x16_v_mmx2( pixel *src );
+#define x264_predict_16x16_v_sse x264_template(predict_16x16_v_sse)
void x264_predict_16x16_v_sse ( pixel *src );
+#define x264_predict_16x16_v_avx x264_template(predict_16x16_v_avx)
void x264_predict_16x16_v_avx ( uint16_t *src );
+#define x264_predict_16x16_h_mmx2 x264_template(predict_16x16_h_mmx2)
void x264_predict_16x16_h_mmx2( pixel *src );
+#define x264_predict_16x16_h_sse2 x264_template(predict_16x16_h_sse2)
void x264_predict_16x16_h_sse2( uint16_t *src );
+#define x264_predict_16x16_h_ssse3 x264_template(predict_16x16_h_ssse3)
void x264_predict_16x16_h_ssse3( uint8_t *src );
+#define x264_predict_16x16_h_avx2 x264_template(predict_16x16_h_avx2)
void x264_predict_16x16_h_avx2( uint16_t *src );
+#define x264_predict_16x16_dc_sse2 x264_template(predict_16x16_dc_sse2)
void x264_predict_16x16_dc_sse2( pixel *src );
+#define x264_predict_16x16_dc_avx2 x264_template(predict_16x16_dc_avx2)
void x264_predict_16x16_dc_avx2( pixel *src );
+#define x264_predict_16x16_dc_left_sse2 x264_template(predict_16x16_dc_left_sse2)
void x264_predict_16x16_dc_left_sse2( pixel *src );
+#define x264_predict_16x16_dc_left_avx2 x264_template(predict_16x16_dc_left_avx2)
void x264_predict_16x16_dc_left_avx2( pixel *src );
+#define x264_predict_16x16_dc_top_sse2 x264_template(predict_16x16_dc_top_sse2)
void x264_predict_16x16_dc_top_sse2( pixel *src );
+#define x264_predict_16x16_dc_top_avx2 x264_template(predict_16x16_dc_top_avx2)
void x264_predict_16x16_dc_top_avx2( pixel *src );
+#define x264_predict_16x16_p_core_mmx2 x264_template(predict_16x16_p_core_mmx2)
void x264_predict_16x16_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_sse2 x264_template(predict_16x16_p_core_sse2)
void x264_predict_16x16_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_avx x264_template(predict_16x16_p_core_avx)
void x264_predict_16x16_p_core_avx( pixel *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_avx2 x264_template(predict_16x16_p_core_avx2)
void x264_predict_16x16_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_dc_mmx2 x264_template(predict_8x16c_dc_mmx2)
void x264_predict_8x16c_dc_mmx2( pixel *src );
+#define x264_predict_8x16c_dc_sse2 x264_template(predict_8x16c_dc_sse2)
void x264_predict_8x16c_dc_sse2( uint16_t *src );
+#define x264_predict_8x16c_dc_top_mmx2 x264_template(predict_8x16c_dc_top_mmx2)
void x264_predict_8x16c_dc_top_mmx2( uint8_t *src );
+#define x264_predict_8x16c_dc_top_sse2 x264_template(predict_8x16c_dc_top_sse2)
void x264_predict_8x16c_dc_top_sse2( uint16_t *src );
+#define x264_predict_8x16c_v_mmx x264_template(predict_8x16c_v_mmx)
void x264_predict_8x16c_v_mmx( uint8_t *src );
+#define x264_predict_8x16c_v_sse x264_template(predict_8x16c_v_sse)
void x264_predict_8x16c_v_sse( uint16_t *src );
+#define x264_predict_8x16c_h_mmx2 x264_template(predict_8x16c_h_mmx2)
void x264_predict_8x16c_h_mmx2( pixel *src );
+#define x264_predict_8x16c_h_sse2 x264_template(predict_8x16c_h_sse2)
void x264_predict_8x16c_h_sse2( uint16_t *src );
+#define x264_predict_8x16c_h_ssse3 x264_template(predict_8x16c_h_ssse3)
void x264_predict_8x16c_h_ssse3( uint8_t *src );
+#define x264_predict_8x16c_h_avx2 x264_template(predict_8x16c_h_avx2)
void x264_predict_8x16c_h_avx2( uint16_t *src );
+#define x264_predict_8x16c_p_core_mmx2 x264_template(predict_8x16c_p_core_mmx2)
void x264_predict_8x16c_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_sse2 x264_template(predict_8x16c_p_core_sse2)
void x264_predict_8x16c_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_avx x264_template(predict_8x16c_p_core_avx)
void x264_predict_8x16c_p_core_avx ( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_avx2 x264_template(predict_8x16c_p_core_avx2)
void x264_predict_8x16c_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_mmx2 x264_template(predict_8x8c_p_core_mmx2)
void x264_predict_8x8c_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_sse2 x264_template(predict_8x8c_p_core_sse2)
void x264_predict_8x8c_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_avx x264_template(predict_8x8c_p_core_avx)
void x264_predict_8x8c_p_core_avx ( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_avx2 x264_template(predict_8x8c_p_core_avx2)
void x264_predict_8x8c_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_dc_mmx2 x264_template(predict_8x8c_dc_mmx2)
void x264_predict_8x8c_dc_mmx2( pixel *src );
+#define x264_predict_8x8c_dc_sse2 x264_template(predict_8x8c_dc_sse2)
void x264_predict_8x8c_dc_sse2( uint16_t *src );
+#define x264_predict_8x8c_dc_top_mmx2 x264_template(predict_8x8c_dc_top_mmx2)
void x264_predict_8x8c_dc_top_mmx2( uint8_t *src );
+#define x264_predict_8x8c_dc_top_sse2 x264_template(predict_8x8c_dc_top_sse2)
void x264_predict_8x8c_dc_top_sse2( uint16_t *src );
+#define x264_predict_8x8c_v_mmx x264_template(predict_8x8c_v_mmx)
void x264_predict_8x8c_v_mmx( pixel *src );
+#define x264_predict_8x8c_v_sse x264_template(predict_8x8c_v_sse)
void x264_predict_8x8c_v_sse( uint16_t *src );
+#define x264_predict_8x8c_h_mmx2 x264_template(predict_8x8c_h_mmx2)
void x264_predict_8x8c_h_mmx2( pixel *src );
+#define x264_predict_8x8c_h_sse2 x264_template(predict_8x8c_h_sse2)
void x264_predict_8x8c_h_sse2( uint16_t *src );
+#define x264_predict_8x8c_h_ssse3 x264_template(predict_8x8c_h_ssse3)
void x264_predict_8x8c_h_ssse3( uint8_t *src );
+#define x264_predict_8x8c_h_avx2 x264_template(predict_8x8c_h_avx2)
void x264_predict_8x8c_h_avx2( uint16_t *src );
+#define x264_predict_8x8_v_mmx2 x264_template(predict_8x8_v_mmx2)
void x264_predict_8x8_v_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_v_sse x264_template(predict_8x8_v_sse)
void x264_predict_8x8_v_sse ( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_h_mmx2 x264_template(predict_8x8_h_mmx2)
void x264_predict_8x8_h_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_sse2 x264_template(predict_8x8_h_sse2)
void x264_predict_8x8_h_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_hd_mmx2 x264_template(predict_8x8_hd_mmx2)
void x264_predict_8x8_hd_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_mmx2 x264_template(predict_8x8_hu_mmx2)
void x264_predict_8x8_hu_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_mmx2 x264_template(predict_8x8_dc_mmx2)
void x264_predict_8x8_dc_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_sse2 x264_template(predict_8x8_dc_sse2)
void x264_predict_8x8_dc_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_dc_top_mmx2 x264_template(predict_8x8_dc_top_mmx2)
void x264_predict_8x8_dc_top_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_top_sse2 x264_template(predict_8x8_dc_top_sse2)
void x264_predict_8x8_dc_top_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_dc_left_mmx2 x264_template(predict_8x8_dc_left_mmx2)
void x264_predict_8x8_dc_left_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_left_sse2 x264_template(predict_8x8_dc_left_sse2)
void x264_predict_8x8_dc_left_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_ddl_mmx2 x264_template(predict_8x8_ddl_mmx2)
void x264_predict_8x8_ddl_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddl_sse2 x264_template(predict_8x8_ddl_sse2)
void x264_predict_8x8_ddl_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_ssse3 x264_template(predict_8x8_ddl_ssse3)
void x264_predict_8x8_ddl_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_cache64_ssse3 x264_template(predict_8x8_ddl_cache64_ssse3)
void x264_predict_8x8_ddl_cache64_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_avx x264_template(predict_8x8_ddl_avx)
void x264_predict_8x8_ddl_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_mmx2 x264_template(predict_8x8_ddr_mmx2)
void x264_predict_8x8_ddr_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_sse2 x264_template(predict_8x8_ddr_sse2)
void x264_predict_8x8_ddr_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_ssse3 x264_template(predict_8x8_ddr_ssse3)
void x264_predict_8x8_ddr_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_cache64_ssse3 x264_template(predict_8x8_ddr_cache64_ssse3)
void x264_predict_8x8_ddr_cache64_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_avx x264_template(predict_8x8_ddr_avx)
void x264_predict_8x8_ddr_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_sse2 x264_template(predict_8x8_vl_sse2)
void x264_predict_8x8_vl_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_ssse3 x264_template(predict_8x8_vl_ssse3)
void x264_predict_8x8_vl_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_avx x264_template(predict_8x8_vl_avx)
void x264_predict_8x8_vl_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_mmx2 x264_template(predict_8x8_vl_mmx2)
void x264_predict_8x8_vl_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_mmx2 x264_template(predict_8x8_vr_mmx2)
void x264_predict_8x8_vr_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_sse2 x264_template(predict_8x8_vr_sse2)
void x264_predict_8x8_vr_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vr_ssse3 x264_template(predict_8x8_vr_ssse3)
void x264_predict_8x8_vr_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vr_avx x264_template(predict_8x8_vr_avx)
void x264_predict_8x8_vr_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_sse2 x264_template(predict_8x8_hu_sse2)
void x264_predict_8x8_hu_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_ssse3 x264_template(predict_8x8_hu_ssse3)
void x264_predict_8x8_hu_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_avx x264_template(predict_8x8_hu_avx)
void x264_predict_8x8_hu_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_sse2 x264_template(predict_8x8_hd_sse2)
void x264_predict_8x8_hd_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_ssse3 x264_template(predict_8x8_hd_ssse3)
void x264_predict_8x8_hd_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_avx x264_template(predict_8x8_hd_avx)
void x264_predict_8x8_hd_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_filter_mmx2 x264_template(predict_8x8_filter_mmx2)
void x264_predict_8x8_filter_mmx2( uint8_t *src, uint8_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_sse2 x264_template(predict_8x8_filter_sse2)
void x264_predict_8x8_filter_sse2( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_ssse3 x264_template(predict_8x8_filter_ssse3)
void x264_predict_8x8_filter_ssse3( pixel *src, pixel edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_avx x264_template(predict_8x8_filter_avx)
void x264_predict_8x8_filter_avx( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_4x4_h_avx2 x264_template(predict_4x4_h_avx2)
void x264_predict_4x4_h_avx2( uint16_t *src );
+#define x264_predict_4x4_ddl_mmx2 x264_template(predict_4x4_ddl_mmx2)
void x264_predict_4x4_ddl_mmx2( pixel *src );
+#define x264_predict_4x4_ddl_sse2 x264_template(predict_4x4_ddl_sse2)
void x264_predict_4x4_ddl_sse2( uint16_t *src );
+#define x264_predict_4x4_ddl_avx x264_template(predict_4x4_ddl_avx)
void x264_predict_4x4_ddl_avx( uint16_t *src );
+#define x264_predict_4x4_ddr_mmx2 x264_template(predict_4x4_ddr_mmx2)
void x264_predict_4x4_ddr_mmx2( pixel *src );
+#define x264_predict_4x4_vl_mmx2 x264_template(predict_4x4_vl_mmx2)
void x264_predict_4x4_vl_mmx2( pixel *src );
+#define x264_predict_4x4_vl_sse2 x264_template(predict_4x4_vl_sse2)
void x264_predict_4x4_vl_sse2( uint16_t *src );
+#define x264_predict_4x4_vl_avx x264_template(predict_4x4_vl_avx)
void x264_predict_4x4_vl_avx( uint16_t *src );
+#define x264_predict_4x4_vr_mmx2 x264_template(predict_4x4_vr_mmx2)
void x264_predict_4x4_vr_mmx2( uint8_t *src );
+#define x264_predict_4x4_vr_sse2 x264_template(predict_4x4_vr_sse2)
void x264_predict_4x4_vr_sse2( uint16_t *src );
+#define x264_predict_4x4_vr_ssse3 x264_template(predict_4x4_vr_ssse3)
void x264_predict_4x4_vr_ssse3( pixel *src );
+#define x264_predict_4x4_vr_cache64_ssse3 x264_template(predict_4x4_vr_cache64_ssse3)
void x264_predict_4x4_vr_cache64_ssse3( uint8_t *src );
+#define x264_predict_4x4_vr_avx x264_template(predict_4x4_vr_avx)
void x264_predict_4x4_vr_avx( uint16_t *src );
+#define x264_predict_4x4_hd_mmx2 x264_template(predict_4x4_hd_mmx2)
void x264_predict_4x4_hd_mmx2( pixel *src );
+#define x264_predict_4x4_hd_sse2 x264_template(predict_4x4_hd_sse2)
void x264_predict_4x4_hd_sse2( uint16_t *src );
+#define x264_predict_4x4_hd_ssse3 x264_template(predict_4x4_hd_ssse3)
void x264_predict_4x4_hd_ssse3( pixel *src );
+#define x264_predict_4x4_hd_avx x264_template(predict_4x4_hd_avx)
void x264_predict_4x4_hd_avx( uint16_t *src );
+#define x264_predict_4x4_dc_mmx2 x264_template(predict_4x4_dc_mmx2)
void x264_predict_4x4_dc_mmx2( pixel *src );
+#define x264_predict_4x4_ddr_sse2 x264_template(predict_4x4_ddr_sse2)
void x264_predict_4x4_ddr_sse2( uint16_t *src );
+#define x264_predict_4x4_ddr_ssse3 x264_template(predict_4x4_ddr_ssse3)
void x264_predict_4x4_ddr_ssse3( pixel *src );
+#define x264_predict_4x4_ddr_avx x264_template(predict_4x4_ddr_avx)
void x264_predict_4x4_ddr_avx( uint16_t *src );
+#define x264_predict_4x4_hu_mmx2 x264_template(predict_4x4_hu_mmx2)
void x264_predict_4x4_hu_mmx2( pixel *src );
#endif
Only in x264-go.new/x264c/external/x264/common/x86: quant-a.asm
diff -ur x264-go/x264c/external/x264/common/x86/quant.h x264-go.new/x264c/external/x264/common/x86/quant.h
--- x264-go/x264c/external/x264/common/x86/quant.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/quant.h 2020-06-06 15:20:58.694039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* quant.h: x86 quantization and level-run
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -25,132 +25,254 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_I386_QUANT_H
-#define X264_I386_QUANT_H
+#ifndef X264_X86_QUANT_H
+#define X264_X86_QUANT_H
+#define x264_quant_2x2_dc_mmx2 x264_template(quant_2x2_dc_mmx2)
int x264_quant_2x2_dc_mmx2( dctcoef dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_mmx2 x264_template(quant_4x4_dc_mmx2)
int x264_quant_4x4_dc_mmx2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_mmx2 x264_template(quant_4x4_mmx2)
int x264_quant_4x4_mmx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_mmx2 x264_template(quant_8x8_mmx2)
int x264_quant_8x8_mmx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_sse2 x264_template(quant_2x2_dc_sse2)
int x264_quant_2x2_dc_sse2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_dc_sse2 x264_template(quant_4x4_dc_sse2)
int x264_quant_4x4_dc_sse2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_sse2 x264_template(quant_4x4_sse2)
int x264_quant_4x4_sse2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_sse2 x264_template(quant_4x4x4_sse2)
int x264_quant_4x4x4_sse2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_sse2 x264_template(quant_8x8_sse2)
int x264_quant_8x8_sse2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_ssse3 x264_template(quant_2x2_dc_ssse3)
int x264_quant_2x2_dc_ssse3( dctcoef dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_ssse3 x264_template(quant_4x4_dc_ssse3)
int x264_quant_4x4_dc_ssse3( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_ssse3 x264_template(quant_4x4_ssse3)
int x264_quant_4x4_ssse3( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_ssse3 x264_template(quant_4x4x4_ssse3)
int x264_quant_4x4x4_ssse3( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_ssse3 x264_template(quant_8x8_ssse3)
int x264_quant_8x8_ssse3( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_sse4 x264_template(quant_2x2_dc_sse4)
int x264_quant_2x2_dc_sse4( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_dc_sse4 x264_template(quant_4x4_dc_sse4)
int x264_quant_4x4_dc_sse4( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_sse4 x264_template(quant_4x4_sse4)
int x264_quant_4x4_sse4( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_sse4 x264_template(quant_4x4x4_sse4)
int x264_quant_4x4x4_sse4( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_sse4 x264_template(quant_8x8_sse4)
int x264_quant_8x8_sse4( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_4x4_avx2 x264_template(quant_4x4_avx2)
int x264_quant_4x4_avx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4_dc_avx2 x264_template(quant_4x4_dc_avx2)
int x264_quant_4x4_dc_avx2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_8x8_avx2 x264_template(quant_8x8_avx2)
int x264_quant_8x8_avx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_4x4x4_avx2 x264_template(quant_4x4x4_avx2)
int x264_quant_4x4x4_avx2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_dequant_4x4_mmx x264_template(dequant_4x4_mmx)
void x264_dequant_4x4_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_mmx2 x264_template(dequant_4x4dc_mmx2)
void x264_dequant_4x4dc_mmx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_mmx x264_template(dequant_8x8_mmx)
void x264_dequant_8x8_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_sse2 x264_template(dequant_4x4_sse2)
void x264_dequant_4x4_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_sse2 x264_template(dequant_4x4dc_sse2)
void x264_dequant_4x4dc_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_sse2 x264_template(dequant_8x8_sse2)
void x264_dequant_8x8_sse2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx x264_template(dequant_4x4_avx)
void x264_dequant_4x4_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_avx x264_template(dequant_4x4dc_avx)
void x264_dequant_4x4dc_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx x264_template(dequant_8x8_avx)
void x264_dequant_8x8_avx( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_xop x264_template(dequant_4x4_xop)
void x264_dequant_4x4_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_xop x264_template(dequant_4x4dc_xop)
void x264_dequant_4x4dc_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_xop x264_template(dequant_8x8_xop)
void x264_dequant_8x8_xop( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx2 x264_template(dequant_4x4_avx2)
void x264_dequant_4x4_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_avx2 x264_template(dequant_4x4dc_avx2)
void x264_dequant_4x4dc_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx2 x264_template(dequant_8x8_avx2)
void x264_dequant_8x8_avx2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx512 x264_template(dequant_4x4_avx512)
void x264_dequant_4x4_avx512( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx512 x264_template(dequant_8x8_avx512)
void x264_dequant_8x8_avx512( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_mmx x264_template(dequant_4x4_flat16_mmx)
void x264_dequant_4x4_flat16_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_mmx x264_template(dequant_8x8_flat16_mmx)
void x264_dequant_8x8_flat16_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_sse2 x264_template(dequant_4x4_flat16_sse2)
void x264_dequant_4x4_flat16_sse2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_sse2 x264_template(dequant_8x8_flat16_sse2)
void x264_dequant_8x8_flat16_sse2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_avx2 x264_template(dequant_4x4_flat16_avx2)
void x264_dequant_4x4_flat16_avx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_avx2 x264_template(dequant_8x8_flat16_avx2)
void x264_dequant_8x8_flat16_avx2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_8x8_flat16_avx512 x264_template(dequant_8x8_flat16_avx512)
void x264_dequant_8x8_flat16_avx512( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_idct_dequant_2x4_dc_sse2 x264_template(idct_dequant_2x4_dc_sse2)
void x264_idct_dequant_2x4_dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dc_avx x264_template(idct_dequant_2x4_dc_avx)
void x264_idct_dequant_2x4_dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dconly_sse2 x264_template(idct_dequant_2x4_dconly_sse2)
void x264_idct_dequant_2x4_dconly_sse2( dctcoef dct[8], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dconly_avx x264_template(idct_dequant_2x4_dconly_avx)
void x264_idct_dequant_2x4_dconly_avx ( dctcoef dct[8], int dequant_mf[6][16], int i_qp );
+#define x264_optimize_chroma_2x2_dc_sse2 x264_template(optimize_chroma_2x2_dc_sse2)
int x264_optimize_chroma_2x2_dc_sse2( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_ssse3 x264_template(optimize_chroma_2x2_dc_ssse3)
int x264_optimize_chroma_2x2_dc_ssse3( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_sse4 x264_template(optimize_chroma_2x2_dc_sse4)
int x264_optimize_chroma_2x2_dc_sse4( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_avx x264_template(optimize_chroma_2x2_dc_avx)
int x264_optimize_chroma_2x2_dc_avx( dctcoef dct[4], int dequant_mf );
+#define x264_denoise_dct_mmx x264_template(denoise_dct_mmx)
void x264_denoise_dct_mmx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_sse2 x264_template(denoise_dct_sse2)
void x264_denoise_dct_sse2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_ssse3 x264_template(denoise_dct_ssse3)
void x264_denoise_dct_ssse3( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_avx x264_template(denoise_dct_avx)
void x264_denoise_dct_avx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_avx2 x264_template(denoise_dct_avx2)
void x264_denoise_dct_avx2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_decimate_score15_sse2 x264_template(decimate_score15_sse2)
int x264_decimate_score15_sse2( dctcoef *dct );
+#define x264_decimate_score15_ssse3 x264_template(decimate_score15_ssse3)
int x264_decimate_score15_ssse3( dctcoef *dct );
+#define x264_decimate_score15_avx512 x264_template(decimate_score15_avx512)
int x264_decimate_score15_avx512( dctcoef *dct );
+#define x264_decimate_score16_sse2 x264_template(decimate_score16_sse2)
int x264_decimate_score16_sse2( dctcoef *dct );
+#define x264_decimate_score16_ssse3 x264_template(decimate_score16_ssse3)
int x264_decimate_score16_ssse3( dctcoef *dct );
+#define x264_decimate_score16_avx512 x264_template(decimate_score16_avx512)
int x264_decimate_score16_avx512( dctcoef *dct );
+#define x264_decimate_score64_sse2 x264_template(decimate_score64_sse2)
int x264_decimate_score64_sse2( dctcoef *dct );
+#define x264_decimate_score64_ssse3 x264_template(decimate_score64_ssse3)
int x264_decimate_score64_ssse3( dctcoef *dct );
+#define x264_decimate_score64_avx2 x264_template(decimate_score64_avx2)
int x264_decimate_score64_avx2( int16_t *dct );
+#define x264_decimate_score64_avx512 x264_template(decimate_score64_avx512)
int x264_decimate_score64_avx512( dctcoef *dct );
+#define x264_coeff_last4_mmx2 x264_template(coeff_last4_mmx2)
int x264_coeff_last4_mmx2( dctcoef *dct );
+#define x264_coeff_last8_mmx2 x264_template(coeff_last8_mmx2)
int x264_coeff_last8_mmx2( dctcoef *dct );
+#define x264_coeff_last15_mmx2 x264_template(coeff_last15_mmx2)
int x264_coeff_last15_mmx2( dctcoef *dct );
+#define x264_coeff_last16_mmx2 x264_template(coeff_last16_mmx2)
int x264_coeff_last16_mmx2( dctcoef *dct );
+#define x264_coeff_last64_mmx2 x264_template(coeff_last64_mmx2)
int x264_coeff_last64_mmx2( dctcoef *dct );
+#define x264_coeff_last8_sse2 x264_template(coeff_last8_sse2)
int x264_coeff_last8_sse2( dctcoef *dct );
+#define x264_coeff_last15_sse2 x264_template(coeff_last15_sse2)
int x264_coeff_last15_sse2( dctcoef *dct );
+#define x264_coeff_last16_sse2 x264_template(coeff_last16_sse2)
int x264_coeff_last16_sse2( dctcoef *dct );
+#define x264_coeff_last64_sse2 x264_template(coeff_last64_sse2)
int x264_coeff_last64_sse2( dctcoef *dct );
+#define x264_coeff_last4_lzcnt x264_template(coeff_last4_lzcnt)
int x264_coeff_last4_lzcnt( dctcoef *dct );
+#define x264_coeff_last8_lzcnt x264_template(coeff_last8_lzcnt)
int x264_coeff_last8_lzcnt( dctcoef *dct );
+#define x264_coeff_last15_lzcnt x264_template(coeff_last15_lzcnt)
int x264_coeff_last15_lzcnt( dctcoef *dct );
+#define x264_coeff_last16_lzcnt x264_template(coeff_last16_lzcnt)
int x264_coeff_last16_lzcnt( dctcoef *dct );
+#define x264_coeff_last64_lzcnt x264_template(coeff_last64_lzcnt)
int x264_coeff_last64_lzcnt( dctcoef *dct );
+#define x264_coeff_last64_avx2 x264_template(coeff_last64_avx2)
int x264_coeff_last64_avx2 ( dctcoef *dct );
+#define x264_coeff_last4_avx512 x264_template(coeff_last4_avx512)
int x264_coeff_last4_avx512( int32_t *dct );
+#define x264_coeff_last8_avx512 x264_template(coeff_last8_avx512)
int x264_coeff_last8_avx512( dctcoef *dct );
+#define x264_coeff_last15_avx512 x264_template(coeff_last15_avx512)
int x264_coeff_last15_avx512( dctcoef *dct );
+#define x264_coeff_last16_avx512 x264_template(coeff_last16_avx512)
int x264_coeff_last16_avx512( dctcoef *dct );
+#define x264_coeff_last64_avx512 x264_template(coeff_last64_avx512)
int x264_coeff_last64_avx512( dctcoef *dct );
+#define x264_coeff_level_run16_mmx2 x264_template(coeff_level_run16_mmx2)
int x264_coeff_level_run16_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_sse2 x264_template(coeff_level_run16_sse2)
int x264_coeff_level_run16_sse2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_lzcnt x264_template(coeff_level_run16_lzcnt)
int x264_coeff_level_run16_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_ssse3 x264_template(coeff_level_run16_ssse3)
int x264_coeff_level_run16_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_ssse3_lzcnt x264_template(coeff_level_run16_ssse3_lzcnt)
int x264_coeff_level_run16_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_avx2 x264_template(coeff_level_run16_avx2)
int x264_coeff_level_run16_avx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_mmx2 x264_template(coeff_level_run15_mmx2)
int x264_coeff_level_run15_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_sse2 x264_template(coeff_level_run15_sse2)
int x264_coeff_level_run15_sse2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_lzcnt x264_template(coeff_level_run15_lzcnt)
int x264_coeff_level_run15_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_ssse3 x264_template(coeff_level_run15_ssse3)
int x264_coeff_level_run15_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_ssse3_lzcnt x264_template(coeff_level_run15_ssse3_lzcnt)
int x264_coeff_level_run15_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_avx2 x264_template(coeff_level_run15_avx2)
int x264_coeff_level_run15_avx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_mmx2 x264_template(coeff_level_run4_mmx2)
int x264_coeff_level_run4_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_lzcnt x264_template(coeff_level_run4_lzcnt)
int x264_coeff_level_run4_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_ssse3 x264_template(coeff_level_run4_ssse3)
int x264_coeff_level_run4_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_ssse3_lzcnt x264_template(coeff_level_run4_ssse3_lzcnt)
int x264_coeff_level_run4_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_mmx2 x264_template(coeff_level_run8_mmx2)
int x264_coeff_level_run8_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_lzcnt x264_template(coeff_level_run8_lzcnt)
int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_sse2 x264_template(coeff_level_run8_sse2)
int x264_coeff_level_run8_sse2( dctcoef *dct, x264_run_level_t *runlevel );
-int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_ssse3 x264_template(coeff_level_run8_ssse3)
int x264_coeff_level_run8_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_ssse3_lzcnt x264_template(coeff_level_run8_ssse3_lzcnt)
int x264_coeff_level_run8_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_trellis_cabac_4x4_sse2 x264_template(trellis_cabac_4x4_sse2)
int x264_trellis_cabac_4x4_sse2 ( TRELLIS_PARAMS, int b_ac );
+#define x264_trellis_cabac_4x4_ssse3 x264_template(trellis_cabac_4x4_ssse3)
int x264_trellis_cabac_4x4_ssse3( TRELLIS_PARAMS, int b_ac );
+#define x264_trellis_cabac_8x8_sse2 x264_template(trellis_cabac_8x8_sse2)
int x264_trellis_cabac_8x8_sse2 ( TRELLIS_PARAMS, int b_interlaced );
+#define x264_trellis_cabac_8x8_ssse3 x264_template(trellis_cabac_8x8_ssse3)
int x264_trellis_cabac_8x8_ssse3( TRELLIS_PARAMS, int b_interlaced );
+#define x264_trellis_cabac_4x4_psy_sse2 x264_template(trellis_cabac_4x4_psy_sse2)
int x264_trellis_cabac_4x4_psy_sse2 ( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_4x4_psy_ssse3 x264_template(trellis_cabac_4x4_psy_ssse3)
int x264_trellis_cabac_4x4_psy_ssse3( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_8x8_psy_sse2 x264_template(trellis_cabac_8x8_psy_sse2)
int x264_trellis_cabac_8x8_psy_sse2 ( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_8x8_psy_ssse3 x264_template(trellis_cabac_8x8_psy_ssse3)
int x264_trellis_cabac_8x8_psy_ssse3( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_dc_sse2 x264_template(trellis_cabac_dc_sse2)
int x264_trellis_cabac_dc_sse2 ( TRELLIS_PARAMS, int i_coefs );
+#define x264_trellis_cabac_dc_ssse3 x264_template(trellis_cabac_dc_ssse3)
int x264_trellis_cabac_dc_ssse3( TRELLIS_PARAMS, int i_coefs );
+#define x264_trellis_cabac_chroma_422_dc_sse2 x264_template(trellis_cabac_chroma_422_dc_sse2)
int x264_trellis_cabac_chroma_422_dc_sse2 ( TRELLIS_PARAMS );
+#define x264_trellis_cabac_chroma_422_dc_ssse3 x264_template(trellis_cabac_chroma_422_dc_ssse3)
int x264_trellis_cabac_chroma_422_dc_ssse3( TRELLIS_PARAMS );
#endif
Only in x264-go.new/x264c/external/x264/common/x86: sad16-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: sad-a.asm
Only in x264-go.new/x264c/external/x264/common/x86: trellis-64.asm
diff -ur x264-go/x264c/external/x264/common/x86/util.h x264-go.new/x264c/external/x264/common/x86/util.h
--- x264-go/x264c/external/x264/common/x86/util.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/common/x86/util.h 2020-06-06 15:20:58.695039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* util.h: x86 inline asm
*****************************************************************************
- * Copyright (C) 2008-2017 x264 project
+ * Copyright (C) 2008-2020 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
* Loren Merritt <lorenm@u.washington.edu>
@@ -33,7 +33,7 @@
#undef M128_ZERO
#define M128_ZERO ((__m128){0,0,0,0})
#define x264_union128_t x264_union128_sse_t
-typedef union { __m128 i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_sse_t;
+typedef union { __m128 i; uint64_t q[2]; uint32_t d[4]; uint16_t w[8]; uint8_t b[16]; } MAY_ALIAS x264_union128_sse_t;
#if HAVE_VECTOREXT
typedef uint32_t v4si __attribute__((vector_size (16)));
#endif
@@ -122,7 +122,7 @@
}
#define x264_predictor_clip x264_predictor_clip_mmx2
-static int ALWAYS_INLINE x264_predictor_clip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
+static ALWAYS_INLINE int x264_predictor_clip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
{
static const uint32_t pd_32 = 0x20;
intptr_t tmp = (intptr_t)mv_limit, mvc_max = i_mvc, i = 0;
@@ -184,7 +184,7 @@
/* Same as the above, except we do (mv + 2) >> 2 on the input. */
#define x264_predictor_roundclip x264_predictor_roundclip_mmx2
-static int ALWAYS_INLINE x264_predictor_roundclip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
+static ALWAYS_INLINE int x264_predictor_roundclip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv )
{
static const uint64_t pw_2 = 0x0002000200020002ULL;
static const uint32_t pd_32 = 0x20;
Only in x264-go.new/x264c/external/x264/common/x86: x86inc.asm
Only in x264-go.new/x264c/external/x264/common/x86: x86util.asm
Only in x264-go.new/x264c/external/x264: common_
diff -ur x264-go/x264c/external/x264/encoder/analyse.c x264-go.new/x264c/external/x264/encoder/analyse.c
--- x264-go/x264c/external/x264/encoder/analyse.c 2020-08-25 18:16:05.835874815 +0200
+++ x264-go.new/x264c/external/x264/encoder/analyse.c 2020-06-06 15:20:58.696039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* analyse.c: macroblock analysis
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -49,8 +49,8 @@
int i_cost4x8[4]; /* cost per 8x8 partition */
int i_cost16x8;
int i_cost8x16;
- /* [ref][0] is 16x16 mv, [ref][1..4] are 8x8 mv from partition [0..3] */
- ALIGNED_4( int16_t mvc[32][5][2] );
+ /* [ref][0] is 16x16 mv, [ref][1..4] are 8x8 mv from partition [0..3], [ref][5] is for alignment */
+ ALIGNED_8( int16_t mvc[32][6][2] );
} x264_mb_analysis_list_t;
typedef struct
@@ -120,124 +120,6 @@
} x264_mb_analysis_t;
-/* lambda = pow(2,qp/6-2) */
-const uint16_t x264_lambda_tab[QP_MAX_MAX+1] =
-{
- 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 7 */
- 1, 1, 1, 1, 1, 1, 1, 1, /* 8-15 */
- 2, 2, 2, 2, 3, 3, 3, 4, /* 16-23 */
- 4, 4, 5, 6, 6, 7, 8, 9, /* 24-31 */
- 10, 11, 13, 14, 16, 18, 20, 23, /* 32-39 */
- 25, 29, 32, 36, 40, 45, 51, 57, /* 40-47 */
- 64, 72, 81, 91, 102, 114, 128, 144, /* 48-55 */
- 161, 181, 203, 228, 256, 287, 323, 362, /* 56-63 */
- 406, 456, 512, 575, 645, 724, 813, 912, /* 64-71 */
-1024,1149,1290,1448,1625,1825,2048,2299, /* 72-79 */
-2580,2896, /* 80-81 */
-};
-
-/* lambda2 = pow(lambda,2) * .9 * 256 */
-/* Capped to avoid overflow */
-const int x264_lambda2_tab[QP_MAX_MAX+1] =
-{
- 14, 18, 22, 28, 36, 45, 57, 72, /* 0- 7 */
- 91, 115, 145, 182, 230, 290, 365, 460, /* 8-15 */
- 580, 731, 921, 1161, 1462, 1843, 2322, 2925, /* 16-23 */
- 3686, 4644, 5851, 7372, 9289, 11703, 14745, 18578, /* 24-31 */
- 23407, 29491, 37156, 46814, 58982, 74313, 93628, 117964, /* 32-39 */
- 148626, 187257, 235929, 297252, 374514, 471859, 594505, 749029, /* 40-47 */
- 943718, 1189010, 1498059, 1887436, 2378021, 2996119, 3774873, 4756042, /* 48-55 */
- 5992238, 7549747, 9512085, 11984476, 15099494, 19024170,23968953,30198988, /* 56-63 */
- 38048341, 47937906, 60397977, 76096683, 95875813,120795955, /* 64-69 */
-134217727,134217727,134217727,134217727,134217727,134217727, /* 70-75 */
-134217727,134217727,134217727,134217727,134217727,134217727, /* 76-81 */
-};
-
-const uint8_t x264_exp2_lut[64] =
-{
- 0, 3, 6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 36, 39, 42, 45,
- 48, 52, 55, 58, 62, 65, 69, 72, 76, 80, 83, 87, 91, 94, 98, 102,
- 106, 110, 114, 118, 122, 126, 130, 135, 139, 143, 147, 152, 156, 161, 165, 170,
- 175, 179, 184, 189, 194, 198, 203, 208, 214, 219, 224, 229, 234, 240, 245, 250
-};
-
-const float x264_log2_lut[128] =
-{
- 0.00000, 0.01123, 0.02237, 0.03342, 0.04439, 0.05528, 0.06609, 0.07682,
- 0.08746, 0.09803, 0.10852, 0.11894, 0.12928, 0.13955, 0.14975, 0.15987,
- 0.16993, 0.17991, 0.18982, 0.19967, 0.20945, 0.21917, 0.22882, 0.23840,
- 0.24793, 0.25739, 0.26679, 0.27612, 0.28540, 0.29462, 0.30378, 0.31288,
- 0.32193, 0.33092, 0.33985, 0.34873, 0.35755, 0.36632, 0.37504, 0.38370,
- 0.39232, 0.40088, 0.40939, 0.41785, 0.42626, 0.43463, 0.44294, 0.45121,
- 0.45943, 0.46761, 0.47573, 0.48382, 0.49185, 0.49985, 0.50779, 0.51570,
- 0.52356, 0.53138, 0.53916, 0.54689, 0.55459, 0.56224, 0.56986, 0.57743,
- 0.58496, 0.59246, 0.59991, 0.60733, 0.61471, 0.62205, 0.62936, 0.63662,
- 0.64386, 0.65105, 0.65821, 0.66534, 0.67243, 0.67948, 0.68650, 0.69349,
- 0.70044, 0.70736, 0.71425, 0.72110, 0.72792, 0.73471, 0.74147, 0.74819,
- 0.75489, 0.76155, 0.76818, 0.77479, 0.78136, 0.78790, 0.79442, 0.80090,
- 0.80735, 0.81378, 0.82018, 0.82655, 0.83289, 0.83920, 0.84549, 0.85175,
- 0.85798, 0.86419, 0.87036, 0.87652, 0.88264, 0.88874, 0.89482, 0.90087,
- 0.90689, 0.91289, 0.91886, 0.92481, 0.93074, 0.93664, 0.94251, 0.94837,
- 0.95420, 0.96000, 0.96578, 0.97154, 0.97728, 0.98299, 0.98868, 0.99435,
-};
-
-/* Avoid an int/float conversion. */
-const float x264_log2_lz_lut[32] =
-{
- 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
-};
-
-// should the intra and inter lambdas be different?
-// I'm just matching the behaviour of deadzone quant.
-static const int x264_trellis_lambda2_tab[2][QP_MAX_MAX+1] =
-{
- // inter lambda = .85 * .85 * 2**(qp/3. + 10 - LAMBDA_BITS)
- {
- 46, 58, 73, 92, 117, 147,
- 185, 233, 294, 370, 466, 587,
- 740, 932, 1174, 1480, 1864, 2349,
- 2959, 3728, 4697, 5918, 7457, 9395,
- 11837, 14914, 18790, 23674, 29828, 37581,
- 47349, 59656, 75163, 94699, 119313, 150326,
- 189399, 238627, 300652, 378798, 477255, 601304,
- 757596, 954511, 1202608, 1515192, 1909022, 2405217,
- 3030384, 3818045, 4810435, 6060769, 7636091, 9620872,
- 12121539, 15272182, 19241743, 24243077, 30544363, 38483486,
- 48486154, 61088726, 76966972, 96972308,
- 122177453,134217727,134217727,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- },
- // intra lambda = .65 * .65 * 2**(qp/3. + 10 - LAMBDA_BITS)
- {
- 27, 34, 43, 54, 68, 86,
- 108, 136, 172, 216, 273, 343,
- 433, 545, 687, 865, 1090, 1374,
- 1731, 2180, 2747, 3461, 4361, 5494,
- 6922, 8721, 10988, 13844, 17442, 21976,
- 27688, 34885, 43953, 55377, 69771, 87906,
- 110755, 139543, 175813, 221511, 279087, 351627,
- 443023, 558174, 703255, 886046, 1116348, 1406511,
- 1772093, 2232697, 2813022, 3544186, 4465396, 5626046,
- 7088374, 8930791, 11252092, 14176748, 17861583, 22504184,
- 28353495, 35723165, 45008368, 56706990,
- 71446330, 90016736,113413980,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- }
-};
-
-#define MAX_CHROMA_LAMBDA_OFFSET 36
-static const uint16_t x264_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1] =
-{
- 16, 20, 25, 32, 40, 50,
- 64, 80, 101, 128, 161, 203,
- 256, 322, 406, 512, 645, 812,
- 1024, 1290, 1625, 2048, 2580, 3250,
- 4096, 5160, 6501, 8192, 10321, 13003,
- 16384, 20642, 26007, 32768, 41285, 52015,
- 65535
-};
-
/* TODO: calculate CABAC costs */
static const uint8_t i_mb_b_cost_table[X264_MBTYPE_MAX] =
{
@@ -256,18 +138,14 @@
5, 3, 3, 1
};
-static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a );
-
-static uint16_t x264_cost_ref[QP_MAX+1][3][33];
-static UNUSED x264_pthread_mutex_t cost_ref_mutex = X264_PTHREAD_MUTEX_INITIALIZER;
-static uint16_t x264_cost_i4x4_mode[(QP_MAX+2)*32];
+static void analyse_update_cache( x264_t *h, x264_mb_analysis_t *a );
static int init_costs( x264_t *h, float *logs, int qp )
{
if( h->cost_mv[qp] )
return 0;
- int mv_range = h->param.analyse.i_mv_range;
+ int mv_range = h->param.analyse.i_mv_range << PARAM_INTERLACED;
int lambda = x264_lambda_tab[qp];
/* factor of 4 from qpel, 2 from sign, and 2 because mv can be opposite from mvp */
CHECKED_MALLOC( h->cost_mv[qp], (4*4*mv_range + 1) * sizeof(uint16_t) );
@@ -277,11 +155,9 @@
h->cost_mv[qp][-i] =
h->cost_mv[qp][i] = X264_MIN( (int)(lambda * logs[i] + .5f), UINT16_MAX );
}
- x264_pthread_mutex_lock( &cost_ref_mutex );
for( int i = 0; i < 3; i++ )
for( int j = 0; j < 33; j++ )
- x264_cost_ref[qp][i][j] = i ? X264_MIN( lambda * bs_size_te( i, j ), UINT16_MAX ) : 0;
- x264_pthread_mutex_unlock( &cost_ref_mutex );
+ h->cost_table->ref[qp][i][j] = i ? X264_MIN( lambda * bs_size_te( i, j ), UINT16_MAX ) : 0;
if( h->param.analyse.i_me_method >= X264_ME_ESA && !h->cost_mv_fpel[qp][0] )
{
for( int j = 0; j < 4; j++ )
@@ -292,7 +168,7 @@
h->cost_mv_fpel[qp][j][i] = h->cost_mv[qp][i*4+j];
}
}
- uint16_t *cost_i4x4_mode = (uint16_t*)ALIGN((intptr_t)x264_cost_i4x4_mode,64) + qp*32;
+ uint16_t *cost_i4x4_mode = h->cost_table->i4x4_mode[qp];
for( int i = 0; i < 17; i++ )
cost_i4x4_mode[i] = 3*lambda*(i!=8);
return 0;
@@ -302,7 +178,7 @@
int x264_analyse_init_costs( x264_t *h )
{
- int mv_range = h->param.analyse.i_mv_range;
+ int mv_range = h->param.analyse.i_mv_range << PARAM_INTERLACED;
float *logs = x264_malloc( (2*4*mv_range+1) * sizeof(float) );
if( !logs )
return -1;
@@ -327,14 +203,16 @@
void x264_analyse_free_costs( x264_t *h )
{
- int mv_range = h->param.analyse.i_mv_range;
+ int mv_range = h->param.analyse.i_mv_range << PARAM_INTERLACED;
for( int i = 0; i < QP_MAX+1; i++ )
{
if( h->cost_mv[i] )
x264_free( h->cost_mv[i] - 2*4*mv_range );
- if( h->cost_mv_fpel[i][0] )
- for( int j = 0; j < 4; j++ )
+ for( int j = 0; j < 4; j++ )
+ {
+ if( h->cost_mv_fpel[i][j] )
x264_free( h->cost_mv_fpel[i][j] - 2*mv_range );
+ }
}
}
@@ -367,14 +245,14 @@
}
/* initialize an array of lambda*nbits for all possible mvs */
-static void x264_mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a )
{
a->p_cost_mv = h->cost_mv[a->i_qp];
- a->p_cost_ref[0] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l0_active-1,0,2)];
- a->p_cost_ref[1] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l1_active-1,0,2)];
+ a->p_cost_ref[0] = h->cost_table->ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l0_active-1,0,2)];
+ a->p_cost_ref[1] = h->cost_table->ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l1_active-1,0,2)];
}
-static void x264_mb_analyse_init_qp( x264_t *h, x264_mb_analysis_t *a, int qp )
+static void mb_analyse_init_qp( x264_t *h, x264_mb_analysis_t *a, int qp )
{
int effective_chroma_qp = h->chroma_qp_table[SPEC_QP(qp)] + X264_MAX( qp - QP_MAX_SPEC, 0 );
a->i_lambda = x264_lambda_tab[qp];
@@ -413,7 +291,7 @@
h->mb.i_chroma_qp = h->chroma_qp_table[qp];
}
-static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
+static void mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
{
int subme = h->param.analyse.i_subpel_refine - (h->sh.i_type == SLICE_TYPE_B);
@@ -424,15 +302,15 @@
h->mb.b_deblock_rdo = h->param.analyse.i_subpel_refine >= 9 && h->sh.i_disable_deblocking_filter_idc != 1;
a->b_early_terminate = h->param.analyse.i_subpel_refine < 11;
- x264_mb_analyse_init_qp( h, a, qp );
+ mb_analyse_init_qp( h, a, qp );
h->mb.b_transform_8x8 = 0;
/* I: Intra part */
a->i_satd_i16x16 =
a->i_satd_i8x8 =
- a->i_satd_i4x4 =
- a->i_satd_chroma = COST_MAX;
+ a->i_satd_i4x4 = COST_MAX;
+ a->i_satd_chroma = CHROMA_FORMAT ? COST_MAX : 0;
/* non-RD PCM decision is inaccurate (as is psy-rd), so don't do it.
* PCM cost can overflow with high lambda2, so cap it at COST_MAX. */
@@ -567,14 +445,12 @@
/* Fast intra decision */
if( a->b_early_terminate && h->mb.i_mb_xy - h->sh.i_first_mb > 4 )
{
- /* Always run in fast-intra mode for subme < 3 */
- if( h->mb.i_subpel_refine > 2 &&
- ( IS_INTRA( h->mb.i_mb_type_left[0] ) ||
+ if( IS_INTRA( h->mb.i_mb_type_left[0] ) ||
IS_INTRA( h->mb.i_mb_type_top ) ||
IS_INTRA( h->mb.i_mb_type_topleft ) ||
IS_INTRA( h->mb.i_mb_type_topright ) ||
(h->sh.i_type == SLICE_TYPE_P && IS_INTRA( h->fref[0][0]->mb_type[h->mb.i_mb_xy] )) ||
- (h->mb.i_mb_xy - h->sh.i_first_mb < 3*(h->stat.frame.i_mb_count[I_4x4] + h->stat.frame.i_mb_count[I_8x8] + h->stat.frame.i_mb_count[I_16x16])) ) )
+ (h->mb.i_mb_xy - h->sh.i_first_mb < 3*(h->stat.frame.i_mb_count[I_4x4] + h->stat.frame.i_mb_count[I_8x8] + h->stat.frame.i_mb_count[I_16x16])) )
{ /* intra is likely */ }
else
{
@@ -682,21 +558,19 @@
}
/* For trellis=2, we need to do this for both sizes of DCT, for trellis=1 we only need to use it on the chosen mode. */
-static void inline x264_psy_trellis_init( x264_t *h, int do_both_dct )
+static inline void psy_trellis_init( x264_t *h, int do_both_dct )
{
- ALIGNED_16( static pixel zero[16*FDEC_STRIDE] ) = {0};
-
if( do_both_dct || h->mb.b_transform_8x8 )
- h->dctf.sub16x16_dct8( h->mb.pic.fenc_dct8, h->mb.pic.p_fenc[0], zero );
+ h->dctf.sub16x16_dct8( h->mb.pic.fenc_dct8, h->mb.pic.p_fenc[0], (pixel*)x264_zero );
if( do_both_dct || !h->mb.b_transform_8x8 )
- h->dctf.sub16x16_dct( h->mb.pic.fenc_dct4, h->mb.pic.p_fenc[0], zero );
+ h->dctf.sub16x16_dct( h->mb.pic.fenc_dct4, h->mb.pic.p_fenc[0], (pixel*)x264_zero );
}
/* Reset fenc satd scores cache for psy RD */
-static inline void x264_mb_init_fenc_cache( x264_t *h, int b_satd )
+static inline void mb_init_fenc_cache( x264_t *h, int b_satd )
{
if( h->param.analyse.i_trellis == 2 && h->mb.i_psy_trellis )
- x264_psy_trellis_init( h, h->param.analyse.b_transform_8x8 );
+ psy_trellis_init( h, h->param.analyse.b_transform_8x8 );
if( !h->mb.i_psy_rd )
return;
@@ -709,7 +583,7 @@
h->mc.memzero_aligned( h->mb.pic.fenc_satd_cache, sizeof(h->mb.pic.fenc_satd_cache) );
}
-static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a )
{
if( a->i_satd_chroma < COST_MAX )
return;
@@ -791,7 +665,7 @@
}
/* FIXME: should we do any sort of merged chroma analysis with 4:4:4? */
-static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
+static void mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
{
const unsigned int flags = h->sh.i_type == SLICE_TYPE_I ? h->param.analyse.intra : h->param.analyse.inter;
pixel *p_src = h->mb.pic.p_fenc[0];
@@ -867,7 +741,7 @@
return;
}
- uint16_t *cost_i4x4_mode = (uint16_t*)ALIGN((intptr_t)x264_cost_i4x4_mode,64) + a->i_qp*32 + 8;
+ uint16_t *cost_i4x4_mode = h->cost_table->i4x4_mode[a->i_qp] + 8;
/* 8x8 prediction selection */
if( flags & X264_ANALYSE_I8x8 )
{
@@ -909,10 +783,11 @@
{
if( !h->mb.b_lossless && predict_mode[5] >= 0 )
{
- ALIGNED_ARRAY_16( int32_t, satd,[9] );
+ ALIGNED_ARRAY_16( int32_t, satd,[4] );
h->pixf.intra_mbcmp_x3_8x8( p_src_by, edge, satd );
int favor_vertical = satd[I_PRED_4x4_H] > satd[I_PRED_4x4_V];
- satd[i_pred_mode] -= 3 * lambda;
+ if( i_pred_mode < 3 )
+ satd[i_pred_mode] -= 3 * lambda;
for( int i = 2; i >= 0; i-- )
{
int cost = satd[i];
@@ -1027,10 +902,11 @@
{
if( !h->mb.b_lossless && predict_mode[5] >= 0 )
{
- ALIGNED_ARRAY_16( int32_t, satd,[9] );
+ ALIGNED_ARRAY_16( int32_t, satd,[4] );
h->pixf.intra_mbcmp_x3_4x4( p_src_by, p_dst_by, satd );
int favor_vertical = satd[I_PRED_4x4_H] > satd[I_PRED_4x4_V];
- satd[i_pred_mode] -= 3 * lambda;
+ if( i_pred_mode < 3 )
+ satd[i_pred_mode] -= 3 * lambda;
i_best = satd[I_PRED_4x4_DC]; a->i_predict4x4[idx] = I_PRED_4x4_DC;
COPY2_IF_LT( i_best, satd[I_PRED_4x4_H], a->i_predict4x4[idx], I_PRED_4x4_H );
COPY2_IF_LT( i_best, satd[I_PRED_4x4_V], a->i_predict4x4[idx], I_PRED_4x4_V );
@@ -1103,7 +979,7 @@
}
}
-static void x264_intra_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_thresh )
+static void intra_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_thresh )
{
if( !a->b_early_terminate )
i_satd_thresh = COST_MAX;
@@ -1111,8 +987,8 @@
if( a->i_satd_i16x16 < i_satd_thresh )
{
h->mb.i_type = I_16x16;
- x264_analyse_update_cache( h, a );
- a->i_satd_i16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i16x16 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->i_satd_i16x16 = COST_MAX;
@@ -1120,8 +996,8 @@
if( a->i_satd_i4x4 < i_satd_thresh )
{
h->mb.i_type = I_4x4;
- x264_analyse_update_cache( h, a );
- a->i_satd_i4x4 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i4x4 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->i_satd_i4x4 = COST_MAX;
@@ -1129,15 +1005,15 @@
if( a->i_satd_i8x8 < i_satd_thresh )
{
h->mb.i_type = I_8x8;
- x264_analyse_update_cache( h, a );
- a->i_satd_i8x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_satd_i8x8 = rd_cost_mb( h, a->i_lambda2 );
a->i_cbp_i8x8_luma = h->mb.i_cbp_luma;
}
else
a->i_satd_i8x8 = COST_MAX;
}
-static void x264_intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
+static void intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
{
uint64_t i_satd, i_best;
int plane_count = CHROMA444 ? 3 : 1;
@@ -1155,13 +1031,13 @@
if( i_mode == old_pred_mode || a->i_satd_i16x16_dir[i_mode] > i_thresh )
continue;
h->mb.i_intra16x16_pred_mode = i_mode;
- i_satd = x264_rd_cost_mb( h, a->i_lambda2 );
+ i_satd = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( i_best, i_satd, a->i_predict16x16, i_mode );
}
}
/* RD selection for chroma prediction */
- if( !CHROMA444 )
+ if( CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422 )
{
const int8_t *predict_mode = predict_chroma_mode_available( h->mb.i_neighbour_intra );
if( predict_mode[1] >= 0 )
@@ -1181,10 +1057,10 @@
{
int i_cbp_chroma_best = h->mb.i_cbp_chroma;
int i_chroma_lambda = x264_lambda2_tab[h->mb.i_chroma_qp];
- /* the previous thing encoded was x264_intra_rd(), so the pixels and
+ /* the previous thing encoded was intra_rd(), so the pixels and
* coefs for the current chroma mode are still around, so we only
* have to recount the bits. */
- i_best = x264_rd_cost_chroma( h, i_chroma_lambda, a->i_predict8x8chroma, 0 );
+ i_best = rd_cost_chroma( h, i_chroma_lambda, a->i_predict8x8chroma, 0 );
for( int i = 0; i < i_max; i++ )
{
int i_mode = predict_mode_sorted[i];
@@ -1198,7 +1074,7 @@
/* if we've already found a mode that needs no residual, then
* probably any mode with a residual will be worse.
* so avoid dct on the remaining modes to improve speed. */
- i_satd = x264_rd_cost_chroma( h, i_chroma_lambda, i_mode, h->mb.i_cbp_chroma != 0x00 );
+ i_satd = rd_cost_chroma( h, i_chroma_lambda, i_mode, h->mb.i_cbp_chroma != 0x00 );
COPY3_IF_LT( i_best, i_satd, a->i_predict8x8chroma, i_mode, i_cbp_chroma_best, h->mb.i_cbp_chroma );
}
h->mb.i_chroma_pred_mode = a->i_predict8x8chroma;
@@ -1214,8 +1090,8 @@
for( int idx = 0; idx < 16; idx++ )
{
pixel *dst[3] = {h->mb.pic.p_fdec[0] + block_idx_xy_fdec[idx],
- h->mb.pic.p_fdec[1] + block_idx_xy_fdec[idx],
- h->mb.pic.p_fdec[2] + block_idx_xy_fdec[idx]};
+ CHROMA_FORMAT ? h->mb.pic.p_fdec[1] + block_idx_xy_fdec[idx] : NULL,
+ CHROMA_FORMAT ? h->mb.pic.p_fdec[2] + block_idx_xy_fdec[idx] : NULL};
i_best = COST_MAX64;
const int8_t *predict_mode = predict_4x4_mode_available( a->b_avoid_topright, h->mb.i_neighbour4[idx], idx );
@@ -1228,7 +1104,7 @@
for( ; *predict_mode >= 0; predict_mode++ )
{
int i_mode = *predict_mode;
- i_satd = x264_rd_cost_i4x4( h, a->i_lambda2, idx, i_mode );
+ i_satd = rd_cost_i4x4( h, a->i_lambda2, idx, i_mode );
if( i_best > i_satd )
{
@@ -1269,8 +1145,8 @@
int y = idx>>1;
int s8 = X264_SCAN8_0 + 2*x + 16*y;
pixel *dst[3] = {h->mb.pic.p_fdec[0] + 8*x + 8*y*FDEC_STRIDE,
- h->mb.pic.p_fdec[1] + 8*x + 8*y*FDEC_STRIDE,
- h->mb.pic.p_fdec[2] + 8*x + 8*y*FDEC_STRIDE};
+ CHROMA_FORMAT ? h->mb.pic.p_fdec[1] + 8*x + 8*y*FDEC_STRIDE : NULL,
+ CHROMA_FORMAT ? h->mb.pic.p_fdec[2] + 8*x + 8*y*FDEC_STRIDE : NULL};
int cbp_luma_new = 0;
int i_thresh = a->b_early_terminate ? a->i_satd_i8x8_dir[idx][a->i_predict8x8[idx]] * 11/8 : COST_MAX;
@@ -1287,7 +1163,7 @@
continue;
h->mb.i_cbp_luma = a->i_cbp_i8x8_luma;
- i_satd = x264_rd_cost_i8x8( h, a->i_lambda2, idx, i_mode, edge );
+ i_satd = rd_cost_i8x8( h, a->i_lambda2, idx, i_mode, edge );
if( i_best > i_satd )
{
@@ -1331,30 +1207,40 @@
(m)->i_stride[1] = h->mb.pic.i_stride[1]; \
(m)->i_stride[2] = h->mb.pic.i_stride[2]; \
(m)->p_fenc[0] = &(src)[0][(xoff)+(yoff)*FENC_STRIDE]; \
- (m)->p_fenc[1] = &(src)[1][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \
- (m)->p_fenc[2] = &(src)[2][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \
+ if( CHROMA_FORMAT ) \
+ { \
+ (m)->p_fenc[1] = &(src)[1][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \
+ (m)->p_fenc[2] = &(src)[2][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \
+ } \
}
#define LOAD_HPELS(m, src, list, ref, xoff, yoff) \
{ \
(m)->p_fref_w = (m)->p_fref[0] = &(src)[0][(xoff)+(yoff)*(m)->i_stride[0]]; \
- (m)->p_fref[1] = &(src)[1][(xoff)+(yoff)*(m)->i_stride[0]]; \
- (m)->p_fref[2] = &(src)[2][(xoff)+(yoff)*(m)->i_stride[0]]; \
- (m)->p_fref[3] = &(src)[3][(xoff)+(yoff)*(m)->i_stride[0]]; \
+ if( h->param.analyse.i_subpel_refine ) \
+ { \
+ (m)->p_fref[1] = &(src)[1][(xoff)+(yoff)*(m)->i_stride[0]]; \
+ (m)->p_fref[2] = &(src)[2][(xoff)+(yoff)*(m)->i_stride[0]]; \
+ (m)->p_fref[3] = &(src)[3][(xoff)+(yoff)*(m)->i_stride[0]]; \
+ } \
if( CHROMA444 ) \
{ \
(m)->p_fref[ 4] = &(src)[ 4][(xoff)+(yoff)*(m)->i_stride[1]]; \
- (m)->p_fref[ 5] = &(src)[ 5][(xoff)+(yoff)*(m)->i_stride[1]]; \
- (m)->p_fref[ 6] = &(src)[ 6][(xoff)+(yoff)*(m)->i_stride[1]]; \
- (m)->p_fref[ 7] = &(src)[ 7][(xoff)+(yoff)*(m)->i_stride[1]]; \
(m)->p_fref[ 8] = &(src)[ 8][(xoff)+(yoff)*(m)->i_stride[2]]; \
- (m)->p_fref[ 9] = &(src)[ 9][(xoff)+(yoff)*(m)->i_stride[2]]; \
- (m)->p_fref[10] = &(src)[10][(xoff)+(yoff)*(m)->i_stride[2]]; \
- (m)->p_fref[11] = &(src)[11][(xoff)+(yoff)*(m)->i_stride[2]]; \
+ if( h->param.analyse.i_subpel_refine ) \
+ { \
+ (m)->p_fref[ 5] = &(src)[ 5][(xoff)+(yoff)*(m)->i_stride[1]]; \
+ (m)->p_fref[ 6] = &(src)[ 6][(xoff)+(yoff)*(m)->i_stride[1]]; \
+ (m)->p_fref[ 7] = &(src)[ 7][(xoff)+(yoff)*(m)->i_stride[1]]; \
+ (m)->p_fref[ 9] = &(src)[ 9][(xoff)+(yoff)*(m)->i_stride[2]]; \
+ (m)->p_fref[10] = &(src)[10][(xoff)+(yoff)*(m)->i_stride[2]]; \
+ (m)->p_fref[11] = &(src)[11][(xoff)+(yoff)*(m)->i_stride[2]]; \
+ } \
} \
- else \
+ else if( CHROMA_FORMAT ) \
(m)->p_fref[4] = &(src)[4][(xoff)+((yoff)>>CHROMA_V_SHIFT)*(m)->i_stride[1]]; \
- (m)->integral = &h->mb.pic.p_integral[list][ref][(xoff)+(yoff)*(m)->i_stride[0]]; \
+ if( h->param.analyse.i_me_method >= X264_ME_ESA ) \
+ (m)->integral = &h->mb.pic.p_integral[list][ref][(xoff)+(yoff)*(m)->i_stride[0]]; \
(m)->weight = x264_weight_none; \
(m)->i_ref = ref; \
}
@@ -1366,11 +1252,11 @@
#define REF_COST(list, ref) \
(a->p_cost_ref[list][ref])
-static void x264_mb_analyse_inter_p16x16( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p16x16( x264_t *h, x264_mb_analysis_t *a )
{
x264_me_t m;
int i_mvc;
- ALIGNED_4( int16_t mvc[8][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[8],[2] );
int i_halfpel_thresh = INT_MAX;
int *p_halfpel_thresh = (a->b_early_terminate && h->mb.pic.i_fref[0]>1) ? &i_halfpel_thresh : NULL;
@@ -1415,7 +1301,7 @@
&& x264_macroblock_probe_pskip( h ) )
{
h->mb.i_type = P_SKIP;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
assert( h->mb.cache.pskip_mv[1] <= h->mb.mv_max_spel[1] || h->i_thread_frames == 1 );
return;
}
@@ -1433,19 +1319,19 @@
h->mb.i_type = P_L0;
if( a->i_mbrd )
{
- x264_mb_init_fenc_cache( h, a->i_mbrd >= 2 || h->param.analyse.inter & X264_ANALYSE_PSUB8x8 );
+ mb_init_fenc_cache( h, a->i_mbrd >= 2 || h->param.analyse.inter & X264_ANALYSE_PSUB8x8 );
if( a->l0.me16x16.i_ref == 0 && M32( a->l0.me16x16.mv ) == M32( h->mb.cache.pskip_mv ) && !a->b_force_intra )
{
h->mb.i_partition = D_16x16;
x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
if( !(h->mb.i_cbp_luma|h->mb.i_cbp_chroma) )
h->mb.i_type = P_SKIP;
}
}
}
-static void x264_mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
@@ -1536,7 +1422,7 @@
M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101;
}
-static void x264_mb_analyse_inter_p8x8( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_p8x8( x264_t *h, x264_mb_analysis_t *a )
{
/* Duplicate refs are rarely useful in p8x8 due to the high cost of the
* reference frame flags. Thus, if we're not doing mixedrefs, just
@@ -1591,11 +1477,11 @@
M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101;
}
-static void x264_mb_analyse_inter_p16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_p16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
- ALIGNED_4( int16_t mvc[3][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[3],[2] );
/* XXX Needed for x264_mb_predict_mv */
h->mb.i_partition = D_16x8;
@@ -1657,11 +1543,11 @@
a->l0.i_cost16x8 = a->l0.me16x8[0].cost + a->l0.me16x8[1].cost;
}
-static void x264_mb_analyse_inter_p8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_p8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
x264_me_t m;
pixel **p_fenc = h->mb.pic.p_fenc;
- ALIGNED_4( int16_t mvc[3][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[3],[2] );
/* XXX Needed for x264_mb_predict_mv */
h->mb.i_partition = D_8x16;
@@ -1722,8 +1608,8 @@
a->l0.i_cost8x16 = a->l0.me8x16[0].cost + a->l0.me8x16[1].cost;
}
-static ALWAYS_INLINE int x264_mb_analyse_inter_p4x4_chroma_internal( x264_t *h, x264_mb_analysis_t *a,
- pixel **p_fref, int i8x8, int size, int chroma )
+static ALWAYS_INLINE int mb_analyse_inter_p4x4_chroma_internal( x264_t *h, x264_mb_analysis_t *a,
+ pixel **p_fref, int i8x8, int size, int chroma )
{
ALIGNED_ARRAY_32( pixel, pix1,[16*16] );
pixel *pix2 = pix1+8;
@@ -1786,17 +1672,17 @@
+ h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[2][oe], FENC_STRIDE, pix2, 16 );
}
-static int x264_mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, pixel **p_fref, int i8x8, int size )
+static int mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, pixel **p_fref, int i8x8, int size )
{
if( CHROMA_FORMAT == CHROMA_444 )
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_444 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_444 );
else if( CHROMA_FORMAT == CHROMA_422 )
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_422 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_422 );
else
- return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_420 );
+ return mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_420 );
}
-static void x264_mb_analyse_inter_p4x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p4x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
@@ -1832,10 +1718,10 @@
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x4];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost4x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x4 );
+ a->l0.i_cost4x4[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x4 );
}
-static void x264_mb_analyse_inter_p8x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p8x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
@@ -1868,10 +1754,10 @@
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_8x4];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost8x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_8x4 );
+ a->l0.i_cost8x4[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_8x4 );
}
-static void x264_mb_analyse_inter_p4x8( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
+static void mb_analyse_inter_p4x8( x264_t *h, x264_mb_analysis_t *a, int i8x8 )
{
pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref];
pixel **p_fenc = h->mb.pic.p_fenc;
@@ -1904,10 +1790,10 @@
REF_COST( 0, i_ref ) +
a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x8];
if( h->mb.b_chroma_me && !CHROMA444 )
- a->l0.i_cost4x8[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x8 );
+ a->l0.i_cost4x8[i8x8] += mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x8 );
}
-static ALWAYS_INLINE int x264_analyse_bi_chroma( x264_t *h, x264_mb_analysis_t *a, int idx, int i_pixel )
+static ALWAYS_INLINE int analyse_bi_chroma( x264_t *h, x264_mb_analysis_t *a, int idx, int i_pixel )
{
ALIGNED_ARRAY_32( pixel, pix, [4],[16*16] );
ALIGNED_ARRAY_32( pixel, bi, [2],[16*16] );
@@ -1955,7 +1841,7 @@
return i_chroma_cost;
}
-static void x264_mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a )
{
/* Assumes that fdec still contains the results of
* x264_mb_predict_mv_direct16x16 and x264_mb_mc */
@@ -2001,14 +1887,14 @@
}
}
-static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
{
ALIGNED_ARRAY_32( pixel, pix0,[16*16] );
ALIGNED_ARRAY_32( pixel, pix1,[16*16] );
pixel *src0, *src1;
intptr_t stride0 = 16, stride1 = 16;
int i_ref, i_mvc;
- ALIGNED_4( int16_t mvc[9][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[9],[2] );
int try_skip = a->b_try_skip;
int list1_skipped = 0;
int i_halfpel_thresh[2] = {INT_MAX, INT_MAX};
@@ -2073,7 +1959,7 @@
{
/* We already tested skip */
h->mb.i_type = B_SKIP;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
return;
}
}
@@ -2105,7 +1991,7 @@
+ a->l1.bi16x16.cost_mv;
if( h->mb.b_chroma_me )
- a->i_cost16x16bi += x264_analyse_bi_chroma( h, a, 0, PIXEL_16x16 );
+ a->i_cost16x16bi += analyse_bi_chroma( h, a, 0, PIXEL_16x16 );
/* Always try the 0,0,0,0 vector; helps avoid errant motion vectors in fades */
if( M32( a->l0.bi16x16.mv ) | M32( a->l1.bi16x16.mv ) )
@@ -2137,7 +2023,7 @@
}
else
{
- ALIGNED_ARRAY_32( pixel, pixuv, [2],[16*FENC_STRIDE] );
+ ALIGNED_ARRAY_64( pixel, pixuv, [2],[16*FENC_STRIDE] );
int chromapix = h->luma2chroma_pixel[PIXEL_16x16];
int v_shift = CHROMA_V_SHIFT;
@@ -2187,7 +2073,7 @@
a->l1.me16x16.cost += a->i_lambda * i_mb_b_cost_table[B_L1_L1];
}
-static inline void x264_mb_cache_mv_p8x8( x264_t *h, x264_mb_analysis_t *a, int i )
+static inline void mb_cache_mv_p8x8( x264_t *h, x264_mb_analysis_t *a, int i )
{
int x = 2*(i&1);
int y = i&2;
@@ -2217,7 +2103,7 @@
}
}
-static void x264_mb_load_mv_direct8x8( x264_t *h, int idx )
+static void mb_load_mv_direct8x8( x264_t *h, int idx )
{
int x = 2*(idx&1);
int y = idx&2;
@@ -2253,13 +2139,13 @@
x264_macroblock_cache_mvd( h, x,y,dx,dy, 1, 0 ); \
}
-static inline void x264_mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
int x = 2*(i&1);
int y = i&2;
if( h->mb.i_sub_partition[i] == D_DIRECT_8x8 )
{
- x264_mb_load_mv_direct8x8( h, i );
+ mb_load_mv_direct8x8( h, i );
if( b_mvd )
{
x264_macroblock_cache_mvd( h, x, y, 2, 2, 0, 0 );
@@ -2272,17 +2158,17 @@
CACHE_MV_BI( x, y, 2, 2, a->l0.me8x8[i], a->l1.me8x8[i], h->mb.i_sub_partition[i] );
}
}
-static inline void x264_mb_cache_mv_b16x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b16x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
CACHE_MV_BI( 0, 2*i, 4, 2, a->l0.me16x8[i], a->l1.me16x8[i], a->i_mb_partition16x8[i] );
}
-static inline void x264_mb_cache_mv_b8x16( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
+static inline void mb_cache_mv_b8x16( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd )
{
CACHE_MV_BI( 2*i, 0, 2, 4, a->l0.me8x16[i], a->l1.me8x16[i], a->i_mb_partition8x16[i] );
}
#undef CACHE_MV_BI
-static void x264_mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a )
{
ALIGNED_ARRAY_16( pixel, pix,[2],[8*8] );
int i_maxref[2] = {h->mb.pic.i_fref[0]-1, h->mb.pic.i_fref[1]-1};
@@ -2371,7 +2257,7 @@
if( h->mb.b_chroma_me )
{
- int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 );
+ int i_chroma_cost = analyse_bi_chroma( h, a, i, PIXEL_8x8 );
i_part_cost_bi += i_chroma_cost;
a->i_satd8x8[2][i] += i_chroma_cost;
}
@@ -2387,14 +2273,14 @@
a->i_cost8x8bi += i_part_cost;
/* XXX Needed for x264_mb_predict_mv */
- x264_mb_cache_mv_b8x8( h, a, i, 0 );
+ mb_cache_mv_b8x8( h, a, i, 0 );
}
/* mb type cost */
a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8];
}
-static void x264_mb_analyse_inter_b8x8( x264_t *h, x264_mb_analysis_t *a )
+static void mb_analyse_inter_b8x8( x264_t *h, x264_mb_analysis_t *a )
{
pixel **p_fref[2] =
{ h->mb.pic.p_fref[0][a->l0.me16x16.i_ref],
@@ -2451,7 +2337,7 @@
if( h->mb.b_chroma_me )
{
- int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 );
+ int i_chroma_cost = analyse_bi_chroma( h, a, i, PIXEL_8x8 );
i_part_cost_bi += i_chroma_cost;
a->i_satd8x8[2][i] += i_chroma_cost;
}
@@ -2464,17 +2350,17 @@
a->i_cost8x8bi += i_part_cost;
/* XXX Needed for x264_mb_predict_mv */
- x264_mb_cache_mv_b8x8( h, a, i, 0 );
+ mb_cache_mv_b8x8( h, a, i, 0 );
}
/* mb type cost */
a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8];
}
-static void x264_mb_analyse_inter_b16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_b16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
ALIGNED_ARRAY_32( pixel, pix,[2],[16*8] );
- ALIGNED_4( int16_t mvc[3][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[3],[2] );
h->mb.i_partition = D_16x8;
a->i_cost16x8bi = 0;
@@ -2529,7 +2415,7 @@
+ a->l1.me16x8[i].i_ref_cost;
if( h->mb.b_chroma_me )
- i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_16x8 );
+ i_part_cost_bi += analyse_bi_chroma( h, a, i, PIXEL_16x8 );
i_part_cost = a->l0.me16x8[i].cost;
a->i_mb_partition16x8[i] = D_L0_8x8; /* not actually 8x8, only the L0 matters */
@@ -2555,7 +2441,7 @@
return;
}
- x264_mb_cache_mv_b16x8( h, a, i, 0 );
+ mb_cache_mv_b16x8( h, a, i, 0 );
}
/* mb type cost */
@@ -2565,10 +2451,10 @@
a->i_cost16x8bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type16x8];
}
-static void x264_mb_analyse_inter_b8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
+static void mb_analyse_inter_b8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd )
{
ALIGNED_ARRAY_16( pixel, pix,[2],[8*16] );
- ALIGNED_4( int16_t mvc[3][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[3],[2] );
h->mb.i_partition = D_8x16;
a->i_cost8x16bi = 0;
@@ -2622,7 +2508,7 @@
+ a->l1.me8x16[i].i_ref_cost;
if( h->mb.b_chroma_me )
- i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_8x16 );
+ i_part_cost_bi += analyse_bi_chroma( h, a, i, PIXEL_8x16 );
i_part_cost = a->l0.me8x16[i].cost;
a->i_mb_partition8x16[i] = D_L0_8x8;
@@ -2648,7 +2534,7 @@
return;
}
- x264_mb_cache_mv_b8x16( h, a, i, 0 );
+ mb_cache_mv_b8x16( h, a, i, 0 );
}
/* mb type cost */
@@ -2658,7 +2544,7 @@
a->i_cost8x16bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type8x16];
}
-static void x264_mb_analyse_p_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd )
+static void mb_analyse_p_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd )
{
int thresh = a->b_early_terminate ? i_satd * 5/4 + 1 : COST_MAX;
@@ -2666,15 +2552,15 @@
if( a->l0.i_rd16x16 == COST_MAX && (!a->b_early_terminate || a->l0.me16x16.cost <= i_satd * 3/2) )
{
h->mb.i_partition = D_16x16;
- x264_analyse_update_cache( h, a );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
if( a->l0.i_cost16x8 < thresh )
{
h->mb.i_partition = D_16x8;
- x264_analyse_update_cache( h, a );
- a->l0.i_cost16x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost16x8 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost16x8 = COST_MAX;
@@ -2682,8 +2568,8 @@
if( a->l0.i_cost8x16 < thresh )
{
h->mb.i_partition = D_8x16;
- x264_analyse_update_cache( h, a );
- a->l0.i_cost8x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost8x16 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost8x16 = COST_MAX;
@@ -2712,7 +2598,7 @@
if( costs[subtype] > sub8x8_thresh )
continue;
h->mb.i_sub_partition[i] = subtype;
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
if( subtype == btype )
continue;
cost = x264_rd_cost_part( h, a->i_lambda2, i<<2, PIXEL_8x8 );
@@ -2721,19 +2607,19 @@
if( h->mb.i_sub_partition[i] != btype )
{
h->mb.i_sub_partition[i] = btype;
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
}
}
}
else
- x264_analyse_update_cache( h, a );
- a->l0.i_cost8x8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_cost8x8 = rd_cost_mb( h, a->i_lambda2 );
}
else
a->l0.i_cost8x8 = COST_MAX;
}
-static void x264_mb_analyse_b_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
+static void mb_analyse_b_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )
{
int thresh = a->b_early_terminate ? i_satd_inter * (17 + (!!h->mb.i_psy_rd))/16 + 1 : COST_MAX;
@@ -2743,8 +2629,8 @@
/* Assumes direct/skip MC is still in fdec */
/* Requires b-rdo to be done before intra analysis */
h->mb.b_skip_mc = 1;
- x264_analyse_update_cache( h, a );
- a->i_rd16x16direct = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x16direct = rd_cost_mb( h, a->i_lambda2 );
h->mb.b_skip_mc = 0;
}
@@ -2754,24 +2640,24 @@
if( a->l0.me16x16.cost < thresh && a->l0.i_rd16x16 == COST_MAX )
{
h->mb.i_type = B_L0_L0;
- x264_analyse_update_cache( h, a );
- a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l0.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
/* L1 */
if( a->l1.me16x16.cost < thresh && a->l1.i_rd16x16 == COST_MAX )
{
h->mb.i_type = B_L1_L1;
- x264_analyse_update_cache( h, a );
- a->l1.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->l1.i_rd16x16 = rd_cost_mb( h, a->i_lambda2 );
}
/* BI */
if( a->i_cost16x16bi < thresh && a->i_rd16x16bi == COST_MAX )
{
h->mb.i_type = B_BI_BI;
- x264_analyse_update_cache( h, a );
- a->i_rd16x16bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x16bi = rd_cost_mb( h, a->i_lambda2 );
}
/* 8x8 */
@@ -2779,8 +2665,8 @@
{
h->mb.i_type = B_8x8;
h->mb.i_partition = D_8x8;
- x264_analyse_update_cache( h, a );
- a->i_rd8x8bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd8x8bi = rd_cost_mb( h, a->i_lambda2 );
x264_macroblock_cache_skip( h, 0, 0, 4, 4, 0 );
}
@@ -2789,8 +2675,8 @@
{
h->mb.i_type = a->i_mb_type16x8;
h->mb.i_partition = D_16x8;
- x264_analyse_update_cache( h, a );
- a->i_rd16x8bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd16x8bi = rd_cost_mb( h, a->i_lambda2 );
}
/* 8x16 */
@@ -2798,12 +2684,12 @@
{
h->mb.i_type = a->i_mb_type8x16;
h->mb.i_partition = D_8x16;
- x264_analyse_update_cache( h, a );
- a->i_rd8x16bi = x264_rd_cost_mb( h, a->i_lambda2 );
+ analyse_update_cache( h, a );
+ a->i_rd8x16bi = rd_cost_mb( h, a->i_lambda2 );
}
}
-static void x264_refine_bidir( x264_t *h, x264_mb_analysis_t *a )
+static void refine_bidir( x264_t *h, x264_mb_analysis_t *a )
{
int i_biweight;
@@ -2846,7 +2732,7 @@
}
}
-static inline void x264_mb_analyse_transform( x264_t *h )
+static inline void mb_analyse_transform( x264_t *h )
{
if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 && !h->mb.b_lossless )
{
@@ -2884,7 +2770,7 @@
}
}
-static inline void x264_mb_analyse_transform_rd( x264_t *h, x264_mb_analysis_t *a, int *i_satd, int *i_rd )
+static inline void mb_analyse_transform_rd( x264_t *h, x264_mb_analysis_t *a, int *i_satd, int *i_rd )
{
if( h->param.analyse.b_transform_8x8 && h->pps->b_transform_8x8_mode )
{
@@ -2895,10 +2781,10 @@
else if( !x264_transform_allowed[h->mb.i_type] )
return;
- x264_analyse_update_cache( h, a );
+ analyse_update_cache( h, a );
h->mb.b_transform_8x8 ^= 1;
/* FIXME only luma is needed for 4:2:0, but the score for comparison already includes chroma */
- int i_rd8 = x264_rd_cost_mb( h, a->i_lambda2 );
+ int i_rd8 = rd_cost_mb( h, a->i_lambda2 );
if( *i_rd >= i_rd8 )
{
@@ -2921,12 +2807,12 @@
* There must be a more efficient way to get that portion of the benefit
* without doing full QP-RD, but RD-decimation doesn't seem to do the
* trick. */
-static inline void x264_mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
+static inline void mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
{
int bcost, cost, failures, prevcost, origcost;
int orig_qp = h->mb.i_qp, bqp = h->mb.i_qp;
int last_qp_tried = 0;
- origcost = bcost = x264_rd_cost_mb( h, a->i_lambda2 );
+ origcost = bcost = rd_cost_mb( h, a->i_lambda2 );
int origcbp = h->mb.cbp[h->mb.i_mb_xy];
/* If CBP is already zero, don't raise the quantizer any higher. */
@@ -2959,7 +2845,7 @@
{
h->mb.i_qp = X264_MAX( h->mb.i_qp - threshold - 1, SPEC_QP( h->param.rc.i_qp_min ) );
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- already_checked_cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ already_checked_cost = rd_cost_mb( h, a->i_lambda2 );
if( !h->mb.cbp[h->mb.i_mb_xy] )
{
/* If our empty-CBP block is lower QP than the last QP,
@@ -2983,7 +2869,7 @@
else
{
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp );
}
@@ -3008,7 +2894,7 @@
{
h->mb.i_qp = h->mb.i_last_qp;
h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp );
}
@@ -3020,7 +2906,7 @@
x264_mb_transform_8x8_allowed( h ) )
{
h->mb.b_transform_8x8 ^= 1;
- cost = x264_rd_cost_mb( h, a->i_lambda2 );
+ cost = rd_cost_mb( h, a->i_lambda2 );
if( cost > bcost )
h->mb.b_transform_8x8 ^= 1;
}
@@ -3042,17 +2928,17 @@
if( h->param.analyse.b_mb_info )
h->fdec->effective_qp[h->mb.i_mb_xy] = h->mb.i_qp; /* Store the real analysis QP. */
- x264_mb_analyse_init( h, &analysis, h->mb.i_qp );
+ mb_analyse_init( h, &analysis, h->mb.i_qp );
/*--------------------------- Do the analysis ---------------------------*/
if( h->sh.i_type == SLICE_TYPE_I )
{
intra_analysis:
if( analysis.i_mbrd )
- x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
- x264_mb_analyse_intra( h, &analysis, COST_MAX );
+ mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
+ mb_analyse_intra( h, &analysis, COST_MAX );
if( analysis.i_mbrd )
- x264_intra_rd( h, &analysis, COST_MAX );
+ intra_rd( h, &analysis, COST_MAX );
i_cost = analysis.i_satd_i16x16;
h->mb.i_type = I_16x16;
@@ -3062,7 +2948,7 @@
h->mb.i_type = I_PCM;
else if( analysis.i_mbrd >= 2 )
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
}
else if( h->sh.i_type == SLICE_TYPE_P )
{
@@ -3075,7 +2961,7 @@
{
if( !h->param.analyse.b_psy )
{
- x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
+ mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
goto intra_analysis;
}
}
@@ -3147,9 +3033,9 @@
int i_partition;
int i_satd_inter, i_satd_intra;
- x264_mb_analyse_load_costs( h, &analysis );
+ mb_analyse_load_costs( h, &analysis );
- x264_mb_analyse_inter_p16x16( h, &analysis );
+ mb_analyse_inter_p16x16( h, &analysis );
if( h->mb.i_type == P_SKIP )
{
@@ -3161,9 +3047,9 @@
if( flags & X264_ANALYSE_PSUB16x16 )
{
if( h->param.analyse.b_mixed_references )
- x264_mb_analyse_inter_p8x8_mixed_ref( h, &analysis );
+ mb_analyse_inter_p8x8_mixed_ref( h, &analysis );
else
- x264_mb_analyse_inter_p8x8( h, &analysis );
+ mb_analyse_inter_p8x8( h, &analysis );
}
/* Select best inter mode */
@@ -3183,24 +3069,24 @@
{
for( int i = 0; i < 4; i++ )
{
- x264_mb_analyse_inter_p4x4( h, &analysis, i );
+ mb_analyse_inter_p4x4( h, &analysis, i );
int i_thresh8x4 = analysis.l0.me4x4[i][1].cost_mv + analysis.l0.me4x4[i][2].cost_mv;
if( !analysis.b_early_terminate || analysis.l0.i_cost4x4[i] < analysis.l0.me8x8[i].cost + i_thresh8x4 )
{
int i_cost8x8 = analysis.l0.i_cost4x4[i];
h->mb.i_sub_partition[i] = D_L0_4x4;
- x264_mb_analyse_inter_p8x4( h, &analysis, i );
+ mb_analyse_inter_p8x4( h, &analysis, i );
COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost8x4[i],
h->mb.i_sub_partition[i], D_L0_8x4 );
- x264_mb_analyse_inter_p4x8( h, &analysis, i );
+ mb_analyse_inter_p4x8( h, &analysis, i );
COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost4x8[i],
h->mb.i_sub_partition[i], D_L0_4x8 );
i_cost += i_cost8x8 - analysis.l0.me8x8[i].cost;
}
- x264_mb_cache_mv_p8x8( h, &analysis, i );
+ mb_cache_mv_p8x8( h, &analysis, i );
}
analysis.l0.i_cost8x8 = i_cost;
}
@@ -3215,14 +3101,14 @@
+ analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1;
analysis.i_cost_est16x8[1] = analysis.i_satd8x8[0][2] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost;
- x264_mb_analyse_inter_p16x8( h, &analysis, i_cost );
+ mb_analyse_inter_p16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.l0.i_cost16x8, i_type, P_L0, i_partition, D_16x8 );
i_avg_mv_ref_cost = (analysis.l0.me8x8[1].cost_mv + analysis.l0.me8x8[1].i_ref_cost
+ analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1;
analysis.i_cost_est8x16[1] = analysis.i_satd8x8[0][1] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost;
- x264_mb_analyse_inter_p8x16( h, &analysis, i_cost );
+ mb_analyse_inter_p8x16( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.l0.i_cost8x16, i_type, P_L0, i_partition, D_8x16 );
}
@@ -3296,20 +3182,20 @@
{
if( CHROMA444 )
{
- x264_mb_analyse_intra( h, &analysis, i_cost );
- x264_mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_cost );
+ mb_analyse_intra_chroma( h, &analysis );
}
else
{
- x264_mb_analyse_intra_chroma( h, &analysis );
- x264_mb_analyse_intra( h, &analysis, i_cost - analysis.i_satd_chroma );
+ mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_cost - analysis.i_satd_chroma );
}
analysis.i_satd_i16x16 += analysis.i_satd_chroma;
analysis.i_satd_i8x8 += analysis.i_satd_chroma;
analysis.i_satd_i4x4 += analysis.i_satd_chroma;
}
else
- x264_mb_analyse_intra( h, &analysis, i_cost );
+ mb_analyse_intra( h, &analysis, i_cost );
i_satd_inter = i_cost;
i_satd_intra = X264_MIN3( analysis.i_satd_i16x16,
@@ -3318,7 +3204,7 @@
if( analysis.i_mbrd )
{
- x264_mb_analyse_p_rd( h, &analysis, X264_MIN(i_satd_inter, i_satd_intra) );
+ mb_analyse_p_rd( h, &analysis, X264_MIN(i_satd_inter, i_satd_intra) );
i_type = P_L0;
i_partition = D_16x16;
i_cost = analysis.l0.i_rd16x16;
@@ -3328,8 +3214,8 @@
h->mb.i_type = i_type;
h->mb.i_partition = i_partition;
if( i_cost < COST_MAX )
- x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
- x264_intra_rd( h, &analysis, i_satd_inter * 5/4 + 1 );
+ mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
+ intra_rd( h, &analysis, i_satd_inter * 5/4 + 1 );
}
COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 );
@@ -3343,7 +3229,7 @@
{
/* Intra masking: copy fdec to fenc and re-encode the block as intra in order to make it appear as if
* it was an inter block. */
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
x264_macroblock_encode( h );
for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ )
h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, h->mb.pic.p_fdec[p], FDEC_STRIDE, 16 );
@@ -3353,7 +3239,7 @@
h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE, height );
h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE, height );
}
- x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
+ mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) );
goto intra_analysis;
}
@@ -3361,7 +3247,7 @@
{
if( IS_INTRA( h->mb.i_type ) )
{
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
}
else if( i_partition == D_16x16 )
{
@@ -3387,7 +3273,7 @@
}
else if( i_partition == D_8x8 )
{
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
for( int i8x8 = 0; i8x8 < 4; i8x8++ )
{
if( h->mb.i_sub_partition[i8x8] == D_L0_8x8 )
@@ -3422,7 +3308,7 @@
int b_skip = 0;
if( analysis.i_mbrd )
- x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
+ mb_init_fenc_cache( h, analysis.i_mbrd >= 2 );
h->mb.i_type = B_SKIP;
if( h->mb.b_direct_auto_write )
@@ -3490,14 +3376,14 @@
h->mb.b_skip_mc = 0;
h->mb.i_type = B_DIRECT;
- x264_mb_analyse_load_costs( h, &analysis );
+ mb_analyse_load_costs( h, &analysis );
/* select best inter mode */
/* direct must be first */
if( analysis.b_direct_available )
- x264_mb_analyse_inter_direct( h, &analysis );
+ mb_analyse_inter_direct( h, &analysis );
- x264_mb_analyse_inter_b16x16( h, &analysis );
+ mb_analyse_inter_b16x16( h, &analysis );
if( h->mb.i_type == B_SKIP )
{
@@ -3517,14 +3403,14 @@
if( analysis.i_mbrd && analysis.b_early_terminate && analysis.i_cost16x16direct <= i_cost * 33/32 )
{
- x264_mb_analyse_b_rd( h, &analysis, i_cost );
+ mb_analyse_b_rd( h, &analysis, i_cost );
if( i_bskip_cost < analysis.i_rd16x16direct &&
i_bskip_cost < analysis.i_rd16x16bi &&
i_bskip_cost < analysis.l0.i_rd16x16 &&
i_bskip_cost < analysis.l1.i_rd16x16 )
{
h->mb.i_type = B_SKIP;
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
return;
}
}
@@ -3532,9 +3418,9 @@
if( flags & X264_ANALYSE_BSUB16x16 )
{
if( h->param.analyse.b_mixed_references )
- x264_mb_analyse_inter_b8x8_mixed_ref( h, &analysis );
+ mb_analyse_inter_b8x8_mixed_ref( h, &analysis );
else
- x264_mb_analyse_inter_b8x8( h, &analysis );
+ mb_analyse_inter_b8x8( h, &analysis );
COPY3_IF_LT( i_cost, analysis.i_cost8x8bi, i_type, B_8x8, i_partition, D_8x8 );
@@ -3584,17 +3470,17 @@
int try_16x8_first = i_cost_est16x8bi_total < i_cost_est8x16bi_total;
if( try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) )
{
- x264_mb_analyse_inter_b16x8( h, &analysis, i_cost );
+ mb_analyse_inter_b16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 );
}
if( !analysis.b_early_terminate || i_cost_est8x16bi_total < i_cost )
{
- x264_mb_analyse_inter_b8x16( h, &analysis, i_cost );
+ mb_analyse_inter_b8x16( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost8x16bi, i_type, analysis.i_mb_type8x16, i_partition, D_8x16 );
}
if( !try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) )
{
- x264_mb_analyse_inter_b16x8( h, &analysis, i_cost );
+ mb_analyse_inter_b16x8( h, &analysis, i_cost );
COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 );
}
}
@@ -3686,7 +3572,7 @@
if( analysis.i_mbrd )
{
- x264_mb_analyse_b_rd( h, &analysis, i_satd_inter );
+ mb_analyse_b_rd( h, &analysis, i_satd_inter );
i_type = B_SKIP;
i_cost = i_bskip_cost;
i_partition = D_16x16;
@@ -3706,25 +3592,25 @@
{
if( CHROMA444 )
{
- x264_mb_analyse_intra( h, &analysis, i_satd_inter );
- x264_mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_satd_inter );
+ mb_analyse_intra_chroma( h, &analysis );
}
else
{
- x264_mb_analyse_intra_chroma( h, &analysis );
- x264_mb_analyse_intra( h, &analysis, i_satd_inter - analysis.i_satd_chroma );
+ mb_analyse_intra_chroma( h, &analysis );
+ mb_analyse_intra( h, &analysis, i_satd_inter - analysis.i_satd_chroma );
}
analysis.i_satd_i16x16 += analysis.i_satd_chroma;
analysis.i_satd_i8x8 += analysis.i_satd_chroma;
analysis.i_satd_i4x4 += analysis.i_satd_chroma;
}
else
- x264_mb_analyse_intra( h, &analysis, i_satd_inter );
+ mb_analyse_intra( h, &analysis, i_satd_inter );
if( analysis.i_mbrd )
{
- x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
- x264_intra_rd( h, &analysis, i_satd_inter * 17/16 + 1 );
+ mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost );
+ intra_rd( h, &analysis, i_satd_inter * 17/16 + 1 );
}
COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 );
@@ -3736,14 +3622,14 @@
h->mb.i_partition = i_partition;
if( analysis.i_mbrd >= 2 && IS_INTRA( i_type ) && i_type != I_PCM )
- x264_intra_rd_refine( h, &analysis );
+ intra_rd_refine( h, &analysis );
if( h->mb.i_subpel_refine >= 5 )
- x264_refine_bidir( h, &analysis );
+ refine_bidir( h, &analysis );
if( analysis.i_mbrd >= 2 && i_type > B_DIRECT && i_type < B_SKIP )
{
int i_biweight;
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
if( i_partition == D_16x16 )
{
@@ -3814,7 +3700,7 @@
}
}
- x264_analyse_update_cache( h, &analysis );
+ analyse_update_cache( h, &analysis );
/* In rare cases we can end up qpel-RDing our way back to a larger partition size
* without realizing it. Check for this and account for it if necessary. */
@@ -3830,22 +3716,22 @@
}
if( !analysis.i_mbrd )
- x264_mb_analyse_transform( h );
+ mb_analyse_transform( h );
if( analysis.i_mbrd == 3 && !IS_SKIP(h->mb.i_type) )
- x264_mb_analyse_qp_rd( h, &analysis );
+ mb_analyse_qp_rd( h, &analysis );
h->mb.b_trellis = h->param.analyse.i_trellis;
h->mb.b_noise_reduction = h->mb.b_noise_reduction || (!!h->param.analyse.i_noise_reduction && !IS_INTRA( h->mb.i_type ));
if( !IS_SKIP(h->mb.i_type) && h->mb.i_psy_trellis && h->param.analyse.i_trellis == 1 )
- x264_psy_trellis_init( h, 0 );
+ psy_trellis_init( h, 0 );
if( h->mb.b_trellis == 1 || h->mb.b_noise_reduction )
h->mb.i_skip_intra = 0;
}
/*-------------------- Update MB from the analysis ----------------------*/
-static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a )
+static void analyse_update_cache( x264_t *h, x264_mb_analysis_t *a )
{
switch( h->mb.i_type )
{
@@ -3853,17 +3739,17 @@
for( int i = 0; i < 16; i++ )
h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] = a->i_predict4x4[i];
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_8x8:
for( int i = 0; i < 4; i++ )
x264_macroblock_cache_intra8x8_pred( h, 2*(i&1), 2*(i>>1), a->i_predict8x8[i] );
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_16x16:
h->mb.i_intra16x16_pred_mode = a->i_predict16x16;
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
break;
case I_PCM:
@@ -3903,7 +3789,7 @@
x264_macroblock_cache_ref( h, 0, 2, 2, 2, 0, a->l0.me8x8[2].i_ref );
x264_macroblock_cache_ref( h, 2, 2, 2, 2, 0, a->l0.me8x8[3].i_ref );
for( int i = 0; i < 4; i++ )
- x264_mb_cache_mv_p8x8( h, a, i );
+ mb_cache_mv_p8x8( h, a, i );
break;
case P_SKIP:
@@ -3917,16 +3803,16 @@
case B_SKIP:
case B_DIRECT:
h->mb.i_partition = h->mb.cache.direct_partition;
- x264_mb_load_mv_direct8x8( h, 0 );
- x264_mb_load_mv_direct8x8( h, 1 );
- x264_mb_load_mv_direct8x8( h, 2 );
- x264_mb_load_mv_direct8x8( h, 3 );
+ mb_load_mv_direct8x8( h, 0 );
+ mb_load_mv_direct8x8( h, 1 );
+ mb_load_mv_direct8x8( h, 2 );
+ mb_load_mv_direct8x8( h, 3 );
break;
case B_8x8:
/* optimize: cache might not need to be rewritten */
for( int i = 0; i < 4; i++ )
- x264_mb_cache_mv_b8x8( h, a, i, 1 );
+ mb_cache_mv_b8x8( h, a, i, 1 );
break;
default: /* the rest of the B types */
@@ -3961,12 +3847,12 @@
}
break;
case D_16x8:
- x264_mb_cache_mv_b16x8( h, a, 0, 1 );
- x264_mb_cache_mv_b16x8( h, a, 1, 1 );
+ mb_cache_mv_b16x8( h, a, 0, 1 );
+ mb_cache_mv_b16x8( h, a, 1, 1 );
break;
case D_8x16:
- x264_mb_cache_mv_b8x16( h, a, 0, 1 );
- x264_mb_cache_mv_b8x16( h, a, 1, 1 );
+ mb_cache_mv_b8x16( h, a, 0, 1 );
+ mb_cache_mv_b8x16( h, a, 1, 1 );
break;
default:
x264_log( h, X264_LOG_ERROR, "internal error (invalid MB type)\n" );
@@ -3995,10 +3881,10 @@
x264_log( h, X264_LOG_DEBUG, "mb_xy: %d,%d \n", h->mb.i_mb_x, h->mb.i_mb_y);
x264_log( h, X264_LOG_DEBUG, "completed: %d \n", completed );
x264_log( h, X264_LOG_WARNING, "recovering by using intra mode\n");
- x264_mb_analyse_intra( h, a, COST_MAX );
+ mb_analyse_intra( h, a, COST_MAX );
h->mb.i_type = I_16x16;
h->mb.i_intra16x16_pred_mode = a->i_predict16x16;
- x264_mb_analyse_intra_chroma( h, a );
+ mb_analyse_intra_chroma( h, a );
}
}
}
diff -ur x264-go/x264c/external/x264/encoder/analyse.h x264-go.new/x264c/external/x264/encoder/analyse.h
--- x264-go/x264c/external/x264/encoder/analyse.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/analyse.h 2020-06-06 15:20:58.697039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* analyse.h: macroblock analysis
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -24,21 +24,32 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_ANALYSE_H
-#define X264_ANALYSE_H
+#ifndef X264_ENCODER_ANALYSE_H
+#define X264_ENCODER_ANALYSE_H
+#define x264_analyse_init_costs x264_template(analyse_init_costs)
int x264_analyse_init_costs( x264_t *h );
+#define x264_analyse_free_costs x264_template(analyse_free_costs)
void x264_analyse_free_costs( x264_t *h );
+#define x264_analyse_weight_frame x264_template(analyse_weight_frame)
void x264_analyse_weight_frame( x264_t *h, int end );
+#define x264_macroblock_analyse x264_template(macroblock_analyse)
void x264_macroblock_analyse( x264_t *h );
+#define x264_slicetype_decide x264_template(slicetype_decide)
void x264_slicetype_decide( x264_t *h );
+#define x264_slicetype_analyse x264_template(slicetype_analyse)
void x264_slicetype_analyse( x264_t *h, int intra_minigop );
+#define x264_lookahead_init x264_template(lookahead_init)
int x264_lookahead_init( x264_t *h, int i_slicetype_length );
+#define x264_lookahead_is_empty x264_template(lookahead_is_empty)
int x264_lookahead_is_empty( x264_t *h );
+#define x264_lookahead_put_frame x264_template(lookahead_put_frame)
void x264_lookahead_put_frame( x264_t *h, x264_frame_t *frame );
+#define x264_lookahead_get_frames x264_template(lookahead_get_frames)
void x264_lookahead_get_frames( x264_t *h );
+#define x264_lookahead_delete x264_template(lookahead_delete)
void x264_lookahead_delete( x264_t *h );
#endif
Only in x264-go.new/x264c/external/x264/encoder: api.c
diff -ur x264-go/x264c/external/x264/encoder/cabac.c x264-go.new/x264c/external/x264/encoder/cabac.c
--- x264-go/x264c/external/x264/encoder/cabac.c 2018-02-15 15:58:53.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/cabac.c 2020-06-06 15:20:58.697039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cabac.c: cabac bitstream writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -32,8 +32,8 @@
#define RDO_SKIP_BS 0
#endif
-static inline void x264_cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type,
- int ctx0, int ctx1, int ctx2, int ctx3, int ctx4, int ctx5 )
+static inline void cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type,
+ int ctx0, int ctx1, int ctx2, int ctx3, int ctx4, int ctx5 )
{
if( i_mb_type == I_4x4 || i_mb_type == I_8x8 )
{
@@ -67,7 +67,7 @@
}
#if !RDO_SKIP_BS
-static void x264_cabac_field_decoding_flag( x264_t *h, x264_cabac_t *cb )
+static void cabac_field_decoding_flag( x264_t *h, x264_cabac_t *cb )
{
int ctx = 0;
ctx += h->mb.field_decoding_flag & !!h->mb.i_mb_x;
@@ -80,7 +80,7 @@
}
#endif
-static void x264_cabac_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode )
+static void cabac_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode )
{
if( i_pred == i_mode )
x264_cabac_encode_decision( cb, 68, 1 );
@@ -95,7 +95,7 @@
}
}
-static void x264_cabac_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb )
+static void cabac_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb )
{
int i_mode = x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode];
int ctx = 0;
@@ -115,7 +115,7 @@
}
}
-static void x264_cabac_cbp_luma( x264_t *h, x264_cabac_t *cb )
+static void cabac_cbp_luma( x264_t *h, x264_cabac_t *cb )
{
int cbp = h->mb.i_cbp_luma;
int cbp_l = h->mb.cache.i_cbp_left;
@@ -126,7 +126,7 @@
x264_cabac_encode_decision_noup( cb, 76 - ((cbp >> 2) & 1) - ((cbp >> 0) & 2), (cbp >> 3) & 1 );
}
-static void x264_cabac_cbp_chroma( x264_t *h, x264_cabac_t *cb )
+static void cabac_cbp_chroma( x264_t *h, x264_cabac_t *cb )
{
int cbp_a = h->mb.cache.i_cbp_left & 0x30;
int cbp_b = h->mb.cache.i_cbp_top & 0x30;
@@ -147,7 +147,7 @@
}
}
-static void x264_cabac_qp_delta( x264_t *h, x264_cabac_t *cb )
+static void cabac_qp_delta( x264_t *h, x264_cabac_t *cb )
{
int i_dqp = h->mb.i_qp - h->mb.i_last_qp;
int ctx;
@@ -195,7 +195,7 @@
}
#endif
-static inline void x264_cabac_subpartition_p( x264_cabac_t *cb, int i_sub )
+static inline void cabac_subpartition_p( x264_cabac_t *cb, int i_sub )
{
if( i_sub == D_L0_8x8 )
{
@@ -212,7 +212,7 @@
}
}
-static ALWAYS_INLINE void x264_cabac_subpartition_b( x264_cabac_t *cb, int i_sub )
+static ALWAYS_INLINE void cabac_subpartition_b( x264_cabac_t *cb, int i_sub )
{
if( i_sub == D_DIRECT_8x8 )
{
@@ -232,13 +232,13 @@
x264_cabac_encode_decision( cb, 39, i_sub == D_L1_8x8 );
}
-static ALWAYS_INLINE void x264_cabac_transform_size( x264_t *h, x264_cabac_t *cb )
+static ALWAYS_INLINE void cabac_transform_size( x264_t *h, x264_cabac_t *cb )
{
int ctx = 399 + h->mb.cache.i_neighbour_transform_size;
x264_cabac_encode_decision_noup( cb, ctx, h->mb.b_transform_8x8 );
}
-static ALWAYS_INLINE void x264_cabac_ref_internal( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int bframe )
+static ALWAYS_INLINE void cabac_ref_internal( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int bframe )
{
const int i8 = x264_scan8[idx];
const int i_refa = h->mb.cache.ref[i_list][i8 - 1];
@@ -258,16 +258,16 @@
x264_cabac_encode_decision( cb, 54 + ctx, 0 );
}
-static NOINLINE void x264_cabac_ref_p( x264_t *h, x264_cabac_t *cb, int idx )
+static NOINLINE void cabac_ref_p( x264_t *h, x264_cabac_t *cb, int idx )
{
- x264_cabac_ref_internal( h, cb, 0, idx, 0 );
+ cabac_ref_internal( h, cb, 0, idx, 0 );
}
-static NOINLINE void x264_cabac_ref_b( x264_t *h, x264_cabac_t *cb, int i_list, int idx )
+static NOINLINE void cabac_ref_b( x264_t *h, x264_cabac_t *cb, int i_list, int idx )
{
- x264_cabac_ref_internal( h, cb, i_list, idx, 1 );
+ cabac_ref_internal( h, cb, i_list, idx, 1 );
}
-static ALWAYS_INLINE int x264_cabac_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
+static ALWAYS_INLINE int cabac_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
{
int ctxbase = l ? 47 : 40;
@@ -326,7 +326,7 @@
return X264_MIN( i_abs, 66 );
}
-static NOINLINE uint16_t x264_cabac_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width )
+static NOINLINE uint16_t cabac_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width )
{
ALIGNED_4( int16_t mvp[2] );
int mdx, mdy;
@@ -339,46 +339,46 @@
h->mb.cache.mvd[i_list][x264_scan8[idx] - 8]);
/* encode */
- mdx = x264_cabac_mvd_cpn( h, cb, i_list, idx, 0, mdx, amvd&0xFF );
- mdy = x264_cabac_mvd_cpn( h, cb, i_list, idx, 1, mdy, amvd>>8 );
+ mdx = cabac_mvd_cpn( h, cb, i_list, idx, 0, mdx, amvd&0xFF );
+ mdy = cabac_mvd_cpn( h, cb, i_list, idx, 1, mdy, amvd>>8 );
return pack8to16(mdx,mdy);
}
-#define x264_cabac_mvd(h,cb,i_list,idx,width,height)\
+#define cabac_mvd(h,cb,i_list,idx,width,height)\
do\
{\
- uint16_t mvd = x264_cabac_mvd(h,cb,i_list,idx,width);\
+ uint16_t mvd = cabac_mvd(h,cb,i_list,idx,width);\
x264_macroblock_cache_mvd( h, block_idx_x[idx], block_idx_y[idx], width, height, i_list, mvd );\
} while( 0 )
-static inline void x264_cabac_8x8_mvd( x264_t *h, x264_cabac_t *cb, int i )
+static inline void cabac_8x8_mvd( x264_t *h, x264_cabac_t *cb, int i )
{
switch( h->mb.i_sub_partition[i] )
{
case D_L0_8x8:
- x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i, 2, 2 );
break;
case D_L0_8x4:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 2, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+2, 2, 1 );
+ cabac_mvd( h, cb, 0, 4*i+0, 2, 1 );
+ cabac_mvd( h, cb, 0, 4*i+2, 2, 1 );
break;
case D_L0_4x8:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 2 );
- x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 2 );
+ cabac_mvd( h, cb, 0, 4*i+0, 1, 2 );
+ cabac_mvd( h, cb, 0, 4*i+1, 1, 2 );
break;
case D_L0_4x4:
- x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+2, 1, 1 );
- x264_cabac_mvd( h, cb, 0, 4*i+3, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+0, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+1, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+2, 1, 1 );
+ cabac_mvd( h, cb, 0, 4*i+3, 1, 1 );
break;
default:
assert(0);
}
}
-static ALWAYS_INLINE void x264_cabac_mb_header_i( x264_t *h, x264_cabac_t *cb, int i_mb_type, int slice_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_i( x264_t *h, x264_cabac_t *cb, int i_mb_type, int slice_type, int chroma )
{
if( slice_type == SLICE_TYPE_I )
{
@@ -388,7 +388,7 @@
if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != I_4x4 )
ctx++;
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 );
}
else if( slice_type == SLICE_TYPE_P )
{
@@ -396,7 +396,7 @@
x264_cabac_encode_decision_noup( cb, 14, 1 );
/* suffix */
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 );
}
else if( slice_type == SLICE_TYPE_B )
{
@@ -408,7 +408,7 @@
x264_cabac_encode_decision( cb, 27+5, 1 );
/* suffix */
- x264_cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 );
+ cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 );
}
if( i_mb_type == I_PCM )
@@ -417,22 +417,22 @@
if( i_mb_type != I_16x16 )
{
if( h->pps->b_transform_8x8_mode )
- x264_cabac_transform_size( h, cb );
+ cabac_transform_size( h, cb );
int di = h->mb.b_transform_8x8 ? 4 : 1;
for( int i = 0; i < 16; i += di )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, i );
const int i_mode = x264_mb_pred_mode4x4_fix( h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
}
}
if( chroma )
- x264_cabac_intra_chroma_pred_mode( h, cb );
+ cabac_intra_chroma_pred_mode( h, cb );
}
-static ALWAYS_INLINE void x264_cabac_mb_header_p( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_p( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
{
if( i_mb_type == P_L0 )
{
@@ -442,8 +442,8 @@
x264_cabac_encode_decision_noup( cb, 15, 0 );
x264_cabac_encode_decision_noup( cb, 16, 0 );
if( h->mb.pic.i_fref[0] > 1 )
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_mvd( h, cb, 0, 0, 4, 4 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_mvd( h, cb, 0, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
@@ -451,11 +451,11 @@
x264_cabac_encode_decision_noup( cb, 17, 1 );
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 8 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 8 );
}
- x264_cabac_mvd( h, cb, 0, 0, 4, 2 );
- x264_cabac_mvd( h, cb, 0, 8, 4, 2 );
+ cabac_mvd( h, cb, 0, 0, 4, 2 );
+ cabac_mvd( h, cb, 0, 8, 4, 2 );
}
else //if( h->mb.i_partition == D_8x16 )
{
@@ -463,11 +463,11 @@
x264_cabac_encode_decision_noup( cb, 17, 0 );
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 4 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 4 );
}
- x264_cabac_mvd( h, cb, 0, 0, 2, 4 );
- x264_cabac_mvd( h, cb, 0, 4, 2, 4 );
+ cabac_mvd( h, cb, 0, 0, 2, 4 );
+ cabac_mvd( h, cb, 0, 4, 2, 4 );
}
}
else if( i_mb_type == P_8x8 )
@@ -478,25 +478,25 @@
/* sub mb type */
for( int i = 0; i < 4; i++ )
- x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i] );
+ cabac_subpartition_p( cb, h->mb.i_sub_partition[i] );
/* ref 0 */
if( h->mb.pic.i_fref[0] > 1 )
{
- x264_cabac_ref_p( h, cb, 0 );
- x264_cabac_ref_p( h, cb, 4 );
- x264_cabac_ref_p( h, cb, 8 );
- x264_cabac_ref_p( h, cb, 12 );
+ cabac_ref_p( h, cb, 0 );
+ cabac_ref_p( h, cb, 4 );
+ cabac_ref_p( h, cb, 8 );
+ cabac_ref_p( h, cb, 12 );
}
for( int i = 0; i < 4; i++ )
- x264_cabac_8x8_mvd( h, cb, i );
+ cabac_8x8_mvd( h, cb, i );
}
else /* intra */
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_P, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_P, chroma );
}
-static ALWAYS_INLINE void x264_cabac_mb_header_b( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cabac_mb_header_b( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma )
{
int ctx = 0;
if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != B_SKIP && h->mb.i_mb_type_left[0] != B_DIRECT )
@@ -521,26 +521,26 @@
/* sub mb type */
for( int i = 0; i < 4; i++ )
- x264_cabac_subpartition_b( cb, h->mb.i_sub_partition[i] );
+ cabac_subpartition_b( cb, h->mb.i_sub_partition[i] );
/* ref */
if( h->mb.pic.i_fref[0] > 1 )
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cabac_ref_b( h, cb, 0, 4*i );
+ cabac_ref_b( h, cb, 0, 4*i );
if( h->mb.pic.i_fref[1] > 1 )
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cabac_ref_b( h, cb, 1, 4*i );
+ cabac_ref_b( h, cb, 1, 4*i );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i, 2, 2 );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cabac_mvd( h, cb, 1, 4*i, 2, 2 );
+ cabac_mvd( h, cb, 1, 4*i, 2, 2 );
}
else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI )
{
@@ -576,40 +576,40 @@
if( h->mb.pic.i_fref[0] > 1 )
{
if( b_list[0][0] )
- x264_cabac_ref_b( h, cb, 0, 0 );
+ cabac_ref_b( h, cb, 0, 0 );
if( b_list[0][1] && h->mb.i_partition != D_16x16 )
- x264_cabac_ref_b( h, cb, 0, 8 >> (h->mb.i_partition == D_8x16) );
+ cabac_ref_b( h, cb, 0, 8 >> (h->mb.i_partition == D_8x16) );
}
if( h->mb.pic.i_fref[1] > 1 )
{
if( b_list[1][0] )
- x264_cabac_ref_b( h, cb, 1, 0 );
+ cabac_ref_b( h, cb, 1, 0 );
if( b_list[1][1] && h->mb.i_partition != D_16x16 )
- x264_cabac_ref_b( h, cb, 1, 8 >> (h->mb.i_partition == D_8x16) );
+ cabac_ref_b( h, cb, 1, 8 >> (h->mb.i_partition == D_8x16) );
}
for( int i_list = 0; i_list < 2; i_list++ )
{
if( h->mb.i_partition == D_16x16 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 4 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 4, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 2 );
- if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 8, 4, 2 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 4, 2 );
+ if( b_list[i_list][1] ) cabac_mvd( h, cb, i_list, 8, 4, 2 );
}
else //if( h->mb.i_partition == D_8x16 )
{
- if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 2, 4 );
- if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 4, 2, 4 );
+ if( b_list[i_list][0] ) cabac_mvd( h, cb, i_list, 0, 2, 4 );
+ if( b_list[i_list][1] ) cabac_mvd( h, cb, i_list, 4, 2, 4 );
}
}
}
else /* intra */
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_B, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_B, chroma );
}
-static int ALWAYS_INLINE x264_cabac_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx, int b_intra, int b_dc )
+static ALWAYS_INLINE int cabac_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx, int b_intra, int b_dc )
{
static const uint16_t base_ctx[14] = {85,89,93,97,101,1012,460,464,468,1016,472,476,480,1020};
@@ -644,53 +644,6 @@
}
}
-#if !RDO_SKIP_BS
-extern const uint8_t x264_significant_coeff_flag_offset_8x8[2][64];
-extern const uint8_t x264_last_coeff_flag_offset_8x8[63];
-extern const uint8_t x264_coeff_flag_offset_chroma_422_dc[7];
-extern const uint16_t x264_significant_coeff_flag_offset[2][16];
-extern const uint16_t x264_last_coeff_flag_offset[2][16];
-extern const uint16_t x264_coeff_abs_level_m1_offset[16];
-extern const uint8_t x264_count_cat_m1[14];
-#else
-/* Padded to [64] for easier addressing */
-const uint8_t x264_significant_coeff_flag_offset_8x8[2][64] =
-{{
- 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
- 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
- 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
- 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12
-},{
- 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
- 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
- 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
- 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14
-}};
-const uint8_t x264_last_coeff_flag_offset_8x8[63] =
-{
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
-};
-const uint8_t x264_coeff_flag_offset_chroma_422_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; /* MIN( i/2, 2 ) */
-const uint16_t x264_significant_coeff_flag_offset[2][16] =
-{
- { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718, 0, 0 },
- { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733, 0, 0 }
-};
-const uint16_t x264_last_coeff_flag_offset[2][16] =
-{
- { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748, 0, 0 },
- { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757, 0, 0 }
-};
-const uint16_t x264_coeff_abs_level_m1_offset[16] =
-{
- 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766
-};
-const uint8_t x264_count_cat_m1[14] = {15, 14, 15, 3, 14, 63, 15, 14, 15, 63, 15, 14, 15, 63};
-#endif
-
// node ctx: 0..3: abslevel1 (with abslevelgt1 == 0).
// 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter).
/* map node ctx => cabac ctx for level=1 */
@@ -709,7 +662,7 @@
};
#if !RDO_SKIP_BS
-static ALWAYS_INLINE void x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int chroma422dc )
+static ALWAYS_INLINE void cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int chroma422dc )
{
int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
int ctx_last = x264_last_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
@@ -796,10 +749,10 @@
void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0 );
}
-static void ALWAYS_INLINE x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static ALWAYS_INLINE void cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_internal( l, MB_INTERLACED, ctx_block_cat, cb );
@@ -807,19 +760,19 @@
x264_cabac_block_residual_c( h, cb, ctx_block_cat, l );
#endif
}
-static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static void cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
/* Template a version specifically for chroma 4:2:2 DC in order to avoid
* slowing down everything else due to the added complexity. */
- x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 1 );
+ cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 1 );
}
-#define x264_cabac_block_residual_8x8( h, cb, cat, l ) x264_cabac_block_residual( h, cb, cat, l )
+#define cabac_block_residual_8x8( h, cb, cat, l ) cabac_block_residual( h, cb, cat, l )
#else
/* Faster RDO by merging sigmap and level coding. Note that for 8x8dct and chroma 4:2:2 dc this is
* slightly incorrect because the sigmap is not reversible (contexts are repeated). However, there
* is nearly no quality penalty for this (~0.001db) and the speed boost (~30%) is worth it. */
-static void ALWAYS_INLINE x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int b_8x8, int chroma422dc )
+static ALWAYS_INLINE void cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int b_8x8, int chroma422dc )
{
const uint8_t *sig_offset = x264_significant_coeff_flag_offset_8x8[MB_INTERLACED];
int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat];
@@ -906,14 +859,14 @@
void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 1, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 1, 0 );
}
void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0, 0 );
+ cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0, 0 );
}
-static ALWAYS_INLINE void x264_cabac_block_residual_8x8( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static ALWAYS_INLINE void cabac_block_residual_8x8( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_8x8_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb );
@@ -921,7 +874,7 @@
x264_cabac_block_residual_8x8_rd_c( h, cb, ctx_block_cat, l );
#endif
}
-static ALWAYS_INLINE void x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static ALWAYS_INLINE void cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ )
h->bsf.cabac_block_residual_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb );
@@ -930,38 +883,38 @@
#endif
}
-static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
+static void cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l )
{
- x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 0, 1 );
+ cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 0, 1 );
}
#endif
-#define x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, b_dc, name )\
+#define cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, b_dc, name )\
do\
{\
- int ctxidxinc = x264_cabac_cbf_ctxidxinc( h, ctx_block_cat, i_idx, b_intra, b_dc );\
+ int ctxidxinc = cabac_cbf_ctxidxinc( h, ctx_block_cat, i_idx, b_intra, b_dc );\
if( h->mb.cache.non_zero_count[x264_scan8[i_idx]] )\
{\
x264_cabac_encode_decision( cb, ctxidxinc, 1 );\
- x264_cabac_block_residual##name( h, cb, ctx_block_cat, l );\
+ cabac_block_residual##name( h, cb, ctx_block_cat, l );\
}\
else\
x264_cabac_encode_decision( cb, ctxidxinc, 0 );\
} while( 0 )
-#define x264_cabac_block_residual_dc_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 1, )
+#define cabac_block_residual_dc_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 1, )
-#define x264_cabac_block_residual_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, )
+#define cabac_block_residual_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, )
-#define x264_cabac_block_residual_8x8_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, _8x8 )
+#define cabac_block_residual_8x8_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, _8x8 )
-#define x264_cabac_block_residual_422_dc_cbf( h, cb, ch, b_intra )\
- x264_cabac_block_residual_cbf_internal( h, cb, DCT_CHROMA_DC, CHROMA_DC+(ch), h->dct.chroma_dc[ch], b_intra, 1, _422_dc )
+#define cabac_block_residual_422_dc_cbf( h, cb, ch, b_intra )\
+ cabac_block_residual_cbf_internal( h, cb, DCT_CHROMA_DC, CHROMA_DC+(ch), h->dct.chroma_dc[ch], b_intra, 1, _422_dc )
-static ALWAYS_INLINE void x264_macroblock_write_cabac_internal( x264_t *h, x264_cabac_t *cb, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_write_cabac_internal( x264_t *h, x264_cabac_t *cb, int plane_count, int chroma )
{
const int i_mb_type = h->mb.i_type;
@@ -972,16 +925,16 @@
if( SLICE_MBAFF &&
(!(h->mb.i_mb_y & 1) || IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride])) )
{
- x264_cabac_field_decoding_flag( h, cb );
+ cabac_field_decoding_flag( h, cb );
}
#endif
if( h->sh.i_type == SLICE_TYPE_P )
- x264_cabac_mb_header_p( h, cb, i_mb_type, chroma );
+ cabac_mb_header_p( h, cb, i_mb_type, chroma );
else if( h->sh.i_type == SLICE_TYPE_B )
- x264_cabac_mb_header_b( h, cb, i_mb_type, chroma );
+ cabac_mb_header_b( h, cb, i_mb_type, chroma );
else //if( h->sh.i_type == SLICE_TYPE_I )
- x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_I, chroma );
+ cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_I, chroma );
#if !RDO_SKIP_BS
i_mb_pos_tex = x264_cabac_pos( cb );
@@ -1012,20 +965,20 @@
if( i_mb_type != I_16x16 )
{
- x264_cabac_cbp_luma( h, cb );
+ cabac_cbp_luma( h, cb );
if( chroma )
- x264_cabac_cbp_chroma( h, cb );
+ cabac_cbp_chroma( h, cb );
}
if( x264_mb_transform_8x8_allowed( h ) && h->mb.i_cbp_luma )
{
- x264_cabac_transform_size( h, cb );
+ cabac_transform_size( h, cb );
}
if( h->mb.i_cbp_luma || (chroma && h->mb.i_cbp_chroma) || i_mb_type == I_16x16 )
{
const int b_intra = IS_INTRA( i_mb_type );
- x264_cabac_qp_delta( h, cb );
+ cabac_qp_delta( h, cb );
/* write residual */
if( i_mb_type == I_16x16 )
@@ -1033,12 +986,12 @@
/* DC Luma */
for( int p = 0; p < plane_count; p++ )
{
- x264_cabac_block_residual_dc_cbf( h, cb, ctx_cat_plane[DCT_LUMA_DC][p], LUMA_DC+p, h->dct.luma16x16_dc[p], 1 );
+ cabac_block_residual_dc_cbf( h, cb, ctx_cat_plane[DCT_LUMA_DC][p], LUMA_DC+p, h->dct.luma16x16_dc[p], 1 );
/* AC Luma */
if( h->mb.i_cbp_luma )
for( int i = p*16; i < p*16+16; i++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_AC][p], i, h->dct.luma4x4[i]+1, 1 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_AC][p], i, h->dct.luma4x4[i]+1, 1 );
}
}
else if( h->mb.b_transform_8x8 )
@@ -1086,14 +1039,14 @@
for( int p = 0; p < 3; p++ )
FOREACH_BIT( i, 0, h->mb.i_cbp_luma )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i*4+p*16, h->dct.luma8x8[i+p*4], b_intra );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i*4+p*16, h->dct.luma8x8[i+p*4], b_intra );
MUNGE_8x8_NNZ( RESTORE )
}
else
{
FOREACH_BIT( i, 0, h->mb.i_cbp_luma )
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i] );
}
}
else
@@ -1101,20 +1054,20 @@
for( int p = 0; p < plane_count; p++ )
FOREACH_BIT( i8x8, 0, h->mb.i_cbp_luma )
for( int i = 0; i < 4; i++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i+i8x8*4+p*16, h->dct.luma4x4[i+i8x8*4+p*16], b_intra );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i+i8x8*4+p*16, h->dct.luma4x4[i+i8x8*4+p*16], b_intra );
}
if( chroma && h->mb.i_cbp_chroma ) /* Chroma DC residual present */
{
if( CHROMA_FORMAT == CHROMA_422 )
{
- x264_cabac_block_residual_422_dc_cbf( h, cb, 0, b_intra );
- x264_cabac_block_residual_422_dc_cbf( h, cb, 1, b_intra );
+ cabac_block_residual_422_dc_cbf( h, cb, 0, b_intra );
+ cabac_block_residual_422_dc_cbf( h, cb, 1, b_intra );
}
else
{
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], b_intra );
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], b_intra );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], b_intra );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], b_intra );
}
if( h->mb.i_cbp_chroma == 2 ) /* Chroma AC residual present */
@@ -1122,7 +1075,7 @@
int step = 8 << CHROMA_V_SHIFT;
for( int i = 16; i < 3*16; i += step )
for( int j = i; j < i+4; j++ )
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra );
}
}
}
@@ -1135,9 +1088,11 @@
void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
{
if( CHROMA444 )
- x264_macroblock_write_cabac_internal( h, cb, 3, 0 );
+ macroblock_write_cabac_internal( h, cb, 3, 0 );
+ else if( CHROMA_FORMAT )
+ macroblock_write_cabac_internal( h, cb, 1, 1 );
else
- x264_macroblock_write_cabac_internal( h, cb, 1, 1 );
+ macroblock_write_cabac_internal( h, cb, 1, 0 );
}
#if RDO_SKIP_BS
@@ -1148,7 +1103,7 @@
* only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
* works on all partition sizes except 16x16
*****************************************************************************/
-static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel )
+static void partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel )
{
const int i_mb_type = h->mb.i_type;
int b_8x16 = h->mb.i_partition == D_8x16;
@@ -1156,22 +1111,22 @@
if( i_mb_type == P_8x8 )
{
- x264_cabac_8x8_mvd( h, cb, i8 );
- x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i8] );
+ cabac_8x8_mvd( h, cb, i8 );
+ cabac_subpartition_p( cb, h->mb.i_sub_partition[i8] );
}
else if( i_mb_type == P_L0 )
- x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
else if( i_mb_type > B_DIRECT && i_mb_type < B_8x8 )
{
- if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
- if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) x264_cabac_mvd( h, cb, 1, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) cabac_mvd( h, cb, 1, 4*i8, 4>>b_8x16, 2<<b_8x16 );
}
else //if( i_mb_type == B_8x8 )
{
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] )
- x264_cabac_mvd( h, cb, 0, 4*i8, 2, 2 );
+ cabac_mvd( h, cb, 0, 4*i8, 2, 2 );
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] )
- x264_cabac_mvd( h, cb, 1, 4*i8, 2, 2 );
+ cabac_mvd( h, cb, 1, 4*i8, 2, 2 );
}
for( int j = (i_pixel < PIXEL_8x8); j >= 0; j-- )
@@ -1182,14 +1137,14 @@
{
if( CHROMA444 )
for( int p = 0; p < 3; p++ )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 0 );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 0 );
else
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
}
else
for( int p = 0; p < plane_count; p++ )
for( int i4 = 0; i4 < 4; i4++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16], 0 );
}
if( h->mb.i_cbp_chroma )
@@ -1197,15 +1152,15 @@
if( CHROMA_FORMAT == CHROMA_422 )
{
int offset = (5*i8) & 0x09;
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1, 0 );
}
else
{
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1, 0 );
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1, 0 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1, 0 );
}
}
@@ -1213,63 +1168,63 @@
}
}
-static void x264_subpartition_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_pixel )
+static void subpartition_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_pixel )
{
int b_8x4 = i_pixel == PIXEL_8x4;
int plane_count = CHROMA444 ? 3 : 1;
if( i_pixel == PIXEL_4x4 )
- x264_cabac_mvd( h, cb, 0, i4, 1, 1 );
+ cabac_mvd( h, cb, 0, i4, 1, 1 );
else
- x264_cabac_mvd( h, cb, 0, i4, 1+b_8x4, 2-b_8x4 );
+ cabac_mvd( h, cb, 0, i4, 1+b_8x4, 2-b_8x4 );
for( int p = 0; p < plane_count; p++ )
{
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4, h->dct.luma4x4[p*16+i4], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4, h->dct.luma4x4[p*16+i4], 0 );
if( i_pixel != PIXEL_4x4 )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4], 0 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4], 0 );
}
}
-static void x264_partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode )
+static void partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, 4*i8 );
i_mode = x264_mb_pred_mode4x4_fix( i_mode );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
- x264_cabac_cbp_luma( h, cb );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_cbp_luma( h, cb );
if( h->mb.i_cbp_luma & (1 << i8) )
{
if( CHROMA444 )
for( int p = 0; p < 3; p++ )
- x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 1 );
+ cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 1 );
else
- x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
+ cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] );
}
}
-static void x264_partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode )
+static void partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode )
{
const int i_pred = x264_mb_predict_intra4x4_mode( h, i4 );
int plane_count = CHROMA444 ? 3 : 1;
i_mode = x264_mb_pred_mode4x4_fix( i_mode );
- x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
+ cabac_intra4x4_pred_mode( cb, i_pred, i_mode );
for( int p = 0; p < plane_count; p++ )
- x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+p*16, h->dct.luma4x4[i4+p*16], 1 );
+ cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+p*16, h->dct.luma4x4[i4+p*16], 1 );
}
-static void x264_chroma_size_cabac( x264_t *h, x264_cabac_t *cb )
+static void chroma_size_cabac( x264_t *h, x264_cabac_t *cb )
{
- x264_cabac_intra_chroma_pred_mode( h, cb );
- x264_cabac_cbp_chroma( h, cb );
+ cabac_intra_chroma_pred_mode( h, cb );
+ cabac_cbp_chroma( h, cb );
if( h->mb.i_cbp_chroma )
{
if( CHROMA_FORMAT == CHROMA_422 )
{
- x264_cabac_block_residual_422_dc_cbf( h, cb, 0, 1 );
- x264_cabac_block_residual_422_dc_cbf( h, cb, 1, 1 );
+ cabac_block_residual_422_dc_cbf( h, cb, 0, 1 );
+ cabac_block_residual_422_dc_cbf( h, cb, 1, 1 );
}
else
{
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], 1 );
- x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], 1 );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], 1 );
+ cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], 1 );
}
if( h->mb.i_cbp_chroma == 2 )
@@ -1277,7 +1232,7 @@
int step = 8 << CHROMA_V_SHIFT;
for( int i = 16; i < 3*16; i += step )
for( int j = i; j < i+4; j++ )
- x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 );
+ cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 );
}
}
}
diff -ur x264-go/x264c/external/x264/encoder/cavlc.c x264-go.new/x264c/external/x264/encoder/cavlc.c
--- x264-go/x264c/external/x264/encoder/cavlc.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/cavlc.c 2020-06-06 15:20:58.697039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* cavlc.c: cavlc bitstream writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -67,7 +67,7 @@
/****************************************************************************
* x264_cavlc_block_residual:
****************************************************************************/
-static inline int x264_cavlc_block_residual_escape( x264_t *h, int i_suffix_length, int level )
+static inline int cavlc_block_residual_escape( x264_t *h, int i_suffix_length, int level )
{
bs_t *s = &h->out.bs;
static const uint16_t next_suffix[7] = { 0, 3, 6, 12, 24, 48, 0xffff };
@@ -118,7 +118,7 @@
return i_suffix_length;
}
-static int x264_cavlc_block_residual_internal( x264_t *h, int ctx_block_cat, dctcoef *l, int nC )
+static int cavlc_block_residual_internal( x264_t *h, int ctx_block_cat, dctcoef *l, int nC )
{
bs_t *s = &h->out.bs;
static const uint8_t ctz_index[8] = {3,0,1,0,2,0,1,0};
@@ -163,7 +163,7 @@
i_suffix_length = x264_level_token[i_suffix_length][val_original].i_next;
}
else
- i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
+ i_suffix_length = cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
for( int i = i_trailing+1; i < i_total; i++ )
{
val = runlevel.level[i] + LEVEL_TABLE_SIZE/2;
@@ -173,7 +173,7 @@
i_suffix_length = x264_level_token[i_suffix_length][val].i_next;
}
else
- i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
+ i_suffix_length = cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 );
}
}
@@ -205,10 +205,10 @@
if( !*nnz )\
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );\
else\
- *nnz = x264_cavlc_block_residual_internal(h,cat,l,nC);\
+ *nnz = cavlc_block_residual_internal(h,cat,l,nC);\
}
-static void x264_cavlc_qp_delta( x264_t *h )
+static void cavlc_qp_delta( x264_t *h )
{
bs_t *s = &h->out.bs;
int i_dqp = h->mb.i_qp - h->mb.i_last_qp;
@@ -238,7 +238,7 @@
bs_write_se( s, i_dqp );
}
-static void x264_cavlc_mvd( x264_t *h, int i_list, int idx, int width )
+static void cavlc_mvd( x264_t *h, int i_list, int idx, int width )
{
bs_t *s = &h->out.bs;
ALIGNED_4( int16_t mvp[2] );
@@ -247,31 +247,31 @@
bs_write_se( s, h->mb.cache.mv[i_list][x264_scan8[idx]][1] - mvp[1] );
}
-static inline void x264_cavlc_8x8_mvd( x264_t *h, int i )
+static inline void cavlc_8x8_mvd( x264_t *h, int i )
{
switch( h->mb.i_sub_partition[i] )
{
case D_L0_8x8:
- x264_cavlc_mvd( h, 0, 4*i, 2 );
+ cavlc_mvd( h, 0, 4*i, 2 );
break;
case D_L0_8x4:
- x264_cavlc_mvd( h, 0, 4*i+0, 2 );
- x264_cavlc_mvd( h, 0, 4*i+2, 2 );
+ cavlc_mvd( h, 0, 4*i+0, 2 );
+ cavlc_mvd( h, 0, 4*i+2, 2 );
break;
case D_L0_4x8:
- x264_cavlc_mvd( h, 0, 4*i+0, 1 );
- x264_cavlc_mvd( h, 0, 4*i+1, 1 );
+ cavlc_mvd( h, 0, 4*i+0, 1 );
+ cavlc_mvd( h, 0, 4*i+1, 1 );
break;
case D_L0_4x4:
- x264_cavlc_mvd( h, 0, 4*i+0, 1 );
- x264_cavlc_mvd( h, 0, 4*i+1, 1 );
- x264_cavlc_mvd( h, 0, 4*i+2, 1 );
- x264_cavlc_mvd( h, 0, 4*i+3, 1 );
+ cavlc_mvd( h, 0, 4*i+0, 1 );
+ cavlc_mvd( h, 0, 4*i+1, 1 );
+ cavlc_mvd( h, 0, 4*i+2, 1 );
+ cavlc_mvd( h, 0, 4*i+3, 1 );
break;
}
}
-static ALWAYS_INLINE void x264_cavlc_macroblock_luma_residual( x264_t *h, int plane_count )
+static ALWAYS_INLINE void cavlc_macroblock_luma_residual( x264_t *h, int plane_count )
{
if( h->mb.b_transform_8x8 )
{
@@ -290,9 +290,9 @@
}
#if RDO_SKIP_BS
-static ALWAYS_INLINE void x264_cavlc_partition_luma_residual( x264_t *h, int i8, int p )
+static ALWAYS_INLINE void cavlc_partition_luma_residual( x264_t *h, int i8, int p )
{
- if( h->mb.b_transform_8x8 && h->mb.cache.non_zero_count[x264_scan8[i8*4]] )
+ if( h->mb.b_transform_8x8 && h->mb.cache.non_zero_count[x264_scan8[i8*4+p*16]] )
h->zigzagf.interleave_8x8_cavlc( h->dct.luma4x4[i8*4+p*16], h->dct.luma8x8[i8+p*4],
&h->mb.cache.non_zero_count[x264_scan8[i8*4+p*16]] );
@@ -302,7 +302,7 @@
}
#endif
-static void x264_cavlc_mb_header_i( x264_t *h, int i_mb_type, int i_mb_i_offset, int chroma )
+static void cavlc_mb_header_i( x264_t *h, int i_mb_type, int i_mb_i_offset, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == I_16x16 )
@@ -334,7 +334,7 @@
bs_write_ue( s, x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] );
}
-static ALWAYS_INLINE void x264_cavlc_mb_header_p( x264_t *h, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cavlc_mb_header_p( x264_t *h, int i_mb_type, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == P_L0 )
@@ -345,7 +345,7 @@
if( h->mb.pic.i_fref[0] > 1 )
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
- x264_cavlc_mvd( h, 0, 0, 4 );
+ cavlc_mvd( h, 0, 0, 4 );
}
else if( h->mb.i_partition == D_16x8 )
{
@@ -355,8 +355,8 @@
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[8]] );
}
- x264_cavlc_mvd( h, 0, 0, 4 );
- x264_cavlc_mvd( h, 0, 8, 4 );
+ cavlc_mvd( h, 0, 0, 4 );
+ cavlc_mvd( h, 0, 8, 4 );
}
else if( h->mb.i_partition == D_8x16 )
{
@@ -366,8 +366,8 @@
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] );
bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[4]] );
}
- x264_cavlc_mvd( h, 0, 0, 2 );
- x264_cavlc_mvd( h, 0, 4, 2 );
+ cavlc_mvd( h, 0, 0, 2 );
+ cavlc_mvd( h, 0, 4, 2 );
}
}
else if( i_mb_type == P_8x8 )
@@ -402,13 +402,13 @@
}
for( int i = 0; i < 4; i++ )
- x264_cavlc_8x8_mvd( h, i );
+ cavlc_8x8_mvd( h, i );
}
else //if( IS_INTRA( i_mb_type ) )
- x264_cavlc_mb_header_i( h, i_mb_type, 5, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 5, chroma );
}
-static ALWAYS_INLINE void x264_cavlc_mb_header_b( x264_t *h, int i_mb_type, int chroma )
+static ALWAYS_INLINE void cavlc_mb_header_b( x264_t *h, int i_mb_type, int chroma )
{
bs_t *s = &h->out.bs;
if( i_mb_type == B_8x8 )
@@ -432,10 +432,10 @@
/* mvd */
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] )
- x264_cavlc_mvd( h, 0, 4*i, 2 );
+ cavlc_mvd( h, 0, 4*i, 2 );
for( int i = 0; i < 4; i++ )
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] )
- x264_cavlc_mvd( h, 1, 4*i, 2 );
+ cavlc_mvd( h, 1, 4*i, 2 );
}
else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI )
{
@@ -450,8 +450,8 @@
{
if( i_ref0_max && b_list[0][0] ) bs_write_te( s, i_ref0_max, h->mb.cache.ref[0][x264_scan8[0]] );
if( i_ref1_max && b_list[1][0] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[0]] );
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 4 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 4 );
}
else
{
@@ -461,24 +461,24 @@
if( i_ref1_max && b_list[1][1] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[12]] );
if( h->mb.i_partition == D_16x8 )
{
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 );
- if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 8, 4 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 );
- if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 8, 4 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 4 );
+ if( b_list[0][1] ) cavlc_mvd( h, 0, 8, 4 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 4 );
+ if( b_list[1][1] ) cavlc_mvd( h, 1, 8, 4 );
}
else //if( h->mb.i_partition == D_8x16 )
{
- if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 2 );
- if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 4, 2 );
- if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 2 );
- if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 4, 2 );
+ if( b_list[0][0] ) cavlc_mvd( h, 0, 0, 2 );
+ if( b_list[0][1] ) cavlc_mvd( h, 0, 4, 2 );
+ if( b_list[1][0] ) cavlc_mvd( h, 1, 0, 2 );
+ if( b_list[1][1] ) cavlc_mvd( h, 1, 4, 2 );
}
}
}
else if( i_mb_type == B_DIRECT )
bs_write1( s, 1 );
else //if( IS_INTRA( i_mb_type ) )
- x264_cavlc_mb_header_i( h, i_mb_type, 23, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 23, chroma );
}
/*****************************************************************************
@@ -489,7 +489,7 @@
bs_t *s = &h->out.bs;
const int i_mb_type = h->mb.i_type;
int plane_count = CHROMA444 ? 3 : 1;
- int chroma = !CHROMA444;
+ int chroma = CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422;
#if RDO_SKIP_BS
s->i_bits_encoded = 0;
@@ -536,11 +536,11 @@
#endif
if( h->sh.i_type == SLICE_TYPE_P )
- x264_cavlc_mb_header_p( h, i_mb_type, chroma );
+ cavlc_mb_header_p( h, i_mb_type, chroma );
else if( h->sh.i_type == SLICE_TYPE_B )
- x264_cavlc_mb_header_b( h, i_mb_type, chroma );
+ cavlc_mb_header_b( h, i_mb_type, chroma );
else //if( h->sh.i_type == SLICE_TYPE_I )
- x264_cavlc_mb_header_i( h, i_mb_type, 0, chroma );
+ cavlc_mb_header_i( h, i_mb_type, 0, chroma );
#if !RDO_SKIP_BS
i_mb_pos_tex = bs_pos( s );
@@ -557,7 +557,7 @@
if( i_mb_type == I_16x16 )
{
- x264_cavlc_qp_delta( h );
+ cavlc_qp_delta( h );
/* DC Luma */
for( int p = 0; p < plane_count; p++ )
@@ -572,8 +572,8 @@
}
else if( h->mb.i_cbp_luma | h->mb.i_cbp_chroma )
{
- x264_cavlc_qp_delta( h );
- x264_cavlc_macroblock_luma_residual( h, plane_count );
+ cavlc_qp_delta( h );
+ cavlc_macroblock_luma_residual( h, plane_count );
}
if( h->mb.i_cbp_chroma )
{
@@ -602,7 +602,7 @@
* only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
* works on all partition sizes except 16x16
*****************************************************************************/
-static int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel )
+static int partition_size_cavlc( x264_t *h, int i8, int i_pixel )
{
bs_t *s = &h->out.bs;
const int i_mb_type = h->mb.i_type;
@@ -614,28 +614,28 @@
if( i_mb_type == P_8x8 )
{
- x264_cavlc_8x8_mvd( h, i8 );
+ cavlc_8x8_mvd( h, i8 );
bs_write_ue( s, subpartition_p_to_golomb[ h->mb.i_sub_partition[i8] ] );
}
else if( i_mb_type == P_L0 )
- x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
+ cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
else if( i_mb_type > B_DIRECT && i_mb_type < B_8x8 )
{
- if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
- if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) x264_cavlc_mvd( h, 1, 4*i8, 4>>b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 );
+ if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) cavlc_mvd( h, 1, 4*i8, 4>>b_8x16 );
}
else //if( i_mb_type == B_8x8 )
{
if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] )
- x264_cavlc_mvd( h, 0, 4*i8, 2 );
+ cavlc_mvd( h, 0, 4*i8, 2 );
if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] )
- x264_cavlc_mvd( h, 1, 4*i8, 2 );
+ cavlc_mvd( h, 1, 4*i8, 2 );
}
for( j = (i_pixel < PIXEL_8x8); j >= 0; j-- )
{
for( int p = 0; p < plane_count; p++ )
- x264_cavlc_partition_luma_residual( h, i8, p );
+ cavlc_partition_luma_residual( h, i8, p );
if( h->mb.i_cbp_chroma )
{
if( CHROMA_FORMAT == CHROMA_422 )
@@ -658,12 +658,12 @@
return h->out.bs.i_bits_encoded;
}
-static int x264_subpartition_size_cavlc( x264_t *h, int i4, int i_pixel )
+static int subpartition_size_cavlc( x264_t *h, int i4, int i_pixel )
{
int plane_count = CHROMA444 ? 3 : 1;
int b_8x4 = i_pixel == PIXEL_8x4;
h->out.bs.i_bits_encoded = 0;
- x264_cavlc_mvd( h, 0, i4, 1+b_8x4 );
+ cavlc_mvd( h, 0, i4, 1+b_8x4 );
for( int p = 0; p < plane_count; p++ )
{
x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] );
@@ -674,7 +674,7 @@
return h->out.bs.i_bits_encoded;
}
-static int x264_cavlc_intra4x4_pred_size( x264_t *h, int i4, int i_mode )
+static int cavlc_intra4x4_pred_size( x264_t *h, int i4, int i_mode )
{
if( x264_mb_predict_intra4x4_mode( h, i4 ) == x264_mb_pred_mode4x4_fix( i_mode ) )
return 1;
@@ -682,26 +682,26 @@
return 4;
}
-static int x264_partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
+static int partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
{
int plane_count = CHROMA444 ? 3 : 1;
- h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, 4*i8, i_mode );
+ h->out.bs.i_bits_encoded = cavlc_intra4x4_pred_size( h, 4*i8, i_mode );
bs_write_ue( &h->out.bs, cbp_to_golomb[!CHROMA444][1][(h->mb.i_cbp_chroma << 4)|h->mb.i_cbp_luma] );
for( int p = 0; p < plane_count; p++ )
- x264_cavlc_partition_luma_residual( h, i8, p );
+ cavlc_partition_luma_residual( h, i8, p );
return h->out.bs.i_bits_encoded;
}
-static int x264_partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode )
+static int partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode )
{
int plane_count = CHROMA444 ? 3 : 1;
- h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, i4, i_mode );
+ h->out.bs.i_bits_encoded = cavlc_intra4x4_pred_size( h, i4, i_mode );
for( int p = 0; p < plane_count; p++ )
x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] );
return h->out.bs.i_bits_encoded;
}
-static int x264_chroma_size_cavlc( x264_t *h )
+static int chroma_size_cavlc( x264_t *h )
{
h->out.bs.i_bits_encoded = bs_size_ue( x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] );
if( h->mb.i_cbp_chroma )
diff -ur x264-go/x264c/external/x264/encoder/encoder.c x264-go.new/x264c/external/x264/encoder/encoder.c
--- x264-go/x264c/external/x264/encoder/encoder.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/encoder.c 2020-06-06 15:20:58.697039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* encoder.c: top-level encoder functions
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -40,16 +40,20 @@
#define bs_write_ue bs_write_ue_big
-static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
- x264_nal_t **pp_nal, int *pi_nal,
- x264_picture_t *pic_out );
+// forward declaration needed for template usage
+void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
+void x264_macroblock_cache_load_progressive( x264_t *h, int i_mb_x, int i_mb_y );
+
+static int encoder_frame_end( x264_t *h, x264_t *thread_current,
+ x264_nal_t **pp_nal, int *pi_nal,
+ x264_picture_t *pic_out );
/****************************************************************************
*
******************************* x264 libs **********************************
*
****************************************************************************/
-static double x264_psnr( double sqe, double size )
+static double calc_psnr( double sqe, double size )
{
double mse = sqe / (PIXEL_MAX*PIXEL_MAX * size);
if( mse <= 0.0000000001 ) /* Max 100dB */
@@ -58,7 +62,7 @@
return -10.0 * log10( mse );
}
-static double x264_ssim( double ssim )
+static double calc_ssim_db( double ssim )
{
double inv_ssim = 1 - ssim;
if( inv_ssim <= 0.0000000001 ) /* Max 100dB */
@@ -67,7 +71,7 @@
return -10.0 * log10( inv_ssim );
}
-static int x264_threadpool_wait_all( x264_t *h )
+static int threadpool_wait_all( x264_t *h )
{
for( int i = 0; i < h->param.i_threads; i++ )
if( h->thread[i]->b_thread_active )
@@ -79,7 +83,7 @@
return 0;
}
-static void x264_frame_dump( x264_t *h )
+static void frame_dump( x264_t *h )
{
FILE *f = x264_fopen( h->param.psz_dump_yuv, "r+b" );
if( !f )
@@ -87,26 +91,26 @@
/* Wait for the threads to finish deblocking */
if( h->param.b_sliced_threads )
- x264_threadpool_wait_all( h );
+ threadpool_wait_all( h );
/* Write the frame in display order */
- int frame_size = FRAME_SIZE( h->param.i_height * h->param.i_width * sizeof(pixel) );
+ int frame_size = FRAME_SIZE( h->param.i_height * h->param.i_width * SIZEOF_PIXEL );
if( !fseek( f, (int64_t)h->fdec->i_frame * frame_size, SEEK_SET ) )
{
for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ )
for( int y = 0; y < h->param.i_height; y++ )
- fwrite( &h->fdec->plane[p][y*h->fdec->i_stride[p]], sizeof(pixel), h->param.i_width, f );
- if( !CHROMA444 )
+ fwrite( &h->fdec->plane[p][y*h->fdec->i_stride[p]], SIZEOF_PIXEL, h->param.i_width, f );
+ if( CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422 )
{
int cw = h->param.i_width>>1;
int ch = h->param.i_height>>CHROMA_V_SHIFT;
- pixel *planeu = x264_malloc( 2 * (cw*ch*sizeof(pixel) + 32) );
+ pixel *planeu = x264_malloc( 2 * (cw*ch*SIZEOF_PIXEL + 32) );
if( planeu )
{
- pixel *planev = planeu + cw*ch + 32/sizeof(pixel);
+ pixel *planev = planeu + cw*ch + 32/SIZEOF_PIXEL;
h->mc.plane_copy_deinterleave( planeu, cw, planev, cw, h->fdec->plane[1], h->fdec->i_stride[1], cw, ch );
- fwrite( planeu, 1, cw*ch*sizeof(pixel), f );
- fwrite( planev, 1, cw*ch*sizeof(pixel), f );
+ fwrite( planeu, 1, cw*ch*SIZEOF_PIXEL, f );
+ fwrite( planev, 1, cw*ch*SIZEOF_PIXEL, f );
x264_free( planeu );
}
}
@@ -115,9 +119,9 @@
}
/* Fill "default" values */
-static void x264_slice_header_init( x264_t *h, x264_slice_header_t *sh,
- x264_sps_t *sps, x264_pps_t *pps,
- int i_idr_pic_id, int i_frame, int i_qp )
+static void slice_header_init( x264_t *h, x264_slice_header_t *sh,
+ x264_sps_t *sps, x264_pps_t *pps,
+ int i_idr_pic_id, int i_frame, int i_qp )
{
x264_param_t *param = &h->param;
@@ -206,7 +210,7 @@
sh->i_beta_offset = param->i_deblocking_filter_beta << 1;
}
-static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal_ref_idc )
+static void slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal_ref_idc )
{
if( sh->b_mbaff )
{
@@ -289,25 +293,29 @@
{
sh->b_weighted_pred = sh->weight[0][0].weightfn || sh->weight[0][1].weightfn || sh->weight[0][2].weightfn;
/* pred_weight_table() */
- bs_write_ue( s, sh->weight[0][0].i_denom );
- bs_write_ue( s, sh->weight[0][1].i_denom );
+ bs_write_ue( s, sh->weight[0][0].i_denom ); /* luma_log2_weight_denom */
+ if( sh->sps->i_chroma_format_idc )
+ bs_write_ue( s, sh->weight[0][1].i_denom ); /* chroma_log2_weight_denom */
for( int i = 0; i < sh->i_num_ref_idx_l0_active; i++ )
{
int luma_weight_l0_flag = !!sh->weight[i][0].weightfn;
- int chroma_weight_l0_flag = !!sh->weight[i][1].weightfn || !!sh->weight[i][2].weightfn;
bs_write1( s, luma_weight_l0_flag );
if( luma_weight_l0_flag )
{
bs_write_se( s, sh->weight[i][0].i_scale );
bs_write_se( s, sh->weight[i][0].i_offset );
}
- bs_write1( s, chroma_weight_l0_flag );
- if( chroma_weight_l0_flag )
+ if( sh->sps->i_chroma_format_idc )
{
- for( int j = 1; j < 3; j++ )
+ int chroma_weight_l0_flag = sh->weight[i][1].weightfn || sh->weight[i][2].weightfn;
+ bs_write1( s, chroma_weight_l0_flag );
+ if( chroma_weight_l0_flag )
{
- bs_write_se( s, sh->weight[i][j].i_scale );
- bs_write_se( s, sh->weight[i][j].i_offset );
+ for( int j = 1; j < 3; j++ )
+ {
+ bs_write_se( s, sh->weight[i][j].i_scale );
+ bs_write_se( s, sh->weight[i][j].i_offset );
+ }
}
}
}
@@ -357,11 +365,13 @@
/* If we are within a reasonable distance of the end of the memory allocated for the bitstream, */
/* reallocate, adding an arbitrary amount of space. */
-static int x264_bitstream_check_buffer_internal( x264_t *h, int size, int b_cabac, int i_nal )
+static int bitstream_check_buffer_internal( x264_t *h, int size, int b_cabac, int i_nal )
{
if( (b_cabac && (h->cabac.p_end - h->cabac.p < size)) ||
(h->out.bs.p_end - h->out.bs.p < size) )
{
+ if( size > INT_MAX - h->out.i_bitstream )
+ return -1;
int buf_size = h->out.i_bitstream + size;
uint8_t *buf = x264_malloc( buf_size );
if( !buf )
@@ -390,20 +400,20 @@
return 0;
}
-static int x264_bitstream_check_buffer( x264_t *h )
+static int bitstream_check_buffer( x264_t *h )
{
int max_row_size = (2500 << SLICE_MBAFF) * h->mb.i_mb_width;
- return x264_bitstream_check_buffer_internal( h, max_row_size, h->param.b_cabac, h->out.i_nal );
+ return bitstream_check_buffer_internal( h, max_row_size, h->param.b_cabac, h->out.i_nal );
}
-static int x264_bitstream_check_buffer_filler( x264_t *h, int filler )
+static int bitstream_check_buffer_filler( x264_t *h, int filler )
{
filler += 32; // add padding for safety
- return x264_bitstream_check_buffer_internal( h, filler, 0, -1 );
+ return bitstream_check_buffer_internal( h, filler, 0, -1 );
}
#if HAVE_THREAD
-static void x264_encoder_thread_init( x264_t *h )
+static void encoder_thread_init( x264_t *h )
{
if( h->param.i_sync_lookahead )
x264_lower_thread_priority( 10 );
@@ -418,18 +428,18 @@
*
****************************************************************************/
-static int x264_validate_parameters( x264_t *h, int b_open )
+static int validate_parameters( x264_t *h, int b_open )
{
if( !h->param.pf_log )
{
- x264_log( NULL, X264_LOG_ERROR, "pf_log not set! did you forget to call x264_param_default?\n" );
+ x264_log_internal( X264_LOG_ERROR, "pf_log not set! did you forget to call x264_param_default?\n" );
return -1;
}
#if HAVE_MMX
if( b_open )
{
- int cpuflags = x264_cpu_detect();
+ uint32_t cpuflags = x264_cpu_detect();
int fail = 0;
#ifdef __SSE__
if( !(cpuflags & X264_CPU_SSE) )
@@ -462,7 +472,9 @@
}
#endif
- if( h->param.i_width <= 0 || h->param.i_height <= 0 )
+#define MAX_RESOLUTION 16384
+ if( h->param.i_width <= 0 || h->param.i_height <= 0 ||
+ h->param.i_width > MAX_RESOLUTION || h->param.i_height > MAX_RESOLUTION )
{
x264_log( h, X264_LOG_ERROR, "invalid width x height (%dx%d)\n",
h->param.i_width, h->param.i_height );
@@ -471,7 +483,12 @@
int i_csp = h->param.i_csp & X264_CSP_MASK;
#if X264_CHROMA_FORMAT
- if( CHROMA_FORMAT != CHROMA_420 && i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 )
+ if( CHROMA_FORMAT != CHROMA_400 && i_csp == X264_CSP_I400 )
+ {
+ x264_log( h, X264_LOG_ERROR, "not compiled with 4:0:0 support\n" );
+ return -1;
+ }
+ else if( CHROMA_FORMAT != CHROMA_420 && i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 )
{
x264_log( h, X264_LOG_ERROR, "not compiled with 4:2:0 support\n" );
return -1;
@@ -489,13 +506,26 @@
#endif
if( i_csp <= X264_CSP_NONE || i_csp >= X264_CSP_MAX )
{
- x264_log( h, X264_LOG_ERROR, "invalid CSP (only I420/YV12/NV12/NV21/I422/YV16/NV16/YUYV/UYVY/"
+ x264_log( h, X264_LOG_ERROR, "invalid CSP (only I400/I420/YV12/NV12/NV21/I422/YV16/NV16/YUYV/UYVY/"
"I444/YV24/BGR/BGRA/RGB supported)\n" );
return -1;
}
- int w_mod = i_csp < X264_CSP_I444 ? 2 : 1;
- int h_mod = (i_csp < X264_CSP_I422 ? 2 : 1) << PARAM_INTERLACED;
+ int w_mod = 1;
+ int h_mod = 1 << (PARAM_INTERLACED || h->param.b_fake_interlaced);
+ if( i_csp == X264_CSP_I400 )
+ {
+ h->param.analyse.i_chroma_qp_offset = 0;
+ h->param.analyse.b_chroma_me = 0;
+ h->param.vui.i_colmatrix = 2; /* undefined */
+ }
+ else if( i_csp < X264_CSP_I444 )
+ {
+ w_mod = 2;
+ if( i_csp < X264_CSP_I422 )
+ h_mod *= 2;
+ }
+
if( h->param.i_width % w_mod )
{
x264_log( h, X264_LOG_ERROR, "width not divisible by %d (%dx%d)\n",
@@ -509,21 +539,21 @@
return -1;
}
- if( h->param.crop_rect.i_left >= h->param.i_width ||
- h->param.crop_rect.i_right >= h->param.i_width ||
- h->param.crop_rect.i_top >= h->param.i_height ||
- h->param.crop_rect.i_bottom >= h->param.i_height ||
+ if( h->param.crop_rect.i_left < 0 || h->param.crop_rect.i_left >= h->param.i_width ||
+ h->param.crop_rect.i_right < 0 || h->param.crop_rect.i_right >= h->param.i_width ||
+ h->param.crop_rect.i_top < 0 || h->param.crop_rect.i_top >= h->param.i_height ||
+ h->param.crop_rect.i_bottom < 0 || h->param.crop_rect.i_bottom >= h->param.i_height ||
h->param.crop_rect.i_left + h->param.crop_rect.i_right >= h->param.i_width ||
h->param.crop_rect.i_top + h->param.crop_rect.i_bottom >= h->param.i_height )
{
- x264_log( h, X264_LOG_ERROR, "invalid crop-rect %u,%u,%u,%u\n", h->param.crop_rect.i_left,
+ x264_log( h, X264_LOG_ERROR, "invalid crop-rect %d,%d,%d,%d\n", h->param.crop_rect.i_left,
h->param.crop_rect.i_top, h->param.crop_rect.i_right, h->param.crop_rect.i_bottom );
return -1;
}
if( h->param.crop_rect.i_left % w_mod || h->param.crop_rect.i_right % w_mod ||
h->param.crop_rect.i_top % h_mod || h->param.crop_rect.i_bottom % h_mod )
{
- x264_log( h, X264_LOG_ERROR, "crop-rect %u,%u,%u,%u not divisible by %dx%d\n", h->param.crop_rect.i_left,
+ x264_log( h, X264_LOG_ERROR, "crop-rect %d,%d,%d,%d not divisible by %dx%d\n", h->param.crop_rect.i_left,
h->param.crop_rect.i_top, h->param.crop_rect.i_right, h->param.crop_rect.i_bottom, w_mod, h_mod );
return -1;
}
@@ -791,21 +821,36 @@
memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].cqm_4ic, sizeof(h->param.cqm_4ic) );
memcpy( h->param.cqm_8iy, avcintra_lut[type][res][i].cqm_8iy, sizeof(h->param.cqm_8iy) );
- /* Need exactly 10 slices of equal MB count... why? $deity knows... */
- h->param.i_slice_max_mbs = ((h->param.i_width + 15) / 16) * ((h->param.i_height + 15) / 16) / 10;
- h->param.i_slice_max_size = 0;
- /* The slice structure only allows a maximum of 2 threads for 1080i/p
- * and 1 or 5 threads for 720p */
- if( h->param.b_sliced_threads )
+ /* Sony XAVC flavor much more simple */
+ if( h->param.i_avcintra_flavor == X264_AVCINTRA_FLAVOR_SONY )
{
- if( res )
- h->param.i_threads = X264_MIN( 2, h->param.i_threads );
- else
+ h->param.i_slice_count = 8;
+ if( h->param.b_sliced_threads )
+ h->param.i_threads = h->param.i_slice_count;
+ /* Sony XAVC unlike AVC-Intra doesn't seem to have a QP floor */
+ }
+ else
+ {
+ /* Need exactly 10 slices of equal MB count... why? $deity knows... */
+ h->param.i_slice_max_mbs = ((h->param.i_width + 15) / 16) * ((h->param.i_height + 15) / 16) / 10;
+ h->param.i_slice_max_size = 0;
+ /* The slice structure only allows a maximum of 2 threads for 1080i/p
+ * and 1 or 5 threads for 720p */
+ if( h->param.b_sliced_threads )
{
- h->param.i_threads = X264_MIN( 5, h->param.i_threads );
- if( h->param.i_threads < 5 )
- h->param.i_threads = 1;
+ if( res )
+ h->param.i_threads = X264_MIN( 2, h->param.i_threads );
+ else
+ {
+ h->param.i_threads = X264_MIN( 5, h->param.i_threads );
+ if( h->param.i_threads < 5 )
+ h->param.i_threads = 1;
+ }
}
+
+ /* Official encoder doesn't appear to go under 13
+ * and Avid cannot handle negative QPs */
+ h->param.rc.i_qp_min = X264_MAX( h->param.rc.i_qp_min, QP_BD_OFFSET + 1 );
}
if( type )
@@ -815,18 +860,14 @@
h->param.vui.i_sar_width = 4;
h->param.vui.i_sar_height = 3;
}
-
- /* Official encoder doesn't appear to go under 13
- * and Avid cannot handle negative QPs */
- h->param.rc.i_qp_min = X264_MAX( h->param.rc.i_qp_min, QP_BD_OFFSET + 1 );
}
h->param.rc.f_rf_constant = x264_clip3f( h->param.rc.f_rf_constant, -QP_BD_OFFSET, 51 );
h->param.rc.f_rf_constant_max = x264_clip3f( h->param.rc.f_rf_constant_max, -QP_BD_OFFSET, 51 );
- h->param.rc.i_qp_constant = x264_clip3( h->param.rc.i_qp_constant, 0, QP_MAX );
+ h->param.rc.i_qp_constant = x264_clip3( h->param.rc.i_qp_constant, -1, QP_MAX );
h->param.analyse.i_subpel_refine = x264_clip3( h->param.analyse.i_subpel_refine, 0, 11 );
- h->param.rc.f_ip_factor = X264_MAX( h->param.rc.f_ip_factor, 0.01f );
- h->param.rc.f_pb_factor = X264_MAX( h->param.rc.f_pb_factor, 0.01f );
+ h->param.rc.f_ip_factor = x264_clip3f( h->param.rc.f_ip_factor, 0.01, 10.0 );
+ h->param.rc.f_pb_factor = x264_clip3f( h->param.rc.f_pb_factor, 0.01, 10.0 );
if( h->param.rc.i_rc_method == X264_RC_CRF )
{
h->param.rc.i_qp_constant = h->param.rc.f_rf_constant + QP_BD_OFFSET;
@@ -852,19 +893,18 @@
/* 8x8dct is not useful without RD in CAVLC lossless */
if( !h->param.b_cabac && h->param.analyse.i_subpel_refine < 6 )
h->param.analyse.b_transform_8x8 = 0;
- h->param.analyse.inter &= ~X264_ANALYSE_I8x8;
- h->param.analyse.intra &= ~X264_ANALYSE_I8x8;
- }
- if( i_csp >= X264_CSP_I444 && h->param.b_cabac )
- {
- /* Disable 8x8dct during 4:4:4+CABAC encoding for compatibility with libavcodec */
- h->param.analyse.b_transform_8x8 = 0;
}
if( h->param.rc.i_rc_method == X264_RC_CQP )
{
float qp_p = h->param.rc.i_qp_constant;
float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor );
float qp_b = qp_p + 6*log2f( h->param.rc.f_pb_factor );
+ if( qp_p < 0 )
+ {
+ x264_log( h, X264_LOG_ERROR, "qp not specified\n" );
+ return -1;
+ }
+
h->param.rc.i_qp_min = x264_clip3( (int)(X264_MIN3( qp_p, qp_i, qp_b )), 0, QP_MAX );
h->param.rc.i_qp_max = x264_clip3( (int)(X264_MAX3( qp_p, qp_i, qp_b ) + .999), 0, QP_MAX );
h->param.rc.i_aq_mode = 0;
@@ -1338,6 +1378,9 @@
switch( CHROMA_FORMAT )
{
+ case CHROMA_400:
+ h->mc.prefetch_fenc = h->mc.prefetch_fenc_400;
+ break;
case CHROMA_420:
memcpy( h->predict_chroma, h->predict_8x8c, sizeof(h->predict_chroma) );
h->mc.prefetch_fenc = h->mc.prefetch_fenc_420;
@@ -1368,7 +1411,7 @@
}
}
-static void x264_set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
+static void set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
{
/* VUI */
if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 )
@@ -1431,7 +1474,7 @@
goto fail;
}
- if( x264_validate_parameters( h, 1 ) < 0 )
+ if( validate_parameters( h, 1 ) < 0 )
goto fail;
if( h->param.psz_cqm_file )
@@ -1461,9 +1504,10 @@
goto fail;
}
- x264_set_aspect_ratio( h, &h->param, 1 );
+ set_aspect_ratio( h, &h->param, 1 );
x264_sps_init( h->sps, h->param.i_sps_id, &h->param );
+ x264_sps_init_scaling_list( h->sps, &h->param );
x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps );
x264_validate_levels( h, 1 );
@@ -1517,6 +1561,7 @@
h->frames.i_largest_pts = h->frames.i_second_largest_pts = -1;
h->frames.i_poc_last_open_gop = -1;
+ CHECKED_MALLOCZERO( h->cost_table, sizeof(*h->cost_table) );
CHECKED_MALLOCZERO( h->frames.unused[0], (h->frames.i_delay + 3) * sizeof(x264_frame_t *) );
/* Allocate room for max refs plus a few extra just in case. */
CHECKED_MALLOCZERO( h->frames.unused[1], (h->i_thread_frames + X264_REF_MAX + 4) * sizeof(x264_frame_t *) );
@@ -1553,7 +1598,7 @@
if( h->param.b_cabac )
x264_cabac_init( h );
else
- x264_stack_align( x264_cavlc_init, h );
+ x264_cavlc_init( h );
mbcmp_init( h );
chroma_dsp_init( h );
@@ -1606,9 +1651,13 @@
}
h->out.i_nal = 0;
- h->out.i_bitstream = X264_MAX( 1000000, h->param.i_width * h->param.i_height * 4
- * ( h->param.rc.i_rc_method == X264_RC_ABR ? pow( 0.95, h->param.rc.i_qp_min )
- : pow( 0.95, h->param.rc.i_qp_constant ) * X264_MAX( 1, h->param.rc.f_ip_factor )));
+ h->out.i_bitstream = x264_clip3f(
+ h->param.i_width * h->param.i_height * 4
+ * ( h->param.rc.i_rc_method == X264_RC_ABR
+ ? pow( 0.95, h->param.rc.i_qp_min )
+ : pow( 0.95, h->param.rc.i_qp_constant ) * X264_MAX( 1, h->param.rc.f_ip_factor ) ),
+ 1000000, INT_MAX/3
+ );
h->nal_buffer_size = h->out.i_bitstream * 3/2 + 4 + 64; /* +4 for startcode, +64 for nal_escape assembly padding */
CHECKED_MALLOC( h->nal_buffer, h->nal_buffer_size );
@@ -1616,7 +1665,7 @@
CHECKED_MALLOC( h->reconfig_h, sizeof(x264_t) );
if( h->param.i_threads > 1 &&
- x264_threadpool_init( &h->threadpool, h->param.i_threads, (void*)x264_encoder_thread_init, h ) )
+ x264_threadpool_init( &h->threadpool, h->param.i_threads, (void*)encoder_thread_init, h ) )
goto fail;
if( h->param.i_lookahead_threads > 1 &&
x264_threadpool_init( &h->lookaheadpool, h->param.i_lookahead_threads, NULL, NULL ) )
@@ -1717,26 +1766,20 @@
const char *profile = h->sps->i_profile_idc == PROFILE_BASELINE ? "Constrained Baseline" :
h->sps->i_profile_idc == PROFILE_MAIN ? "Main" :
h->sps->i_profile_idc == PROFILE_HIGH ? "High" :
- h->sps->i_profile_idc == PROFILE_HIGH10 ? (h->sps->b_constraint_set3 == 1 ? "High 10 Intra" : "High 10") :
- h->sps->i_profile_idc == PROFILE_HIGH422 ? (h->sps->b_constraint_set3 == 1 ? "High 4:2:2 Intra" : "High 4:2:2") :
- h->sps->b_constraint_set3 == 1 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive";
+ h->sps->i_profile_idc == PROFILE_HIGH10 ?
+ (h->sps->b_constraint_set3 ? "High 10 Intra" : "High 10") :
+ h->sps->i_profile_idc == PROFILE_HIGH422 ?
+ (h->sps->b_constraint_set3 ? "High 4:2:2 Intra" : "High 4:2:2") :
+ h->sps->b_constraint_set3 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive";
char level[4];
snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc/10, h->sps->i_level_idc%10 );
if( h->sps->i_level_idc == 9 || ( h->sps->i_level_idc == 11 && h->sps->b_constraint_set3 &&
(h->sps->i_profile_idc == PROFILE_BASELINE || h->sps->i_profile_idc == PROFILE_MAIN) ) )
strcpy( level, "1b" );
- if( h->sps->i_profile_idc < PROFILE_HIGH10 )
- {
- x264_log( h, X264_LOG_INFO, "profile %s, level %s\n",
- profile, level );
- }
- else
- {
- static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" };
- x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s %d-bit\n",
- profile, level, subsampling[CHROMA_FORMAT], BIT_DEPTH );
- }
+ static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" };
+ x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s, %d-bit\n",
+ profile, level, subsampling[CHROMA_FORMAT], BIT_DEPTH );
return h;
fail:
@@ -1745,10 +1788,10 @@
}
/****************************************************************************/
-static int x264_encoder_try_reconfig( x264_t *h, x264_param_t *param, int *rc_reconfig )
+static int encoder_try_reconfig( x264_t *h, x264_param_t *param, int *rc_reconfig )
{
*rc_reconfig = 0;
- x264_set_aspect_ratio( h, param, 0 );
+ set_aspect_ratio( h, param, 0 );
#define COPY(var) h->param.var = param->var
COPY( i_frame_reference ); // but never uses more refs than initially specified
COPY( i_bframe_bias );
@@ -1809,13 +1852,13 @@
COPY( rc.f_rf_constant_max );
#undef COPY
- return x264_validate_parameters( h, 0 );
+ return validate_parameters( h, 0 );
}
int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param )
{
int rc_reconfig;
- int ret = x264_encoder_try_reconfig( h, param, &rc_reconfig );
+ int ret = encoder_try_reconfig( h, param, &rc_reconfig );
mbcmp_init( h );
if( !ret )
@@ -1842,7 +1885,7 @@
h->reconfig_h->param = h->param;
int rc_reconfig;
- int ret = x264_encoder_try_reconfig( h->reconfig_h, param, &rc_reconfig );
+ int ret = encoder_try_reconfig( h->reconfig_h, param, &rc_reconfig );
if( !ret )
h->reconfig = 1;
else
@@ -1860,7 +1903,7 @@
}
/* internal usage */
-static void x264_nal_start( x264_t *h, int i_type, int i_ref_idc )
+static void nal_start( x264_t *h, int i_type, int i_ref_idc )
{
x264_nal_t *nal = &h->out.nal[h->out.i_nal];
@@ -1874,7 +1917,7 @@
}
/* if number of allocated nals is not enough, re-allocate a larger one. */
-static int x264_nal_check_buffer( x264_t *h )
+static int nal_check_buffer( x264_t *h )
{
if( h->out.i_nal >= h->out.i_nals_allocated )
{
@@ -1889,7 +1932,7 @@
return 0;
}
-static int x264_nal_end( x264_t *h )
+static int nal_end( x264_t *h )
{
x264_nal_t *nal = &h->out.nal[h->out.i_nal];
uint8_t *end = &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8];
@@ -1901,15 +1944,17 @@
h->param.nalu_process( h, nal, h->fenc->opaque );
h->out.i_nal++;
- return x264_nal_check_buffer( h );
+ return nal_check_buffer( h );
}
-static int x264_check_encapsulated_buffer( x264_t *h, x264_t *h0, int start,
- int previous_nal_size, int necessary_size )
+static int check_encapsulated_buffer( x264_t *h, x264_t *h0, int start,
+ int64_t previous_nal_size, int64_t necessary_size )
{
if( h0->nal_buffer_size < necessary_size )
{
necessary_size *= 2;
+ if( necessary_size > INT_MAX )
+ return -1;
uint8_t *buf = x264_malloc( necessary_size );
if( !buf )
return -1;
@@ -1928,15 +1973,17 @@
return 0;
}
-static int x264_encoder_encapsulate_nals( x264_t *h, int start )
+static int encoder_encapsulate_nals( x264_t *h, int start )
{
x264_t *h0 = h->thread[0];
- int nal_size = 0, previous_nal_size = 0;
+ int64_t nal_size = 0, previous_nal_size = 0;
if( h->param.nalu_process )
{
for( int i = start; i < h->out.i_nal; i++ )
nal_size += h->out.nal[i].i_payload;
+ if( nal_size > INT_MAX )
+ return -1;
return nal_size;
}
@@ -1947,10 +1994,10 @@
nal_size += h->out.nal[i].i_payload;
/* Worst-case NAL unit escaping: reallocate the buffer if it's too small. */
- int necessary_size = previous_nal_size + nal_size * 3/2 + h->out.i_nal * 4 + 4 + 64;
+ int64_t necessary_size = previous_nal_size + nal_size * 3/2 + h->out.i_nal * 4 + 4 + 64;
for( int i = start; i < h->out.i_nal; i++ )
necessary_size += h->out.nal[i].i_padding;
- if( x264_check_encapsulated_buffer( h, h0, start, previous_nal_size, necessary_size ) )
+ if( check_encapsulated_buffer( h, h0, start, previous_nal_size, necessary_size ) )
return -1;
uint8_t *nal_buffer = h0->nal_buffer + previous_nal_size;
@@ -1981,25 +2028,25 @@
/* Write SEI, SPS and PPS. */
/* generate sequence parameters */
- x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* generate picture parameters */
- x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
x264_pps_write( &h->out.bs, h->sps, h->pps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* identify ourselves */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_version_write( h, &h->out.bs ) )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
- frame_size = x264_encoder_encapsulate_nals( h, 0 );
+ frame_size = encoder_encapsulate_nals( h, 0 );
if( frame_size < 0 )
return -1;
@@ -2013,7 +2060,7 @@
/* Check to see whether we have chosen a reference list ordering different
* from the standard's default. */
-static inline void x264_reference_check_reorder( x264_t *h )
+static inline void reference_check_reorder( x264_t *h )
{
/* The reorder check doesn't check for missing frames, so just
* force a reorder if one of the reference list is corrupt. */
@@ -2038,7 +2085,7 @@
}
/* return -1 on failure, else return the index of the new reference frame */
-static int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w )
+static int weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w )
{
int i = h->i_ref[0];
int j = 1;
@@ -2077,7 +2124,7 @@
return j;
}
-static void x264_weighted_pred_init( x264_t *h )
+static void weighted_pred_init( x264_t *h )
{
/* for now no analysis and set all weights to nothing */
for( int i_ref = 0; i_ref < h->i_ref[0]; i_ref++ )
@@ -2161,7 +2208,7 @@
h->sh.weight[0][2].i_denom = h->sh.weight[0][1].i_denom;
}
-static inline int x264_reference_distance( x264_t *h, x264_frame_t *frame )
+static inline int reference_distance( x264_t *h, x264_frame_t *frame )
{
if( h->param.i_frame_packing == 5 )
return abs((h->fenc->i_frame&~1) - (frame->i_frame&~1)) +
@@ -2170,7 +2217,7 @@
return abs(h->fenc->i_frame - frame->i_frame);
}
-static inline void x264_reference_build_list( x264_t *h, int i_poc )
+static inline void reference_build_list( x264_t *h, int i_poc )
{
int b_ok;
@@ -2227,7 +2274,7 @@
if( list ? h->fref[list][i+1]->i_poc < h->fref_nearest[list]->i_poc
: h->fref[list][i+1]->i_poc > h->fref_nearest[list]->i_poc )
h->fref_nearest[list] = h->fref[list][i+1];
- if( x264_reference_distance( h, h->fref[list][i] ) > x264_reference_distance( h, h->fref[list][i+1] ) )
+ if( reference_distance( h, h->fref[list][i] ) > reference_distance( h, h->fref[list][i+1] ) )
{
XCHG( x264_frame_t*, h->fref[list][i], h->fref[list][i+1] );
b_ok = 0;
@@ -2237,7 +2284,7 @@
} while( !b_ok );
}
- x264_reference_check_reorder( h );
+ reference_check_reorder( h );
h->i_ref[1] = X264_MIN( h->i_ref[1], h->frames.i_max_ref1 );
h->i_ref[0] = X264_MIN( h->i_ref[0], h->frames.i_max_ref0 );
@@ -2262,7 +2309,7 @@
{
h->fenc->weight[0][0].i_denom = 0;
SET_WEIGHT( w[0], 1, 1, 0, -1 );
- idx = x264_weighted_reference_duplicate( h, 0, w );
+ idx = weighted_reference_duplicate( h, 0, w );
}
else
{
@@ -2270,13 +2317,13 @@
{
SET_WEIGHT( h->fenc->weight[0][0], 1, 1, 0, h->fenc->weight[0][0].i_offset );
}
- x264_weighted_reference_duplicate( h, 0, x264_weight_none );
+ weighted_reference_duplicate( h, 0, x264_weight_none );
if( h->fenc->weight[0][0].i_offset > -128 )
{
w[0] = h->fenc->weight[0][0];
w[0].i_offset--;
h->mc.weight_cache( h, &w[0] );
- idx = x264_weighted_reference_duplicate( h, 0, w );
+ idx = weighted_reference_duplicate( h, 0, w );
}
}
}
@@ -2288,7 +2335,7 @@
h->mb.pic.i_fref[1] = h->i_ref[1];
}
-static void x264_fdec_filter_row( x264_t *h, int mb_y, int pass )
+static void fdec_filter_row( x264_t *h, int mb_y, int pass )
{
/* mb_y is the mb to be encoded next, not the mb to be filtered here */
int b_hpel = h->fdec->b_kept_as_ref;
@@ -2343,7 +2390,7 @@
for( int i = minpix_y>>(CHROMA_V_SHIFT && p); i < maxpix_y>>(CHROMA_V_SHIFT && p); i++ )
memcpy( h->fdec->plane_fld[p] + i*h->fdec->i_stride[p],
h->fdec->plane[p] + i*h->fdec->i_stride[p],
- h->mb.i_mb_width*16*sizeof(pixel) );
+ h->mb.i_mb_width*16*SIZEOF_PIXEL );
if( h->fdec->b_kept_as_ref && (!h->param.b_sliced_threads || pass == 1) )
x264_frame_expand_border( h, h->fdec, min_y );
@@ -2408,7 +2455,7 @@
}
}
-static inline int x264_reference_update( x264_t *h )
+static inline int reference_update( x264_t *h )
{
if( !h->fdec->b_kept_as_ref )
{
@@ -2438,7 +2485,7 @@
return 0;
}
-static inline void x264_reference_reset( x264_t *h )
+static inline void reference_reset( x264_t *h )
{
while( h->frames.reference[0] )
x264_frame_push_unused( h, x264_frame_pop( h->frames.reference ) );
@@ -2446,7 +2493,7 @@
h->fenc->i_poc = 0;
}
-static inline void x264_reference_hierarchy_reset( x264_t *h )
+static inline void reference_hierarchy_reset( x264_t *h )
{
int ref;
int b_hasdelayframe = 0;
@@ -2483,12 +2530,12 @@
h->sh.i_mmco_remove_from_end = X264_MAX( ref + 2 - h->frames.i_max_dpb, 0 );
}
-static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_global_qp )
+static inline void slice_init( x264_t *h, int i_nal_type, int i_global_qp )
{
/* ------------------------ Create slice header ----------------------- */
if( i_nal_type == NAL_SLICE_IDR )
{
- x264_slice_header_init( h, &h->sh, h->sps, h->pps, h->i_idr_pic_id, h->i_frame_num, i_global_qp );
+ slice_header_init( h, &h->sh, h->sps, h->pps, h->i_idr_pic_id, h->i_frame_num, i_global_qp );
/* alternate id */
if( h->param.i_avcintra_class )
@@ -2512,7 +2559,7 @@
}
else
{
- x264_slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp );
+ slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp );
h->sh.i_num_ref_idx_l0_active = h->i_ref[0] <= 0 ? 1 : h->i_ref[0];
h->sh.i_num_ref_idx_l1_active = h->i_ref[1] <= 0 ? 1 : h->i_ref[1];
@@ -2564,7 +2611,7 @@
int field_decoding_flag;
} x264_bs_bak_t;
-static ALWAYS_INLINE void x264_bitstream_backup( x264_t *h, x264_bs_bak_t *bak, int i_skip, int full )
+static ALWAYS_INLINE void bitstream_backup( x264_t *h, x264_bs_bak_t *bak, int i_skip, int full )
{
if( full )
{
@@ -2598,7 +2645,7 @@
}
}
-static ALWAYS_INLINE void x264_bitstream_restore( x264_t *h, x264_bs_bak_t *bak, int *skip, int full )
+static ALWAYS_INLINE void bitstream_restore( x264_t *h, x264_bs_bak_t *bak, int *skip, int full )
{
if( full )
{
@@ -2627,7 +2674,7 @@
}
}
-static intptr_t x264_slice_write( x264_t *h )
+static intptr_t slice_write( x264_t *h )
{
int i_skip;
int mb_xy, i_mb_x, i_mb_y;
@@ -2654,7 +2701,7 @@
bs_realign( &h->out.bs );
/* Slice */
- x264_nal_start( h, h->i_nal_type, h->i_nal_ref_idc );
+ nal_start( h, h->i_nal_type, h->i_nal_ref_idc );
h->out.nal[h->out.i_nal].i_first_mb = h->sh.i_first_mb;
/* Slice header */
@@ -2666,7 +2713,7 @@
h->sh.i_qp = SPEC_QP( h->sh.i_qp );
h->sh.i_qp_delta = h->sh.i_qp - h->pps->i_pic_init_qp;
- x264_slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );
+ slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );
if( h->param.b_cabac )
{
/* alignment needed */
@@ -2694,23 +2741,23 @@
if( i_mb_x == 0 )
{
- if( x264_bitstream_check_buffer( h ) )
+ if( bitstream_check_buffer( h ) )
return -1;
if( !(i_mb_y & SLICE_MBAFF) && h->param.rc.i_vbv_buffer_size )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_ROW_VBV], i_skip, 1 );
+ bitstream_backup( h, &bs_bak[BS_BAK_ROW_VBV], i_skip, 1 );
if( !h->mb.b_reencode_mb )
- x264_fdec_filter_row( h, i_mb_y, 0 );
+ fdec_filter_row( h, i_mb_y, 0 );
}
if( back_up_bitstream )
{
if( back_up_bitstream_cavlc )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], i_skip, 0 );
if( slice_max_size && !(i_mb_y & SLICE_MBAFF) )
{
- x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], i_skip, 0 );
if( (thread_last_mb+1-mb_xy) == h->param.i_slice_min_mbs )
- x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], i_skip, 0 );
+ bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], i_skip, 0 );
}
}
@@ -2775,7 +2822,7 @@
h->mb.i_skip_intra = 0;
h->mb.b_skip_mc = 0;
h->mb.b_overflow = 0;
- x264_bitstream_restore( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], &i_skip, 0 );
goto reencode;
}
}
@@ -2815,14 +2862,14 @@
slice_max_size = 0;
goto cont;
}
- x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], &i_skip, 0 );
h->mb.b_reencode_mb = 1;
h->sh.i_last_mb = thread_last_mb-h->param.i_slice_min_mbs;
break;
}
if( mb_xy-SLICE_MBAFF*h->mb.i_mb_stride != h->sh.i_first_mb )
{
- x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], &i_skip, 0 );
+ bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], &i_skip, 0 );
h->mb.b_reencode_mb = 1;
if( SLICE_MBAFF )
{
@@ -2851,7 +2898,7 @@
if( x264_ratecontrol_mb( h, mb_size ) < 0 )
{
- x264_bitstream_restore( h, &bs_bak[BS_BAK_ROW_VBV], &i_skip, 1 );
+ bitstream_restore( h, &bs_bak[BS_BAK_ROW_VBV], &i_skip, 1 );
h->mb.b_reencode_mb = 1;
i_mb_x = 0;
i_mb_y = i_mb_y - SLICE_MBAFF;
@@ -2968,7 +3015,7 @@
bs_rbsp_trailing( &h->out.bs );
bs_flush( &h->out.bs );
}
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
if( h->sh.i_last_mb == (h->i_threadslice_end * h->mb.i_mb_width - 1) )
@@ -2977,7 +3024,7 @@
+ (h->out.i_nal*NALU_OVERHEAD * 8)
- h->stat.frame.i_tex_bits
- h->stat.frame.i_mv_bits;
- x264_fdec_filter_row( h, h->i_threadslice_end, 0 );
+ fdec_filter_row( h, h->i_threadslice_end, 0 );
if( h->param.b_sliced_threads )
{
@@ -2985,13 +3032,13 @@
x264_threadslice_cond_broadcast( h, 1 );
/* Do hpel now */
for( int mb_y = h->i_threadslice_start; mb_y <= h->i_threadslice_end; mb_y++ )
- x264_fdec_filter_row( h, mb_y, 1 );
+ fdec_filter_row( h, mb_y, 1 );
x264_threadslice_cond_broadcast( h, 2 );
/* Do the first row of hpel, now that the previous slice is done */
if( h->i_thread_idx > 0 )
{
x264_threadslice_cond_wait( h->thread[h->i_thread_idx-1], 2 );
- x264_fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 );
+ fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 );
}
}
@@ -3007,7 +3054,7 @@
return 0;
}
-static void x264_thread_sync_context( x264_t *dst, x264_t *src )
+static void thread_sync_context( x264_t *dst, x264_t *src )
{
if( dst == src )
return;
@@ -3028,16 +3075,17 @@
dst->reconfig = src->reconfig;
}
-static void x264_thread_sync_stat( x264_t *dst, x264_t *src )
+static void thread_sync_stat( x264_t *dst, x264_t *src )
{
if( dst != src )
memcpy( &dst->stat, &src->stat, offsetof(x264_t, stat.frame) - offsetof(x264_t, stat) );
}
-static void *x264_slices_write( x264_t *h )
+static void *slices_write( x264_t *h )
{
int i_slice_num = 0;
int last_thread_mb = h->sh.i_last_mb;
+ int round_bias = h->param.i_avcintra_class ? 0 : h->param.i_slice_count/2;
/* init stats */
memset( &h->stat.frame, 0, sizeof(h->stat.frame) );
@@ -3072,11 +3120,11 @@
int height = h->mb.i_mb_height >> PARAM_INTERLACED;
int width = h->mb.i_mb_width << PARAM_INTERLACED;
i_slice_num++;
- h->sh.i_last_mb = (height * i_slice_num + h->param.i_slice_count/2) / h->param.i_slice_count * width - 1;
+ h->sh.i_last_mb = (height * i_slice_num + round_bias) / h->param.i_slice_count * width - 1;
}
}
h->sh.i_last_mb = X264_MIN( h->sh.i_last_mb, last_thread_mb );
- if( x264_stack_align( x264_slice_write, h ) )
+ if( slice_write( h ) )
goto fail;
h->sh.i_first_mb = h->sh.i_last_mb + 1;
// if i_first_mb is not the last mb in a row then go to the next mb in MBAFF order
@@ -3093,8 +3141,10 @@
return (void *)-1;
}
-static int x264_threaded_slices_write( x264_t *h )
+static int threaded_slices_write( x264_t *h )
{
+ int round_bias = h->param.i_avcintra_class ? 0 : h->param.i_slice_count/2;
+
/* set first/last mb and sync contexts */
for( int i = 0; i < h->param.i_threads; i++ )
{
@@ -3105,13 +3155,13 @@
memcpy( &t->i_frame, &h->i_frame, offsetof(x264_t, rc) - offsetof(x264_t, i_frame) );
}
int height = h->mb.i_mb_height >> PARAM_INTERLACED;
- t->i_threadslice_start = ((height * i + h->param.i_slice_count/2) / h->param.i_threads) << PARAM_INTERLACED;
- t->i_threadslice_end = ((height * (i+1) + h->param.i_slice_count/2) / h->param.i_threads) << PARAM_INTERLACED;
+ t->i_threadslice_start = ((height * i + round_bias) / h->param.i_threads) << PARAM_INTERLACED;
+ t->i_threadslice_end = ((height * (i+1) + round_bias) / h->param.i_threads) << PARAM_INTERLACED;
t->sh.i_first_mb = t->i_threadslice_start * h->mb.i_mb_width;
t->sh.i_last_mb = t->i_threadslice_end * h->mb.i_mb_width - 1;
}
- x264_stack_align( x264_analyse_weight_frame, h, h->mb.i_mb_height*16 + 16 );
+ x264_analyse_weight_frame( h, h->mb.i_mb_height*16 + 16 );
x264_threads_distribute_ratecontrol( h );
@@ -3124,7 +3174,7 @@
}
/* dispatch */
for( int i = 0; i < h->param.i_threads; i++ )
- x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h->thread[i] );
+ x264_threadpool_run( h->threadpool, (void*)slices_write, h->thread[i] );
/* wait */
for( int i = 0; i < h->param.i_threads; i++ )
x264_threadslice_cond_wait( h->thread[i], 1 );
@@ -3138,10 +3188,10 @@
{
h->out.nal[h->out.i_nal] = t->out.nal[j];
h->out.i_nal++;
- x264_nal_check_buffer( h );
+ nal_check_buffer( h );
}
/* All entries in stat.frame are ints except for ssd/ssim. */
- for( int j = 0; j < (offsetof(x264_t,stat.frame.i_ssd) - offsetof(x264_t,stat.frame.i_mv_bits)) / sizeof(int); j++ )
+ for( size_t j = 0; j < (offsetof(x264_t,stat.frame.i_ssd) - offsetof(x264_t,stat.frame.i_mv_bits)) / sizeof(int); j++ )
((int*)&h->stat.frame)[j] += ((int*)&t->stat.frame)[j];
for( int j = 0; j < 3; j++ )
h->stat.frame.i_ssd[j] += t->stat.frame.i_ssd[j];
@@ -3215,7 +3265,7 @@
h->i_thread_phase = (h->i_thread_phase + 1) % h->i_thread_frames;
thread_current = h->thread[ h->i_thread_phase ];
thread_oldest = h->thread[ (h->i_thread_phase + 1) % h->i_thread_frames ];
- x264_thread_sync_context( thread_current, thread_prev );
+ thread_sync_context( thread_current, thread_prev );
x264_thread_sync_ratecontrol( thread_current, thread_prev, thread_oldest );
h = thread_current;
}
@@ -3289,7 +3339,7 @@
return -1;
}
else
- x264_stack_align( x264_adaptive_quant_frame, h, fenc, pic_in->prop.quant_offsets );
+ x264_adaptive_quant_frame( h, fenc, pic_in->prop.quant_offsets );
if( pic_in->prop.quant_offsets_free )
pic_in->prop.quant_offsets_free( pic_in->prop.quant_offsets );
@@ -3322,7 +3372,7 @@
x264_lookahead_get_frames( h );
if( !h->frames.current[0] && x264_lookahead_is_empty( h ) )
- return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
+ return encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
/* ------------------- Get frame to be encoded ------------------------- */
/* 4: get picture to encode */
@@ -3330,7 +3380,7 @@
/* If applicable, wait for previous frame reconstruction to finish */
if( h->param.b_sliced_threads )
- if( x264_threadpool_wait_all( h ) < 0 )
+ if( threadpool_wait_all( h ) < 0 )
return -1;
if( h->i_frame == 0 )
@@ -3352,7 +3402,7 @@
x264_ratecontrol_zone_init( h );
// ok to call this before encoding any frames, since the initial values of fdec have b_kept_as_ref=0
- if( x264_reference_update( h ) )
+ if( reference_update( h ) )
return -1;
h->fdec->i_lines_completed = -1;
@@ -3394,7 +3444,7 @@
i_nal_type = NAL_SLICE_IDR;
i_nal_ref_idc = NAL_PRIORITY_HIGHEST;
h->sh.i_type = SLICE_TYPE_I;
- x264_reference_reset( h );
+ reference_reset( h );
h->frames.i_poc_last_open_gop = -1;
}
else if( h->fenc->i_type == X264_TYPE_I )
@@ -3402,7 +3452,7 @@
i_nal_type = NAL_SLICE;
i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/
h->sh.i_type = SLICE_TYPE_I;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
if( h->param.b_open_gop )
h->frames.i_poc_last_open_gop = h->fenc->b_keyframe ? h->fenc->i_poc : -1;
}
@@ -3411,7 +3461,7 @@
i_nal_type = NAL_SLICE;
i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/
h->sh.i_type = SLICE_TYPE_P;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
h->frames.i_poc_last_open_gop = -1;
}
else if( h->fenc->i_type == X264_TYPE_BREF )
@@ -3419,7 +3469,7 @@
i_nal_type = NAL_SLICE;
i_nal_ref_idc = h->param.i_bframe_pyramid == X264_B_PYRAMID_STRICT ? NAL_PRIORITY_LOW : NAL_PRIORITY_HIGH;
h->sh.i_type = SLICE_TYPE_B;
- x264_reference_hierarchy_reset( h );
+ reference_hierarchy_reset( h );
}
else /* B frame */
{
@@ -3454,7 +3504,7 @@
/* ------------------- Init ----------------------------- */
/* build ref list 0/1 */
- x264_reference_build_list( h, h->fdec->i_poc );
+ reference_build_list( h, h->fdec->i_poc );
/* ---------------------- Write the bitstream -------------------------- */
/* Init bitstream context */
@@ -3485,10 +3535,11 @@
else
pic_type = 7;
- x264_nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE );
bs_write( &h->out.bs, 3, pic_type );
bs_rbsp_trailing( &h->out.bs );
- if( x264_nal_end( h ) )
+ bs_flush( &h->out.bs );
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
}
@@ -3538,9 +3589,9 @@
if( h->param.b_repeat_headers )
{
/* generate sequence parameters */
- x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST );
x264_sps_write( &h->out.bs, h->sps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* Pad AUD/SPS to 256 bytes like Panasonic */
if( h->param.i_avcintra_class )
@@ -3548,22 +3599,28 @@
overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD;
/* generate picture parameters */
- x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
+ nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST );
x264_pps_write( &h->out.bs, h->sps, h->pps );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
if( h->param.i_avcintra_class )
- h->out.nal[h->out.i_nal-1].i_padding = 256 - h->out.nal[h->out.i_nal-1].i_payload - NALU_OVERHEAD;
+ {
+ int total_len = 256;
+ /* Sony XAVC uses an oversized PPS instead of SEI padding */
+ if( h->param.i_avcintra_flavor == X264_AVCINTRA_FLAVOR_SONY )
+ total_len += h->param.i_height == 1080 ? 18*512 : 10*512;
+ h->out.nal[h->out.i_nal-1].i_padding = total_len - h->out.nal[h->out.i_nal-1].i_payload - NALU_OVERHEAD;
+ }
overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD;
}
- /* when frame threading is used, buffering period sei is written in x264_encoder_frame_end */
+ /* when frame threading is used, buffering period sei is written in encoder_frame_end */
if( h->i_thread_frames == 1 && h->sps->vui.b_nal_hrd_parameters_present )
{
x264_hrd_fullness( h );
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_buffering_period_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3572,10 +3629,10 @@
/* write extra sei */
for( int i = 0; i < h->fenc->extra_sei.num_payloads; i++ )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_write( &h->out.bs, h->fenc->extra_sei.payloads[i].payload, h->fenc->extra_sei.payloads[i].payload_size,
h->fenc->extra_sei.payloads[i].payload_type );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
if( h->fenc->extra_sei.sei_free )
@@ -3598,10 +3655,10 @@
if( h->param.b_repeat_headers && h->fenc->i_frame == 0 && !h->param.i_avcintra_class )
{
/* identify ourself */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_version_write( h, &h->out.bs ) )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3609,9 +3666,9 @@
if( h->fenc->i_type != X264_TYPE_IDR )
{
int time_to_recovery = h->param.b_open_gop ? 0 : X264_MIN( h->mb.i_mb_width - 1, h->param.i_keyint_max ) + h->param.i_bframe - 1;
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_recovery_point_write( h, &h->out.bs, time_to_recovery );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3619,9 +3676,18 @@
if( h->param.i_frame_packing >= 0 && (h->fenc->b_keyframe || h->param.i_frame_packing == 5) )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_frame_packing_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
+ return -1;
+ overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
+ }
+
+ if( h->param.i_alternative_transfer != 2 )
+ {
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ x264_sei_alternative_transfer_write( h, &h->out.bs );
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3629,9 +3695,9 @@
/* generate sei pic timing */
if( h->sps->vui.b_pic_struct_present || h->sps->vui.b_nal_hrd_parameters_present )
{
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_pic_timing_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3640,9 +3706,9 @@
if( !IS_X264_TYPE_B( h->fenc->i_type ) && h->b_sh_backup )
{
h->b_sh_backup = 0;
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_dec_ref_pic_marking_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
@@ -3651,21 +3717,21 @@
h->i_cpb_delay_pir_offset_next = h->fenc->i_cpb_delay;
/* Filler space: 10 or 18 SEIs' worth of space, depending on resolution */
- if( h->param.i_avcintra_class )
+ if( h->param.i_avcintra_class && h->param.i_avcintra_flavor != X264_AVCINTRA_FLAVOR_SONY )
{
/* Write an empty filler NAL to mimic the AUD in the P2 format*/
- x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
x264_filler_write( h, &h->out.bs, 0 );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD;
/* All lengths are magic lengths that decoders expect to see */
/* "UMID" SEI */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_avcintra_umid_write( h, &h->out.bs ) < 0 )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
@@ -3682,10 +3748,10 @@
total_len = 9*512;
}
/* "VANC" SEI */
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
if( x264_sei_avcintra_vanc_write( h, &h->out.bs, unpadded_len ) < 0 )
return -1;
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
h->out.nal[h->out.i_nal-1].i_padding = total_len - h->out.nal[h->out.i_nal-1].i_payload - SEI_OVERHEAD;
@@ -3703,20 +3769,20 @@
if( h->param.rc.b_stat_read && h->sh.i_type != SLICE_TYPE_I )
{
x264_reference_build_list_optimal( h );
- x264_reference_check_reorder( h );
+ reference_check_reorder( h );
}
if( h->i_ref[0] )
h->fdec->i_poc_l0ref0 = h->fref[0][0]->i_poc;
/* ------------------------ Create slice header ----------------------- */
- x264_slice_init( h, i_nal_type, i_global_qp );
+ slice_init( h, i_nal_type, i_global_qp );
/*------------------------- Weights -------------------------------------*/
if( h->sh.i_type == SLICE_TYPE_B )
x264_macroblock_bipred_init( h );
- x264_weighted_pred_init( h );
+ weighted_pred_init( h );
if( i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE )
h->i_frame_num++;
@@ -3726,24 +3792,24 @@
h->i_threadslice_end = h->mb.i_mb_height;
if( h->i_thread_frames > 1 )
{
- x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h );
+ x264_threadpool_run( h->threadpool, (void*)slices_write, h );
h->b_thread_active = 1;
}
else if( h->param.b_sliced_threads )
{
- if( x264_threaded_slices_write( h ) )
+ if( threaded_slices_write( h ) )
return -1;
}
else
- if( (intptr_t)x264_slices_write( h ) )
+ if( (intptr_t)slices_write( h ) )
return -1;
- return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
+ return encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out );
}
-static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current,
- x264_nal_t **pp_nal, int *pi_nal,
- x264_picture_t *pic_out )
+static int encoder_frame_end( x264_t *h, x264_t *thread_current,
+ x264_nal_t **pp_nal, int *pi_nal,
+ x264_picture_t *pic_out )
{
char psz_message[80];
@@ -3765,9 +3831,9 @@
if( h->i_thread_frames > 1 && h->fenc->b_keyframe && h->sps->vui.b_nal_hrd_parameters_present )
{
x264_hrd_fullness( h );
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
x264_sei_buffering_period_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
/* buffering period sei must follow AUD, SPS and PPS and precede all other SEIs */
int idx = 0;
@@ -3780,7 +3846,7 @@
h->out.nal[idx] = nal_tmp;
}
- int frame_size = x264_encoder_encapsulate_nals( h, 0 );
+ int frame_size = encoder_encapsulate_nals( h, 0 );
if( frame_size < 0 )
return -1;
@@ -3805,7 +3871,7 @@
pic_out->img.i_plane = h->fdec->i_plane;
for( int i = 0; i < pic_out->img.i_plane; i++ )
{
- pic_out->img.i_stride[i] = h->fdec->i_stride[i] * sizeof(pixel);
+ pic_out->img.i_stride[i] = h->fdec->i_stride[i] * SIZEOF_PIXEL;
pic_out->img.plane[i] = (uint8_t*)h->fdec->plane[i];
}
@@ -3825,7 +3891,7 @@
* We don't know the size of the last slice until encapsulation so we add filler to the encapsulated NAL */
if( h->param.i_avcintra_class )
{
- if( x264_check_encapsulated_buffer( h, h->thread[0], h->out.i_nal, frame_size, frame_size + filler ) < 0 )
+ if( check_encapsulated_buffer( h, h->thread[0], h->out.i_nal, frame_size, (int64_t)frame_size + filler ) < 0 )
return -1;
x264_nal_t *nal = &h->out.nal[h->out.i_nal-1];
@@ -3860,13 +3926,13 @@
else
f = X264_MAX( 0, filler - overhead );
- if( x264_bitstream_check_buffer_filler( h, f ) )
+ if( bitstream_check_buffer_filler( h, f ) )
return -1;
- x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
+ nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE );
x264_filler_write( h, &h->out.bs, f );
- if( x264_nal_end( h ) )
+ if( nal_end( h ) )
return -1;
- int total_size = x264_encoder_encapsulate_nals( h, h->out.i_nal-1 );
+ int total_size = encoder_encapsulate_nals( h, h->out.i_nal-1 );
if( total_size < 0 )
return -1;
frame_size += total_size;
@@ -3883,7 +3949,7 @@
x264_noise_reduction_update( h );
/* ---------------------- Compute/Print statistics --------------------- */
- x264_thread_sync_stat( h, h->thread[0] );
+ thread_sync_stat( h, h->thread[0] );
/* Slice stat */
h->stat.i_frame_count[h->sh.i_type]++;
@@ -3892,8 +3958,6 @@
for( int i = 0; i < X264_MBTYPE_MAX; i++ )
h->stat.i_mb_count[h->sh.i_type][i] += h->stat.frame.i_mb_count[i];
- for( int i = 0; i < X264_PARTTYPE_MAX; i++ )
- h->stat.i_mb_partition[h->sh.i_type][i] += h->stat.frame.i_mb_partition[i];
for( int i = 0; i < 2; i++ )
h->stat.i_mb_count_8x8dct[i] += h->stat.frame.i_mb_count_8x8dct[i];
for( int i = 0; i < 6; i++ )
@@ -3902,9 +3966,13 @@
for( int j = 0; j < 13; j++ )
h->stat.i_mb_pred_mode[i][j] += h->stat.frame.i_mb_pred_mode[i][j];
if( h->sh.i_type != SLICE_TYPE_I )
+ {
+ for( int i = 0; i < X264_PARTTYPE_MAX; i++ )
+ h->stat.i_mb_partition[h->sh.i_type][i] += h->stat.frame.i_mb_partition[i];
for( int i_list = 0; i_list < 2; i_list++ )
for( int i = 0; i < X264_REF_MAX*2; i++ )
h->stat.i_mb_count_ref[h->sh.i_type][i_list][i] += h->stat.frame.i_mb_count_ref[i_list][i];
+ }
for( int i = 0; i < 3; i++ )
h->stat.i_mb_field[i] += h->stat.frame.i_mb_field[i];
if( h->sh.i_type == SLICE_TYPE_P && h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE )
@@ -3941,10 +4009,10 @@
};
int luma_size = h->param.i_width * h->param.i_height;
int chroma_size = CHROMA_SIZE( luma_size );
- pic_out->prop.f_psnr[0] = x264_psnr( ssd[0], luma_size );
- pic_out->prop.f_psnr[1] = x264_psnr( ssd[1], chroma_size );
- pic_out->prop.f_psnr[2] = x264_psnr( ssd[2], chroma_size );
- pic_out->prop.f_psnr_avg = x264_psnr( ssd[0] + ssd[1] + ssd[2], luma_size + chroma_size*2 );
+ pic_out->prop.f_psnr[0] = calc_psnr( ssd[0], luma_size );
+ pic_out->prop.f_psnr[1] = calc_psnr( ssd[1], chroma_size );
+ pic_out->prop.f_psnr[2] = calc_psnr( ssd[2], chroma_size );
+ pic_out->prop.f_psnr_avg = calc_psnr( ssd[0] + ssd[1] + ssd[2], luma_size + chroma_size*2 );
h->stat.f_ssd_global[h->sh.i_type] += dur * (ssd[0] + ssd[1] + ssd[2]);
h->stat.f_psnr_average[h->sh.i_type] += dur * pic_out->prop.f_psnr_avg;
@@ -3980,9 +4048,9 @@
psz_message );
// keep stats all in one place
- x264_thread_sync_stat( h->thread[0], h );
+ thread_sync_stat( h->thread[0], h );
// for the use of the next frame
- x264_thread_sync_stat( thread_current, h );
+ thread_sync_stat( thread_current, h );
#ifdef DEBUG_MB_TYPE
{
@@ -4011,13 +4079,13 @@
}
if( h->param.psz_dump_yuv )
- x264_frame_dump( h );
+ frame_dump( h );
x264_emms();
return frame_size;
}
-static void x264_print_intra( int64_t *i_mb_count, double i_count, int b_print_pcm, char *intra )
+static void print_intra( int64_t *i_mb_count, double i_count, int b_print_pcm, char *intra )
{
intra += sprintf( intra, "I16..4%s: %4.1f%% %4.1f%% %4.1f%%",
b_print_pcm ? "..PCM" : "",
@@ -4048,7 +4116,7 @@
#endif
if( h->param.b_sliced_threads )
- x264_threadpool_wait_all( h );
+ threadpool_wait_all( h );
if( h->param.i_threads > 1 )
x264_threadpool_delete( h->threadpool );
if( h->param.i_lookahead_threads > 1 )
@@ -4089,7 +4157,7 @@
(double)h->stat.i_frame_size[i_slice] / i_count,
h->stat.f_psnr_mean_y[i_slice] / dur, h->stat.f_psnr_mean_u[i_slice] / dur, h->stat.f_psnr_mean_v[i_slice] / dur,
h->stat.f_psnr_average[i_slice] / dur,
- x264_psnr( h->stat.f_ssd_global[i_slice], dur * i_yuv_size ) );
+ calc_psnr( h->stat.f_ssd_global[i_slice], dur * i_yuv_size ) );
}
else
{
@@ -4126,7 +4194,7 @@
{
int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_I];
double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_I] * h->mb.i_mb_count / 100.0;
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
x264_log( h, X264_LOG_INFO, "mb I %s\n", buf );
}
if( h->stat.i_frame_count[SLICE_TYPE_P] > 0 )
@@ -4134,7 +4202,7 @@
int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_P];
double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_P] * h->mb.i_mb_count / 100.0;
int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_P];
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
x264_log( h, X264_LOG_INFO,
"mb P %s P16..4: %4.1f%% %4.1f%% %4.1f%% %4.1f%% %4.1f%% skip:%4.1f%%\n",
buf,
@@ -4152,7 +4220,7 @@
double i_mb_list_count;
int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_B];
int64_t list_count[3] = {0}; /* 0 == L0, 1 == L1, 2 == BI */
- x264_print_intra( i_mb_count, i_count, b_print_pcm, buf );
+ print_intra( i_mb_count, i_count, b_print_pcm, buf );
for( int i = 0; i < X264_PARTTYPE_MAX; i++ )
for( int j = 0; j < 2; j++ )
{
@@ -4232,17 +4300,27 @@
}
buf[0] = 0;
- int csize = CHROMA444 ? 4 : 1;
- if( i_mb_count != i_all_intra )
- sprintf( buf, " inter: %.1f%% %.1f%% %.1f%%",
- h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4),
- h->stat.i_mb_cbp[3] * 100.0 / ((i_mb_count - i_all_intra)*csize),
- h->stat.i_mb_cbp[5] * 100.0 / ((i_mb_count - i_all_intra)*csize) );
- x264_log( h, X264_LOG_INFO, "coded y,%s,%s intra: %.1f%% %.1f%% %.1f%%%s\n",
- CHROMA444?"u":"uvDC", CHROMA444?"v":"uvAC",
- h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4),
- h->stat.i_mb_cbp[2] * 100.0 / (i_all_intra*csize),
- h->stat.i_mb_cbp[4] * 100.0 / (i_all_intra*csize), buf );
+ if( CHROMA_FORMAT )
+ {
+ int csize = CHROMA444 ? 4 : 1;
+ if( i_mb_count != i_all_intra )
+ sprintf( buf, " inter: %.1f%% %.1f%% %.1f%%",
+ h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4),
+ h->stat.i_mb_cbp[3] * 100.0 / ((i_mb_count - i_all_intra)*csize),
+ h->stat.i_mb_cbp[5] * 100.0 / ((i_mb_count - i_all_intra)*csize) );
+ x264_log( h, X264_LOG_INFO, "coded y,%s,%s intra: %.1f%% %.1f%% %.1f%%%s\n",
+ CHROMA444?"u":"uvDC", CHROMA444?"v":"uvAC",
+ h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4),
+ h->stat.i_mb_cbp[2] * 100.0 / (i_all_intra*csize),
+ h->stat.i_mb_cbp[4] * 100.0 / (i_all_intra*csize), buf );
+ }
+ else
+ {
+ if( i_mb_count != i_all_intra )
+ sprintf( buf, " inter: %.1f%%", h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4) );
+ x264_log( h, X264_LOG_INFO, "coded y intra: %.1f%%%s\n",
+ h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4), buf );
+ }
int64_t fixed_pred_modes[4][9] = {{0}};
int64_t sum_pred_modes[4] = {0};
@@ -4289,9 +4367,13 @@
fixed_pred_modes[3][3] * 100.0 / sum_pred_modes[3] );
if( h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE && h->stat.i_frame_count[SLICE_TYPE_P] > 0 )
- x264_log( h, X264_LOG_INFO, "Weighted P-Frames: Y:%.1f%% UV:%.1f%%\n",
- h->stat.i_wpred[0] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P],
- h->stat.i_wpred[1] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P] );
+ {
+ buf[0] = 0;
+ if( CHROMA_FORMAT )
+ sprintf( buf, " UV:%.1f%%", h->stat.i_wpred[1] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P] );
+ x264_log( h, X264_LOG_INFO, "Weighted P-Frames: Y:%.1f%%%s\n",
+ h->stat.i_wpred[0] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P], buf );
+ }
for( int i_list = 0; i_list < 2; i_list++ )
for( int i_slice = 0; i_slice < 2; i_slice++ )
@@ -4315,7 +4397,7 @@
if( h->param.analyse.b_ssim )
{
float ssim = SUM3( h->stat.f_ssim_mean_y ) / duration;
- x264_log( h, X264_LOG_INFO, "SSIM Mean Y:%.7f (%6.3fdb)\n", ssim, x264_ssim( ssim ) );
+ x264_log( h, X264_LOG_INFO, "SSIM Mean Y:%.7f (%6.3fdb)\n", ssim, calc_ssim_db( ssim ) );
}
if( h->param.analyse.b_psnr )
{
@@ -4325,7 +4407,7 @@
SUM3( h->stat.f_psnr_mean_u ) / duration,
SUM3( h->stat.f_psnr_mean_v ) / duration,
SUM3( h->stat.f_psnr_average ) / duration,
- x264_psnr( SUM3( h->stat.f_ssd_global ), duration * i_yuv_size ),
+ calc_psnr( SUM3( h->stat.f_ssd_global ), duration * i_yuv_size ),
f_bitrate );
}
else
@@ -4345,6 +4427,7 @@
x264_free( h->nal_buffer );
x264_free( h->reconfig_h );
x264_analyse_free_costs( h );
+ x264_free( h->cost_table );
if( h->i_thread_frames > 1 )
h = h->thread[h->i_thread_phase];
diff -ur x264-go/x264c/external/x264/encoder/lookahead.c x264-go.new/x264c/external/x264/encoder/lookahead.c
--- x264-go/x264c/external/x264/encoder/lookahead.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/lookahead.c 2020-06-06 15:20:58.697039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* lookahead.c: high-level lookahead functions
*****************************************************************************
- * Copyright (C) 2010-2017 Avail Media and x264 project
+ * Copyright (C) 2010-2020 Avail Media and x264 project
*
* Authors: Michael Kazmier <mkazmier@availmedia.com>
* Alex Giladi <agiladi@availmedia.com>
@@ -39,7 +39,7 @@
#include "common/common.h"
#include "analyse.h"
-static void x264_lookahead_shift( x264_sync_frame_list_t *dst, x264_sync_frame_list_t *src, int count )
+static void lookahead_shift( x264_sync_frame_list_t *dst, x264_sync_frame_list_t *src, int count )
{
int i = count;
while( i-- )
@@ -56,7 +56,7 @@
}
}
-static void x264_lookahead_update_last_nonb( x264_t *h, x264_frame_t *new_nonb )
+static void lookahead_update_last_nonb( x264_t *h, x264_frame_t *new_nonb )
{
if( h->lookahead->last_nonb )
x264_frame_push_unused( h, h->lookahead->last_nonb );
@@ -65,11 +65,11 @@
}
#if HAVE_THREAD
-static void x264_lookahead_slicetype_decide( x264_t *h )
+static void lookahead_slicetype_decide( x264_t *h )
{
- x264_stack_align( x264_slicetype_decide, h );
+ x264_slicetype_decide( h );
- x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
+ lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
int shift_frames = h->lookahead->next.list[0]->i_bframes + 1;
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
@@ -77,24 +77,24 @@
x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_empty, &h->lookahead->ofbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
- x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
+ lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
/* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */
if( h->lookahead->b_analyse_keyframe && IS_X264_TYPE_I( h->lookahead->last_nonb->i_type ) )
- x264_stack_align( x264_slicetype_analyse, h, shift_frames );
+ x264_slicetype_analyse( h, shift_frames );
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
}
-static void *x264_lookahead_thread( x264_t *h )
+REALIGN_STACK static void *lookahead_thread( x264_t *h )
{
while( !h->lookahead->b_exit_thread )
{
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
int shift = X264_MIN( h->lookahead->next.i_max_size - h->lookahead->next.i_size, h->lookahead->ifbuf.i_size );
- x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift );
+ lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
if( h->lookahead->next.i_size <= h->lookahead->i_slicetype_length + h->param.b_vfr_input )
{
@@ -105,22 +105,23 @@
else
{
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
- x264_lookahead_slicetype_decide( h );
+ lookahead_slicetype_decide( h );
}
} /* end of input frames */
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
x264_pthread_mutex_lock( &h->lookahead->next.mutex );
- x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, h->lookahead->ifbuf.i_size );
+ lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, h->lookahead->ifbuf.i_size );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex );
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
while( h->lookahead->next.i_size )
- x264_lookahead_slicetype_decide( h );
+ lookahead_slicetype_decide( h );
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
h->lookahead->b_thread_active = 0;
x264_pthread_cond_broadcast( &h->lookahead->ofbuf.cv_fill );
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
return NULL;
}
+
#endif
int x264_lookahead_init( x264_t *h, int i_slicetype_length )
@@ -152,7 +153,7 @@
if( x264_macroblock_thread_allocate( look_h, 1 ) < 0 )
goto fail;
- if( x264_pthread_create( &look->thread_handle, NULL, (void*)x264_lookahead_thread, look_h ) )
+ if( x264_pthread_create( &look->thread_handle, NULL, (void*)lookahead_thread, look_h ) )
goto fail;
look->b_thread_active = 1;
@@ -201,7 +202,7 @@
return b_empty;
}
-static void x264_lookahead_encoder_shift( x264_t *h )
+static void lookahead_encoder_shift( x264_t *h )
{
if( !h->lookahead->ofbuf.i_size )
return;
@@ -221,7 +222,7 @@
x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex );
while( !h->lookahead->ofbuf.i_size && h->lookahead->b_thread_active )
x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_fill, &h->lookahead->ofbuf.mutex );
- x264_lookahead_encoder_shift( h );
+ lookahead_encoder_shift( h );
x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex );
}
else
@@ -230,15 +231,15 @@
if( h->frames.current[0] || !h->lookahead->next.i_size )
return;
- x264_stack_align( x264_slicetype_decide, h );
- x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
+ x264_slicetype_decide( h );
+ lookahead_update_last_nonb( h, h->lookahead->next.list[0] );
int shift_frames = h->lookahead->next.list[0]->i_bframes + 1;
- x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
+ lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames );
/* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */
if( h->lookahead->b_analyse_keyframe && IS_X264_TYPE_I( h->lookahead->last_nonb->i_type ) )
- x264_stack_align( x264_slicetype_analyse, h, shift_frames );
+ x264_slicetype_analyse( h, shift_frames );
- x264_lookahead_encoder_shift( h );
+ lookahead_encoder_shift( h );
}
}
diff -ur x264-go/x264c/external/x264/encoder/macroblock.c x264-go.new/x264c/external/x264/encoder/macroblock.c
--- x264-go/x264c/external/x264/encoder/macroblock.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/macroblock.c 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* macroblock.c: macroblock encoding
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -123,7 +123,7 @@
/* This means that decimation can be done merely by adjusting the CBP and NNZ
* rather than memsetting the coefficients. */
-static void x264_mb_encode_i16x16( x264_t *h, int p, int i_qp )
+static void mb_encode_i16x16( x264_t *h, int p, int i_qp )
{
pixel *p_src = h->mb.pic.p_fenc[p];
pixel *p_dst = h->mb.pic.p_fdec[p];
@@ -242,7 +242,7 @@
* Unlike luma blocks, this can't be done with a lookup table or
* other shortcut technique because of the interdependencies
* between the coefficients due to the chroma DC transform. */
-static ALWAYS_INLINE int x264_mb_optimize_chroma_dc( x264_t *h, dctcoef *dct_dc, int dequant_mf[6][16], int i_qp, int chroma422 )
+static ALWAYS_INLINE int mb_optimize_chroma_dc( x264_t *h, dctcoef *dct_dc, int dequant_mf[6][16], int i_qp, int chroma422 )
{
int dmf = dequant_mf[i_qp%6][0] << i_qp/6;
@@ -256,7 +256,7 @@
return h->quantf.optimize_chroma_2x2_dc( dct_dc, dmf );
}
-static ALWAYS_INLINE void x264_mb_encode_chroma_internal( x264_t *h, int b_inter, int i_qp, int chroma422 )
+static ALWAYS_INLINE void mb_encode_chroma_internal( x264_t *h, int b_inter, int i_qp, int chroma422 )
{
int nz, nz_dc;
int b_decimate = b_inter && h->mb.b_dct_decimate;
@@ -316,7 +316,7 @@
if( nz_dc )
{
- if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
+ if( !mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
continue;
h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 1;
if( chroma422 )
@@ -441,7 +441,7 @@
if( !nz_dc ) /* Whole block is empty */
continue;
- if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
+ if( !mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) )
{
h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 0;
continue;
@@ -492,12 +492,12 @@
void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp )
{
if( CHROMA_FORMAT == CHROMA_420 )
- x264_mb_encode_chroma_internal( h, b_inter, i_qp, 0 );
+ mb_encode_chroma_internal( h, b_inter, i_qp, 0 );
else
- x264_mb_encode_chroma_internal( h, b_inter, i_qp, 1 );
+ mb_encode_chroma_internal( h, b_inter, i_qp, 1 );
}
-static void x264_macroblock_encode_skip( x264_t *h )
+static void macroblock_encode_skip( x264_t *h )
{
M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) = 0;
M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ) = 0;
@@ -530,8 +530,8 @@
{
h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1]-FENC_STRIDE, FENC_STRIDE, height );
h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2]-FENC_STRIDE, FENC_STRIDE, height );
- memcpy( h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[1]-FDEC_STRIDE, 8*sizeof(pixel) );
- memcpy( h->mb.pic.p_fdec[2], h->mb.pic.p_fdec[2]-FDEC_STRIDE, 8*sizeof(pixel) );
+ memcpy( h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[1]-FDEC_STRIDE, 8*SIZEOF_PIXEL );
+ memcpy( h->mb.pic.p_fdec[2], h->mb.pic.p_fdec[2]-FDEC_STRIDE, 8*SIZEOF_PIXEL );
}
else if( i_mode == I_PRED_CHROMA_H )
{
@@ -560,7 +560,7 @@
if( i_mode == I_PRED_4x4_V )
{
h->mc.copy[PIXEL_4x4]( p_dst, FDEC_STRIDE, p_src-stride, stride, 4 );
- memcpy( p_dst, p_dst-FDEC_STRIDE, 4*sizeof(pixel) );
+ memcpy( p_dst, p_dst-FDEC_STRIDE, 4*SIZEOF_PIXEL );
}
else if( i_mode == I_PRED_4x4_H )
{
@@ -580,7 +580,7 @@
if( i_mode == I_PRED_8x8_V )
{
h->mc.copy[PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src-stride, stride, 8 );
- memcpy( p_dst, &edge[16], 8*sizeof(pixel) );
+ memcpy( p_dst, &edge[16], 8*SIZEOF_PIXEL );
}
else if( i_mode == I_PRED_8x8_H )
{
@@ -600,7 +600,7 @@
if( i_mode == I_PRED_16x16_V )
{
h->mc.copy[PIXEL_16x16]( p_dst, FDEC_STRIDE, h->mb.pic.p_fenc_plane[p]-stride, stride, 16 );
- memcpy( p_dst, p_dst-FDEC_STRIDE, 16*sizeof(pixel) );
+ memcpy( p_dst, p_dst-FDEC_STRIDE, 16*SIZEOF_PIXEL );
}
else if( i_mode == I_PRED_16x16_H )
{
@@ -615,7 +615,7 @@
/*****************************************************************************
* x264_macroblock_encode:
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_internal( x264_t *h, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_encode_internal( x264_t *h, int plane_count, int chroma )
{
int i_qp = h->mb.i_qp;
int b_decimate = h->mb.b_dct_decimate;
@@ -691,7 +691,7 @@
}
}
- x264_macroblock_encode_skip( h );
+ macroblock_encode_skip( h );
return;
}
if( h->mb.i_type == B_SKIP )
@@ -699,7 +699,7 @@
/* don't do bskip motion compensation if it was already done in macroblock_analyse */
if( !h->mb.b_skip_mc )
x264_mb_mc( h );
- x264_macroblock_encode_skip( h );
+ macroblock_encode_skip( h );
return;
}
@@ -708,7 +708,7 @@
h->mb.b_transform_8x8 = 0;
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
- x264_mb_encode_i16x16( h, p, i_qp );
+ mb_encode_i16x16( h, p, i_qp );
}
else if( h->mb.i_type == I_8x8 )
{
@@ -974,16 +974,18 @@
void x264_macroblock_encode( x264_t *h )
{
if( CHROMA444 )
- x264_macroblock_encode_internal( h, 3, 0 );
+ macroblock_encode_internal( h, 3, 0 );
+ else if( CHROMA_FORMAT )
+ macroblock_encode_internal( h, 1, 1 );
else
- x264_macroblock_encode_internal( h, 1, 1 );
+ macroblock_encode_internal( h, 1, 0 );
}
/*****************************************************************************
* x264_macroblock_probe_skip:
* Check if the current MB could be encoded as a [PB]_SKIP
*****************************************************************************/
-static ALWAYS_INLINE int x264_macroblock_probe_skip_internal( x264_t *h, int b_bidir, int plane_count, int chroma )
+static ALWAYS_INLINE int macroblock_probe_skip_internal( x264_t *h, int b_bidir, int plane_count, int chroma )
{
ALIGNED_ARRAY_64( dctcoef, dct4x4,[8],[16] );
ALIGNED_ARRAY_64( dctcoef, dctscan,[16] );
@@ -1126,12 +1128,14 @@
int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
{
- if( CHROMA_FORMAT == CHROMA_444 )
- return x264_macroblock_probe_skip_internal( h, b_bidir, 3, CHROMA_444 );
+ if( CHROMA_FORMAT == CHROMA_420 )
+ return macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_420 );
else if( CHROMA_FORMAT == CHROMA_422 )
- return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_422 );
+ return macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_422 );
+ else if( CHROMA_FORMAT == CHROMA_444 )
+ return macroblock_probe_skip_internal( h, b_bidir, 3, CHROMA_444 );
else
- return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_420 );
+ return macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_400 );
}
/****************************************************************************
@@ -1172,7 +1176,7 @@
* RD only; 4 calls to this do not make up for one macroblock_encode.
* doesn't transform chroma dc.
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_p8x8_internal( x264_t *h, int i8, int plane_count, int chroma )
+static ALWAYS_INLINE void macroblock_encode_p8x8_internal( x264_t *h, int i8, int plane_count, int chroma )
{
int b_decimate = h->mb.b_dct_decimate;
int i_qp = h->mb.i_qp;
@@ -1365,18 +1369,20 @@
void x264_macroblock_encode_p8x8( x264_t *h, int i8 )
{
- if( CHROMA444 )
- x264_macroblock_encode_p8x8_internal( h, i8, 3, CHROMA_444 );
+ if( CHROMA_FORMAT == CHROMA_420 )
+ macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_420 );
else if( CHROMA_FORMAT == CHROMA_422 )
- x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_422 );
+ macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_422 );
+ else if( CHROMA_FORMAT == CHROMA_444 )
+ macroblock_encode_p8x8_internal( h, i8, 3, CHROMA_444 );
else
- x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_420 );
+ macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_400 );
}
/*****************************************************************************
* RD only, luma only (for 4:2:0)
*****************************************************************************/
-static ALWAYS_INLINE void x264_macroblock_encode_p4x4_internal( x264_t *h, int i4, int plane_count )
+static ALWAYS_INLINE void macroblock_encode_p4x4_internal( x264_t *h, int i4, int plane_count )
{
int i_qp = h->mb.i_qp;
@@ -1413,7 +1419,7 @@
void x264_macroblock_encode_p4x4( x264_t *h, int i8 )
{
if( CHROMA444 )
- x264_macroblock_encode_p4x4_internal( h, i8, 3 );
+ macroblock_encode_p4x4_internal( h, i8, 3 );
else
- x264_macroblock_encode_p4x4_internal( h, i8, 1 );
+ macroblock_encode_p4x4_internal( h, i8, 1 );
}
diff -ur x264-go/x264c/external/x264/encoder/macroblock.h x264-go.new/x264c/external/x264/encoder/macroblock.h
--- x264-go/x264c/external/x264/encoder/macroblock.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/macroblock.h 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* macroblock.h: macroblock encoding
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -29,11 +29,10 @@
#include "common/macroblock.h"
-extern const int x264_lambda2_tab[QP_MAX_MAX+1];
-extern const uint16_t x264_lambda_tab[QP_MAX_MAX+1];
-
+#define x264_rdo_init x264_template(rdo_init)
void x264_rdo_init( void );
+#define x264_macroblock_probe_skip x264_template(macroblock_probe_skip)
int x264_macroblock_probe_skip( x264_t *h, int b_bidir );
#define x264_macroblock_probe_pskip( h )\
@@ -41,32 +40,51 @@
#define x264_macroblock_probe_bskip( h )\
x264_macroblock_probe_skip( h, 1 )
+#define x264_predict_lossless_4x4 x264_template(predict_lossless_4x4)
void x264_predict_lossless_4x4( x264_t *h, pixel *p_dst, int p, int idx, int i_mode );
+#define x264_predict_lossless_8x8 x264_template(predict_lossless_8x8)
void x264_predict_lossless_8x8( x264_t *h, pixel *p_dst, int p, int idx, int i_mode, pixel edge[36] );
+#define x264_predict_lossless_16x16 x264_template(predict_lossless_16x16)
void x264_predict_lossless_16x16( x264_t *h, int p, int i_mode );
+#define x264_predict_lossless_chroma x264_template(predict_lossless_chroma)
void x264_predict_lossless_chroma( x264_t *h, int i_mode );
+#define x264_macroblock_encode x264_template(macroblock_encode)
void x264_macroblock_encode ( x264_t *h );
+#define x264_macroblock_write_cabac x264_template(macroblock_write_cabac)
void x264_macroblock_write_cabac ( x264_t *h, x264_cabac_t *cb );
+#define x264_macroblock_write_cavlc x264_template(macroblock_write_cavlc)
void x264_macroblock_write_cavlc ( x264_t *h );
+#define x264_macroblock_encode_p8x8 x264_template(macroblock_encode_p8x8)
void x264_macroblock_encode_p8x8( x264_t *h, int i8 );
+#define x264_macroblock_encode_p4x4 x264_template(macroblock_encode_p4x4)
void x264_macroblock_encode_p4x4( x264_t *h, int i4 );
+#define x264_mb_encode_chroma x264_template(mb_encode_chroma)
void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp );
+#define x264_cabac_mb_skip x264_template(cabac_mb_skip)
void x264_cabac_mb_skip( x264_t *h, int b_skip );
+#define x264_cabac_block_residual_c x264_template(cabac_block_residual_c)
void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_cabac_block_residual_8x8_rd_c x264_template(cabac_block_residual_8x8_rd_c)
void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_cabac_block_residual_rd_c x264_template(cabac_block_residual_rd_c)
void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_quant_luma_dc_trellis x264_template(quant_luma_dc_trellis)
int x264_quant_luma_dc_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, int i_qp,
int ctx_block_cat, int b_intra, int idx );
+#define x264_quant_chroma_dc_trellis x264_template(quant_chroma_dc_trellis)
int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx );
+#define x264_quant_4x4_trellis x264_template(quant_4x4_trellis)
int x264_quant_4x4_trellis( x264_t *h, dctcoef *dct, int i_quant_cat,
int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx );
+#define x264_quant_8x8_trellis x264_template(quant_8x8_trellis)
int x264_quant_8x8_trellis( x264_t *h, dctcoef *dct, int i_quant_cat,
int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx );
+#define x264_noise_reduction_update x264_template(noise_reduction_update)
void x264_noise_reduction_update( x264_t *h );
static ALWAYS_INLINE int x264_quant_4x4( x264_t *h, dctcoef dct[16], int i_qp, int ctx_block_cat, int b_intra, int p, int idx )
@@ -195,4 +213,3 @@
}
#endif
-
diff -ur x264-go/x264c/external/x264/encoder/me.c x264-go.new/x264c/external/x264/encoder/me.c
--- x264-go/x264c/external/x264/encoder/me.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/me.c 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* me.c: motion estimation
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -424,7 +424,7 @@
/* Uneven-cross Multi-Hexagon-grid Search
* as in JM, except with different early termination */
- static const uint8_t x264_pixel_size_shift[7] = { 0, 1, 1, 2, 3, 3, 4 };
+ static const uint8_t pixel_size_shift[7] = { 0, 1, 1, 2, 3, 3, 4 };
int ucost1, ucost2;
int cross_start = 1;
@@ -446,7 +446,7 @@
omx = bmx; omy = bmy;
/* early termination */
-#define SAD_THRESH(v) ( bcost < ( v >> x264_pixel_size_shift[i_pixel] ) )
+#define SAD_THRESH(v) ( bcost < ( v >> pixel_size_shift[i_pixel] ) )
if( bcost == ucost2 && SAD_THRESH(2000) )
{
COST_MV_X4( 0,-2, -1,-1, 1,-1, -2,0 );
@@ -633,7 +633,6 @@
/* successive elimination by comparing DC before a full SAD,
* because sum(abs(diff)) >= abs(diff(sum)). */
uint16_t *sums_base = m->integral;
- ALIGNED_16( static pixel zero[8*FENC_STRIDE] ) = {0};
ALIGNED_ARRAY_16( int, enc_dc,[4] );
int sad_size = i_pixel <= PIXEL_8x8 ? PIXEL_8x8 : PIXEL_4x4;
int delta = x264_pixel_size[sad_size].w;
@@ -641,7 +640,7 @@
int xn;
uint16_t *cost_fpel_mvx = h->cost_mv_fpel[h->mb.i_qp][-m->mvp[0]&3] + (-m->mvp[0]>>2);
- h->pixf.sad_x4[sad_size]( zero, p_fenc, p_fenc+delta,
+ h->pixf.sad_x4[sad_size]( (pixel*)x264_zero, p_fenc, p_fenc+delta,
p_fenc+delta*FENC_STRIDE, p_fenc+delta+delta*FENC_STRIDE,
FENC_STRIDE, enc_dc );
if( delta == 4 )
@@ -1012,7 +1011,7 @@
src[2][list][i] = h->mc.get_ref( pixv_buf[list][i], &stride[2][list][i], &m->p_fref[8],\
m->i_stride[2], mvx, mvy, bw, bh, x264_weight_none );\
}\
- else\
+ else if( CHROMA_FORMAT )\
h->mc.mc_chroma( pixu_buf[list][i], pixv_buf[list][i], 8, m->p_fref[4], m->i_stride[1],\
mvx, 2*(mvy+mv##list##y_offset)>>chroma_v_shift, bw>>1, bh>>chroma_v_shift );\
}\
@@ -1022,9 +1021,10 @@
/* Don't unroll the BIME_CACHE loop. I couldn't find any way to force this
* other than making its iteration count not a compile-time constant. */
+#define x264_iter_kludge x264_template(iter_kludge)
int x264_iter_kludge = 0;
-static void ALWAYS_INLINE x264_me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd )
+static ALWAYS_INLINE void me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd )
{
int x = i8&1;
int y = i8>>1;
@@ -1043,8 +1043,8 @@
int chroma_x = (8 >> CHROMA_H_SHIFT) * x;
int chroma_y = (8 >> chroma_v_shift) * y;
pixel *pix = &h->mb.pic.p_fdec[0][8*x + 8*y*FDEC_STRIDE];
- pixel *pixu = &h->mb.pic.p_fdec[1][chroma_x + chroma_y*FDEC_STRIDE];
- pixel *pixv = &h->mb.pic.p_fdec[2][chroma_x + chroma_y*FDEC_STRIDE];
+ pixel *pixu = CHROMA_FORMAT ? &h->mb.pic.p_fdec[1][chroma_x + chroma_y*FDEC_STRIDE] : NULL;
+ pixel *pixv = CHROMA_FORMAT ? &h->mb.pic.p_fdec[2][chroma_x + chroma_y*FDEC_STRIDE] : NULL;
int ref0 = h->mb.cache.ref[0][s8];
int ref1 = h->mb.cache.ref[1][s8];
const int mv0y_offset = chroma_v_shift & MB_INTERLACED & ref0 ? (h->mb.i_mb_y & 1)*4 - 2 : 0;
@@ -1134,7 +1134,7 @@
h->mc.avg[i_pixel]( pixu, FDEC_STRIDE, src[1][0][i0], stride[1][0][i0], src[1][1][i1], stride[1][1][i1], i_weight );
h->mc.avg[i_pixel]( pixv, FDEC_STRIDE, src[2][0][i0], stride[2][0][i0], src[2][1][i1], stride[2][1][i1], i_weight );
}
- else
+ else if( CHROMA_FORMAT )
{
h->mc.avg[chromapix]( pixu, FDEC_STRIDE, pixu_buf[0][i0], 8, pixu_buf[1][i1], 8, i_weight );
h->mc.avg[chromapix]( pixv, FDEC_STRIDE, pixv_buf[0][i0], 8, pixv_buf[1][i1], 8, i_weight );
@@ -1179,7 +1179,7 @@
void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight )
{
- x264_me_refine_bidir( h, m0, m1, i_weight, 0, 0, 0 );
+ me_refine_bidir( h, m0, m1, i_weight, 0, 0, 0 );
}
void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 )
@@ -1187,7 +1187,7 @@
/* Motion compensation is done as part of bidir_rd; don't repeat
* it in encoding. */
h->mb.b_skip_mc = 1;
- x264_me_refine_bidir( h, m0, m1, i_weight, i8, i_lambda2, 1 );
+ me_refine_bidir( h, m0, m1, i_weight, i8, i_lambda2, 1 );
h->mb.b_skip_mc = 0;
}
@@ -1216,7 +1216,7 @@
h->mc.mc_luma( pixu, FDEC_STRIDE, &m->p_fref[4], m->i_stride[1], mx, my, bw, bh, &m->weight[1] ); \
h->mc.mc_luma( pixv, FDEC_STRIDE, &m->p_fref[8], m->i_stride[2], mx, my, bw, bh, &m->weight[2] ); \
} \
- else if( m->i_pixel <= PIXEL_8x8 ) \
+ else if( CHROMA_FORMAT && m->i_pixel <= PIXEL_8x8 ) \
{ \
h->mc.mc_chroma( pixu, pixv, FDEC_STRIDE, m->p_fref[4], m->i_stride[1], \
mx, 2*(my+mvy_offset)>>chroma_v_shift, bw>>1, bh>>chroma_v_shift ); \
@@ -1256,11 +1256,16 @@
pixu = &h->mb.pic.p_fdec[1][block_idx_xy_fdec[i4]];
pixv = &h->mb.pic.p_fdec[2][block_idx_xy_fdec[i4]];
}
- else
+ else if( CHROMA_FORMAT )
{
pixu = &h->mb.pic.p_fdec[1][(i8>>1)*(8*FDEC_STRIDE>>chroma_v_shift)+(i8&1)*4];
pixv = &h->mb.pic.p_fdec[2][(i8>>1)*(8*FDEC_STRIDE>>chroma_v_shift)+(i8&1)*4];
}
+ else
+ {
+ pixu = NULL;
+ pixv = NULL;
+ }
h->mb.b_skip_mc = 1;
diff -ur x264-go/x264c/external/x264/encoder/me.h x264-go.new/x264c/external/x264/encoder/me.h
--- x264-go/x264c/external/x264/encoder/me.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/me.h 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* me.h: motion estimation
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -24,8 +24,8 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_ME_H
-#define X264_ME_H
+#ifndef X264_ENCODER_ME_H
+#define X264_ENCODER_ME_H
#define COST_MAX (1<<28)
#define COST_MAX64 (1ULL<<60)
@@ -52,18 +52,25 @@
/* output */
int cost_mv; /* lambda * nbits for the chosen mv */
int cost; /* satd + lambda * nbits */
- ALIGNED_4( int16_t mv[2] );
+ ALIGNED_8( int16_t mv[2] );
} ALIGNED_64( x264_me_t );
+#define x264_me_search_ref x264_template(me_search_ref)
void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh );
#define x264_me_search( h, m, mvc, i_mvc )\
x264_me_search_ref( h, m, mvc, i_mvc, NULL )
+#define x264_me_refine_qpel x264_template(me_refine_qpel)
void x264_me_refine_qpel( x264_t *h, x264_me_t *m );
+#define x264_me_refine_qpel_refdupe x264_template(me_refine_qpel_refdupe)
void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh );
+#define x264_me_refine_qpel_rd x264_template(me_refine_qpel_rd)
void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int i_list );
+#define x264_me_refine_bidir_rd x264_template(me_refine_bidir_rd)
void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 );
+#define x264_me_refine_bidir_satd x264_template(me_refine_bidir_satd)
void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight );
+#define x264_rd_cost_part x264_template(rd_cost_part)
uint64_t x264_rd_cost_part( x264_t *h, int i_lambda2, int i8, int i_pixel );
#define COPY1_IF_LT(x,y)\
diff -ur x264-go/x264c/external/x264/encoder/ratecontrol.c x264-go.new/x264c/external/x264/encoder/ratecontrol.c
--- x264-go/x264c/external/x264/encoder/ratecontrol.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/ratecontrol.c 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* ratecontrol.c: ratecontrol
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Michael Niedermayer <michaelni@gmx.at>
@@ -154,8 +154,8 @@
} mbtree;
/* MBRC stuff */
- float frame_size_estimated; /* Access to this variable must be atomic: double is
- * not atomic on all arches we care about */
+ volatile float frame_size_estimated; /* Access to this variable must be atomic: double is
+ * not atomic on all arches we care about */
double frame_size_maximum; /* Maximum frame size due to MinCR */
double frame_size_planned;
double slice_size_planned;
@@ -243,7 +243,7 @@
stride <<= b_field;
if( b_chroma )
{
- ALIGNED_ARRAY_32( pixel, pix,[FENC_STRIDE*16] );
+ ALIGNED_ARRAY_64( pixel, pix,[FENC_STRIDE*16] );
int chromapix = h->luma2chroma_pixel[PIXEL_16x16];
int shift = 7 - CHROMA_V_SHIFT;
@@ -256,7 +256,7 @@
}
// Find the total AC energy of the block in all planes.
-static NOINLINE uint32_t x264_ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame )
+static NOINLINE uint32_t ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame )
{
/* This function contains annoying hacks because GCC has a habit of reordering emms
* and putting it after floating point ops. As a result, we put the emms at the end of the
@@ -278,7 +278,7 @@
var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 1, 1 );
var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 0, 0 );
}
- else
+ else if( CHROMA_FORMAT )
{
var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 1, 1 );
var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 0, 0 );
@@ -293,7 +293,7 @@
var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, PARAM_INTERLACED, 1 );
var += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, PARAM_INTERLACED, 1 );
}
- else
+ else if( CHROMA_FORMAT )
var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, PARAM_INTERLACED, 1 );
}
x264_emms();
@@ -337,7 +337,7 @@
{
for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
- x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ ac_energy_mb( h, mb_x, mb_y, frame );
}
else
return;
@@ -358,7 +358,7 @@
for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ )
for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ )
{
- uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ uint32_t energy = ac_energy_mb( h, mb_x, mb_y, frame );
float qp_adj = powf( energy * bit_depth_correction + 1, 0.125f );
frame->f_qp_offset[mb_x + mb_y*h->mb.i_mb_stride] = qp_adj;
avg_adj += qp_adj;
@@ -390,7 +390,7 @@
}
else
{
- uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame );
+ uint32_t energy = ac_energy_mb( h, mb_x, mb_y, frame );
qp_adj = strength * (x264_log2( X264_MAX(energy, 1) ) - (14.427f + 2*(BIT_DEPTH-8)));
}
if( quant_offsets )
@@ -413,7 +413,7 @@
}
}
-static int x264_macroblock_tree_rescale_init( x264_t *h, x264_ratecontrol_t *rc )
+static int macroblock_tree_rescale_init( x264_t *h, x264_ratecontrol_t *rc )
{
/* Use fractional QP array dimensions to compensate for edge padding */
float srcdim[2] = {rc->mbtree.srcdim[0] / 16.f, rc->mbtree.srcdim[1] / 16.f};
@@ -486,7 +486,7 @@
return -1;
}
-static void x264_macroblock_tree_rescale_destroy( x264_ratecontrol_t *rc )
+static void macroblock_tree_rescale_destroy( x264_ratecontrol_t *rc )
{
for( int i = 0; i < 2; i++ )
{
@@ -505,7 +505,7 @@
return sum;
}
-static void x264_macroblock_tree_rescale( x264_t *h, x264_ratecontrol_t *rc, float *dst )
+static void macroblock_tree_rescale( x264_t *h, x264_ratecontrol_t *rc, float *dst )
{
float *input, *output;
int filtersize, stride, height;
@@ -553,7 +553,7 @@
if( !fread( &i_type, 1, 1, rc->p_mbtree_stat_file_in ) )
goto fail;
- if( fread( rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], sizeof(uint16_t), rc->mbtree.src_mb_count, rc->p_mbtree_stat_file_in ) != rc->mbtree.src_mb_count )
+ if( fread( rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], sizeof(uint16_t), rc->mbtree.src_mb_count, rc->p_mbtree_stat_file_in ) != (unsigned)rc->mbtree.src_mb_count )
goto fail;
if( i_type != i_type_actual && rc->mbtree.qpbuf_pos == 1 )
@@ -567,14 +567,14 @@
float *dst = rc->mbtree.rescale_enabled ? rc->mbtree.scale_buffer[0] : frame->f_qp_offset;
h->mc.mbtree_fix8_unpack( dst, rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], rc->mbtree.src_mb_count );
if( rc->mbtree.rescale_enabled )
- x264_macroblock_tree_rescale( h, rc, frame->f_qp_offset );
+ macroblock_tree_rescale( h, rc, frame->f_qp_offset );
if( h->frames.b_have_lowres )
for( int i = 0; i < h->mb.i_mb_count; i++ )
frame->i_inv_qscale_factor[i] = x264_exp2fix8( frame->f_qp_offset[i] );
rc->mbtree.qpbuf_pos--;
}
else
- x264_stack_align( x264_adaptive_quant_frame, h, frame, quant_offsets );
+ x264_adaptive_quant_frame( h, frame, quant_offsets );
return 0;
fail:
x264_log( h, X264_LOG_ERROR, "Incomplete MB-tree stats file.\n" );
@@ -618,7 +618,7 @@
return 0;
}
-static char *x264_strcat_filename( char *input, char *suffix )
+static char *strcat_filename( char *input, char *suffix )
{
char *output = x264_malloc( strlen( input ) + strlen( suffix ) + 1 );
if( !output )
@@ -713,8 +713,9 @@
rc->vbv_max_rate = vbv_max_bitrate;
rc->buffer_size = vbv_buffer_size;
rc->single_frame_vbv = rc->buffer_rate * 1.1 > rc->buffer_size;
- rc->cbr_decay = 1.0 - rc->buffer_rate / rc->buffer_size
- * 0.5 * X264_MAX(0, 1.5 - rc->buffer_rate * rc->fps / rc->bitrate);
+ if( rc->b_abr && h->param.rc.i_rc_method == X264_RC_ABR )
+ rc->cbr_decay = 1.0 - rc->buffer_rate / rc->buffer_size
+ * 0.5 * X264_MAX(0, 1.5 - rc->buffer_rate * rc->fps / rc->bitrate);
if( h->param.rc.i_rc_method == X264_RC_CRF && h->param.rc.f_rf_constant_max )
{
rc->rate_factor_max_increment = h->param.rc.f_rf_constant_max - h->param.rc.f_rf_constant;
@@ -771,9 +772,9 @@
rc->last_non_b_pict_type = -1;
rc->cbr_decay = 1.0;
- if( h->param.rc.i_rc_method == X264_RC_CRF && h->param.rc.b_stat_read )
+ if( h->param.rc.i_rc_method != X264_RC_ABR && h->param.rc.b_stat_read )
{
- x264_log( h, X264_LOG_ERROR, "constant rate-factor is incompatible with 2pass.\n" );
+ x264_log( h, X264_LOG_ERROR, "CRF/CQP is incompatible with 2pass.\n" );
return -1;
}
@@ -878,7 +879,7 @@
}
if( h->param.rc.b_mb_tree )
{
- char *mbtree_stats_in = x264_strcat_filename( h->param.rc.psz_stat_in, ".mbtree" );
+ char *mbtree_stats_in = strcat_filename( h->param.rc.psz_stat_in, ".mbtree" );
if( !mbtree_stats_in )
return -1;
rc->p_mbtree_stat_file_in = x264_fopen( mbtree_stats_in, "rb" );
@@ -941,6 +942,7 @@
CMP_OPT_FIRST_PASS( "intra_refresh", h->param.b_intra_refresh );
CMP_OPT_FIRST_PASS( "open_gop", h->param.b_open_gop );
CMP_OPT_FIRST_PASS( "bluray_compat", h->param.b_bluray_compat );
+ CMP_OPT_FIRST_PASS( "mbtree", h->param.rc.b_mb_tree );
if( (p = strstr( opts, "interlaced=" )) )
{
@@ -1154,7 +1156,7 @@
if( h->param.rc.b_stat_write )
{
char *p;
- rc->psz_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".temp" );
+ rc->psz_stat_file_tmpname = strcat_filename( h->param.rc.psz_stat_out, ".temp" );
if( !rc->psz_stat_file_tmpname )
return -1;
@@ -1171,8 +1173,8 @@
x264_free( p );
if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read )
{
- rc->psz_mbtree_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree.temp" );
- rc->psz_mbtree_stat_file_name = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree" );
+ rc->psz_mbtree_stat_file_tmpname = strcat_filename( h->param.rc.psz_stat_out, ".mbtree.temp" );
+ rc->psz_mbtree_stat_file_name = strcat_filename( h->param.rc.psz_stat_out, ".mbtree" );
if( !rc->psz_mbtree_stat_file_tmpname || !rc->psz_mbtree_stat_file_name )
return -1;
@@ -1192,7 +1194,7 @@
rc->mbtree.srcdim[0] = h->param.i_width;
rc->mbtree.srcdim[1] = h->param.i_height;
}
- if( x264_macroblock_tree_rescale_init( h, rc ) < 0 )
+ if( macroblock_tree_rescale_init( h, rc ) < 0 )
return -1;
}
@@ -1327,9 +1329,10 @@
static x264_zone_t *get_zone( x264_t *h, int frame_num )
{
- for( int i = h->rc->i_zones - 1; i >= 0; i-- )
+ x264_ratecontrol_t *rc = h->rc;
+ for( int i = rc->i_zones - 1; i >= 0; i-- )
{
- x264_zone_t *z = &h->rc->zones[i];
+ x264_zone_t *z = &rc->zones[i];
if( frame_num >= z->i_start && frame_num <= z->i_end )
return z;
}
@@ -1385,7 +1388,7 @@
x264_free( rc->pred_b_from_p );
x264_free( rc->entry );
x264_free( rc->entry_out );
- x264_macroblock_tree_rescale_destroy( rc );
+ macroblock_tree_rescale_destroy( rc );
if( rc->zones )
{
x264_free( rc->zones[0].param );
@@ -1432,7 +1435,7 @@
{
int frame = h->fenc->i_frame;
assert( frame >= 0 && frame < rc->num_entries );
- rce = h->rc->rce = &h->rc->entry[frame];
+ rce = rc->rce = &rc->entry[frame];
if( h->sh.i_type == SLICE_TYPE_B
&& h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO )
@@ -1693,7 +1696,7 @@
b1 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices;
}
- h->rc->frame_size_estimated = b1 - size_of_other_slices;
+ rc->frame_size_estimated = b1 - size_of_other_slices;
/* If the current row was large enough to cause a large QP jump, try re-encoding it. */
if( rc->qpm > qp_max && prev_row_qp < qp_max && can_reencode_row )
@@ -1709,12 +1712,12 @@
}
else
{
- h->rc->frame_size_estimated = bits_so_far;
+ rc->frame_size_estimated = bits_so_far;
/* Last-ditch attempt: if the last row of the frame underflowed the VBV,
* try again. */
if( rc->qpm < qp_max && can_reencode_row
- && (h->rc->frame_size_estimated + size_of_other_slices > X264_MIN( rc->frame_size_maximum, rc->buffer_fill )) )
+ && (bits_so_far + size_of_other_slices > X264_MIN( rc->frame_size_maximum, rc->buffer_fill )) )
{
rc->qpm = qp_max;
rc->qpa_rc = rc->qpa_rc_prev;
@@ -1893,7 +1896,7 @@
h->mc.mbtree_fix8_pack( rc->mbtree.qp_buffer[0], h->fenc->f_qp_offset, h->mb.i_mb_count );
if( fwrite( &i_type, 1, 1, rc->p_mbtree_stat_file_out ) < 1 )
goto fail;
- if( fwrite( rc->mbtree.qp_buffer[0], sizeof(uint16_t), h->mb.i_mb_count, rc->p_mbtree_stat_file_out ) < h->mb.i_mb_count )
+ if( fwrite( rc->mbtree.qp_buffer[0], sizeof(uint16_t), h->mb.i_mb_count, rc->p_mbtree_stat_file_out ) < (unsigned)h->mb.i_mb_count )
goto fail;
}
}
@@ -2211,7 +2214,7 @@
rcc->buffer_fill = h->thread[0]->rc->buffer_fill_final_min / h->sps->vui.i_time_scale;
if( h->i_thread_frames > 1 )
{
- int j = h->rc - h->thread[0]->rc;
+ int j = rcc - h->thread[0]->rc;
for( int i = 1; i < h->i_thread_frames; i++ )
{
x264_t *t = h->thread[ (j+i)%h->i_thread_frames ];
@@ -2445,7 +2448,7 @@
/* Limit planned size by MinCR */
if( rcc->b_vbv )
rcc->frame_size_planned = X264_MIN( rcc->frame_size_planned, rcc->frame_size_maximum );
- h->rc->frame_size_estimated = rcc->frame_size_planned;
+ rcc->frame_size_estimated = rcc->frame_size_planned;
/* For row SATDs */
if( rcc->b_vbv )
@@ -2458,7 +2461,7 @@
double predicted_bits = total_bits;
if( h->i_thread_frames > 1 )
{
- int j = h->rc - h->thread[0]->rc;
+ int j = rcc - h->thread[0]->rc;
for( int i = 1; i < h->i_thread_frames; i++ )
{
x264_t *t = h->thread[(j+i) % h->i_thread_frames];
@@ -2627,12 +2630,12 @@
/* Limit planned size by MinCR */
if( rcc->b_vbv )
rcc->frame_size_planned = X264_MIN( rcc->frame_size_planned, rcc->frame_size_maximum );
- h->rc->frame_size_estimated = rcc->frame_size_planned;
+ rcc->frame_size_estimated = rcc->frame_size_planned;
return q;
}
}
-static void x264_threads_normalize_predictors( x264_t *h )
+static void threads_normalize_predictors( x264_t *h )
{
double totalsize = 0;
for( int i = 0; i < h->param.i_threads; i++ )
@@ -2677,7 +2680,7 @@
}
if( rc->b_vbv && rc->frame_size_planned )
{
- x264_threads_normalize_predictors( h );
+ threads_normalize_predictors( h );
if( rc->single_frame_vbv )
{
@@ -2688,7 +2691,7 @@
float max_frame_error = x264_clip3f( 1.0 / (t->i_threadslice_end - t->i_threadslice_start), 0.05, 0.25 );
t->rc->slice_size_planned += 2 * max_frame_error * rc->frame_size_planned;
}
- x264_threads_normalize_predictors( h );
+ threads_normalize_predictors( h );
}
for( int i = 0; i < h->param.i_threads; i++ )
diff -ur x264-go/x264c/external/x264/encoder/ratecontrol.h x264-go.new/x264c/external/x264/encoder/ratecontrol.h
--- x264-go/x264c/external/x264/encoder/ratecontrol.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/ratecontrol.h 2020-06-06 15:20:58.698039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* ratecontrol.h: ratecontrol
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Laurent Aimar <fenrir@via.ecp.fr>
@@ -24,8 +24,8 @@
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#ifndef X264_RATECONTROL_H
-#define X264_RATECONTROL_H
+#ifndef X264_ENCODER_RATECONTROL_H
+#define X264_ENCODER_RATECONTROL_H
/* Completely arbitrary. Ratecontrol lowers relative quality at higher framerates
* and the reverse at lower framerates; this serves as the center of the curve.
@@ -39,28 +39,49 @@
#define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION)
+#define x264_ratecontrol_new x264_template(ratecontrol_new)
int x264_ratecontrol_new ( x264_t * );
+#define x264_ratecontrol_delete x264_template(ratecontrol_delete)
void x264_ratecontrol_delete( x264_t * );
+#define x264_ratecontrol_init_reconfigurable x264_template(ratecontrol_init_reconfigurable)
void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init );
+#define x264_encoder_reconfig_apply x264_template(encoder_reconfig_apply)
int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param );
+#define x264_adaptive_quant_frame x264_template(adaptive_quant_frame)
void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets );
+#define x264_macroblock_tree_read x264_template(macroblock_tree_read)
int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );
+#define x264_reference_build_list_optimal x264_template(reference_build_list_optimal)
int x264_reference_build_list_optimal( x264_t *h );
+#define x264_thread_sync_ratecontrol x264_template(thread_sync_ratecontrol)
void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );
+#define x264_ratecontrol_zone_init x264_template(ratecontrol_zone_init)
void x264_ratecontrol_zone_init( x264_t * );
+#define x264_ratecontrol_start x264_template(ratecontrol_start)
void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );
+#define x264_ratecontrol_slice_type x264_template(ratecontrol_slice_type)
int x264_ratecontrol_slice_type( x264_t *, int i_frame );
+#define x264_ratecontrol_set_weights x264_template(ratecontrol_set_weights)
void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );
+#define x264_ratecontrol_mb x264_template(ratecontrol_mb)
int x264_ratecontrol_mb( x264_t *, int bits );
+#define x264_ratecontrol_qp x264_template(ratecontrol_qp)
int x264_ratecontrol_qp( x264_t * );
+#define x264_ratecontrol_mb_qp x264_template(ratecontrol_mb_qp)
int x264_ratecontrol_mb_qp( x264_t *h );
+#define x264_ratecontrol_end x264_template(ratecontrol_end)
int x264_ratecontrol_end( x264_t *, int bits, int *filler );
+#define x264_ratecontrol_summary x264_template(ratecontrol_summary)
void x264_ratecontrol_summary( x264_t * );
+#define x264_rc_analyse_slice x264_template(rc_analyse_slice)
int x264_rc_analyse_slice( x264_t *h );
+#define x264_threads_distribute_ratecontrol x264_template(threads_distribute_ratecontrol)
void x264_threads_distribute_ratecontrol( x264_t *h );
+#define x264_threads_merge_ratecontrol x264_template(threads_merge_ratecontrol)
void x264_threads_merge_ratecontrol( x264_t *h );
+#define x264_hrd_fullness x264_template(hrd_fullness)
void x264_hrd_fullness( x264_t *h );
-#endif
+#endif
diff -ur x264-go/x264c/external/x264/encoder/rdo.c x264-go.new/x264c/external/x264/encoder/rdo.c
--- x264-go/x264c/external/x264/encoder/rdo.c 2020-08-25 18:16:14.155874700 +0200
+++ x264-go.new/x264c/external/x264/encoder/rdo.c 2020-06-06 15:20:58.699039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* rdo.c: rate-distortion optimization
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
@@ -32,7 +32,9 @@
/* Transition and size tables for abs<9 MVD and residual coding */
/* Consist of i_prefix-2 1s, one zero, and a bypass sign bit */
+#define x264_cabac_transition_unary x264_template(cabac_transition_unary)
uint8_t x264_cabac_transition_unary[15][128];
+#define x264_cabac_size_unary x264_template(cabac_size_unary)
uint16_t x264_cabac_size_unary[15][128];
/* Transition and size tables for abs>9 MVD */
/* Consist of 5 1s and a bypass sign bit */
@@ -46,7 +48,8 @@
#define bs_write_ue(s,v) ((s)->i_bits_encoded += bs_size_ue(v))
#define bs_write_se(s,v) ((s)->i_bits_encoded += bs_size_se(v))
#define bs_write_te(s,v,l) ((s)->i_bits_encoded += bs_size_te(v,l))
-#define x264_macroblock_write_cavlc static x264_macroblock_size_cavlc
+#undef x264_macroblock_write_cavlc
+#define x264_macroblock_write_cavlc static macroblock_size_cavlc
#include "cavlc.c"
/* CABAC: not exactly the same. x264_cabac_size_decision() keeps track of
@@ -55,12 +58,14 @@
#undef x264_cabac_encode_decision_noup
#undef x264_cabac_encode_bypass
#undef x264_cabac_encode_terminal
+#undef x264_cabac_encode_ue_bypass
#define x264_cabac_encode_decision(c,x,v) x264_cabac_size_decision(c,x,v)
#define x264_cabac_encode_decision_noup(c,x,v) x264_cabac_size_decision_noup(c,x,v)
#define x264_cabac_encode_terminal(c) ((c)->f8_bits_encoded += 7)
#define x264_cabac_encode_bypass(c,v) ((c)->f8_bits_encoded += 256)
#define x264_cabac_encode_ue_bypass(c,e,v) ((c)->f8_bits_encoded += (bs_size_ue_big(v+(1<<e)-1)-e)<<8)
-#define x264_macroblock_write_cabac static x264_macroblock_size_cabac
+#undef x264_macroblock_write_cabac
+#define x264_macroblock_write_cabac static macroblock_size_cabac
#include "cabac.c"
#define COPY_CABAC h->mc.memcpy_aligned( &cabac_tmp.f8_bits_encoded, &h->cabac.f8_bits_encoded, \
@@ -91,7 +96,6 @@
static const uint8_t satd_shift_x[3] = {3, 2, 2};
static const uint8_t satd_shift_y[3] = {2-1, 3-2, 2-2};
static const uint8_t satd_offset[3] = {0, 8, 16};
- ALIGNED_16( static pixel zero[16] ) = {0};
int cache_index = (x >> satd_shift_x[size - PIXEL_8x4]) + (y >> satd_shift_y[size - PIXEL_8x4])
+ satd_offset[size - PIXEL_8x4];
int res = h->mb.pic.fenc_satd_cache[cache_index];
@@ -100,8 +104,8 @@
else
{
pixel *fenc = h->mb.pic.p_fenc[0] + x + y*FENC_STRIDE;
- int dc = h->pixf.sad[size]( fenc, FENC_STRIDE, zero, 0 ) >> 1;
- res = h->pixf.satd[size]( fenc, FENC_STRIDE, zero, 0 ) - dc;
+ int dc = h->pixf.sad[size]( fenc, FENC_STRIDE, (pixel*)x264_zero, 0 ) >> 1;
+ res = h->pixf.satd[size]( fenc, FENC_STRIDE, (pixel*)x264_zero, 0 ) - dc;
h->mb.pic.fenc_satd_cache[cache_index] = res + 1;
return res;
}
@@ -118,7 +122,6 @@
static inline int ssd_plane( x264_t *h, int size, int p, int x, int y )
{
- ALIGNED_16( static pixel zero[16] ) = {0};
int satd = 0;
pixel *fdec = h->mb.pic.p_fdec[p] + x + y*FDEC_STRIDE;
pixel *fenc = h->mb.pic.p_fenc[p] + x + y*FENC_STRIDE;
@@ -135,8 +138,8 @@
}
else
{
- int dc = h->pixf.sad[size]( fdec, FDEC_STRIDE, zero, 0 ) >> 1;
- satd = abs(h->pixf.satd[size]( fdec, FDEC_STRIDE, zero, 0 ) - dc - cached_satd( h, size, x, y ));
+ int dc = h->pixf.sad[size]( fdec, FDEC_STRIDE, (pixel*)x264_zero, 0 ) >> 1;
+ satd = abs(h->pixf.satd[size]( fdec, FDEC_STRIDE, (pixel*)x264_zero, 0 ) - dc - cached_satd( h, size, x, y ));
}
satd = (satd * h->mb.i_psy_rd * h->mb.i_psy_rd_lambda + 128) >> 8;
}
@@ -145,13 +148,17 @@
static inline int ssd_mb( x264_t *h )
{
- int chroma_size = h->luma2chroma_pixel[PIXEL_16x16];
- int chroma_ssd = ssd_plane(h, chroma_size, 1, 0, 0) + ssd_plane(h, chroma_size, 2, 0, 0);
- chroma_ssd = ((uint64_t)chroma_ssd * h->mb.i_chroma_lambda2_offset + 128) >> 8;
- return ssd_plane(h, PIXEL_16x16, 0, 0, 0) + chroma_ssd;
+ int i_ssd = ssd_plane( h, PIXEL_16x16, 0, 0, 0 );
+ if( CHROMA_FORMAT )
+ {
+ int chroma_size = h->luma2chroma_pixel[PIXEL_16x16];
+ int chroma_ssd = ssd_plane( h, chroma_size, 1, 0, 0 ) + ssd_plane( h, chroma_size, 2, 0, 0 );
+ i_ssd += ((uint64_t)chroma_ssd * h->mb.i_chroma_lambda2_offset + 128) >> 8;
+ }
+ return i_ssd;
}
-static int x264_rd_cost_mb( x264_t *h, int i_lambda2 )
+static int rd_cost_mb( x264_t *h, int i_lambda2 )
{
int b_transform_bak = h->mb.b_transform_8x8;
int i_ssd;
@@ -173,12 +180,12 @@
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_macroblock_size_cabac( h, &cabac_tmp );
+ macroblock_size_cabac( h, &cabac_tmp );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 32768 ) >> 16;
}
else
{
- x264_macroblock_size_cavlc( h );
+ macroblock_size_cavlc( h );
i_bits = ( (uint64_t)h->out.bs.i_bits_encoded * i_lambda2 + 128 ) >> 8;
}
@@ -190,7 +197,7 @@
/* partition RD functions use 8 bits more precision to avoid large rounding errors at low QPs */
-static uint64_t x264_rd_cost_subpart( x264_t *h, int i_lambda2, int i4, int i_pixel )
+static uint64_t rd_cost_subpart( x264_t *h, int i_lambda2, int i4, int i_pixel )
{
uint64_t i_ssd, i_bits;
@@ -213,11 +220,11 @@
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_subpartition_size_cabac( h, &cabac_tmp, i4, i_pixel );
+ subpartition_size_cabac( h, &cabac_tmp, i4, i_pixel );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = x264_subpartition_size_cavlc( h, i4, i_pixel );
+ i_bits = subpartition_size_cavlc( h, i4, i_pixel );
return (i_ssd<<8) + i_bits;
}
@@ -229,12 +236,12 @@
if( i_pixel == PIXEL_16x16 )
{
- int i_cost = x264_rd_cost_mb( h, i_lambda2 );
+ int i_cost = rd_cost_mb( h, i_lambda2 );
return i_cost;
}
if( i_pixel > PIXEL_8x8 )
- return x264_rd_cost_subpart( h, i_lambda2, i4, i_pixel );
+ return rd_cost_subpart( h, i_lambda2, i4, i_pixel );
h->mb.i_cbp_luma = 0;
@@ -247,25 +254,28 @@
int ssd_x = 8*(i8&1);
int ssd_y = 8*(i8>>1);
i_ssd = ssd_plane( h, i_pixel, 0, ssd_x, ssd_y );
- int chromapix = h->luma2chroma_pixel[i_pixel];
- int chromassd = ssd_plane( h, chromapix, 1, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT )
- + ssd_plane( h, chromapix, 2, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT );
- i_ssd += ((uint64_t)chromassd * h->mb.i_chroma_lambda2_offset + 128) >> 8;
+ if( CHROMA_FORMAT )
+ {
+ int chroma_size = h->luma2chroma_pixel[i_pixel];
+ int chroma_ssd = ssd_plane( h, chroma_size, 1, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT )
+ + ssd_plane( h, chroma_size, 2, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT );
+ i_ssd += ((uint64_t)chroma_ssd * h->mb.i_chroma_lambda2_offset + 128) >> 8;
+ }
if( h->param.b_cabac )
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_size_cabac( h, &cabac_tmp, i8, i_pixel );
+ partition_size_cabac( h, &cabac_tmp, i8, i_pixel );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_size_cavlc( h, i8, i_pixel ) * i_lambda2;
+ i_bits = (uint64_t)partition_size_cavlc( h, i8, i_pixel ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_i8x8( x264_t *h, int i_lambda2, int i8, int i_mode, pixel edge[4][32] )
+static uint64_t rd_cost_i8x8( x264_t *h, int i_lambda2, int i8, int i_mode, pixel edge[4][32] )
{
uint64_t i_ssd, i_bits;
int plane_count = CHROMA444 ? 3 : 1;
@@ -292,16 +302,16 @@
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_i8x8_size_cabac( h, &cabac_tmp, i8, i_mode );
+ partition_i8x8_size_cabac( h, &cabac_tmp, i8, i_mode );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_i8x8_size_cavlc( h, i8, i_mode ) * i_lambda2;
+ i_bits = (uint64_t)partition_i8x8_size_cavlc( h, i8, i_mode ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_i4x4( x264_t *h, int i_lambda2, int i4, int i_mode )
+static uint64_t rd_cost_i4x4( x264_t *h, int i_lambda2, int i4, int i_mode )
{
uint64_t i_ssd, i_bits;
int plane_count = CHROMA444 ? 3 : 1;
@@ -326,16 +336,16 @@
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_partition_i4x4_size_cabac( h, &cabac_tmp, i4, i_mode );
+ partition_i4x4_size_cabac( h, &cabac_tmp, i4, i_mode );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_partition_i4x4_size_cavlc( h, i4, i_mode ) * i_lambda2;
+ i_bits = (uint64_t)partition_i4x4_size_cavlc( h, i4, i_mode ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
-static uint64_t x264_rd_cost_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct )
+static uint64_t rd_cost_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct )
{
uint64_t i_ssd, i_bits;
@@ -352,11 +362,11 @@
{
x264_cabac_t cabac_tmp;
COPY_CABAC;
- x264_chroma_size_cabac( h, &cabac_tmp );
+ chroma_size_cabac( h, &cabac_tmp );
i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8;
}
else
- i_bits = (uint64_t)x264_chroma_size_cavlc( h ) * i_lambda2;
+ i_bits = (uint64_t)chroma_size_cavlc( h ) * i_lambda2;
return (i_ssd<<8) + i_bits;
}
@@ -364,8 +374,8 @@
* Trellis RD quantization
****************************************************************************/
-#define TRELLIS_SCORE_MAX -1LL // negative marks the node as invalid
-#define TRELLIS_SCORE_BIAS 1LL<<60; // bias so that all valid scores are positive, even after negative contributions from psy
+#define TRELLIS_SCORE_MAX (~0ULL) // marks the node as invalid
+#define TRELLIS_SCORE_BIAS (1ULL<<60) // bias so that all valid scores are positive, even after negative contributions from psy
#define CABAC_SIZE_BITS 8
#define LAMBDA_BITS 4
@@ -695,8 +705,12 @@
}
#if HAVE_MMX && ARCH_X86_64 && !defined( __MACH__ )
+ uint64_t level_state0;
+ memcpy( &level_state0, cabac_state, sizeof(uint64_t) );
+ uint16_t level_state1;
+ memcpy( &level_state1, cabac_state+8, sizeof(uint16_t) );
#define TRELLIS_ARGS unquant_mf, zigzag, lambda2, last_nnz, orig_coefs, quant_coefs, dct,\
- cabac_state_sig, cabac_state_last, M64(cabac_state), M16(cabac_state+8)
+ cabac_state_sig, cabac_state_last, level_state0, level_state1
if( num_coefs == 16 && !dc )
if( b_chroma || !h->mb.i_psy_trellis )
return h->quantf.trellis_cabac_4x4( TRELLIS_ARGS, b_ac );
@@ -907,8 +921,8 @@
const uint8_t *zigzag, int ctx_block_cat, int lambda2, int b_ac,
int b_chroma, int dc, int num_coefs, int idx, int b_8x8 )
{
- ALIGNED_16( dctcoef quant_coefs[2][16] );
- ALIGNED_16( dctcoef coefs[16] ) = {0};
+ ALIGNED_ARRAY_16( dctcoef, quant_coefs,[2],[16] );
+ ALIGNED_ARRAY_16( dctcoef, coefs,[16] );
const uint32_t *coef_weight1 = b_8x8 ? x264_dct8_weight_tab : x264_dct4_weight_tab;
const uint32_t *coef_weight2 = b_8x8 ? x264_dct8_weight2_tab : x264_dct4_weight2_tab;
int delta_distortion[16];
@@ -918,6 +932,9 @@
int nC = b_chroma && dc ? 3 + (num_coefs>>2)
: ct_index[x264_mb_predict_non_zero_code( h, !b_chroma && dc ? (idx - LUMA_DC)*16 : idx )];
+ for( i = 0; i < 16; i += 16/sizeof(*coefs) )
+ M128( &coefs[i] ) = M128_ZERO;
+
/* Code for handling 8x8dct -> 4x4dct CAVLC munging. Input/output use a different
* step/start/end than internal processing. */
int step = 1;
@@ -997,7 +1014,7 @@
if( !coef_mask )
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );
else
- x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
+ cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
score = (int64_t)h->out.bs.i_bits_encoded * lambda2;
/* QNS loop: pick the change that improves RD the most, apply it, repeat.
@@ -1030,7 +1047,7 @@
if( !cur_mask )
bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );
else
- x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
+ cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC );
cur_score += (int64_t)h->out.bs.i_bits_encoded * lambda2;
coefs[i] = old_coef;
@@ -1089,8 +1106,8 @@
DCT_LUMA_DC, h->mb.i_trellis_lambda2[0][b_intra], 0, 0, 1, 16, idx, 0 );
}
-static const uint8_t x264_zigzag_scan2x2[4] = { 0, 1, 2, 3 };
-static const uint8_t x264_zigzag_scan2x4[8] = { 0, 2, 1, 4, 6, 3, 5, 7 };
+static const uint8_t zigzag_scan2x2[4] = { 0, 1, 2, 3 };
+static const uint8_t zigzag_scan2x4[8] = { 0, 2, 1, 4, 6, 3, 5, 7 };
int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx )
{
@@ -1100,12 +1117,12 @@
if( CHROMA_FORMAT == CHROMA_422 )
{
- zigzag = x264_zigzag_scan2x4;
+ zigzag = zigzag_scan2x4;
num_coefs = 8;
}
else
{
- zigzag = x264_zigzag_scan2x2;
+ zigzag = zigzag_scan2x2;
num_coefs = 4;
}
diff -ur x264-go/x264c/external/x264/encoder/set.c x264-go.new/x264c/external/x264/encoder/set.c
--- x264-go/x264c/external/x264/encoder/set.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/set.c 2020-06-06 15:20:58.699039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* set: header writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -31,7 +31,7 @@
// Indexed by pic_struct values
static const uint8_t num_clock_ts[10] = { 0, 1, 1, 1, 2, 2, 3, 3, 2, 3 };
-const static uint8_t avcintra_uuid[] = {0xF7, 0x49, 0x3E, 0xB3, 0xD4, 0x00, 0x47, 0x96, 0x86, 0x86, 0xC9, 0x70, 0x7B, 0x64, 0x37, 0x2A};
+static const uint8_t avcintra_uuid[] = {0xF7, 0x49, 0x3E, 0xB3, 0xD4, 0x00, 0x47, 0x96, 0x86, 0x86, 0xC9, 0x70, 0x7B, 0x64, 0x37, 0x2A};
static void transpose( uint8_t *buf, int w )
{
@@ -40,15 +40,15 @@
XCHG( uint8_t, buf[w*i+j], buf[w*j+i] );
}
-static void scaling_list_write( bs_t *s, x264_pps_t *pps, int idx )
+static void scaling_list_write( bs_t *s, x264_sps_t *sps, int idx )
{
const int len = idx<4 ? 16 : 64;
const uint8_t *zigzag = idx<4 ? x264_zigzag_scan4[0] : x264_zigzag_scan8[0];
- const uint8_t *list = pps->scaling_list[idx];
- const uint8_t *def_list = (idx==CQM_4IC) ? pps->scaling_list[CQM_4IY]
- : (idx==CQM_4PC) ? pps->scaling_list[CQM_4PY]
- : (idx==CQM_8IC+4) ? pps->scaling_list[CQM_8IY+4]
- : (idx==CQM_8PC+4) ? pps->scaling_list[CQM_8PY+4]
+ const uint8_t *list = sps->scaling_list[idx];
+ const uint8_t *def_list = (idx==CQM_4IC) ? sps->scaling_list[CQM_4IY]
+ : (idx==CQM_4PC) ? sps->scaling_list[CQM_4PY]
+ : (idx==CQM_8IC+4) ? sps->scaling_list[CQM_8IY+4]
+ : (idx==CQM_8PC+4) ? sps->scaling_list[CQM_8PY+4]
: x264_cqm_jvt[idx];
if( !memcmp( list, def_list, len ) )
bs_write1( s, 0 ); // scaling_list_present_flag
@@ -105,8 +105,12 @@
sps->i_id = i_id;
sps->i_mb_width = ( param->i_width + 15 ) / 16;
sps->i_mb_height= ( param->i_height + 15 ) / 16;
+ sps->b_frame_mbs_only = !(param->b_interlaced || param->b_fake_interlaced);
+ if( !sps->b_frame_mbs_only )
+ sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
sps->i_chroma_format_idc = csp >= X264_CSP_I444 ? CHROMA_444 :
- csp >= X264_CSP_I422 ? CHROMA_422 : CHROMA_420;
+ csp >= X264_CSP_I422 ? CHROMA_422 :
+ csp >= X264_CSP_I420 ? CHROMA_420 : CHROMA_400;
sps->b_qpprime_y_zero_transform_bypass = param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant == 0;
if( sps->b_qpprime_y_zero_transform_bypass || sps->i_chroma_format_idc == CHROMA_444 )
@@ -115,7 +119,7 @@
sps->i_profile_idc = PROFILE_HIGH422;
else if( BIT_DEPTH > 8 )
sps->i_profile_idc = PROFILE_HIGH10;
- else if( param->analyse.b_transform_8x8 || param->i_cqm_preset != X264_CQM_FLAT )
+ else if( param->analyse.b_transform_8x8 || param->i_cqm_preset != X264_CQM_FLAT || sps->i_chroma_format_idc == CHROMA_400 )
sps->i_profile_idc = PROFILE_HIGH;
else if( param->b_cabac || param->i_bframe > 0 || param->b_interlaced || param->b_fake_interlaced || param->analyse.i_weighted_pred > 0 )
sps->i_profile_idc = PROFILE_MAIN;
@@ -178,9 +182,6 @@
sps->b_vui = 1;
sps->b_gaps_in_frame_num_value_allowed = 0;
- sps->b_frame_mbs_only = !(param->b_interlaced || param->b_fake_interlaced);
- if( !sps->b_frame_mbs_only )
- sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
sps->b_mb_adaptive_frame_field = param->b_interlaced;
sps->b_direct8x8_inference = 1;
@@ -197,22 +198,14 @@
sps->vui.b_color_description_present = 0;
sps->vui.i_colorprim = ( param->vui.i_colorprim >= 0 && param->vui.i_colorprim <= 12 ? param->vui.i_colorprim : 2 );
- sps->vui.i_transfer = ( param->vui.i_transfer >= 0 && param->vui.i_transfer <= 17 ? param->vui.i_transfer : 2 );
- sps->vui.i_colmatrix = ( param->vui.i_colmatrix >= 0 && param->vui.i_colmatrix <= 11 ? param->vui.i_colmatrix :
+ sps->vui.i_transfer = ( param->vui.i_transfer >= 0 && param->vui.i_transfer <= 18 ? param->vui.i_transfer : 2 );
+ sps->vui.i_colmatrix = ( param->vui.i_colmatrix >= 0 && param->vui.i_colmatrix <= 14 ? param->vui.i_colmatrix :
( csp >= X264_CSP_BGR ? 0 : 2 ) );
- if( sps->vui.i_colorprim != 2 ||
- sps->vui.i_transfer != 2 ||
- sps->vui.i_colmatrix != 2 )
- {
+ if( sps->vui.i_colorprim != 2 || sps->vui.i_transfer != 2 || sps->vui.i_colmatrix != 2 )
sps->vui.b_color_description_present = 1;
- }
- if( sps->vui.i_vidformat != 5 ||
- sps->vui.b_fullrange ||
- sps->vui.b_color_description_present )
- {
+ if( sps->vui.i_vidformat != 5 || sps->vui.b_fullrange || sps->vui.b_color_description_present )
sps->vui.b_signal_type_present = 1;
- }
/* FIXME: not sufficient for interlaced video */
sps->vui.b_chroma_loc_info_present = param->vui.i_chroma_loc > 0 && param->vui.i_chroma_loc <= 5 &&
@@ -247,6 +240,9 @@
sps->vui.i_log2_max_mv_length_horizontal =
sps->vui.i_log2_max_mv_length_vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1;
}
+
+ sps->b_avcintra = !!param->i_avcintra_class;
+ sps->i_cqm_preset = param->i_cqm_preset;
}
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param )
@@ -254,7 +250,7 @@
sps->crop.i_left = param->crop_rect.i_left;
sps->crop.i_top = param->crop_rect.i_top;
sps->crop.i_right = param->crop_rect.i_right + sps->i_mb_width*16 - param->i_width;
- sps->crop.i_bottom = (param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
+ sps->crop.i_bottom = param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height;
sps->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
@@ -267,6 +263,44 @@
}
}
+void x264_sps_init_scaling_list( x264_sps_t *sps, x264_param_t *param )
+{
+ switch( sps->i_cqm_preset )
+ {
+ case X264_CQM_FLAT:
+ for( int i = 0; i < 8; i++ )
+ sps->scaling_list[i] = x264_cqm_flat16;
+ break;
+ case X264_CQM_JVT:
+ for( int i = 0; i < 8; i++ )
+ sps->scaling_list[i] = x264_cqm_jvt[i];
+ break;
+ case X264_CQM_CUSTOM:
+ /* match the transposed DCT & zigzag */
+ transpose( param->cqm_4iy, 4 );
+ transpose( param->cqm_4py, 4 );
+ transpose( param->cqm_4ic, 4 );
+ transpose( param->cqm_4pc, 4 );
+ transpose( param->cqm_8iy, 8 );
+ transpose( param->cqm_8py, 8 );
+ transpose( param->cqm_8ic, 8 );
+ transpose( param->cqm_8pc, 8 );
+ sps->scaling_list[CQM_4IY] = param->cqm_4iy;
+ sps->scaling_list[CQM_4PY] = param->cqm_4py;
+ sps->scaling_list[CQM_4IC] = param->cqm_4ic;
+ sps->scaling_list[CQM_4PC] = param->cqm_4pc;
+ sps->scaling_list[CQM_8IY+4] = param->cqm_8iy;
+ sps->scaling_list[CQM_8PY+4] = param->cqm_8py;
+ sps->scaling_list[CQM_8IC+4] = param->cqm_8ic;
+ sps->scaling_list[CQM_8PC+4] = param->cqm_8pc;
+ for( int i = 0; i < 8; i++ )
+ for( int j = 0; j < (i < 4 ? 16 : 64); j++ )
+ if( sps->scaling_list[i][j] == 0 )
+ sps->scaling_list[i] = x264_cqm_jvt[i];
+ break;
+ }
+}
+
void x264_sps_write( bs_t *s, x264_sps_t *sps )
{
bs_realign( s );
@@ -290,7 +324,26 @@
bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_luma_minus8
bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_chroma_minus8
bs_write1( s, sps->b_qpprime_y_zero_transform_bypass );
- bs_write1( s, 0 ); // seq_scaling_matrix_present_flag
+ /* Exactly match the AVC-Intra bitstream */
+ bs_write1( s, sps->b_avcintra ); // seq_scaling_matrix_present_flag
+ if( sps->b_avcintra )
+ {
+ scaling_list_write( s, sps, CQM_4IY );
+ scaling_list_write( s, sps, CQM_4IC );
+ scaling_list_write( s, sps, CQM_4IC );
+ bs_write1( s, 0 ); // no inter
+ bs_write1( s, 0 ); // no inter
+ bs_write1( s, 0 ); // no inter
+ scaling_list_write( s, sps, CQM_8IY+4 );
+ bs_write1( s, 0 ); // no inter
+ if( sps->i_chroma_format_idc == CHROMA_444 )
+ {
+ scaling_list_write( s, sps, CQM_8IC+4 );
+ bs_write1( s, 0 ); // no inter
+ scaling_list_write( s, sps, CQM_8IC+4 );
+ bs_write1( s, 0 ); // no inter
+ }
+ }
}
bs_write_ue( s, sps->i_log2_max_frame_num - 4 );
@@ -310,7 +363,7 @@
if( sps->b_crop )
{
int h_shift = sps->i_chroma_format_idc == CHROMA_420 || sps->i_chroma_format_idc == CHROMA_422;
- int v_shift = sps->i_chroma_format_idc == CHROMA_420;
+ int v_shift = (sps->i_chroma_format_idc == CHROMA_420) + !sps->b_frame_mbs_only;
bs_write_ue( s, sps->crop.i_left >> h_shift );
bs_write_ue( s, sps->crop.i_right >> h_shift );
bs_write_ue( s, sps->crop.i_top >> v_shift );
@@ -446,43 +499,6 @@
pps->b_redundant_pic_cnt = 0;
pps->b_transform_8x8_mode = param->analyse.b_transform_8x8 ? 1 : 0;
-
- pps->i_cqm_preset = param->i_cqm_preset;
-
- switch( pps->i_cqm_preset )
- {
- case X264_CQM_FLAT:
- for( int i = 0; i < 8; i++ )
- pps->scaling_list[i] = x264_cqm_flat16;
- break;
- case X264_CQM_JVT:
- for( int i = 0; i < 8; i++ )
- pps->scaling_list[i] = x264_cqm_jvt[i];
- break;
- case X264_CQM_CUSTOM:
- /* match the transposed DCT & zigzag */
- transpose( param->cqm_4iy, 4 );
- transpose( param->cqm_4py, 4 );
- transpose( param->cqm_4ic, 4 );
- transpose( param->cqm_4pc, 4 );
- transpose( param->cqm_8iy, 8 );
- transpose( param->cqm_8py, 8 );
- transpose( param->cqm_8ic, 8 );
- transpose( param->cqm_8pc, 8 );
- pps->scaling_list[CQM_4IY] = param->cqm_4iy;
- pps->scaling_list[CQM_4PY] = param->cqm_4py;
- pps->scaling_list[CQM_4IC] = param->cqm_4ic;
- pps->scaling_list[CQM_4PC] = param->cqm_4pc;
- pps->scaling_list[CQM_8IY+4] = param->cqm_8iy;
- pps->scaling_list[CQM_8PY+4] = param->cqm_8py;
- pps->scaling_list[CQM_8IC+4] = param->cqm_8ic;
- pps->scaling_list[CQM_8PC+4] = param->cqm_8pc;
- for( int i = 0; i < 8; i++ )
- for( int j = 0; j < (i < 4 ? 16 : 64); j++ )
- if( pps->scaling_list[i][j] == 0 )
- pps->scaling_list[i] = x264_cqm_jvt[i];
- break;
- }
}
void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps )
@@ -508,26 +524,27 @@
bs_write1( s, pps->b_constrained_intra_pred );
bs_write1( s, pps->b_redundant_pic_cnt );
- if( pps->b_transform_8x8_mode || pps->i_cqm_preset != X264_CQM_FLAT )
+ int b_scaling_list = !sps->b_avcintra && sps->i_cqm_preset != X264_CQM_FLAT;
+ if( pps->b_transform_8x8_mode || b_scaling_list )
{
bs_write1( s, pps->b_transform_8x8_mode );
- bs_write1( s, (pps->i_cqm_preset != X264_CQM_FLAT) );
- if( pps->i_cqm_preset != X264_CQM_FLAT )
+ bs_write1( s, b_scaling_list );
+ if( b_scaling_list )
{
- scaling_list_write( s, pps, CQM_4IY );
- scaling_list_write( s, pps, CQM_4IC );
+ scaling_list_write( s, sps, CQM_4IY );
+ scaling_list_write( s, sps, CQM_4IC );
bs_write1( s, 0 ); // Cr = Cb
- scaling_list_write( s, pps, CQM_4PY );
- scaling_list_write( s, pps, CQM_4PC );
+ scaling_list_write( s, sps, CQM_4PY );
+ scaling_list_write( s, sps, CQM_4PC );
bs_write1( s, 0 ); // Cr = Cb
if( pps->b_transform_8x8_mode )
{
- scaling_list_write( s, pps, CQM_8IY+4 );
- scaling_list_write( s, pps, CQM_8PY+4 );
+ scaling_list_write( s, sps, CQM_8IY+4 );
+ scaling_list_write( s, sps, CQM_8PY+4 );
if( sps->i_chroma_format_idc == CHROMA_444 )
{
- scaling_list_write( s, pps, CQM_8IC+4 );
- scaling_list_write( s, pps, CQM_8PC+4 );
+ scaling_list_write( s, sps, CQM_8IC+4 );
+ scaling_list_write( s, sps, CQM_8PC+4 );
bs_write1( s, 0 ); // Cr = Cb
bs_write1( s, 0 ); // Cr = Cb
}
@@ -555,7 +572,6 @@
bs_write( &q, 2, 0 ); //changing_slice_group 0
bs_align_10( &q );
- bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_RECOVERY_POINT );
}
@@ -578,7 +594,7 @@
memcpy( payload, uuid, 16 );
sprintf( payload+16, "x264 - core %d%s - H.264/MPEG-4 AVC codec - "
- "Copy%s 2003-2017 - http://www.videolan.org/x264.html - options: %s",
+ "Copy%s 2003-2020 - http://www.videolan.org/x264.html - options: %s",
X264_BUILD, X264_VERSION, HAVE_GPL?"left":"right", opts );
length = strlen(payload)+1;
@@ -610,7 +626,6 @@
}
bs_align_10( &q );
- bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_BUFFERING_PERIOD );
}
@@ -642,7 +657,6 @@
}
bs_align_10( &q );
- bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_PIC_TIMING );
}
@@ -685,11 +699,26 @@
bs_write1( &q, 0 ); // frame_packing_arrangement_extension_flag
bs_align_10( &q );
- bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_FRAME_PACKING );
}
+void x264_sei_alternative_transfer_write( x264_t *h, bs_t *s )
+{
+ bs_t q;
+ ALIGNED_4( uint8_t tmp_buf[100] );
+ M32( tmp_buf ) = 0; // shut up gcc
+ bs_init( &q, tmp_buf, 100 );
+
+ bs_realign( &q );
+
+ bs_write ( &q, 8, h->param.i_alternative_transfer ); // preferred_transfer_characteristics
+
+ bs_align_10( &q );
+
+ x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_ALTERNATIVE_TRANSFER );
+}
+
void x264_filler_write( x264_t *h, bs_t *s, int filler )
{
bs_realign( s );
@@ -729,7 +758,6 @@
}
bs_align_10( &q );
- bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_DEC_REF_PIC_MARKING );
}
@@ -766,7 +794,7 @@
{
uint8_t data[6000];
const char *msg = "VANC";
- if( len > sizeof(data) )
+ if( len < 0 || (unsigned)len > sizeof(data) )
{
x264_log( h, X264_LOG_ERROR, "AVC-Intra SEI is too large (%d)\n", len );
return -1;
@@ -781,31 +809,6 @@
return 0;
}
-const x264_level_t x264_levels[] =
-{
- { 10, 1485, 99, 396, 64, 175, 64, 64, 0, 2, 0, 0, 1 },
- { 9, 1485, 99, 396, 128, 350, 64, 64, 0, 2, 0, 0, 1 }, /* "1b" */
- { 11, 3000, 396, 900, 192, 500, 128, 64, 0, 2, 0, 0, 1 },
- { 12, 6000, 396, 2376, 384, 1000, 128, 64, 0, 2, 0, 0, 1 },
- { 13, 11880, 396, 2376, 768, 2000, 128, 64, 0, 2, 0, 0, 1 },
- { 20, 11880, 396, 2376, 2000, 2000, 128, 64, 0, 2, 0, 0, 1 },
- { 21, 19800, 792, 4752, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
- { 22, 20250, 1620, 8100, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
- { 30, 40500, 1620, 8100, 10000, 10000, 256, 32, 22, 2, 0, 1, 0 },
- { 31, 108000, 3600, 18000, 14000, 14000, 512, 16, 60, 4, 1, 1, 0 },
- { 32, 216000, 5120, 20480, 20000, 20000, 512, 16, 60, 4, 1, 1, 0 },
- { 40, 245760, 8192, 32768, 20000, 25000, 512, 16, 60, 4, 1, 1, 0 },
- { 41, 245760, 8192, 32768, 50000, 62500, 512, 16, 24, 2, 1, 1, 0 },
- { 42, 522240, 8704, 34816, 50000, 62500, 512, 16, 24, 2, 1, 1, 1 },
- { 50, 589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 },
- { 51, 983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
- { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
- { 60, 4177920, 139264, 696320, 240000, 240000, 8192, 16, 24, 2, 1, 1, 1 },
- { 61, 8355840, 139264, 696320, 480000, 480000, 8192, 16, 24, 2, 1, 1, 1 },
- { 62, 16711680, 139264, 696320, 800000, 800000, 8192, 16, 24, 2, 1, 1, 1 },
- { 0 }
-};
-
#define ERROR(...)\
{\
if( verbose )\
diff -ur x264-go/x264c/external/x264/encoder/set.h x264-go.new/x264c/external/x264/encoder/set.h
--- x264-go/x264c/external/x264/encoder/set.h 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/set.h 2020-06-06 15:20:58.699039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* set.h: header writing
*****************************************************************************
- * Copyright (C) 2003-2017 x264 project
+ * Copyright (C) 2003-2020 x264 project
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Loren Merritt <lorenm@u.washington.edu>
@@ -27,21 +27,41 @@
#ifndef X264_ENCODER_SET_H
#define X264_ENCODER_SET_H
+#define x264_sps_init x264_template(sps_init)
void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param );
+#define x264_sps_init_reconfigurable x264_template(sps_init_reconfigurable)
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param );
+#define x264_sps_init_scaling_list x264_template(sps_init_scaling_list)
+void x264_sps_init_scaling_list( x264_sps_t *sps, x264_param_t *param );
+#define x264_sps_write x264_template(sps_write)
void x264_sps_write( bs_t *s, x264_sps_t *sps );
+#define x264_pps_init x264_template(pps_init)
void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *sps );
+#define x264_pps_write x264_template(pps_write)
void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps );
+#define x264_sei_recovery_point_write x264_template(sei_recovery_point_write)
void x264_sei_recovery_point_write( x264_t *h, bs_t *s, int recovery_frame_cnt );
+#define x264_sei_version_write x264_template(sei_version_write)
int x264_sei_version_write( x264_t *h, bs_t *s );
+#define x264_validate_levels x264_template(validate_levels)
int x264_validate_levels( x264_t *h, int verbose );
+#define x264_sei_buffering_period_write x264_template(sei_buffering_period_write)
void x264_sei_buffering_period_write( x264_t *h, bs_t *s );
+#define x264_sei_pic_timing_write x264_template(sei_pic_timing_write)
void x264_sei_pic_timing_write( x264_t *h, bs_t *s );
+#define x264_sei_dec_ref_pic_marking_write x264_template(sei_dec_ref_pic_marking_write)
void x264_sei_dec_ref_pic_marking_write( x264_t *h, bs_t *s );
+#define x264_sei_frame_packing_write x264_template(sei_frame_packing_write)
void x264_sei_frame_packing_write( x264_t *h, bs_t *s );
+#define x264_sei_alternative_transfer_write x264_template(sei_alternative_transfer_write)
+void x264_sei_alternative_transfer_write( x264_t *h, bs_t *s );
+#define x264_sei_avcintra_umid_write x264_template(sei_avcintra_umid_write)
int x264_sei_avcintra_umid_write( x264_t *h, bs_t *s );
+#define x264_sei_avcintra_vanc_write x264_template(sei_avcintra_vanc_write)
int x264_sei_avcintra_vanc_write( x264_t *h, bs_t *s, int len );
+#define x264_sei_write x264_template(sei_write)
void x264_sei_write( bs_t *s, uint8_t *payload, int payload_size, int payload_type );
+#define x264_filler_write x264_template(filler_write)
void x264_filler_write( x264_t *h, bs_t *s, int filler );
#endif
diff -ur x264-go/x264c/external/x264/encoder/slicetype.c x264-go.new/x264c/external/x264/encoder/slicetype.c
--- x264-go/x264c/external/x264/encoder/slicetype.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/slicetype.c 2020-06-06 15:20:58.699039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* slicetype.c: lookahead analysis
*****************************************************************************
- * Copyright (C) 2005-2017 x264 project
+ * Copyright (C) 2005-2020 x264 project
*
* Authors: Fiona Glaser <fiona@x264.com>
* Loren Merritt <lorenm@u.washington.edu>
@@ -32,26 +32,21 @@
// Indexed by pic_struct values
static const uint8_t delta_tfi_divisor[10] = { 0, 2, 1, 1, 2, 2, 3, 3, 4, 6 };
-static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
- x264_frame_t **frames, int p0, int p1, int b );
+static int slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
+ x264_frame_t **frames, int p0, int p1, int b );
+#define x264_weights_analyse x264_template(weights_analyse)
void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead );
#if HAVE_OPENCL
-int x264_opencl_lowres_init( x264_t *h, x264_frame_t *fenc, int lambda );
-int x264_opencl_motionsearch( x264_t *h, x264_frame_t **frames, int b, int ref, int b_islist1, int lambda, const x264_weight_t *w );
-int x264_opencl_finalize_cost( x264_t *h, int lambda, x264_frame_t **frames, int p0, int p1, int b, int dist_scale_factor );
-int x264_opencl_precalculate_frame_cost( x264_t *h, x264_frame_t **frames, int lambda, int p0, int p1, int b );
-void x264_opencl_flush( x264_t *h );
-void x264_opencl_slicetype_prep( x264_t *h, x264_frame_t **frames, int num_frames, int lambda );
-void x264_opencl_slicetype_end( x264_t *h );
+#include "slicetype-cl.h"
#endif
-static void x264_lowres_context_init( x264_t *h, x264_mb_analysis_t *a )
+static void lowres_context_init( x264_t *h, x264_mb_analysis_t *a )
{
a->i_qp = X264_LOOKAHEAD_QP;
a->i_lambda = x264_lambda_tab[ a->i_qp ];
- x264_mb_analyse_load_costs( h, a );
+ mb_analyse_load_costs( h, a );
if( h->param.analyse.i_subpel_refine > 1 )
{
h->mb.i_me_method = X264_MIN( X264_ME_HEX, h->param.analyse.i_me_method );
@@ -66,7 +61,7 @@
}
/* makes a non-h264 weight (i.e. fix7), into an h264 weight */
-static void x264_weight_get_h264( int weight_nonh264, int offset, x264_weight_t *w )
+static void weight_get_h264( int weight_nonh264, int offset, x264_weight_t *w )
{
w->i_offset = offset;
w->i_denom = 7;
@@ -79,7 +74,7 @@
w->i_scale = X264_MIN( w->i_scale, 127 );
}
-static NOINLINE pixel *x264_weight_cost_init_luma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dest )
+static NOINLINE pixel *weight_cost_init_luma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dest )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
/* Note: this will never run during lookahead as weights_analyse is only called if no
@@ -113,7 +108,7 @@
* fenc = ref + offset
* v = u + stride * chroma height */
-static NOINLINE void x264_weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dstu, pixel *dstv )
+static NOINLINE void weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dstu, pixel *dstv )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
int i_stride = fenc->i_stride[1];
@@ -145,7 +140,7 @@
x264_emms();
}
-static NOINLINE pixel *x264_weight_cost_init_chroma444( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dst, int p )
+static NOINLINE pixel *weight_cost_init_chroma444( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dst, int p )
{
int ref0_distance = fenc->i_frame - ref->i_frame - 1;
int i_stride = fenc->i_stride[p];
@@ -173,7 +168,7 @@
return ref->plane[p];
}
-static int x264_weight_slice_header_cost( x264_t *h, x264_weight_t *w, int b_chroma )
+static int weight_slice_header_cost( x264_t *h, x264_weight_t *w, int b_chroma )
{
/* Add cost of weights in the slice header. */
int lambda = x264_lambda_tab[X264_LOOKAHEAD_QP];
@@ -194,7 +189,7 @@
return lambda * numslices * ( 10 + denom_cost + 2 * (bs_size_se( w[0].i_scale ) + bs_size_se( w[0].i_offset )) );
}
-static NOINLINE unsigned int x264_weight_cost_luma( x264_t *h, x264_frame_t *fenc, pixel *src, x264_weight_t *w )
+static NOINLINE unsigned int weight_cost_luma( x264_t *h, x264_frame_t *fenc, pixel *src, x264_weight_t *w )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride_lowres;
@@ -214,7 +209,7 @@
int cmp = h->pixf.mbcmp[PIXEL_8x8]( buf, 8, &fenc_plane[pixoff], i_stride );
cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] );
}
- cost += x264_weight_slice_header_cost( h, w, 0 );
+ cost += weight_slice_header_cost( h, w, 0 );
}
else
for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride )
@@ -227,7 +222,7 @@
return cost;
}
-static NOINLINE unsigned int x264_weight_cost_chroma( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w )
+static NOINLINE unsigned int weight_cost_chroma( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride[1];
@@ -250,7 +245,7 @@
* pixels. */
cost += h->pixf.asd8( buf, 8, &src[pixoff], i_stride, height );
}
- cost += x264_weight_slice_header_cost( h, w, 1 );
+ cost += weight_slice_header_cost( h, w, 1 );
}
else
for( int y = 0; y < i_lines; y += height, pixoff = y*i_stride )
@@ -260,7 +255,7 @@
return cost;
}
-static NOINLINE unsigned int x264_weight_cost_chroma444( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w, int p )
+static NOINLINE unsigned int weight_cost_chroma444( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w, int p )
{
unsigned int cost = 0;
int i_stride = fenc->i_stride[p];
@@ -277,7 +272,7 @@
w->weightfn[16>>2]( buf, 16, &ref[pixoff], i_stride, w, 16 );
cost += h->pixf.mbcmp[PIXEL_16x16]( buf, 16, &src[pixoff], i_stride );
}
- cost += x264_weight_slice_header_cost( h, w, 1 );
+ cost += weight_slice_header_cost( h, w, 1 );
}
else
for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride )
@@ -302,11 +297,21 @@
float ref_mean[3];
for( int plane = 0; plane <= 2*!b_lookahead; plane++ )
{
- float fenc_var = fenc->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane];
- float ref_var = ref->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane];
- guess_scale[plane] = sqrtf( fenc_var / ref_var );
- fenc_mean[plane] = (float)fenc->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
- ref_mean[plane] = (float) ref->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
+ if( !plane || CHROMA_FORMAT )
+ {
+ int zero_bias = !ref->i_pixel_ssd[plane];
+ float fenc_var = fenc->i_pixel_ssd[plane] + zero_bias;
+ float ref_var = ref->i_pixel_ssd[plane] + zero_bias;
+ guess_scale[plane] = sqrtf( fenc_var / ref_var );
+ fenc_mean[plane] = (float)(fenc->i_pixel_sum[plane] + zero_bias) / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
+ ref_mean[plane] = (float)( ref->i_pixel_sum[plane] + zero_bias) / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8));
+ }
+ else
+ {
+ guess_scale[plane] = 1;
+ fenc_mean[plane] = 0;
+ ref_mean[plane] = 0;
+ }
}
int chroma_denom = 7;
@@ -323,7 +328,7 @@
}
/* Don't check chroma in lookahead, or if there wasn't a luma weight. */
- for( int plane = 0; plane <= 2 && !( plane && ( !weights[0].weightfn || b_lookahead ) ); plane++ )
+ for( int plane = 0; plane < (CHROMA_FORMAT ? 3 : 1) && !( plane && ( !weights[0].weightfn || b_lookahead ) ); plane++ )
{
int minoff, minscale, mindenom;
unsigned int minscore, origscore;
@@ -347,7 +352,7 @@
}
}
else
- x264_weight_get_h264( round( guess_scale[plane] * 128 ), 0, &weights[plane] );
+ weight_get_h264( round( guess_scale[plane] * 128 ), 0, &weights[plane] );
found = 0;
mindenom = weights[plane].i_denom;
@@ -360,27 +365,27 @@
if( !fenc->b_intra_calculated )
{
x264_mb_analysis_t a;
- x264_lowres_context_init( h, &a );
- x264_slicetype_frame_cost( h, &a, &fenc, 0, 0, 0 );
+ lowres_context_init( h, &a );
+ slicetype_frame_cost( h, &a, &fenc, 0, 0, 0 );
}
- mcbuf = x264_weight_cost_init_luma( h, fenc, ref, h->mb.p_weight_buf[0] );
- origscore = minscore = x264_weight_cost_luma( h, fenc, mcbuf, NULL );
+ mcbuf = weight_cost_init_luma( h, fenc, ref, h->mb.p_weight_buf[0] );
+ origscore = minscore = weight_cost_luma( h, fenc, mcbuf, NULL );
}
else
{
if( CHROMA444 )
{
- mcbuf = x264_weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane );
- origscore = minscore = x264_weight_cost_chroma444( h, fenc, mcbuf, NULL, plane );
+ mcbuf = weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane );
+ origscore = minscore = weight_cost_chroma444( h, fenc, mcbuf, NULL, plane );
}
else
{
pixel *dstu = h->mb.p_weight_buf[0];
pixel *dstv = h->mb.p_weight_buf[0]+fenc->i_stride[1]*fenc->i_lines[1];
if( !chroma_initted++ )
- x264_weight_cost_init_chroma( h, fenc, ref, dstu, dstv );
+ weight_cost_init_chroma( h, fenc, ref, dstu, dstv );
mcbuf = plane == 1 ? dstu : dstv;
- origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL );
+ origscore = minscore = weight_cost_chroma( h, fenc, mcbuf, NULL );
}
}
@@ -409,8 +414,7 @@
* because scale has a much wider range than offset (because of denom), so
* it should almost never need to be clamped. */
cur_offset = x264_clip3( cur_offset, -128, 127 );
- cur_scale = (1 << mindenom) * (fenc_mean[plane] - cur_offset) / ref_mean[plane] + 0.5f;
- cur_scale = x264_clip3( cur_scale, 0, 127 );
+ cur_scale = x264_clip3f( (1 << mindenom) * (fenc_mean[plane] - cur_offset) / ref_mean[plane] + 0.5f, 0, 127 );
}
int start_offset = x264_clip3( cur_offset - offset_dist, -128, 127 );
int end_offset = x264_clip3( cur_offset + offset_dist, -128, 127 );
@@ -421,12 +425,12 @@
if( plane )
{
if( CHROMA444 )
- s = x264_weight_cost_chroma444( h, fenc, mcbuf, &weights[plane], plane );
+ s = weight_cost_chroma444( h, fenc, mcbuf, &weights[plane], plane );
else
- s = x264_weight_cost_chroma( h, fenc, mcbuf, &weights[plane] );
+ s = weight_cost_chroma( h, fenc, mcbuf, &weights[plane] );
}
else
- s = x264_weight_cost_luma( h, fenc, mcbuf, &weights[plane] );
+ s = weight_cost_luma( h, fenc, mcbuf, &weights[plane] );
COPY4_IF_LT( minscore, s, minscale, cur_scale, minoff, i_off, found, 1 );
// Don't check any more offsets if the previous one had a lower cost than the current one
@@ -487,7 +491,7 @@
if( weights[0].weightfn && b_lookahead )
{
//scale lowres in lookahead for slicetype_frame_cost
- pixel *src = ref->buffer_lowres[0];
+ pixel *src = ref->buffer_lowres;
pixel *dst = h->mb.p_weight_buf[0];
int width = ref->i_width_lowres + PADH*2;
int height = ref->i_lines_lowres + PADV*2;
@@ -508,10 +512,10 @@
#define NUM_ROWS 3
#define ROW_SATD (NUM_INTS + (h->mb.i_mb_y - h->i_threadslice_start))
-static void x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
- x264_frame_t **frames, int p0, int p1, int b,
- int dist_scale_factor, int do_search[2], const x264_weight_t *w,
- int *output_inter, int *output_intra )
+static void slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
+ x264_frame_t **frames, int p0, int p1, int b,
+ int dist_scale_factor, int do_search[2], const x264_weight_t *w,
+ int *output_inter, int *output_intra )
{
x264_frame_t *fref0 = frames[p0];
x264_frame_t *fref1 = frames[p1];
@@ -524,8 +528,8 @@
const int i_stride = fenc->i_stride_lowres;
const int i_pel_offset = 8 * (i_mb_x + i_mb_y * i_stride);
const int i_bipred_weight = h->param.analyse.b_weighted_bipred ? 64 - (dist_scale_factor>>2) : 32;
- int16_t (*fenc_mvs[2])[2] = { &fenc->lowres_mvs[0][b-p0-1][i_mb_xy], &fenc->lowres_mvs[1][p1-b-1][i_mb_xy] };
- int (*fenc_costs[2]) = { &fenc->lowres_mv_costs[0][b-p0-1][i_mb_xy], &fenc->lowres_mv_costs[1][p1-b-1][i_mb_xy] };
+ int16_t (*fenc_mvs[2])[2] = { b != p0 ? &fenc->lowres_mvs[0][b-p0-1][i_mb_xy] : NULL, b != p1 ? &fenc->lowres_mvs[1][p1-b-1][i_mb_xy] : NULL };
+ int (*fenc_costs[2]) = { b != p0 ? &fenc->lowres_mv_costs[0][b-p0-1][i_mb_xy] : NULL, b != p1 ? &fenc->lowres_mv_costs[1][p1-b-1][i_mb_xy] : NULL };
int b_frame_score_mb = (i_mb_x > 0 && i_mb_x < h->mb.i_mb_width - 1 &&
i_mb_y > 0 && i_mb_y < h->mb.i_mb_height - 1) ||
h->mb.i_mb_width <= 2 || h->mb.i_mb_height <= 2;
@@ -654,7 +658,7 @@
{
int i_mvc = 0;
int16_t (*fenc_mv)[2] = fenc_mvs[l];
- ALIGNED_4( int16_t mvc[4][2] );
+ ALIGNED_ARRAY_8( int16_t, mvc,[4],[2] );
/* Reverse-order MV prediction. */
M32( mvc[0] ) = 0;
@@ -716,10 +720,10 @@
pixel *src = &fenc->lowres[0][i_pel_offset];
const int intra_penalty = 5 * a->i_lambda;
int satds[3];
- int pixoff = 4 / sizeof(pixel);
+ int pixoff = 4 / SIZEOF_PIXEL;
/* Avoid store forwarding stalls by writing larger chunks */
- memcpy( pix-FDEC_STRIDE, src-i_stride, 16 * sizeof(pixel) );
+ memcpy( pix-FDEC_STRIDE, src-i_stride, 16 * SIZEOF_PIXEL );
for( int i = -1; i < 8; i++ )
M32( &pix[i*FDEC_STRIDE-pixoff] ) = M32( &src[i*i_stride-pixoff] );
@@ -808,7 +812,7 @@
int *output_intra;
} x264_slicetype_slice_t;
-static void x264_slicetype_slice_cost( x264_slicetype_slice_t *s )
+static void slicetype_slice_cost( x264_slicetype_slice_t *s )
{
x264_t *h = s->h;
@@ -826,12 +830,12 @@
for( h->mb.i_mb_y = start_y; h->mb.i_mb_y >= end_y; h->mb.i_mb_y-- )
for( h->mb.i_mb_x = start_x; h->mb.i_mb_x >= end_x; h->mb.i_mb_x-- )
- x264_slicetype_mb_cost( h, s->a, s->frames, s->p0, s->p1, s->b, s->dist_scale_factor,
- s->do_search, s->w, s->output_inter, s->output_intra );
+ slicetype_mb_cost( h, s->a, s->frames, s->p0, s->p1, s->b, s->dist_scale_factor,
+ s->do_search, s->w, s->output_inter, s->output_intra );
}
-static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
- x264_frame_t **frames, int p0, int p1, int b )
+static int slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
+ x264_frame_t **frames, int p0, int p1, int b )
{
int i_score = 0;
int do_search[2];
@@ -923,7 +927,7 @@
output_inter[i+1] = output_inter[i] + thread_output_size + PAD_SIZE;
output_intra[i+1] = output_intra[i] + thread_output_size + PAD_SIZE;
- x264_threadpool_run( h->lookaheadpool, (void*)x264_slicetype_slice_cost, &s[i] );
+ x264_threadpool_run( h->lookaheadpool, (void*)slicetype_slice_cost, &s[i] );
}
for( int i = 0; i < h->param.i_lookahead_threads; i++ )
x264_threadpool_wait( h->lookaheadpool, &s[i] );
@@ -937,7 +941,7 @@
output_inter[0][NUM_ROWS] = output_intra[0][NUM_ROWS] = h->mb.i_mb_height;
x264_slicetype_slice_t s = (x264_slicetype_slice_t){ h, a, frames, p0, p1, b, dist_scale_factor, do_search, w,
output_inter[0], output_intra[0] };
- x264_slicetype_slice_cost( &s );
+ slicetype_slice_cost( &s );
}
/* Sum up accumulators */
@@ -993,7 +997,7 @@
/* If MB-tree changes the quantizers, we need to recalculate the frame cost without
* re-running lookahead. */
-static int x264_slicetype_frame_cost_recalculate( x264_t *h, x264_frame_t **frames, int p0, int p1, int b )
+static int slicetype_frame_cost_recalculate( x264_t *h, x264_frame_t **frames, int p0, int p1, int b )
{
int i_score = 0;
int *row_satd = frames[b]->i_row_satds[b-p0][p1-b];
@@ -1023,7 +1027,7 @@
/* Trade off precision in mbtree for increased range */
#define MBTREE_PRECISION 0.5f
-static void x264_macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float average_duration, int ref0_distance )
+static void macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float average_duration, int ref0_distance )
{
int fps_factor = round( CLIP_DURATION(average_duration) / CLIP_DURATION(frame->f_duration) * 256 / MBTREE_PRECISION );
float weightdelta = 0.0;
@@ -1045,12 +1049,12 @@
}
}
-static void x264_macroblock_tree_propagate( x264_t *h, x264_frame_t **frames, float average_duration, int p0, int p1, int b, int referenced )
+static void macroblock_tree_propagate( x264_t *h, x264_frame_t **frames, float average_duration, int p0, int p1, int b, int referenced )
{
uint16_t *ref_costs[2] = {frames[p0]->i_propagate_cost,frames[p1]->i_propagate_cost};
int dist_scale_factor = ( ((b-p0) << 8) + ((p1-p0) >> 1) ) / (p1-p0);
int i_bipred_weight = h->param.analyse.b_weighted_bipred ? 64 - (dist_scale_factor>>2) : 32;
- int16_t (*mvs[2])[2] = { frames[b]->lowres_mvs[0][b-p0-1], frames[b]->lowres_mvs[1][p1-b-1] };
+ int16_t (*mvs[2])[2] = { b != p0 ? frames[b]->lowres_mvs[0][b-p0-1] : NULL, b != p1 ? frames[b]->lowres_mvs[1][p1-b-1] : NULL };
int bipred_weights[2] = {i_bipred_weight, 64 - i_bipred_weight};
int16_t *buf = h->scratch_buffer;
uint16_t *propagate_cost = frames[b]->i_propagate_cost;
@@ -1082,10 +1086,10 @@
}
if( h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead && referenced )
- x264_macroblock_tree_finish( h, frames[b], average_duration, b == p1 ? b - p0 : 0 );
+ macroblock_tree_finish( h, frames[b], average_duration, b == p1 ? b - p0 : 0 );
}
-static void x264_macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int b_intra )
+static void macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int b_intra )
{
int idx = !b_intra;
int last_nonb, cur_nonb = 1;
@@ -1100,7 +1104,7 @@
int i = num_frames;
if( b_intra )
- x264_slicetype_frame_cost( h, a, frames, 0, 0, 0 );
+ slicetype_frame_cost( h, a, frames, 0, 0, 0 );
while( i > 0 && IS_X264_TYPE_B( frames[i]->i_type ) )
i--;
@@ -1134,13 +1138,13 @@
cur_nonb--;
if( cur_nonb < idx )
break;
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb );
memset( frames[cur_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
bframes = last_nonb - cur_nonb - 1;
if( h->param.i_bframe_pyramid && bframes > 1 )
{
int middle = (bframes + 1)/2 + cur_nonb;
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, middle );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, middle );
memset( frames[middle]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
while( i > cur_nonb )
{
@@ -1148,52 +1152,52 @@
int p1 = i < middle ? middle : last_nonb;
if( i != middle )
{
- x264_slicetype_frame_cost( h, a, frames, p0, p1, i );
- x264_macroblock_tree_propagate( h, frames, average_duration, p0, p1, i, 0 );
+ slicetype_frame_cost( h, a, frames, p0, p1, i );
+ macroblock_tree_propagate( h, frames, average_duration, p0, p1, i, 0 );
}
i--;
}
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, middle, 1 );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, middle, 1 );
}
else
{
while( i > cur_nonb )
{
- x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i );
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, i, 0 );
+ slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, i, 0 );
i--;
}
}
- x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, last_nonb, 1 );
+ macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, last_nonb, 1 );
last_nonb = cur_nonb;
}
if( !h->param.rc.i_lookahead )
{
- x264_slicetype_frame_cost( h, a, frames, 0, last_nonb, last_nonb );
- x264_macroblock_tree_propagate( h, frames, average_duration, 0, last_nonb, last_nonb, 1 );
+ slicetype_frame_cost( h, a, frames, 0, last_nonb, last_nonb );
+ macroblock_tree_propagate( h, frames, average_duration, 0, last_nonb, last_nonb, 1 );
XCHG( uint16_t*, frames[last_nonb]->i_propagate_cost, frames[0]->i_propagate_cost );
}
- x264_macroblock_tree_finish( h, frames[last_nonb], average_duration, last_nonb );
+ macroblock_tree_finish( h, frames[last_nonb], average_duration, last_nonb );
if( h->param.i_bframe_pyramid && bframes > 1 && !h->param.rc.i_vbv_buffer_size )
- x264_macroblock_tree_finish( h, frames[last_nonb+(bframes+1)/2], average_duration, 0 );
+ macroblock_tree_finish( h, frames[last_nonb+(bframes+1)/2], average_duration, 0 );
}
-static int x264_vbv_frame_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int b )
+static int vbv_frame_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int b )
{
- int cost = x264_slicetype_frame_cost( h, a, frames, p0, p1, b );
+ int cost = slicetype_frame_cost( h, a, frames, p0, p1, b );
if( h->param.rc.i_aq_mode )
{
if( h->param.rc.b_mb_tree )
- return x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
+ return slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
else
return frames[b]->i_cost_est_aq[b-p0][p1-b];
}
return cost;
}
-static void x264_calculate_durations( x264_t *h, x264_frame_t *cur_frame, x264_frame_t *prev_frame, int64_t *i_cpb_delay, int64_t *i_coded_fields )
+static void calculate_durations( x264_t *h, x264_frame_t *cur_frame, x264_frame_t *prev_frame, int64_t *i_cpb_delay, int64_t *i_coded_fields )
{
cur_frame->i_cpb_delay = *i_cpb_delay;
cur_frame->i_dpb_output_delay = cur_frame->i_field_cnt - *i_coded_fields;
@@ -1219,7 +1223,7 @@
cur_frame->i_cpb_duration = cur_frame->i_duration;
}
-static void x264_vbv_lookahead( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int keyframe )
+static void vbv_lookahead( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int keyframe )
{
int last_nonb = 0, cur_nonb = 1, idx = 0;
x264_frame_t *prev_frame = NULL;
@@ -1240,11 +1244,11 @@
if( next_nonb != cur_nonb )
{
int p0 = IS_X264_TYPE_I( frames[cur_nonb]->i_type ) ? cur_nonb : last_nonb;
- frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, p0, cur_nonb, cur_nonb );
+ frames[next_nonb]->i_planned_satd[idx] = vbv_frame_cost( h, a, frames, p0, cur_nonb, cur_nonb );
frames[next_nonb]->i_planned_type[idx] = frames[cur_nonb]->i_type;
frames[cur_nonb]->i_coded_fields_lookahead = h->i_coded_fields_lookahead;
frames[cur_nonb]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead;
- x264_calculate_durations( h, frames[cur_nonb], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
+ calculate_durations( h, frames[cur_nonb], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
if( prev_frame )
{
frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration *
@@ -1259,11 +1263,11 @@
/* Handle the B-frames: coded order */
for( int i = last_nonb+1; i < cur_nonb; i++, idx++ )
{
- frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, last_nonb, cur_nonb, i );
+ frames[next_nonb]->i_planned_satd[idx] = vbv_frame_cost( h, a, frames, last_nonb, cur_nonb, i );
frames[next_nonb]->i_planned_type[idx] = X264_TYPE_B;
frames[i]->i_coded_fields_lookahead = h->i_coded_fields_lookahead;
frames[i]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead;
- x264_calculate_durations( h, frames[i], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
+ calculate_durations( h, frames[i], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead );
if( prev_frame )
{
frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration *
@@ -1282,10 +1286,10 @@
frames[next_nonb]->i_planned_type[idx] = X264_TYPE_AUTO;
}
-static int x264_slicetype_path_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, char *path, int threshold )
+static uint64_t slicetype_path_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, char *path, uint64_t threshold )
{
+ uint64_t cost = 0;
int loc = 1;
- int cost = 0;
int cur_nonb = 0;
path--; /* Since the 1st path element is really the second frame */
while( path[loc] )
@@ -1297,9 +1301,9 @@
/* Add the cost of the non-B-frame found above */
if( path[next_nonb] == 'P' )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_nonb );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_nonb );
else /* I-frame */
- cost += x264_slicetype_frame_cost( h, a, frames, next_nonb, next_nonb, next_nonb );
+ cost += slicetype_frame_cost( h, a, frames, next_nonb, next_nonb, next_nonb );
/* Early terminate if the cost we have found is larger than the best path cost so far */
if( cost > threshold )
break;
@@ -1307,15 +1311,15 @@
if( h->param.i_bframe_pyramid && next_nonb - cur_nonb > 2 )
{
int middle = cur_nonb + (next_nonb - cur_nonb)/2;
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, middle );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, middle );
for( int next_b = loc; next_b < middle && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, middle, next_b );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, middle, next_b );
for( int next_b = middle+1; next_b < next_nonb && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, middle, next_nonb, next_b );
+ cost += slicetype_frame_cost( h, a, frames, middle, next_nonb, next_b );
}
else
for( int next_b = loc; next_b < next_nonb && cost < threshold; next_b++ )
- cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_b );
+ cost += slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_b );
loc = next_nonb + 1;
cur_nonb = next_nonb;
@@ -1327,11 +1331,11 @@
/* Uses strings due to the fact that the speed of the control functions is
negligible compared to the cost of running slicetype_frame_cost, and because
it makes debugging easier. */
-static void x264_slicetype_path( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int length, char (*best_paths)[X264_LOOKAHEAD_MAX+1] )
+static void slicetype_path( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int length, char (*best_paths)[X264_LOOKAHEAD_MAX+1] )
{
char paths[2][X264_LOOKAHEAD_MAX+1];
int num_paths = X264_MIN( h->param.i_bframe+1, length );
- int best_cost = COST_MAX;
+ uint64_t best_cost = COST_MAX64;
int best_possible = 0;
int idx = 0;
@@ -1362,9 +1366,9 @@
if( possible || !best_possible )
{
if( possible && !best_possible )
- best_cost = COST_MAX;
+ best_cost = COST_MAX64;
/* Calculate the actual cost of the current path */
- int cost = x264_slicetype_path_cost( h, a, frames, paths[idx], best_cost );
+ uint64_t cost = slicetype_path_cost( h, a, frames, paths[idx], best_cost );
if( cost < best_cost )
{
best_cost = cost;
@@ -1386,7 +1390,7 @@
if( real_scenecut && h->param.i_frame_packing == 5 && (frame->i_frame&1) )
return 0;
- x264_slicetype_frame_cost( h, a, frames, p0, p1, p1 );
+ slicetype_frame_cost( h, a, frames, p0, p1, p1 );
int icost = frame->i_cost_est[0][0];
int pcost = frame->i_cost_est[p1-p0][0];
@@ -1473,7 +1477,7 @@
x264_frame_t *frames[X264_LOOKAHEAD_MAX+3] = { NULL, };
int num_frames, orig_num_frames, keyint_limit, framecnt;
int i_max_search = X264_MIN( h->lookahead->next.i_size, X264_LOOKAHEAD_MAX );
- int vbv_lookahead = h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead;
+ int b_vbv_lookahead = h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead;
/* For determinism we should limit the search to the number of frames lookahead has for sure
* in h->lookahead->next.list buffer, except at the end of stream.
* For normal calls with (intra_minigop == 0) that is h->lookahead->i_slicetype_length + 1 frames.
@@ -1490,12 +1494,12 @@
for( framecnt = 0; framecnt < i_max_search; framecnt++ )
frames[framecnt+1] = h->lookahead->next.list[framecnt];
- x264_lowres_context_init( h, &a );
+ lowres_context_init( h, &a );
if( !framecnt )
{
if( h->param.rc.b_mb_tree )
- x264_macroblock_tree( h, &a, frames, 0, keyframe );
+ macroblock_tree( h, &a, frames, 0, keyframe );
return;
}
@@ -1506,7 +1510,7 @@
* there will be significant visual artifacts if the frames just before
* go down in quality due to being referenced less, despite it being
* more RD-optimal. */
- if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || vbv_lookahead )
+ if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || b_vbv_lookahead )
num_frames = framecnt;
else if( h->param.b_open_gop && num_frames < framecnt )
num_frames++;
@@ -1556,7 +1560,7 @@
/* Perform the frametype analysis. */
for( int j = 2; j <= num_frames; j++ )
- x264_slicetype_path( h, &a, frames, j, best_paths );
+ slicetype_path( h, &a, frames, j, best_paths );
/* Load the results of the analysis into the frame types. */
for( int j = 1; j < num_frames; j++ )
@@ -1607,9 +1611,9 @@
int bframes = j - last_nonb - 1;
memset( path, 'B', bframes );
strcpy( path+bframes, "PP" );
- int cost_p = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX );
+ uint64_t cost_p = slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX64 );
strcpy( path+bframes, "BP" );
- int cost_b = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p );
+ uint64_t cost_b = slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p );
if( cost_b < cost_p )
frames[j]->i_type = X264_TYPE_B;
@@ -1672,7 +1676,7 @@
/* Perform the actual macroblock tree analysis.
* Don't go farther than the maximum keyframe interval; this helps in short GOPs. */
if( h->param.rc.b_mb_tree )
- x264_macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe );
+ macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe );
/* Enforce keyframe limit. */
if( !h->param.b_intra_refresh )
@@ -1727,8 +1731,8 @@
}
}
- if( vbv_lookahead )
- x264_vbv_lookahead( h, &a, frames, num_frames, keyframe );
+ if( b_vbv_lookahead )
+ vbv_lookahead( h, &a, frames, num_frames, keyframe );
/* Restore frametypes for all frames that haven't actually been decided yet. */
for( int j = reset_start; j <= num_frames; j++ )
@@ -1899,7 +1903,7 @@
int p0, p1, b;
p1 = b = bframes + 1;
- x264_lowres_context_init( h, &a );
+ lowres_context_init( h, &a );
frames[0] = h->lookahead->last_nonb;
memcpy( &frames[1], h->lookahead->next.list, (bframes+1) * sizeof(x264_frame_t*) );
@@ -1908,12 +1912,12 @@
else // P
p0 = 0;
- x264_slicetype_frame_cost( h, &a, frames, p0, p1, b );
+ slicetype_frame_cost( h, &a, frames, p0, p1, b );
if( (p0 != p1 || bframes) && h->param.rc.i_vbv_buffer_size )
{
/* We need the intra costs for row SATDs. */
- x264_slicetype_frame_cost( h, &a, frames, b, b, b );
+ slicetype_frame_cost( h, &a, frames, b, b, b );
/* We need B-frame costs for row SATDs. */
p0 = 0;
@@ -1924,7 +1928,7 @@
p1++;
else
p1 = bframes + 1;
- x264_slicetype_frame_cost( h, &a, frames, p0, p1, b );
+ slicetype_frame_cost( h, &a, frames, p0, p1, b );
if( frames[b]->i_type == X264_TYPE_BREF )
p0 = b;
}
@@ -1961,12 +1965,12 @@
h->lookahead->next.list[i]->i_coded = i_coded++;
if( i )
{
- x264_calculate_durations( h, h->lookahead->next.list[i], h->lookahead->next.list[i-1], &h->i_cpb_delay, &h->i_coded_fields );
+ calculate_durations( h, h->lookahead->next.list[i], h->lookahead->next.list[i-1], &h->i_cpb_delay, &h->i_coded_fields );
h->lookahead->next.list[0]->f_planned_cpb_duration[i-1] = (double)h->lookahead->next.list[i]->i_cpb_duration *
h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale;
}
else
- x264_calculate_durations( h, h->lookahead->next.list[i], NULL, &h->i_cpb_delay, &h->i_coded_fields );
+ calculate_durations( h, h->lookahead->next.list[i], NULL, &h->i_cpb_delay, &h->i_coded_fields );
}
}
@@ -1994,9 +1998,9 @@
if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read )
{
- cost = x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
+ cost = slicetype_frame_cost_recalculate( h, frames, p0, p1, b );
if( b && h->param.rc.i_vbv_buffer_size )
- x264_slicetype_frame_cost_recalculate( h, frames, b, b, b );
+ slicetype_frame_cost_recalculate( h, frames, b, b, b );
}
/* In AQ, use the weighted score instead. */
else if( h->param.rc.i_aq_mode )
diff -ur x264-go/x264c/external/x264/encoder/slicetype-cl.c x264-go.new/x264c/external/x264/encoder/slicetype-cl.c
--- x264-go/x264c/external/x264/encoder/slicetype-cl.c 2018-02-14 22:45:04.000000000 +0100
+++ x264-go.new/x264c/external/x264/encoder/slicetype-cl.c 2020-06-06 15:20:58.699039438 +0200
@@ -1,7 +1,7 @@
/*****************************************************************************
* slicetype-cl.c: OpenCL slicetype decision code (lowres lookahead)
*****************************************************************************
- * Copyright (C) 2012-2017 x264 project
+ * Copyright (C) 2012-2020 x264 project
*
* Authors: Steve Borho <sborho@multicorewareinc.com>
*
@@ -26,12 +26,14 @@
#include "common/common.h"
#include "macroblock.h"
#include "me.h"
+#include "slicetype-cl.h"
#if HAVE_OPENCL
#ifdef _WIN32
#include <windows.h>
#endif
+#define x264_weights_analyse x264_template(weights_analyse)
void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead );
/* We define CL_QUEUE_THREAD_HANDLE_AMD here because it is not defined
@@ -67,7 +69,7 @@
h->opencl.pl_occupancy = 0;
}
-static void *x264_opencl_alloc_locked( x264_t *h, int bytes )
+static void *opencl_alloc_locked( x264_t *h, int bytes )
{
if( h->opencl.pl_occupancy + bytes >=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment