Commit ef74ab20 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (34 commits)
  dpcm: return error if packet is too small
  dpcm: use smaller data types for static tables
  dpcm: use sol_table_16 directly instead of through the DPCMContext.
  dpcm: replace short with int16_t
  dpcm: check to make sure channels is 1 or 2.
  dpcm: misc pretty-printing
  dpcm: remove unnecessary variable by using bytestream functions.
  dpcm: move codec-specific variable declarations to their corresponding decoding blocks.
  dpcm: consistently use the variable name 'n' for the next input byte.
  dpcm: output AV_SAMPLE_FMT_U8 for Sol DPCM subcodecs 1 and 2.
  dpcm: calculate and check actual output data size prior to decoding.
  dpcm: factor out the stereo flag calculation
  dpcm: cosmetics: rename channel_number to ch
  avserver: Fix a bug where the socket is IPv4, but IPv6 is autoselected for the loopback address.
  lavf: Avoid using av_malloc(0) in av_dump_format
  dxva2_h264: pass the correct 8x8 scaling lists
  dca: NEON optimised high freq VQ decoding
  avcodec: reject audio packets with NULL data and non-zero size
  dxva: Add ability to enable workaround for older ATI cards
  latmenc: Set latmBufferFullness to largest value to indicate it is not used
  ...

Conflicts:
	libavcodec/dxva2_h264.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5ca5d432 08bd22a6
