mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
Merge remote branch 'qatar/master'
* qatar/master: psymodel: extend API to include PE and bit allocation. avio: always compile dyn_buf functions Remove unnecessary parameter from ff_thread_init() and fix behavior Revert "aac_latm_dec: use aac context and aac m4ac" configure: tell user if libva is enabled like the rest of external libs. Add silence support for AV_SAMPLE_FMT_U8. avio: make URL_PROTOCOL_FLAG_NESTED_SCHEME internal avio: deprecate av_url_read_seek avio: deprecate av_url_read_pause ac3enc: NEON optimised extract_exponents Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
11d78415ca
1
configure
vendored
1
configure
vendored
@ -3171,6 +3171,7 @@ echo "librtmp enabled ${librtmp-no}"
|
|||||||
echo "libschroedinger enabled ${libschroedinger-no}"
|
echo "libschroedinger enabled ${libschroedinger-no}"
|
||||||
echo "libspeex enabled ${libspeex-no}"
|
echo "libspeex enabled ${libspeex-no}"
|
||||||
echo "libtheora enabled ${libtheora-no}"
|
echo "libtheora enabled ${libtheora-no}"
|
||||||
|
echo "libva enabled ${vaapi-no}"
|
||||||
echo "libvorbis enabled ${libvorbis-no}"
|
echo "libvorbis enabled ${libvorbis-no}"
|
||||||
echo "libvpx enabled ${libvpx-no}"
|
echo "libvpx enabled ${libvpx-no}"
|
||||||
echo "libx264 enabled ${libx264-no}"
|
echo "libx264 enabled ${libx264-no}"
|
||||||
|
10
ffmpeg.c
10
ffmpeg.c
@ -1475,6 +1475,14 @@ static void print_report(AVFormatContext **output_files,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
|
||||||
|
{
|
||||||
|
int fill_char = 0x00;
|
||||||
|
if (sample_fmt == AV_SAMPLE_FMT_U8)
|
||||||
|
fill_char = 0x80;
|
||||||
|
memset(buf, fill_char, size);
|
||||||
|
}
|
||||||
|
|
||||||
/* pkt = NULL means EOF (needed to flush decoder buffers) */
|
/* pkt = NULL means EOF (needed to flush decoder buffers) */
|
||||||
static int output_packet(AVInputStream *ist, int ist_index,
|
static int output_packet(AVInputStream *ist, int ist_index,
|
||||||
AVOutputStream **ost_table, int nb_ostreams,
|
AVOutputStream **ost_table, int nb_ostreams,
|
||||||
@ -1826,7 +1834,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
|
|||||||
int frame_bytes = enc->frame_size*osize*enc->channels;
|
int frame_bytes = enc->frame_size*osize*enc->channels;
|
||||||
if (allocated_audio_buf_size < frame_bytes)
|
if (allocated_audio_buf_size < frame_bytes)
|
||||||
ffmpeg_exit(1);
|
ffmpeg_exit(1);
|
||||||
memset(audio_buf+fifo_bytes, 0, frame_bytes - fifo_bytes);
|
generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);
|
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);
|
||||||
|
@ -2266,6 +2266,7 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
|
|||||||
GetBitContext *gb)
|
GetBitContext *gb)
|
||||||
{
|
{
|
||||||
AVCodecContext *avctx = latmctx->aac_ctx.avctx;
|
AVCodecContext *avctx = latmctx->aac_ctx.avctx;
|
||||||
|
MPEG4AudioConfig m4ac;
|
||||||
int config_start_bit = get_bits_count(gb);
|
int config_start_bit = get_bits_count(gb);
|
||||||
int bits_consumed, esize;
|
int bits_consumed, esize;
|
||||||
|
|
||||||
@ -2275,8 +2276,7 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
} else {
|
} else {
|
||||||
bits_consumed =
|
bits_consumed =
|
||||||
decode_audio_specific_config(&latmctx->aac_ctx, avctx,
|
decode_audio_specific_config(NULL, avctx, &m4ac,
|
||||||
&latmctx->aac_ctx.m4ac,
|
|
||||||
gb->buffer + (config_start_bit / 8),
|
gb->buffer + (config_start_bit / 8),
|
||||||
get_bits_left(gb) / 8);
|
get_bits_left(gb) / 8);
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ int ff_ac3_max_msb_abs_int16_neon(const int16_t *src, int len);
|
|||||||
void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift);
|
void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift);
|
||||||
void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
|
void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
|
||||||
void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
|
void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
|
||||||
|
void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
|
||||||
|
|
||||||
void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
|
void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
|
||||||
int start, int end,
|
int start, int end,
|
||||||
@ -50,5 +51,6 @@ av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
|
|||||||
c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon;
|
c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon;
|
||||||
c->ac3_rshift_int32 = ff_ac3_rshift_int32_neon;
|
c->ac3_rshift_int32 = ff_ac3_rshift_int32_neon;
|
||||||
c->float_to_fixed24 = ff_float_to_fixed24_neon;
|
c->float_to_fixed24 = ff_float_to_fixed24_neon;
|
||||||
|
c->extract_exponents = ff_ac3_extract_exponents_neon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,3 +92,23 @@ function ff_float_to_fixed24_neon, export=1
|
|||||||
bgt 1b
|
bgt 1b
|
||||||
bx lr
|
bx lr
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
function ff_ac3_extract_exponents_neon, export=1
|
||||||
|
vmov.i32 q14, #24
|
||||||
|
vmov.i32 q15, #8
|
||||||
|
1:
|
||||||
|
vld1.32 {q0}, [r1,:128]
|
||||||
|
vabs.s32 q1, q0
|
||||||
|
vclz.i32 q3, q1
|
||||||
|
vsub.i32 q3, q3, q15
|
||||||
|
vcge.s32 q2, q3, q14
|
||||||
|
vbit q3, q14, q2
|
||||||
|
vbic q0, q0, q2
|
||||||
|
vmovn.i32 d6, q3
|
||||||
|
vmovn.i16 d6, q3
|
||||||
|
vst1.32 {q0}, [r1,:128]!
|
||||||
|
vst1.32 {d6[0]}, [r0,:32]!
|
||||||
|
subs r2, r2, #4
|
||||||
|
bgt 1b
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
/** maximum possible number of bands */
|
/** maximum possible number of bands */
|
||||||
#define PSY_MAX_BANDS 128
|
#define PSY_MAX_BANDS 128
|
||||||
|
/** maximum number of channels */
|
||||||
|
#define PSY_MAX_CHANS 20
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* single band psychoacoustic information
|
* single band psychoacoustic information
|
||||||
@ -62,6 +64,13 @@ typedef struct FFPsyContext {
|
|||||||
int *num_bands; ///< number of scalefactor bands for possible frame sizes
|
int *num_bands; ///< number of scalefactor bands for possible frame sizes
|
||||||
int num_lens; ///< number of scalefactor band sets
|
int num_lens; ///< number of scalefactor band sets
|
||||||
|
|
||||||
|
float pe[PSY_MAX_CHANS]; ///< total PE for each channel in the frame
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int size; ///< size of the bitresevoir in bits
|
||||||
|
int bits; ///< number of bits used in the bitresevoir
|
||||||
|
} bitres;
|
||||||
|
|
||||||
void* model_priv_data; ///< psychoacoustic model implementation private data
|
void* model_priv_data; ///< psychoacoustic model implementation private data
|
||||||
} FFPsyContext;
|
} FFPsyContext;
|
||||||
|
|
||||||
|
@ -1337,7 +1337,6 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)
|
|||||||
int avcodec_thread_init(AVCodecContext *s, int thread_count)
|
int avcodec_thread_init(AVCodecContext *s, int thread_count)
|
||||||
{
|
{
|
||||||
s->thread_count = thread_count;
|
s->thread_count = thread_count;
|
||||||
s->thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE;
|
|
||||||
return ff_thread_init(s);
|
return ff_thread_init(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +388,7 @@ void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
|
|||||||
url_interrupt_cb = interrupt_cb;
|
url_interrupt_cb = interrupt_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_OLD_AVIO
|
||||||
int av_url_read_pause(URLContext *h, int pause)
|
int av_url_read_pause(URLContext *h, int pause)
|
||||||
{
|
{
|
||||||
if (!h->prot->url_read_pause)
|
if (!h->prot->url_read_pause)
|
||||||
@ -402,3 +403,4 @@ int64_t av_url_read_seek(URLContext *h,
|
|||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
return h->prot->url_read_seek(h, stream_index, timestamp, flags);
|
return h->prot->url_read_seek(h, stream_index, timestamp, flags);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -114,6 +114,9 @@ attribute_deprecated int64_t url_filesize(URLContext *h);
|
|||||||
attribute_deprecated int url_get_file_handle(URLContext *h);
|
attribute_deprecated int url_get_file_handle(URLContext *h);
|
||||||
attribute_deprecated int url_get_max_packet_size(URLContext *h);
|
attribute_deprecated int url_get_max_packet_size(URLContext *h);
|
||||||
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
|
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
|
||||||
|
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
|
||||||
|
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
|
||||||
|
int64_t timestamp, int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,36 +136,10 @@ void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
|
|||||||
#if FF_API_OLD_AVIO
|
#if FF_API_OLD_AVIO
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
|
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pause and resume playing - only meaningful if using a network streaming
|
|
||||||
* protocol (e.g. MMS).
|
|
||||||
* @param pause 1 for pause, 0 for resume
|
|
||||||
*/
|
|
||||||
int av_url_read_pause(URLContext *h, int pause);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to a given timestamp relative to some component stream.
|
|
||||||
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
|
||||||
* @param stream_index The stream index that the timestamp is relative to.
|
|
||||||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
|
||||||
* units from the beginning of the presentation.
|
|
||||||
* If a stream_index >= 0 is used and the protocol does not support
|
|
||||||
* seeking based on component streams, the call will fail with ENOTSUP.
|
|
||||||
* @param timestamp timestamp in AVStream.time_base units
|
|
||||||
* or if there is no stream specified then in AV_TIME_BASE units.
|
|
||||||
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
|
|
||||||
* and AVSEEK_FLAG_ANY. The protocol may silently ignore
|
|
||||||
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
|
|
||||||
* fail with ENOTSUP if used and not supported.
|
|
||||||
* @return >= 0 on success
|
|
||||||
* @see AVInputFormat::read_seek
|
|
||||||
*/
|
|
||||||
int64_t av_url_read_seek(URLContext *h, int stream_index,
|
|
||||||
int64_t timestamp, int flags);
|
|
||||||
|
|
||||||
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
|
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct URLProtocol {
|
typedef struct URLProtocol {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -66,7 +66,29 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
|
|||||||
/** @warning must be called before any I/O */
|
/** @warning must be called before any I/O */
|
||||||
int ffio_set_buf_size(AVIOContext *s, int buf_size);
|
int ffio_set_buf_size(AVIOContext *s, int buf_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause and resume playing - only meaningful if using a network streaming
|
||||||
|
* protocol (e.g. MMS).
|
||||||
|
* @param pause 1 for pause, 0 for resume
|
||||||
|
*/
|
||||||
int ffio_read_pause(AVIOContext *h, int pause);
|
int ffio_read_pause(AVIOContext *h, int pause);
|
||||||
|
/**
|
||||||
|
* Seek to a given timestamp relative to some component stream.
|
||||||
|
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
||||||
|
* @param stream_index The stream index that the timestamp is relative to.
|
||||||
|
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
||||||
|
* units from the beginning of the presentation.
|
||||||
|
* If a stream_index >= 0 is used and the protocol does not support
|
||||||
|
* seeking based on component streams, the call will fail with ENOTSUP.
|
||||||
|
* @param timestamp timestamp in AVStream.time_base units
|
||||||
|
* or if there is no stream specified then in AV_TIME_BASE units.
|
||||||
|
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
|
||||||
|
* and AVSEEK_FLAG_ANY. The protocol may silently ignore
|
||||||
|
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
|
||||||
|
* fail with ENOTSUP if used and not supported.
|
||||||
|
* @return >= 0 on success
|
||||||
|
* @see AVInputFormat::read_seek
|
||||||
|
*/
|
||||||
int64_t ffio_read_seek (AVIOContext *h, int stream_index,
|
int64_t ffio_read_seek (AVIOContext *h, int stream_index,
|
||||||
int64_t timestamp, int flags);
|
int64_t timestamp, int flags);
|
||||||
|
|
||||||
|
@ -1049,9 +1049,6 @@ int64_t ffio_read_seek(AVIOContext *s, int stream_index,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* avio_open_dyn_buf and avio_close_dyn_buf are used in rtp.c to send a response
|
|
||||||
* back to the server even if CONFIG_MUXERS is false. */
|
|
||||||
#if CONFIG_MUXERS || CONFIG_NETWORK
|
|
||||||
/* buffer handling */
|
/* buffer handling */
|
||||||
#if FF_API_OLD_AVIO
|
#if FF_API_OLD_AVIO
|
||||||
int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
|
int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
|
||||||
@ -1198,4 +1195,3 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
|||||||
av_free(s);
|
av_free(s);
|
||||||
return size - padding;
|
return size - padding;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
|
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
#define AVFORMAT_URL_H
|
#define AVFORMAT_URL_H
|
||||||
|
|
||||||
#include "avio.h"
|
#include "avio.h"
|
||||||
|
#include "libavformat/version.h"
|
||||||
|
|
||||||
|
#if !FF_API_OLD_AVIO
|
||||||
|
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a URLContext for accessing to the resource indicated by
|
* Create a URLContext for accessing to the resource indicated by
|
||||||
|
Loading…
x
Reference in New Issue
Block a user