Skip to content

Commit ba18d53

Browse files
codec_update
1 parent 6e8b872 commit ba18d53

6 files changed

Lines changed: 375 additions & 10 deletions

File tree

dataloader/decoder/bin/hevc

1.94 MB
Binary file not shown.
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
* HEVC video decoder
3+
*
4+
* Copyright (C) 2012 - 2013 Guillaume Martres
5+
* Copyright (C) 2013 - 2014 Pierre-Edouard Lepere
6+
*
7+
*
8+
* This file is part of FFmpeg.
9+
*
10+
* FFmpeg is free software; you can redistribute it and/or
11+
* modify it under the terms of the GNU Lesser General Public
12+
* License as published by the Free Software Foundation; either
13+
* version 2.1 of the License, or (at your option) any later version.
14+
*
15+
* FFmpeg is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+
* Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public
21+
* License along with FFmpeg; if not, write to the Free Software
22+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
#include "hevc.h"
26+
27+
#ifndef AVCODEC_HEVCDSP_H
28+
#define AVCODEC_HEVCDSP_H
29+
struct AVFrame;
30+
struct UpsamplInf;
31+
struct HEVCWindow;
32+
33+
34+
#define NTAPS_LUMA 8
35+
#define NTAPS_CHROMA 4
36+
#define US_FILTER_PREC 6
37+
38+
#define MAX_EDGE 4
39+
#define MAX_EDGE_CR 2
40+
#define N_SHIFT (20-8)
41+
#define I_OFFSET (1 << (N_SHIFT - 1))
42+
43+
44+
typedef struct HEVCDSPContext {
45+
void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height,
46+
struct GetBitContext *gb, int pcm_bit_depth);
47+
48+
void (*transform_add[4])(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride);
49+
50+
void (*transform_skip)(int16_t *coeffs, int16_t log2_size);
51+
52+
void (*transform_rdpcm)(int16_t *coeffs, int16_t log2_size, int mode);
53+
54+
void (*idct_4x4_luma)(int16_t *coeffs);
55+
56+
void (*idct[4])(int16_t *coeffs, int col_limit);
57+
58+
void (*idct_dc[4])(int16_t *coeffs);
59+
60+
void (*sao_band_filter)( uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, struct SAOParams *sao, int *borders, int width, int height, int c_idx);
61+
62+
void (*sao_edge_filter[2])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, struct SAOParams *sao, int *borders, int _width, int _height, int c_idx, uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge);
63+
64+
#if COM16_C806_EMT
65+
void (*idct_emt)(int16_t *coeffs, int16_t *dst, int log2_trafo_size, int TRANSFORM_MATRIX_SHIFT, int nLog2SizeMinus2, int maxLog2TrDynamicRange, int bitDepth, int ucMode, int intra_pred_mode, int emt_tu_idx);
66+
#endif
67+
68+
void (*put_hevc_qpel[10][2][2])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
69+
int height, intptr_t mx, intptr_t my, int width);
70+
void (*put_hevc_qpel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
71+
int height, intptr_t mx, intptr_t my, int width);
72+
void (*put_hevc_qpel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
73+
int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
74+
75+
void (*put_hevc_qpel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
76+
int16_t *src2, ptrdiff_t src2stride,
77+
int height, intptr_t mx, intptr_t my, int width);
78+
void (*put_hevc_qpel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
79+
int16_t *src2, ptrdiff_t src2stride,
80+
int height, int denom, int wx0, int wx1,
81+
int ox0, int ox1, intptr_t mx, intptr_t my, int width);
82+
void (*put_hevc_epel[10][2][2])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
83+
int height, intptr_t mx, intptr_t my, int width);
84+
85+
void (*put_hevc_epel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
86+
int height, intptr_t mx, intptr_t my, int width);
87+
void (*put_hevc_epel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
88+
int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
89+
void (*put_hevc_epel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
90+
int16_t *src2, ptrdiff_t src2stride,
91+
int height, intptr_t mx, intptr_t my, int width);
92+
void (*put_hevc_epel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
93+
int16_t *src2, ptrdiff_t src2stride,
94+
int height, int denom, int wx0, int ox0, int wx1,
95+
int ox1, intptr_t mx, intptr_t my, int width);
96+
97+
98+
void (*hevc_h_loop_filter_luma)(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
99+
void (*hevc_v_loop_filter_luma)(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
100+
void (*hevc_h_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
101+
void (*hevc_v_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
102+
void (*hevc_h_loop_filter_luma_c)(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
103+
void (*hevc_v_loop_filter_luma_c)(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
104+
void (*hevc_h_loop_filter_chroma_c)(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
105+
void (*hevc_v_loop_filter_chroma_c)(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
106+
107+
void (*upsample_base_layer_frame) (struct AVFrame *FrameEL, struct AVFrame *FrameBL, short *Buffer[3], const struct HEVCWindow *Enhscal, struct UpsamplInf *up_info, int channel);
108+
void (*upsample_filter_block_luma_h[3])(
109+
int16_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
110+
int x_EL, int x_BL, int block_w, int block_h, int widthEL,
111+
const struct HEVCWindow *Enhscal, struct UpsamplInf *up_info);
112+
void (*upsample_filter_block_luma_v[3])(
113+
uint8_t *dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride,
114+
int y_BL, int x_EL, int y_EL, int block_w, int block_h, int widthEL, int heightEL,
115+
const struct HEVCWindow *Enhscal, struct UpsamplInf *up_info);
116+
void (*upsample_filter_block_cr_h[3])(
117+
int16_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
118+
int x_EL, int x_BL, int block_w, int block_h, int widthEL,
119+
const struct HEVCWindow *Enhscal, struct UpsamplInf *up_info);
120+
void (*upsample_filter_block_cr_v[3])(
121+
uint8_t *dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride,
122+
int y_BL, int x_EL, int y_EL, int block_w, int block_h, int widthEL, int heightEL,
123+
const struct HEVCWindow *Enhscal, struct UpsamplInf *up_info);
124+
} HEVCDSPContext;
125+
126+
void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth);
127+
128+
extern const int8_t ff_hevc_epel_filters[7][4];
129+
extern const int8_t ff_hevc_qpel_filters[3][16];
130+
131+
#if COM16_C806_EMT
132+
// ******************************************** Mode intra et SubSet ********************************************
133+
extern const int emt_Tr_Set_H[35];
134+
extern const int emt_Tr_Set_V[35];
135+
extern const int g_aiTrSubSetIntra[3][2];
136+
extern const int g_aiTrSubSetInter[2];
137+
// ************************************************* Initialisation du tableau fastInvTrans *************************************************
138+
typedef void InvTrans(int16_t*, int16_t*, int, int, int, int, int, int);
139+
// ************************************************* Initialisation des transformées *************************************************
140+
extern int16_t g_aiTr4 [8][ 4][ 4];
141+
extern int16_t g_aiTr8 [8][ 8][ 8];
142+
extern int16_t g_aiTr16[8][16][16];
143+
extern int16_t g_aiTr32[8][32][32];
144+
// ****************************************************************** DCT_II ******************************************************************
145+
void fastInverseDCT2_B4(int16_t *src, int16_t *dst, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
146+
void fastInverseDCT2_B8(int16_t *src, int16_t *dst, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
147+
void fastInverseDCT2_B16(int16_t *src, int16_t *dst, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
148+
void fastInverseDCT2_B32(int16_t *src, int16_t *dst, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
149+
void fastInverseDCT2_B64(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
150+
// ****************************************************************** DCT_V ******************************************************************
151+
void fastInverseDCT5_B4(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
152+
void fastInverseDCT5_B8(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
153+
void fastInverseDCT5_B16(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
154+
void fastInverseDCT5_B32(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
155+
// ****************************************************************** DCT_VIII ******************************************************************
156+
void fastInverseDCT8_B4(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
157+
void fastInverseDCT8_B8(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
158+
void fastInverseDCT8_B16(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
159+
void fastInverseDCT8_B32(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
160+
// ****************************************************************** DST_I ******************************************************************
161+
void fastInverseDST1_B4(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
162+
void fastInverseDST1_B8(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
163+
void fastInverseDST1_B16(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
164+
void fastInverseDST1_B32(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
165+
// ****************************************************************** DST_VII ******************************************************************
166+
void fastInverseDST7_B4(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
167+
void fastInverseDST7_B8(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
168+
void fastInverseDST7_B16(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
169+
void fastInverseDST7_B32(int16_t *coeff, int16_t *block, int shift, int line, int zo, int use, int outputMinimum, int outputMaximum);
170+
// *********************************************************************************************************************************************
171+
#endif
172+
173+
void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth);
174+
void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth);
175+
#endif /* AVCODEC_HEVCDSP_H */
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* HEVC video Decoder
3+
*
4+
* Copyright (C) 2012 - 2013 Guillaume Martres
5+
*
6+
* This file is part of FFmpeg.
7+
*
8+
* FFmpeg is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; either
11+
* version 2.1 of the License, or (at your option) any later version.
12+
*
13+
* FFmpeg is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
* Lesser General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public
19+
* License along with FFmpeg; if not, write to the Free Software
20+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
*/
22+
23+
#ifndef AVCODEC_HEVCPRED_H
24+
#define AVCODEC_HEVCPRED_H
25+
26+
#include <stddef.h>
27+
#include <stdint.h>
28+
29+
struct HEVCContext;
30+
31+
typedef struct HEVCPredContext {
32+
void (*intra_pred[4])(struct HEVCContext *s, int x0, int y0, int c_idx);
33+
34+
void (*pred_planar[4])(uint8_t *src, const uint8_t *top,
35+
const uint8_t *left, ptrdiff_t stride);
36+
void (*pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left,
37+
ptrdiff_t stride, int log2_size, int c_idx);
38+
void (*pred_angular[4])(uint8_t *src, const uint8_t *top,
39+
const uint8_t *left, ptrdiff_t stride,
40+
int c_idx, int mode);
41+
} HEVCPredContext;
42+
/* 从源代码中可以看出,HEVCPredContext中存储了4个汇编函数指针(数组):
43+
* intra_pred[4]():帧内预测的入口函数,该函数执行过程中调用了后面3个函数指针。数组中4个函数分别处理4x4,8x8,16x16,32x32几种块。
44+
* pred_planar[4]():Planar预测模式函数。数组中4个函数分别处理4x4,8x8,16x16,32x32几种块。
45+
* pred_dc():DC预测模式函数。
46+
* pred_angular[4]():角度预测模式。数组中4个函数分别处理4x4,8x8,16x16,32x32几种块。
47+
48+
* */
49+
50+
51+
void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth);
52+
void ff_hevcpred_init_x86(HEVCPredContext *c, const int bit_depth);
53+
54+
#endif /* AVCODEC_HEVCPRED_H */
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* openhevc.h wrapper to openhevc or ffmpeg
3+
* Copyright (c) 2012-2013 Micka�l Raulet, Wassim Hamidouche, Gildas Cocherel, Pierre Edouard Lepere
4+
*
5+
* This file is part of openhevc.
6+
*
7+
* openHevc is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* openhevc is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with openhevc; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
22+
#ifndef OPEN_HEVC_WRAPPER_H
23+
#define OPEN_HEVC_WRAPPER_H
24+
25+
#define NV_VERSION "2.0" ///< Current software version
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
#include <stdint.h>
32+
33+
typedef void* OpenHevc_Handle;
34+
35+
typedef struct OpenHevc_Rational{
36+
int num; ///< numerator
37+
int den; ///< denominator
38+
} OpenHevc_Rational;
39+
40+
41+
enum ChromaFormat {
42+
YUV420 = 0,
43+
YUV422,
44+
YUV444,
45+
};
46+
47+
typedef struct OpenHevc_FrameInfo
48+
{
49+
int nYPitch;
50+
int nUPitch;
51+
int nVPitch;
52+
int nBitDepth;
53+
int nWidth;
54+
int nHeight;
55+
int chromat_format;
56+
OpenHevc_Rational sample_aspect_ratio;
57+
OpenHevc_Rational frameRate;
58+
int display_picture_number;
59+
int flag; //progressive, interlaced, interlaced top field first, interlaced bottom field first.
60+
int64_t nTimeStamp;
61+
} OpenHevc_FrameInfo;
62+
63+
typedef struct OpenHevc_Frame
64+
{
65+
void** pvY;
66+
void** pvU;
67+
void** pvV;
68+
OpenHevc_FrameInfo frameInfo;
69+
} OpenHevc_Frame;
70+
71+
typedef struct OpenHevc_Frame_cpy
72+
{
73+
void* pvY;
74+
void* pvU;
75+
void* pvV;
76+
//MvDecoder
77+
void* pvMV;
78+
void* pvYR;
79+
void* pvUR;
80+
void* pvVR;
81+
82+
83+
OpenHevc_FrameInfo frameInfo;
84+
} OpenHevc_Frame_cpy;
85+
86+
OpenHevc_Handle libOpenHevcInit(int nb_pthreads, int thread_type);
87+
int libOpenHevcStartDecoder(OpenHevc_Handle openHevcHandle);
88+
int libOpenHevcDecode(OpenHevc_Handle openHevcHandle, const unsigned char *buff, int nal_len, int64_t pts);
89+
void libOpenHevcGetPictureInfo(OpenHevc_Handle openHevcHandle, OpenHevc_FrameInfo *openHevcFrameInfo);
90+
void libOpenHevcCopyExtraData(OpenHevc_Handle openHevcHandle, unsigned char *extra_data, int extra_size_alloc);
91+
92+
void libOpenHevcGetPictureInfoCpy(OpenHevc_Handle openHevcHandle, OpenHevc_FrameInfo *openHevcFrameInfo);
93+
int libOpenHevcGetOutput(OpenHevc_Handle openHevcHandle, int got_picture, OpenHevc_Frame *openHevcFrame);
94+
int libOpenHevcGetOutputCpy(OpenHevc_Handle openHevcHandle, int got_picture, OpenHevc_Frame_cpy *openHevcFrame);
95+
void libOpenHevcSetCheckMD5(OpenHevc_Handle openHevcHandle, int val);
96+
void libOpenHevcSetDebugMode(OpenHevc_Handle openHevcHandle, int val);
97+
void libOpenHevcSetTemporalLayer_id(OpenHevc_Handle openHevcHandle, int val);
98+
void libOpenHevcSetNoCropping(OpenHevc_Handle openHevcHandle, int val);
99+
void libOpenHevcSetActiveDecoders(OpenHevc_Handle openHevcHandle, int val);
100+
void libOpenHevcSetViewLayers(OpenHevc_Handle openHevcHandle, int val);
101+
void libOpenHevcClose(OpenHevc_Handle openHevcHandle);
102+
void libOpenHevcFlush(OpenHevc_Handle openHevcHandle);
103+
void libOpenHevcFlushSVC(OpenHevc_Handle openHevcHandle, int decoderId);
104+
105+
const char *libOpenHevcVersion(OpenHevc_Handle openHevcHandle);
106+
107+
#ifdef __cplusplus
108+
}
109+
#endif
110+
111+
#endif // OPEN_HEVC_WRAPPER_H

0 commit comments

Comments
 (0)