......@@ -522,6 +522,7 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
tmp = 1;
setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
my_addr->sin_family = AF_INET;
if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
char bindmsg[32];
snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));
......
This diff is collapsed.
......@@ -32,13 +32,7 @@
* Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
* by Mike Melanson (melanson@pcisys.net)
*
* Reference documents:
* http://www.pcisys.net/~melanson/codecs/simpleaudio.html
* http://www.geocities.com/SiliconValley/8682/aud3.txt
* http://openquicktime.sourceforge.net/plugins.htm
* XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html
* http://www.cs.ucla.edu/~leec/mediabench/applications.html
* SoX source code http://home.sprynet.com/~cbagwell/sox.html
* See ADPCM decoder reference documents for codec information.
*/
typedef struct TrellisPath {
......
/*
* Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
*
* 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_ARM_DCA_H
#define AVCODEC_ARM_DCA_H
#include <stdint.h>
#include "config.h"
#if HAVE_NEON && HAVE_INLINE_ASM
#define int8x8_fmul_int32 int8x8_fmul_int32
static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
{
__asm__ ("vcvt.f32.s32 %2, %2, #4 \n"
"vld1.8 {d0}, [%1,:64] \n"
"vmovl.s8 q0, d0 \n"
"vmovl.s16 q1, d1 \n"
"vmovl.s16 q0, d0 \n"
"vcvt.f32.s32 q0, q0 \n"
"vcvt.f32.s32 q1, q1 \n"
"vmul.f32 q0, q0, %y2 \n"
"vmul.f32 q1, q1, %y2 \n"
"vst1.32 {q0-q1}, [%m0,:128] \n"
: "=Um"(*(float (*)[8])dst)
: "r"(src), "x"(scale)
: "d0", "d1", "d2", "d3");
}
#endif
#endif /* AVCODEC_ARM_DCA_H */
......@@ -42,6 +42,10 @@
#include "dcadsp.h"
#include "fmtconvert.h"
#if ARCH_ARM
# include "arm/dca.h"
#endif
//#define TRACE
#define DCA_PRIM_CHANNELS_MAX (7)
......@@ -320,7 +324,7 @@ typedef struct {
int lfe_scale_factor;
/* Subband samples history (for ADPCM) */
float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
DECLARE_ALIGNED(16, float, subband_samples_hist)[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
int hist_index[DCA_PRIM_CHANNELS_MAX];
......@@ -1057,6 +1061,16 @@ static int decode_blockcode(int code, int levels, int *values)
static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 };
static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
#ifndef int8x8_fmul_int32
static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
{
float fscale = scale / 16.0;
int i;
for (i = 0; i < 8; i++)
dst[i] = src[i] * fscale;
}
#endif
static int dca_subsubframe(DCAContext * s, int base_channel, int block_index)
{
int k, l;
......@@ -1161,19 +1175,16 @@ static int dca_subsubframe(DCAContext * s, int base_channel, int block_index)
for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
/* 1 vector -> 32 samples but we only need the 8 samples
* for this subsubframe. */
int m;
int hfvq = s->high_freq_vq[k][l];
if (!s->debug_flag & 0x01) {
av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n");
s->debug_flag |= 0x01;
}
for (m = 0; m < 8; m++) {
subband_samples[k][l][m] =
high_freq_vq[s->high_freq_vq[k][l]][subsubframe * 8 +
m]
* (float) s->scale_factor[k][l][0] / 16.0;
}
int8x8_fmul_int32(subband_samples[k][l],
&high_freq_vq[hfvq][subsubframe * 8],
s->scale_factor[k][l][0]);
}
}
......
......@@ -4224,7 +4224,7 @@ static const float lossless_quant_d[32] = {
/* Vector quantization tables */
static const int8_t high_freq_vq[1024][32] =
DECLARE_ALIGNED(8, static const int8_t, high_freq_vq)[1024][32] =
{
{ 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 },
......
This diff is collapsed.
......@@ -162,18 +162,18 @@ static void fill_scaling_lists(struct dxva_context *ctx, const H264Context *h, D
for (j = 0; j < 16; j++)
qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][j];
for (j = 0; j < 64; j++) {
qm->bScalingLists8x8[0][j] = h->pps.scaling_matrix8[0][j];
qm->bScalingLists8x8[1][j] = h->pps.scaling_matrix8[3][j];
for (i = 0; i < 64; i++) {
qm->bScalingLists8x8[0][i] = h->pps.scaling_matrix8[0][i];
qm->bScalingLists8x8[1][i] = h->pps.scaling_matrix8[3][i];
}
} else {
for (i = 0; i < 6; i++)
for (j = 0; j < 16; j++)
qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][zigzag_scan[j]];
for (j = 0; j < 64; j++) {
qm->bScalingLists8x8[0][j] = h->pps.scaling_matrix8[0][ff_zigzag_direct[j]];
qm->bScalingLists8x8[1][j] = h->pps.scaling_matrix8[3][ff_zigzag_direct[j]];
for (i = 0; i < 64; i++) {
qm->bScalingLists8x8[0][i] = h->pps.scaling_matrix8[0][ff_zigzag_direct[i]];
qm->bScalingLists8x8[1][i] = h->pps.scaling_matrix8[3][ff_zigzag_direct[i]];
}
}
}
......
......@@ -427,13 +427,13 @@ static inline void decode_ac_coeffs(GetBitContext *gb, DCTELEM *out,
lev_cb_index = lev_to_cb_index[FFMIN(level, 9)];
bits_left = get_bits_left(gb);
if (bits_left <= 8 && !show_bits(gb, bits_left))
if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
return;
run = decode_vlc_codeword(gb, ac_codebook[run_cb_index]);
bits_left = get_bits_left(gb);
if (bits_left <= 8 && !show_bits(gb, bits_left))
if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
return;
level = decode_vlc_codeword(gb, ac_codebook[lev_cb_index]) + 1;
......
......@@ -823,6 +823,11 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
avctx->pkt = avpkt;
if (!avpkt->data && avpkt->size) {
av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
return AVERROR(EINVAL);
}
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
//FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
......
......@@ -120,7 +120,7 @@ static int latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
}
put_bits(bs, 3, 0); /* frameLengthType */
put_bits(bs, 8, 0); /* latmBufferFullness */
put_bits(bs, 8, 0xff); /* latmBufferFullness */
put_bits(bs, 1, 0); /* otherDataPresent */
put_bits(bs, 1, 0); /* crcCheckPresent */
......
......@@ -49,6 +49,10 @@ static int check_pes(uint8_t *p, uint8_t *end){
return pes1||pes2;
}
static int check_pack_header(const uint8_t *buf) {
return (buf[1] & 0xC0) == 0x40 || (buf[1] & 0xF0) == 0x20;
}
static int mpegps_probe(AVProbeData *p)
{
uint32_t code= -1;
......@@ -61,9 +65,10 @@ static int mpegps_probe(AVProbeData *p)
if ((code & 0xffffff00) == 0x100) {
int len= p->buf[i+1] << 8 | p->buf[i+2];
int pes= check_pes(p->buf+i, p->buf+p->buf_size);
int pack = check_pack_header(p->buf+i);
if(code == SYSTEM_HEADER_START_CODE) sys++;
else if(code == PACK_START_CODE) pspack++;
else if(code == PACK_START_CODE && pack) pspack++;
else if((code & 0xf0) == VIDEO_ID && pes) vid++;
// skip pes payload to avoid start code emulation for private
// and audio streams
......
......@@ -3535,7 +3535,7 @@ void av_dump_format(AVFormatContext *ic,
int is_output)
{
int i;
uint8_t *printed = av_mallocz(ic->nb_streams);
uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
if (ic->nb_streams && !printed)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment