Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
fa936a30
Commit
fa936a30
authored
Mar 21, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hevc_parse: rename into h2645_parse
This code will be shared with h264.
parent
cdb1665f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
59 deletions
+91
-59
Makefile
libavcodec/Makefile
+3
-3
h2645_parse.c
libavcodec/h2645_parse.c
+11
-11
h2645_parse.h
libavcodec/h2645_parse.h
+64
-0
hevc.c
libavcodec/hevc.c
+3
-3
hevc.h
libavcodec/hevc.h
+2
-36
hevc_parser.c
libavcodec/hevc_parser.c
+5
-4
qsvenc_hevc.c
libavcodec/qsvenc_hevc.c
+3
-2
No files found.
libavcodec/Makefile
View file @
fa936a30
...
...
@@ -261,10 +261,10 @@ OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
OBJS-$(CONFIG_HAP_ENCODER)
+=
hapenc.o
hap.o
OBJS-$(CONFIG_HEVC_DECODER)
+=
hevc.o
hevc_mvs.o
hevc_ps.o
hevc_sei.o
\
hevc_cabac.o
hevc_refs.o
hevcpred.o
\
hevcdsp.o
hevc_filter.o
h
evc
_parse.o
hevc_data.o
hevcdsp.o
hevc_filter.o
h
2645
_parse.o
hevc_data.o
OBJS-$(CONFIG_HEVC_NVENC_ENCODER)
+=
nvenc_hevc.o
OBJS-$(CONFIG_HEVC_QSV_DECODER)
+=
qsvdec_h2645.o
OBJS-$(CONFIG_HEVC_QSV_ENCODER)
+=
qsvenc_hevc.o
hevc_ps_enc.o
h
evc
_parse.o
OBJS-$(CONFIG_HEVC_QSV_ENCODER)
+=
qsvenc_hevc.o
hevc_ps_enc.o
h
2645
_parse.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER)
+=
hnm4video.o
OBJS-$(CONFIG_HQ_HQA_DECODER)
+=
hq_hqa.o
hq_hqadata.o
hq_hqadsp.o
\
canopus.o
...
...
@@ -719,7 +719,7 @@ OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o
OBJS-$(CONFIG_H261_PARSER)
+=
h261_parser.o
OBJS-$(CONFIG_H263_PARSER)
+=
h263_parser.o
OBJS-$(CONFIG_H264_PARSER)
+=
h264_parser.o
OBJS-$(CONFIG_HEVC_PARSER)
+=
hevc_parser.o
h
evc
_parse.o
hevc_ps.o
hevc_data.o
OBJS-$(CONFIG_HEVC_PARSER)
+=
hevc_parser.o
h
2645
_parse.o
hevc_ps.o
hevc_data.o
OBJS-$(CONFIG_MJPEG_PARSER)
+=
mjpeg_parser.o
OBJS-$(CONFIG_MLP_PARSER)
+=
mlp_parser.o
mlp.o
OBJS-$(CONFIG_MPEG4VIDEO_PARSER)
+=
mpeg4video_parser.o
h263.o
\
...
...
libavcodec/h
evc
_parse.c
→
libavcodec/h
2645
_parse.c
View file @
fa936a30
/*
* H
EVC common
code
* H
.264/HEVC common parsing
code
*
* This file is part of Libav.
*
...
...
@@ -25,12 +25,12 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "h
evc
.h"
#include "h
2645_parse
.h"
/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
* between these functions would be nice. */
int
ff_h
evc
_extract_rbsp
(
const
uint8_t
*
src
,
int
length
,
HEVC
NAL
*
nal
)
int
ff_h
2645
_extract_rbsp
(
const
uint8_t
*
src
,
int
length
,
H2645
NAL
*
nal
)
{
int
i
,
si
,
di
;
uint8_t
*
dst
;
...
...
@@ -132,7 +132,7 @@ nsc:
* @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
* 0 if the unit should be skipped, 1 otherwise
*/
static
int
h
ls_nal_unit
(
HEVC
NAL
*
nal
,
AVCodecContext
*
avctx
)
static
int
h
evc_parse_nal_header
(
H2645
NAL
*
nal
,
AVCodecContext
*
avctx
)
{
GetBitContext
*
gb
=
&
nal
->
gb
;
int
nuh_layer_id
;
...
...
@@ -155,14 +155,14 @@ static int hls_nal_unit(HEVCNAL *nal, AVCodecContext *avctx)
}
int
ff_h
evc_split_packet
(
HEVC
Packet
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
int
ff_h
2645_packet_split
(
H2645
Packet
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
AVCodecContext
*
avctx
,
int
is_nalff
,
int
nal_length_size
)
{
int
consumed
,
ret
=
0
;
pkt
->
nb_nals
=
0
;
while
(
length
>=
4
)
{
H
EVC
NAL
*
nal
;
H
2645
NAL
*
nal
;
int
extract_length
=
0
;
if
(
is_nalff
)
{
...
...
@@ -192,7 +192,7 @@ int ff_hevc_split_packet(HEVCPacket *pkt, const uint8_t *buf, int length,
if
(
pkt
->
nals_allocated
<
pkt
->
nb_nals
+
1
)
{
int
new_size
=
pkt
->
nals_allocated
+
1
;
H
EVC
NAL
*
tmp
=
av_realloc_array
(
pkt
->
nals
,
new_size
,
sizeof
(
*
tmp
));
H
2645
NAL
*
tmp
=
av_realloc_array
(
pkt
->
nals
,
new_size
,
sizeof
(
*
tmp
));
if
(
!
tmp
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -203,7 +203,7 @@ int ff_hevc_split_packet(HEVCPacket *pkt, const uint8_t *buf, int length,
}
nal
=
&
pkt
->
nals
[
pkt
->
nb_nals
++
];
consumed
=
ff_h
evc
_extract_rbsp
(
buf
,
extract_length
,
nal
);
consumed
=
ff_h
2645
_extract_rbsp
(
buf
,
extract_length
,
nal
);
if
(
consumed
<
0
)
return
consumed
;
...
...
@@ -211,7 +211,7 @@ int ff_hevc_split_packet(HEVCPacket *pkt, const uint8_t *buf, int length,
if
(
ret
<
0
)
return
ret
;
ret
=
h
ls_nal_unit
(
nal
,
avctx
);
ret
=
h
evc_parse_nal_header
(
nal
,
avctx
);
if
(
ret
<=
0
)
{
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid NAL unit %d, skipping.
\n
"
,
...
...
libavcodec/h2645_parse.h
0 → 100644
View file @
fa936a30
/*
* H.264/HEVC common parsing code
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_H2645_PARSE_H
#define AVCODEC_H2645_PARSE_H
#include <stdint.h>
#include "avcodec.h"
#include "get_bits.h"
typedef
struct
H2645NAL
{
uint8_t
*
rbsp_buffer
;
int
rbsp_buffer_size
;
int
size
;
const
uint8_t
*
data
;
int
raw_size
;
const
uint8_t
*
raw_data
;
GetBitContext
gb
;
int
type
;
int
temporal_id
;
}
H2645NAL
;
/* an input packet split into unescaped NAL units */
typedef
struct
H2645Packet
{
H2645NAL
*
nals
;
int
nb_nals
;
int
nals_allocated
;
}
H2645Packet
;
/**
* Extract the raw (unescaped) bitstream.
*/
int
ff_h2645_extract_rbsp
(
const
uint8_t
*
src
,
int
length
,
H2645NAL
*
nal
);
/**
* Split an input packet into NAL units.
*/
int
ff_h2645_packet_split
(
H2645Packet
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
AVCodecContext
*
avctx
,
int
is_nalff
,
int
nal_length_size
);
#endif
/* AVCODEC_H2645_PARSE_H */
libavcodec/hevc.c
View file @
fa936a30
...
...
@@ -2429,7 +2429,7 @@ fail:
return
ret
;
}
static
int
decode_nal_unit
(
HEVCContext
*
s
,
const
H
EVC
NAL
*
nal
)
static
int
decode_nal_unit
(
HEVCContext
*
s
,
const
H
2645
NAL
*
nal
)
{
HEVCLocalContext
*
lc
=
&
s
->
HEVClc
;
GetBitContext
*
gb
=
&
lc
->
gb
;
...
...
@@ -2581,7 +2581,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
/* split the input packet into NAL units, so we know the upper bound on the
* number of slices in the frame */
ret
=
ff_h
evc_split_packe
t
(
&
s
->
pkt
,
buf
,
length
,
s
->
avctx
,
s
->
is_nalff
,
ret
=
ff_h
2645_packet_spli
t
(
&
s
->
pkt
,
buf
,
length
,
s
->
avctx
,
s
->
is_nalff
,
s
->
nal_length_size
);
if
(
ret
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
...
...
libavcodec/hevc.h
View file @
fa936a30
...
...
@@ -33,6 +33,7 @@
#include "bswapdsp.h"
#include "cabac.h"
#include "get_bits.h"
#include "h2645_parse.h"
#include "hevcdsp.h"
#include "internal.h"
#include "thread.h"
...
...
@@ -704,29 +705,6 @@ typedef struct HEVCFrame {
uint8_t
flags
;
}
HEVCFrame
;
typedef
struct
HEVCNAL
{
uint8_t
*
rbsp_buffer
;
int
rbsp_buffer_size
;
int
size
;
const
uint8_t
*
data
;
int
raw_size
;
const
uint8_t
*
raw_data
;
GetBitContext
gb
;
enum
NALUnitType
type
;
int
temporal_id
;
}
HEVCNAL
;
/* an input packet split into unescaped NAL units */
typedef
struct
HEVCPacket
{
HEVCNAL
*
nals
;
int
nb_nals
;
int
nals_allocated
;
}
HEVCPacket
;
struct
HEVCContext
;
typedef
struct
HEVCPredContext
{
...
...
@@ -852,7 +830,7 @@ typedef struct HEVCContext {
uint16_t
seq_decode
;
uint16_t
seq_output
;
H
EVC
Packet
pkt
;
H
2645
Packet
pkt
;
// type of the first VCL NAL of the current frame
enum
NALUnitType
first_nal_type
;
...
...
@@ -1023,18 +1001,6 @@ void ff_hevc_pps_free(HEVCPPS **ppps);
void
ff_hevc_pred_init
(
HEVCPredContext
*
hpc
,
int
bit_depth
);
/**
* Extract the raw (unescaped) HEVC bitstream.
*/
int
ff_hevc_extract_rbsp
(
const
uint8_t
*
src
,
int
length
,
HEVCNAL
*
nal
);
/**
* Split an input packet into NAL units.
*/
int
ff_hevc_split_packet
(
HEVCPacket
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
AVCodecContext
*
avctx
,
int
is_nalff
,
int
nal_length_size
);
int
ff_hevc_encode_nal_vps
(
HEVCVPS
*
vps
,
unsigned
int
id
,
uint8_t
*
buf
,
int
buf_size
);
...
...
libavcodec/hevc_parser.c
View file @
fa936a30
...
...
@@ -24,6 +24,7 @@
#include "golomb.h"
#include "hevc.h"
#include "h2645_parse.h"
#include "parser.h"
#define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
...
...
@@ -33,13 +34,13 @@
typedef
struct
HEVCParserContext
{
ParseContext
pc
;
H
EVC
Packet
pkt
;
H
2645
Packet
pkt
;
HEVCParamSets
ps
;
int
parsed_extradata
;
}
HEVCParserContext
;
static
int
hevc_parse_slice_header
(
AVCodecParserContext
*
s
,
H
EVC
NAL
*
nal
,
static
int
hevc_parse_slice_header
(
AVCodecParserContext
*
s
,
H
2645
NAL
*
nal
,
AVCodecContext
*
avctx
)
{
HEVCParserContext
*
ctx
=
s
->
priv_data
;
...
...
@@ -81,12 +82,12 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
HEVCParserContext
*
ctx
=
s
->
priv_data
;
int
ret
,
i
;
ret
=
ff_h
evc_split_packe
t
(
&
ctx
->
pkt
,
buf
,
buf_size
,
avctx
,
0
,
0
);
ret
=
ff_h
2645_packet_spli
t
(
&
ctx
->
pkt
,
buf
,
buf_size
,
avctx
,
0
,
0
);
if
(
ret
<
0
)
return
ret
;
for
(
i
=
0
;
i
<
ctx
->
pkt
.
nb_nals
;
i
++
)
{
H
EVC
NAL
*
nal
=
&
ctx
->
pkt
.
nals
[
i
];
H
2645
NAL
*
nal
=
&
ctx
->
pkt
.
nals
[
i
];
/* ignore everything except parameter sets and VCL NALUs */
switch
(
nal
->
type
)
{
...
...
libavcodec/qsvenc_hevc.c
View file @
fa936a30
...
...
@@ -31,6 +31,7 @@
#include "bytestream.h"
#include "get_bits.h"
#include "hevc.h"
#include "h2645_parse.h"
#include "internal.h"
#include "qsv.h"
#include "qsv_internal.h"
...
...
@@ -54,7 +55,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
PutByteContext
pbc
;
GetBitContext
gb
;
H
EVC
NAL
sps_nal
=
{
NULL
};
H
2645
NAL
sps_nal
=
{
NULL
};
HEVCSPS
sps
=
{
0
};
HEVCVPS
vps
=
{
0
};
uint8_t
vps_buf
[
128
],
vps_rbsp_buf
[
128
];
...
...
@@ -68,7 +69,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
}
/* parse the SPS */
ret
=
ff_h
evc
_extract_rbsp
(
avctx
->
extradata
+
4
,
avctx
->
extradata_size
-
4
,
&
sps_nal
);
ret
=
ff_h
2645
_extract_rbsp
(
avctx
->
extradata
+
4
,
avctx
->
extradata_size
-
4
,
&
sps_nal
);
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error unescaping the SPS buffer
\n
"
);
return
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment