mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea'
* commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea': Bump libavcodec and libavformat minor versions for G.723.1 decoder and demuxer G.723.1 demuxer and decoder Add a shift parameter to celp_lp_synthesis_filter() libopenjpeg: K&R formatting cosmetics yadif: use emms_c() instead of inline assembly for emms invocations. ac3: don't use different names for option tables in the template file. lavfi: use const for AVFilterPad declarations in all filters. adpcm: don't duplicate identical AVSampleFmt array for each encoder. configure: cosmetics: Group test dependencies together configure: add more passthrough flags in tms470 filter configure: move flag filtering functions out of if/else blocks Conflicts: Changelog configure doc/general.texi libavcodec/Makefile libavcodec/ac3enc_fixed.c libavcodec/allcodecs.c libavcodec/eac3enc.c libavcodec/g723_1.c libavcodec/g723_1_data.h libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/v210dec.h libavcodec/version.h libavfilter/af_anull.c libavfilter/asrc_anullsrc.c libavfilter/f_settb.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/vf_aspect.c libavfilter/vf_blackframe.c libavfilter/vf_boxblur.c libavfilter/vf_copy.c libavfilter/vf_crop.c libavfilter/vf_cropdetect.c libavfilter/vf_delogo.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_fieldorder.c libavfilter/vf_format.c libavfilter/vf_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hflip.c libavfilter/vf_hqdn3d.c libavfilter/vf_libopencv.c libavfilter/vf_lut.c libavfilter/vf_null.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_pixdesctest.c libavfilter/vf_scale.c libavfilter/vf_select.c libavfilter/vf_setpts.c libavfilter/vf_showinfo.c libavfilter/vf_slicify.c libavfilter/vf_transpose.c libavfilter/vf_unsharp.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/vsrc_color.c libavfilter/vsrc_testsrc.c libavformat/Makefile libavformat/allformats.c libavformat/g723_1.c libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
9023de342f
168
configure
vendored
168
configure
vendored
@ -1810,6 +1810,20 @@ ffserver_extralibs='$ldl'
|
||||
doc_deps_any="texi2html makeinfo pod2man"
|
||||
|
||||
# tests
|
||||
colormatrix1_test_deps="colormatrix_filter"
|
||||
colormatrix2_test_deps="colormatrix_filter"
|
||||
flashsv2_test_deps="zlib"
|
||||
mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
|
||||
mpng_test_deps="zlib"
|
||||
pp_test_deps="mp_filter"
|
||||
pp2_test_deps="mp_filter"
|
||||
pp3_test_deps="mp_filter"
|
||||
pp4_test_deps="mp_filter"
|
||||
pp5_test_deps="mp_filter"
|
||||
pp6_test_deps="mp_filter"
|
||||
seek_lavf_mxf_d10_test_deps="mxf_d10_test"
|
||||
zlib_test_deps="zlib"
|
||||
zmbv_test_deps="zlib"
|
||||
|
||||
test_deps(){
|
||||
suf1=$1
|
||||
@ -1824,8 +1838,6 @@ test_deps(){
|
||||
done
|
||||
}
|
||||
|
||||
seek_lavf_mxf_d10_test_deps="mxf_d10_test"
|
||||
|
||||
test_deps _muxer _demuxer \
|
||||
aiff \
|
||||
pcm_alaw=alaw \
|
||||
@ -1851,20 +1863,6 @@ test_deps _muxer _demuxer \
|
||||
wav \
|
||||
yuv4mpegpipe=yuv4mpeg \
|
||||
|
||||
colormatrix1_test_deps="colormatrix_filter"
|
||||
colormatrix2_test_deps="colormatrix_filter"
|
||||
flashsv2_test_deps="zlib"
|
||||
mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
|
||||
mpng_test_deps="zlib"
|
||||
pp_test_deps="mp_filter"
|
||||
pp2_test_deps="mp_filter"
|
||||
pp3_test_deps="mp_filter"
|
||||
pp4_test_deps="mp_filter"
|
||||
pp5_test_deps="mp_filter"
|
||||
pp6_test_deps="mp_filter"
|
||||
zlib_test_deps="zlib"
|
||||
zmbv_test_deps="zlib"
|
||||
|
||||
# default parameters
|
||||
|
||||
logfile="config.log"
|
||||
@ -2238,6 +2236,78 @@ EOF
|
||||
die "Sanity test failed."
|
||||
fi
|
||||
|
||||
pgi_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-fomit-frame-pointer) echo -Mnoframe ;;
|
||||
-g) echo -gopt ;;
|
||||
*) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
suncc_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-march=*|-mcpu=*)
|
||||
case "${flag#*=}" in
|
||||
native) echo -xtarget=native ;;
|
||||
v9|niagara) echo -xarch=sparc ;;
|
||||
ultrasparc) echo -xarch=sparcvis ;;
|
||||
ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
|
||||
i586|pentium) echo -xchip=pentium ;;
|
||||
i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
|
||||
pentium3*|c3-2) echo -xtarget=pentium3 ;;
|
||||
pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
|
||||
pentium4*) echo -xtarget=pentium4 ;;
|
||||
prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
|
||||
*-sse3) echo -xarch=sse3 ;;
|
||||
core2) echo -xarch=ssse3 -xchip=core2 ;;
|
||||
amdfam10|barcelona) echo -xarch=sse4_1 ;;
|
||||
athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
|
||||
k8|opteron|athlon64|athlon-fx)
|
||||
echo -xarch=sse2a ;;
|
||||
athlon*) echo -xarch=pentium_proa ;;
|
||||
esac
|
||||
;;
|
||||
-std=c99) echo -xc99 ;;
|
||||
-fomit-frame-pointer) echo -xregs=frameptr ;;
|
||||
-fPIC) echo -KPIC -xcode=pic32 ;;
|
||||
-W*,*) echo $flag ;;
|
||||
-f*-*|-W*) ;;
|
||||
*) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
tms470_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-march=*|-mcpu=*)
|
||||
case "${flag#*=}" in
|
||||
armv7-a|cortex-a*) echo -mv=7a8 ;;
|
||||
armv7-r|cortex-r*) echo -mv=7r4 ;;
|
||||
armv7-m|cortex-m*) echo -mv=7m3 ;;
|
||||
armv6*|arm11*) echo -mv=6 ;;
|
||||
armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
|
||||
echo -mv=5e ;;
|
||||
armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
|
||||
esac
|
||||
;;
|
||||
-mfpu=neon) echo --float_support=vfpv3 --neon ;;
|
||||
-mfpu=vfp) echo --float_support=vfpv2 ;;
|
||||
-mfpu=vfpv3) echo --float_support=vfpv3 ;;
|
||||
-msoft-float) echo --float_support=vfplib ;;
|
||||
-O[0-3]|-mf=*) echo $flag ;;
|
||||
-g) echo -g -mn ;;
|
||||
-pds=*) echo $flag ;;
|
||||
-D*|-I*) echo $flag ;;
|
||||
--gcc|--abi=*) echo $flag ;;
|
||||
-me) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
|
||||
cc_type=llvm_gcc
|
||||
gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
|
||||
@ -2313,30 +2383,6 @@ elif $cc -version 2>/dev/null | grep -q TMS470; then
|
||||
cflags_speed='-O3 -mf=5'
|
||||
cflags_size='-O3 -mf=2'
|
||||
cflags_filter=tms470_flags
|
||||
tms470_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-march=*|-mcpu=*)
|
||||
case "${flag#*=}" in
|
||||
armv7-a|cortex-a*) echo -mv=7a8 ;;
|
||||
armv7-r|cortex-r*) echo -mv=7r4 ;;
|
||||
armv7-m|cortex-m*) echo -mv=7m3 ;;
|
||||
armv6*|arm11*) echo -mv=6 ;;
|
||||
armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
|
||||
echo -mv=5e ;;
|
||||
armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
|
||||
esac
|
||||
;;
|
||||
-mfpu=neon) echo --float_support=vfpv3 --neon ;;
|
||||
-mfpu=vfp) echo --float_support=vfpv2 ;;
|
||||
-mfpu=vfpv3) echo --float_support=vfpv3 ;;
|
||||
-msoft-float) echo --float_support=vfplib ;;
|
||||
-O[0-3]|-mf=*) echo $flag ;;
|
||||
-g) echo -g -mn ;;
|
||||
-pds=*) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
elif $cc -v 2>&1 | grep -q clang; then
|
||||
cc_type=clang
|
||||
cc_ident=$($cc --version | head -n1)
|
||||
@ -2353,39 +2399,6 @@ elif $cc -V 2>&1 | grep -q Sun; then
|
||||
cflags_speed='-O5'
|
||||
cflags_size='-O5 -xspace'
|
||||
cflags_filter=suncc_flags
|
||||
suncc_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-march=*|-mcpu=*)
|
||||
case "${flag#*=}" in
|
||||
native) echo -xtarget=native ;;
|
||||
v9|niagara) echo -xarch=sparc ;;
|
||||
ultrasparc) echo -xarch=sparcvis ;;
|
||||
ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
|
||||
i586|pentium) echo -xchip=pentium ;;
|
||||
i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
|
||||
pentium3*|c3-2) echo -xtarget=pentium3 ;;
|
||||
pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
|
||||
pentium4*) echo -xtarget=pentium4 ;;
|
||||
prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
|
||||
*-sse3) echo -xarch=sse3 ;;
|
||||
core2) echo -xarch=ssse3 -xchip=core2 ;;
|
||||
amdfam10|barcelona) echo -xarch=sse4_1 ;;
|
||||
athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
|
||||
k8|opteron|athlon64|athlon-fx)
|
||||
echo -xarch=sse2a ;;
|
||||
athlon*) echo -xarch=pentium_proa ;;
|
||||
esac
|
||||
;;
|
||||
-std=c99) echo -xc99 ;;
|
||||
-fomit-frame-pointer) echo -xregs=frameptr ;;
|
||||
-fPIC) echo -KPIC -xcode=pic32 ;;
|
||||
-W*,*) echo $flag ;;
|
||||
-f*-*|-W*) ;;
|
||||
*) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
|
||||
cc_type=pathscale
|
||||
cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
|
||||
@ -2410,15 +2423,6 @@ elif $cc -V 2>&1 | grep -q Portland; then
|
||||
cflags_size="-O2 -Munroll=c:1 $opt_common"
|
||||
cflags_noopt="-O1"
|
||||
cflags_filter=pgi_flags
|
||||
pgi_flags(){
|
||||
for flag; do
|
||||
case $flag in
|
||||
-fomit-frame-pointer) echo -Mnoframe ;;
|
||||
-g) echo -gopt ;;
|
||||
*) echo $flag ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
fi
|
||||
|
||||
test -n "$cc_type" && enable $cc_type ||
|
||||
|
@ -38,7 +38,7 @@
|
||||
static const AVClass ac3enc_class = {
|
||||
.class_name = "Fixed-Point AC-3 Encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ac3fixed_options,
|
||||
.option = ac3_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
|
@ -23,13 +23,7 @@
|
||||
#include "internal.h"
|
||||
#include "ac3.h"
|
||||
|
||||
#if AC3ENC_TYPE == AC3ENC_TYPE_AC3_FIXED
|
||||
static const AVOption ac3fixed_options[] = {
|
||||
#elif AC3ENC_TYPE == AC3ENC_TYPE_AC3
|
||||
static const AVOption ac3_options[] = {
|
||||
#else /* AC3ENC_TYPE_EAC3 */
|
||||
static const AVOption eac3_options[] = {
|
||||
#endif
|
||||
/* Metadata Options */
|
||||
{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM},
|
||||
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
|
||||
|
@ -717,6 +717,9 @@ error:
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static const enum AVSampleFormat sample_fmts[] = {
|
||||
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
};
|
||||
|
||||
#define ADPCM_ENCODER(id_, name_, long_name_) \
|
||||
AVCodec ff_ ## name_ ## _encoder = { \
|
||||
@ -727,8 +730,7 @@ AVCodec ff_ ## name_ ## _encoder = { \
|
||||
.init = adpcm_encode_init, \
|
||||
.encode2 = adpcm_encode_frame, \
|
||||
.close = adpcm_encode_close, \
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, \
|
||||
AV_SAMPLE_FMT_NONE }, \
|
||||
.sample_fmts = sample_fmts, \
|
||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
static const AVClass eac3enc_class = {
|
||||
.class_name = "E-AC-3 Encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = eac3_options,
|
||||
.option = ac3_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
|
@ -25,23 +25,27 @@
|
||||
* G.723.1 compatible decoder
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#define BITSTREAM_READER_LE
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "libavutil/lzo.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "acelp_vectors.h"
|
||||
#include "celp_filters.h"
|
||||
#include "celp_math.h"
|
||||
#include "lsp.h"
|
||||
#include "libavutil/lzo.h"
|
||||
#include "g723_1_data.h"
|
||||
|
||||
typedef struct g723_1_context {
|
||||
AVClass *class;
|
||||
AVFrame frame;
|
||||
|
||||
G723_1_Subframe subframe[4];
|
||||
FrameType cur_frame_type;
|
||||
FrameType past_frame_type;
|
||||
Rate cur_rate;
|
||||
enum FrameType cur_frame_type;
|
||||
enum FrameType past_frame_type;
|
||||
enum Rate cur_rate;
|
||||
uint8_t lsp_index[LSP_BANDS];
|
||||
int pitch_lag[2];
|
||||
int erased_frames;
|
||||
@ -62,6 +66,7 @@ typedef struct g723_1_context {
|
||||
int pf_gain; ///< formant postfilter
|
||||
///< gain scaling unit memory
|
||||
|
||||
int postfilter;
|
||||
int16_t prev_data[HALF_FRAME_LEN];
|
||||
int16_t prev_weight_sig[PITCH_MAX];
|
||||
|
||||
@ -80,11 +85,12 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
p->pf_gain = 1 << 12;
|
||||
memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(int16_t));
|
||||
|
||||
avcodec_get_frame_defaults(&p->frame);
|
||||
avctx->coded_frame = &p->frame;
|
||||
|
||||
memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -108,7 +114,7 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
|
||||
info_bits = get_bits(&gb, 2);
|
||||
|
||||
if (info_bits == 3) {
|
||||
p->cur_frame_type = UntransmittedFrame;
|
||||
p->cur_frame_type = UNTRANSMITTED_FRAME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -118,14 +124,14 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
|
||||
p->lsp_index[0] = get_bits(&gb, 8);
|
||||
|
||||
if (info_bits == 2) {
|
||||
p->cur_frame_type = SIDFrame;
|
||||
p->cur_frame_type = SID_FRAME;
|
||||
p->subframe[0].amp_index = get_bits(&gb, 6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Extract the info common to both rates */
|
||||
p->cur_rate = info_bits ? Rate5k3 : Rate6k3;
|
||||
p->cur_frame_type = ActiveFrame;
|
||||
p->cur_rate = info_bits ? RATE_5300 : RATE_6300;
|
||||
p->cur_frame_type = ACTIVE_FRAME;
|
||||
|
||||
p->pitch_lag[0] = get_bits(&gb, 7);
|
||||
if (p->pitch_lag[0] > 123) /* test if forbidden code */
|
||||
@ -146,9 +152,9 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
|
||||
temp = get_bits(&gb, 12);
|
||||
ad_cb_len = 170;
|
||||
p->subframe[i].dirac_train = 0;
|
||||
if (p->cur_rate == Rate6k3 && p->pitch_lag[i >> 1] < SUBFRAME_LEN - 2) {
|
||||
if (p->cur_rate == RATE_6300 && p->pitch_lag[i >> 1] < SUBFRAME_LEN - 2) {
|
||||
p->subframe[i].dirac_train = temp >> 11;
|
||||
temp &= 0x7ff;
|
||||
temp &= 0x7FF;
|
||||
ad_cb_len = 85;
|
||||
}
|
||||
p->subframe[i].ad_cb_gain = FASTDIV(temp, GAIN_LEVELS);
|
||||
@ -165,7 +171,7 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
|
||||
p->subframe[2].grid_index = get_bits1(&gb);
|
||||
p->subframe[3].grid_index = get_bits1(&gb);
|
||||
|
||||
if (p->cur_rate == Rate6k3) {
|
||||
if (p->cur_rate == RATE_6300) {
|
||||
skip_bits1(&gb); /* skip reserved bit */
|
||||
|
||||
/* Compute pulse_pos index using the 13-bit combined position index */
|
||||
@ -192,7 +198,7 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
|
||||
p->subframe[1].pulse_sign = get_bits(&gb, 5);
|
||||
p->subframe[2].pulse_sign = get_bits(&gb, 6);
|
||||
p->subframe[3].pulse_sign = get_bits(&gb, 5);
|
||||
} else { /* Rate5k3 */
|
||||
} else { /* 5300 bps */
|
||||
p->subframe[0].pulse_pos = get_bits(&gb, 12);
|
||||
p->subframe[1].pulse_pos = get_bits(&gb, 12);
|
||||
p->subframe[2].pulse_pos = get_bits(&gb, 12);
|
||||
@ -333,7 +339,7 @@ static void inverse_quant(int16_t *cur_lsp, int16_t *prev_lsp,
|
||||
break;
|
||||
}
|
||||
if (!stable)
|
||||
memcpy(cur_lsp, prev_lsp, LPC_ORDER * sizeof(int16_t));
|
||||
memcpy(cur_lsp, prev_lsp, LPC_ORDER * sizeof(*cur_lsp));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,7 +438,7 @@ static void lsp_interpolate(int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
|
||||
8192, 8192, 1 << 13, 14, LPC_ORDER);
|
||||
ff_acelp_weighted_vector_sum(lpc + 2 * LPC_ORDER, cur_lsp, prev_lsp,
|
||||
12288, 4096, 1 << 13, 14, LPC_ORDER);
|
||||
memcpy(lpc + 3 * LPC_ORDER, cur_lsp, LPC_ORDER * sizeof(int16_t));
|
||||
memcpy(lpc + 3 * LPC_ORDER, cur_lsp, LPC_ORDER * sizeof(*lpc));
|
||||
|
||||
for (i = 0; i < SUBFRAMES; i++) {
|
||||
lsp2lpc(lpc_ptr);
|
||||
@ -448,7 +454,7 @@ static void gen_dirac_train(int16_t *buf, int pitch_lag)
|
||||
int16_t vector[SUBFRAME_LEN];
|
||||
int i, j;
|
||||
|
||||
memcpy(vector, buf, SUBFRAME_LEN * sizeof(int16_t));
|
||||
memcpy(vector, buf, SUBFRAME_LEN * sizeof(*vector));
|
||||
for (i = pitch_lag; i < SUBFRAME_LEN; i += pitch_lag) {
|
||||
for (j = 0; j < SUBFRAME_LEN - i; j++)
|
||||
buf[i + j] += vector[j];
|
||||
@ -465,13 +471,13 @@ static void gen_dirac_train(int16_t *buf, int pitch_lag)
|
||||
* @param index current subframe index
|
||||
*/
|
||||
static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
|
||||
Rate cur_rate, int pitch_lag, int index)
|
||||
enum Rate cur_rate, int pitch_lag, int index)
|
||||
{
|
||||
int temp, i, j;
|
||||
|
||||
memset(vector, 0, SUBFRAME_LEN * sizeof(int16_t));
|
||||
memset(vector, 0, SUBFRAME_LEN * sizeof(*vector));
|
||||
|
||||
if (cur_rate == Rate6k3) {
|
||||
if (cur_rate == RATE_6300) {
|
||||
if (subfrm.pulse_pos >= max_pos[index])
|
||||
return;
|
||||
|
||||
@ -495,7 +501,7 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
|
||||
}
|
||||
if (subfrm.dirac_train == 1)
|
||||
gen_dirac_train(vector, pitch_lag);
|
||||
} else { /* Rate5k3 */
|
||||
} else { /* 5300 bps */
|
||||
int cb_gain = fixed_cb_gain[subfrm.amp_index];
|
||||
int cb_shift = subfrm.grid_index;
|
||||
int cb_sign = subfrm.pulse_sign;
|
||||
@ -554,7 +560,7 @@ static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
|
||||
get_residual(residual, prev_excitation, lag);
|
||||
|
||||
/* Select quantization table */
|
||||
if (cur_rate == Rate6k3 && pitch_lag < SUBFRAME_LEN - 2) {
|
||||
if (cur_rate == RATE_6300 && pitch_lag < SUBFRAME_LEN - 2) {
|
||||
cb_ptr = adaptive_cb_gain85;
|
||||
} else
|
||||
cb_ptr = adaptive_cb_gain170;
|
||||
@ -608,7 +614,7 @@ static int autocorr_max(G723_1_Context *p, int offset, int *ccr_max,
|
||||
* @param ccr cross-correlation
|
||||
* @param res_eng residual energy
|
||||
*/
|
||||
static void comp_ppf_gains(int lag, PPFParam *ppf, Rate cur_rate,
|
||||
static void comp_ppf_gains(int lag, PPFParam *ppf, enum Rate cur_rate,
|
||||
int tgt_eng, int ccr, int res_eng)
|
||||
{
|
||||
int pf_residual; /* square of postfiltered residual */
|
||||
@ -657,7 +663,7 @@ static void comp_ppf_gains(int lag, PPFParam *ppf, Rate cur_rate,
|
||||
* @param cur_rate current bitrate
|
||||
*/
|
||||
static void comp_ppf_coeff(G723_1_Context *p, int offset, int pitch_lag,
|
||||
PPFParam *ppf, Rate cur_rate)
|
||||
PPFParam *ppf, enum Rate cur_rate)
|
||||
{
|
||||
|
||||
int16_t scale;
|
||||
@ -795,15 +801,15 @@ static void residual_interp(int16_t *buf, int16_t *out, int lag,
|
||||
/* Attenuate */
|
||||
for (i = 0; i < lag; i++)
|
||||
vector_ptr[i - lag] = vector_ptr[i - lag] * 3 >> 2;
|
||||
av_memcpy_backptr((uint8_t*)vector_ptr, lag * sizeof(int16_t),
|
||||
FRAME_LEN * sizeof(int16_t));
|
||||
memcpy(out, vector_ptr, FRAME_LEN * sizeof(int16_t));
|
||||
av_memcpy_backptr((uint8_t*)vector_ptr, lag * sizeof(*vector_ptr),
|
||||
FRAME_LEN * sizeof(*vector_ptr));
|
||||
memcpy(out, vector_ptr, FRAME_LEN * sizeof(*vector_ptr));
|
||||
} else { /* Unvoiced */
|
||||
for (i = 0; i < FRAME_LEN; i++) {
|
||||
*rseed = *rseed * 521 + 259;
|
||||
out[i] = gain * *rseed >> 15;
|
||||
}
|
||||
memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(int16_t));
|
||||
memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf));
|
||||
}
|
||||
}
|
||||
|
||||
@ -889,8 +895,8 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)
|
||||
int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr;
|
||||
int i, j, k;
|
||||
|
||||
memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(int16_t));
|
||||
memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(int));
|
||||
memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf));
|
||||
memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal));
|
||||
|
||||
for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) {
|
||||
for (k = 0; k < LPC_ORDER; k++) {
|
||||
@ -977,8 +983,8 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
if (unpack_bitstream(p, buf, buf_size) < 0) {
|
||||
bad_frame = 1;
|
||||
p->cur_frame_type = p->past_frame_type == ActiveFrame ?
|
||||
ActiveFrame : UntransmittedFrame;
|
||||
p->cur_frame_type = p->past_frame_type == ACTIVE_FRAME ?
|
||||
ACTIVE_FRAME : UNTRANSMITTED_FRAME;
|
||||
}
|
||||
|
||||
p->frame.nb_samples = FRAME_LEN + LPC_ORDER;
|
||||
@ -989,20 +995,21 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
out= (int16_t*)p->frame.data[0];
|
||||
|
||||
|
||||
if(p->cur_frame_type == ActiveFrame) {
|
||||
if (!bad_frame) {
|
||||
if(p->cur_frame_type == ACTIVE_FRAME) {
|
||||
if (!bad_frame)
|
||||
p->erased_frames = 0;
|
||||
} else if(p->erased_frames != 3)
|
||||
else if(p->erased_frames != 3)
|
||||
p->erased_frames++;
|
||||
|
||||
inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, bad_frame);
|
||||
lsp_interpolate(lpc, cur_lsp, p->prev_lsp);
|
||||
|
||||
/* Save the lsp_vector for the next frame */
|
||||
memcpy(p->prev_lsp, cur_lsp, LPC_ORDER * sizeof(int16_t));
|
||||
memcpy(p->prev_lsp, cur_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
|
||||
|
||||
/* Generate the excitation for the frame */
|
||||
memcpy(p->excitation, p->prev_excitation, PITCH_MAX * sizeof(int16_t));
|
||||
memcpy(p->excitation, p->prev_excitation,
|
||||
PITCH_MAX * sizeof(*p->excitation));
|
||||
vector_ptr = p->excitation + PITCH_MAX;
|
||||
if (!p->erased_frames) {
|
||||
/* Update interpolation gain memory */
|
||||
@ -1118,7 +1125,7 @@ static av_cold int g723_1_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (avctx->bit_rate == 6300) {
|
||||
p->cur_rate = Rate6k3;
|
||||
p->cur_rate = RATE_6300;
|
||||
} else if (avctx->bit_rate == 5300) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Bitrate not supported yet, use 6.3k\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
@ -2041,7 +2048,7 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size)
|
||||
|
||||
init_put_bits(&pb, frame, size);
|
||||
|
||||
if (p->cur_rate == Rate6k3) {
|
||||
if (p->cur_rate == RATE_6300) {
|
||||
info_bits = 0;
|
||||
put_bits(&pb, 2, info_bits);
|
||||
}
|
||||
@ -2059,7 +2066,7 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size)
|
||||
for (i = 0; i < SUBFRAMES; i++) {
|
||||
temp = p->subframe[i].ad_cb_gain * GAIN_LEVELS +
|
||||
p->subframe[i].amp_index;
|
||||
if (p->cur_rate == Rate6k3)
|
||||
if (p->cur_rate == RATE_6300)
|
||||
temp += p->subframe[i].dirac_train << 11;
|
||||
put_bits(&pb, 12, temp);
|
||||
}
|
||||
@ -2069,7 +2076,7 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size)
|
||||
put_bits(&pb, 1, p->subframe[2].grid_index);
|
||||
put_bits(&pb, 1, p->subframe[3].grid_index);
|
||||
|
||||
if (p->cur_rate == Rate6k3) {
|
||||
if (p->cur_rate == RATE_6300) {
|
||||
skip_put_bits(&pb, 1); /* reserved bit */
|
||||
|
||||
/* Write 13 bit combined position index */
|
||||
@ -2192,7 +2199,7 @@ static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
|
||||
/* Reconstruct the excitation */
|
||||
gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[i >> 1],
|
||||
p->subframe[i], Rate6k3);
|
||||
p->subframe[i], RATE_6300);
|
||||
|
||||
memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN,
|
||||
sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN));
|
||||
|
@ -25,8 +25,8 @@
|
||||
* G723.1 compatible decoder data tables
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_G729_DATA_H
|
||||
#define AVCODEC_G729_DATA_H
|
||||
#ifndef AVCODEC_G729_1_DATA_H
|
||||
#define AVCODEC_G729_1_DATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -49,23 +49,23 @@
|
||||
/**
|
||||
* G723.1 frame types
|
||||
*/
|
||||
typedef enum {
|
||||
ActiveFrame, ///< Active speech
|
||||
SIDFrame, ///< Silence Insertion Descriptor frame
|
||||
UntransmittedFrame
|
||||
typedef enum FrameType {
|
||||
ACTIVE_FRAME, ///< Active speech
|
||||
SID_FRAME, ///< Silence Insertion Descriptor frame
|
||||
UNTRANSMITTED_FRAME
|
||||
} FrameType;
|
||||
|
||||
static const uint8_t frame_size[4] = {24, 20, 4, 1};
|
||||
|
||||
typedef enum {
|
||||
Rate6k3,
|
||||
Rate5k3
|
||||
typedef enum Rate {
|
||||
RATE_6300,
|
||||
RATE_5300
|
||||
} Rate;
|
||||
|
||||
/**
|
||||
* G723.1 unpacked data subframe
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct G723_1_Subframe {
|
||||
int ad_cb_lag; ///< adaptive codebook lag
|
||||
int ad_cb_gain;
|
||||
int dirac_train;
|
||||
@ -1319,4 +1319,4 @@ static const int16_t percept_flt_tbl[2][LPC_ORDER] = {
|
||||
{16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32}
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_G729_DATA_H */
|
||||
#endif /* AVCODEC_G729_1_DATA_H */
|
||||
|
@ -20,19 +20,20 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* JPEG 2000 decoder using libopenjpeg
|
||||
*/
|
||||
* @file
|
||||
* JPEG 2000 decoder using libopenjpeg
|
||||
*/
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "thread.h"
|
||||
#define OPJ_STATIC
|
||||
#include <openjpeg.h>
|
||||
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "thread.h"
|
||||
|
||||
#define JP2_SIG_TYPE 0x6A502020
|
||||
#define JP2_SIG_VALUE 0x0D0A870A
|
||||
|
||||
@ -61,7 +62,8 @@ typedef struct {
|
||||
int lowqual;
|
||||
} LibOpenJPEGContext;
|
||||
|
||||
static inline int libopenjpeg_matches_pix_fmt(const opj_image_t *image, enum PixelFormat pix_fmt){
|
||||
static inline int libopenjpeg_matches_pix_fmt(const opj_image_t *image, enum PixelFormat pix_fmt)
|
||||
{
|
||||
AVPixFmtDescriptor descriptor = av_pix_fmt_descriptors[pix_fmt];
|
||||
int match = 1;
|
||||
|
||||
@ -129,7 +131,7 @@ static inline int libopenjpeg_ispacked(enum PixelFormat pix_fmt) {
|
||||
return 0;
|
||||
|
||||
component_plane = av_pix_fmt_descriptors[pix_fmt].comp[0].plane;
|
||||
for(i = 1; i < av_pix_fmt_descriptors[pix_fmt].nb_components; i++) {
|
||||
for (i = 1; i < av_pix_fmt_descriptors[pix_fmt].nb_components; i++) {
|
||||
if (component_plane != av_pix_fmt_descriptors[pix_fmt].comp[i].plane)
|
||||
return 0;
|
||||
}
|
||||
@ -139,11 +141,11 @@ static inline int libopenjpeg_ispacked(enum PixelFormat pix_fmt) {
|
||||
static inline void libopenjpeg_copy_to_packed8(AVFrame *picture, opj_image_t *image) {
|
||||
uint8_t *img_ptr;
|
||||
int index, x, y, c;
|
||||
for(y = 0; y < picture->height; y++) {
|
||||
for (y = 0; y < picture->height; y++) {
|
||||
index = y*picture->width;
|
||||
img_ptr = picture->data[0] + y*picture->linesize[0];
|
||||
for(x = 0; x < picture->width; x++, index++) {
|
||||
for(c = 0; c < image->numcomps; c++) {
|
||||
for (x = 0; x < picture->width; x++, index++) {
|
||||
for (c = 0; c < image->numcomps; c++) {
|
||||
*img_ptr++ = image->comps[c].data[index];
|
||||
}
|
||||
}
|
||||
@ -154,9 +156,9 @@ static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *i
|
||||
uint16_t *img_ptr;
|
||||
int index, x, y, c;
|
||||
int adjust[4];
|
||||
for (x = 0; x < image->numcomps; x++) {
|
||||
for (x = 0; x < image->numcomps; x++)
|
||||
adjust[x] = FFMAX(FFMIN(16 - image->comps[x].prec, 8), 0);
|
||||
}
|
||||
|
||||
for (y = 0; y < picture->height; y++) {
|
||||
index = y*picture->width;
|
||||
img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]);
|
||||
@ -173,11 +175,11 @@ static inline void libopenjpeg_copyto8(AVFrame *picture, opj_image_t *image) {
|
||||
uint8_t *img_ptr;
|
||||
int index, x, y;
|
||||
|
||||
for(index = 0; index < image->numcomps; index++) {
|
||||
for (index = 0; index < image->numcomps; index++) {
|
||||
comp_data = image->comps[index].data;
|
||||
for(y = 0; y < image->comps[index].h; y++) {
|
||||
for (y = 0; y < image->comps[index].h; y++) {
|
||||
img_ptr = picture->data[index] + y * picture->linesize[index];
|
||||
for(x = 0; x < image->comps[index].w; x++) {
|
||||
for (x = 0; x < image->comps[index].w; x++) {
|
||||
*img_ptr = (uint8_t) *comp_data;
|
||||
img_ptr++;
|
||||
comp_data++;
|
||||
@ -190,11 +192,11 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {
|
||||
int *comp_data;
|
||||
uint16_t *img_ptr;
|
||||
int index, x, y;
|
||||
for(index = 0; index < image->numcomps; index++) {
|
||||
for (index = 0; index < image->numcomps; index++) {
|
||||
comp_data = image->comps[index].data;
|
||||
for(y = 0; y < image->comps[index].h; y++) {
|
||||
for (y = 0; y < image->comps[index].h; y++) {
|
||||
img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]);
|
||||
for(x = 0; x < image->comps[index].w; x++) {
|
||||
for (x = 0; x < image->comps[index].w; x++) {
|
||||
*img_ptr = *comp_data;
|
||||
img_ptr++;
|
||||
comp_data++;
|
||||
@ -240,19 +242,19 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
||||
*data_size = 0;
|
||||
|
||||
// Check if input is a raw jpeg2k codestream or in jp2 wrapping
|
||||
if((AV_RB32(buf) == 12) &&
|
||||
if ((AV_RB32(buf) == 12) &&
|
||||
(AV_RB32(buf + 4) == JP2_SIG_TYPE) &&
|
||||
(AV_RB32(buf + 8) == JP2_SIG_VALUE)) {
|
||||
dec = opj_create_decompress(CODEC_JP2);
|
||||
} else {
|
||||
// If the AVPacket contains a jp2c box, then skip to
|
||||
// the starting byte of the codestream.
|
||||
/* If the AVPacket contains a jp2c box, then skip to
|
||||
* the starting byte of the codestream. */
|
||||
if (AV_RB32(buf + 4) == AV_RB32("jp2c"))
|
||||
buf += 8;
|
||||
dec = opj_create_decompress(CODEC_J2K);
|
||||
}
|
||||
|
||||
if(!dec) {
|
||||
if (!dec) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
|
||||
return -1;
|
||||
}
|
||||
@ -262,27 +264,33 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
||||
// Tie decoder with decoding parameters
|
||||
opj_setup_decoder(dec, &ctx->dec_params);
|
||||
stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
|
||||
if(!stream) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Codestream could not be opened for reading.\n");
|
||||
|
||||
if (!stream) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Codestream could not be opened for reading.\n");
|
||||
opj_destroy_decompress(dec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Decode the header only
|
||||
// Decode the header only.
|
||||
image = opj_decode_with_info(dec, stream, NULL);
|
||||
opj_cio_close(stream);
|
||||
if(!image) {
|
||||
|
||||
if (!image) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
||||
opj_destroy_decompress(dec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
width = image->x1 - image->x0;
|
||||
height = image->y1 - image->y0;
|
||||
|
||||
if(av_image_check_size(width, height, 0, avctx) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
|
||||
if (av_image_check_size(width, height, 0, avctx) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"%dx%d dimension invalid.\n", width, height);
|
||||
goto done;
|
||||
}
|
||||
|
||||
avcodec_set_dimensions(avctx, width, height);
|
||||
|
||||
if (avctx->pix_fmt != PIX_FMT_NONE) {
|
||||
@ -303,29 +311,30 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
||||
if (image->comps[i].prec > avctx->bits_per_raw_sample)
|
||||
avctx->bits_per_raw_sample = image->comps[i].prec;
|
||||
|
||||
if(picture->data[0])
|
||||
if (picture->data[0])
|
||||
ff_thread_release_buffer(avctx, picture);
|
||||
|
||||
if(ff_thread_get_buffer(avctx, picture) < 0){
|
||||
if (ff_thread_get_buffer(avctx, picture) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
|
||||
ctx->dec_params.cp_reduce = avctx->lowres;
|
||||
// Tie decoder with decoding parameters
|
||||
// Tie decoder with decoding parameters.
|
||||
opj_setup_decoder(dec, &ctx->dec_params);
|
||||
stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
|
||||
if(!stream) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Codestream could not be opened for reading.\n");
|
||||
if (!stream) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Codestream could not be opened for reading.\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
opj_image_destroy(image);
|
||||
// Decode the codestream
|
||||
// Decode the codestream.
|
||||
image = opj_decode_with_info(dec, stream, NULL);
|
||||
opj_cio_close(stream);
|
||||
if(!image) {
|
||||
if (!image) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
||||
goto done;
|
||||
}
|
||||
@ -379,9 +388,9 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
LibOpenJPEGContext *ctx = avctx->priv_data;
|
||||
|
||||
if(ctx->image.data[0])
|
||||
if (ctx->image.data[0])
|
||||
ff_thread_release_buffer(avctx, &ctx->image);
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
|
||||
|
@ -20,18 +20,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* JPEG 2000 encoder using libopenjpeg
|
||||
*/
|
||||
* @file
|
||||
* JPEG 2000 encoder using libopenjpeg
|
||||
*/
|
||||
|
||||
#define OPJ_STATIC
|
||||
#include <openjpeg.h>
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct {
|
||||
@ -284,11 +284,10 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram
|
||||
for (y = 0; y < height; ++y) {
|
||||
image_index = y * width;
|
||||
frame_index = y * frame->linesize[compno];
|
||||
for (x = 0; x < width; ++x) {
|
||||
for (x = 0; x < width; ++x)
|
||||
image->comps[compno].data[image_index++] = frame->data[compno][frame_index++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -319,11 +318,10 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra
|
||||
for (y = 0; y < height; ++y) {
|
||||
image_index = y * width;
|
||||
frame_index = y * (frame->linesize[compno] / 2);
|
||||
for (x = 0; x < width; ++x) {
|
||||
for (x = 0; x < width; ++x)
|
||||
image->comps[compno].data[image_index++] = frame_ptr[frame_index++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -432,7 +430,7 @@ static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
|
||||
opj_destroy_compress(ctx->compress);
|
||||
opj_image_destroy(ctx->image);
|
||||
av_freep(&avctx->coded_frame);
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
|
||||
@ -480,7 +478,7 @@ AVCodec ff_libopenjpeg_encoder = {
|
||||
.encode2 = libopenjpeg_encode_frame,
|
||||
.close = libopenjpeg_encode_close,
|
||||
.capabilities = 0,
|
||||
.pix_fmts = (const enum PixelFormat[]){
|
||||
.pix_fmts = (const enum PixelFormat[]) {
|
||||
PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_RGB48, PIX_FMT_RGBA64,
|
||||
PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16,
|
||||
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUVA420P,
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 54
|
||||
#define LIBAVCODEC_VERSION_MINOR 43
|
||||
#define LIBAVCODEC_VERSION_MINOR 44
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
@ -133,10 +133,10 @@ AVFilter avfilter_af_aformat = {
|
||||
.query_formats = query_formats,
|
||||
.priv_size = sizeof(AFormatContext),
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO, },
|
||||
{ .name = NULL}},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO},
|
||||
{ .name = NULL}},
|
||||
};
|
||||
|
@ -392,12 +392,12 @@ AVFilter avfilter_af_channelmap = {
|
||||
.query_formats = channelmap_query_formats,
|
||||
.priv_size = sizeof(ChannelMapContext),
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.filter_samples = channelmap_filter_samples,
|
||||
.config_props = channelmap_config_input },
|
||||
{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO },
|
||||
{ .name = NULL }},
|
||||
};
|
||||
|
@ -149,13 +149,13 @@ AVFilter avfilter_vsink_buffer = {
|
||||
.priv_size = sizeof(BufferSinkContext),
|
||||
.uninit = uninit,
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.start_frame = start_frame,
|
||||
.min_perms = AV_PERM_READ,
|
||||
.needs_fifo = 1 },
|
||||
{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
|
||||
};
|
||||
|
||||
AVFilter avfilter_asink_abuffer = {
|
||||
@ -164,11 +164,11 @@ AVFilter avfilter_asink_abuffer = {
|
||||
.priv_size = sizeof(BufferSinkContext),
|
||||
.uninit = uninit,
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.filter_samples = filter_samples,
|
||||
.min_perms = AV_PERM_READ,
|
||||
.needs_fifo = 1 },
|
||||
{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
|
||||
};
|
||||
|
@ -416,8 +416,8 @@ AVFilter avfilter_vsrc_buffer = {
|
||||
.init = init_video,
|
||||
.uninit = uninit,
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.request_frame = request_frame,
|
||||
.poll_frame = poll_frame,
|
||||
@ -434,8 +434,8 @@ AVFilter avfilter_asrc_abuffer = {
|
||||
.init = init_audio,
|
||||
.uninit = uninit,
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = NULL }},
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.request_frame = request_frame,
|
||||
.poll_frame = poll_frame,
|
||||
|
@ -292,13 +292,13 @@ AVFilter avfilter_af_afifo = {
|
||||
|
||||
.priv_size = sizeof(FifoContext),
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.get_audio_buffer = ff_null_get_audio_buffer,
|
||||
.filter_samples = add_to_queue,
|
||||
.rej_perms = AV_PERM_REUSE2, },
|
||||
{ .name = NULL}},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.request_frame = request_frame, },
|
||||
{ .name = NULL}},
|
||||
|
@ -105,7 +105,7 @@ AVFilter avfilter_vf_split = {
|
||||
.draw_slice = draw_slice,
|
||||
.end_frame = end_frame, },
|
||||
{ .name = NULL}},
|
||||
.outputs = (AVFilterPad[]) {{ .name = NULL}},
|
||||
.outputs = (const AVFilterPad[]) {{ .name = NULL}},
|
||||
};
|
||||
|
||||
static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
|
||||
|
@ -260,13 +260,13 @@ AVFilter avfilter_vf_fps = {
|
||||
|
||||
.priv_size = sizeof(FPSContext),
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.start_frame = null_start_frame,
|
||||
.draw_slice = null_draw_slice,
|
||||
.end_frame = end_frame, },
|
||||
{ .name = NULL}},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.request_frame = request_frame,
|
||||
.config_props = config_props},
|
||||
|
@ -335,6 +335,19 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
|
||||
ff_draw_slice(outlink, y, h, slice_dir);
|
||||
}
|
||||
|
||||
static const AVFilterPad inputs[] = {
|
||||
{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.draw_slice = draw_slice,
|
||||
.config_props = config_props,
|
||||
.min_perms = AV_PERM_READ, },
|
||||
{ .name = NULL}
|
||||
};
|
||||
static const AVFilterPad outputs[] = {
|
||||
{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO, },
|
||||
{ .name = NULL}
|
||||
};
|
||||
#define DEFINE_LUT_FILTER(name_, description_, init_) \
|
||||
AVFilter avfilter_vf_##name_ = { \
|
||||
.name = #name_, \
|
||||
@ -345,15 +358,8 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
|
||||
.uninit = uninit, \
|
||||
.query_formats = query_formats, \
|
||||
\
|
||||
.inputs = (const AVFilterPad[]) {{ .name = "default", \
|
||||
.type = AVMEDIA_TYPE_VIDEO, \
|
||||
.draw_slice = draw_slice, \
|
||||
.config_props = config_props, \
|
||||
.min_perms = AV_PERM_READ, }, \
|
||||
{ .name = NULL}}, \
|
||||
.outputs = (const AVFilterPad[]) {{ .name = "default", \
|
||||
.type = AVMEDIA_TYPE_VIDEO, }, \
|
||||
{ .name = NULL}}, \
|
||||
.inputs = inputs, \
|
||||
.outputs = outputs, \
|
||||
}
|
||||
|
||||
#if CONFIG_LUT_FILTER
|
||||
|
@ -134,9 +134,8 @@ static void filter(AVFilterContext *ctx, AVFilterBufferRef *dstpic,
|
||||
}
|
||||
}
|
||||
}
|
||||
#if HAVE_MMX
|
||||
__asm__ volatile("emms \n\t" : : : "memory");
|
||||
#endif
|
||||
|
||||
emms_c();
|
||||
}
|
||||
|
||||
static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h)
|
||||
|
@ -24,10 +24,11 @@
|
||||
* G.723.1 demuxer
|
||||
*/
|
||||
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
|
||||
static const uint8_t frame_size[4] = {24, 20, 4, 1};
|
||||
static const uint8_t frame_size[4] = { 24, 20, 4, 1 };
|
||||
|
||||
static int g723_1_init(AVFormatContext *s)
|
||||
{
|
||||
@ -39,10 +40,12 @@ static int g723_1_init(AVFormatContext *s)
|
||||
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codec->codec_id = CODEC_ID_G723_1;
|
||||
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
st->codec->channels = 1;
|
||||
st->codec->sample_rate = 8000;
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
|
||||
st->start_time = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "libavutil/avutil.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 54
|
||||
#define LIBAVFORMAT_VERSION_MINOR 18
|
||||
#define LIBAVFORMAT_VERSION_MINOR 19
|
||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user