You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpegvideo: drop unnecessary arguments to hpel_motion() mpegvideo: drop 'inline' from some functions nellymoserdec: drop support for s16 output. bmpdec: only initialize palette for pal8. build: Properly remove object files while cleaning flacdsp: arm optimised lpc filter compat/vsnprintf: return number of bytes required on truncation. Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -124,4 +124,7 @@ CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda
|
|||||||
DISTCLEANSUFFIXES = *.pc
|
DISTCLEANSUFFIXES = *.pc
|
||||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||||
|
|
||||||
|
clean::
|
||||||
|
$(RM) $(OBJS) $(OBJS:.o=.d)
|
||||||
|
|
||||||
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
|
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
|
||||||
|
@@ -8,6 +8,9 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
|
|||||||
|
|
||||||
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
|
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
|
||||||
|
|
||||||
|
OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
|
||||||
|
arm/flacdsp_arm.o \
|
||||||
|
|
||||||
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
|
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
|
||||||
ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
|
ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
|
||||||
|
|
||||||
|
146
libavcodec/arm/flacdsp_arm.S
Normal file
146
libavcodec/arm/flacdsp_arm.S
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
|
||||||
|
*
|
||||||
|
* This file is part of FFmpeg
|
||||||
|
*
|
||||||
|
* FFmpeg 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.
|
||||||
|
*
|
||||||
|
* FFmpeg 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 FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/arm/asm.S"
|
||||||
|
|
||||||
|
function flac_lpc_16_1_arm
|
||||||
|
ldr r12, [sp]
|
||||||
|
push {r4, lr}
|
||||||
|
ldr r1, [r1]
|
||||||
|
subs r12, r12, #2
|
||||||
|
ldr lr, [r0], #4
|
||||||
|
beq 2f
|
||||||
|
it lt
|
||||||
|
poplt {r4, pc}
|
||||||
|
1:
|
||||||
|
mul r4, lr, r1
|
||||||
|
ldm r0, {r2, lr}
|
||||||
|
add_sh r2, r2, r4, asr r3
|
||||||
|
mul r4, r2, r1
|
||||||
|
subs r12, r12, #2
|
||||||
|
add_sh lr, lr, r4, asr r3
|
||||||
|
stm r0!, {r2, lr}
|
||||||
|
bgt 1b
|
||||||
|
it lt
|
||||||
|
poplt {r4, pc}
|
||||||
|
2:
|
||||||
|
mul r4, lr, r1
|
||||||
|
ldr r2, [r0]
|
||||||
|
add_sh r2, r2, r4, asr r3
|
||||||
|
str r2, [r0]
|
||||||
|
pop {r4, pc}
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
function flac_lpc_16_2_arm
|
||||||
|
ldr r12, [sp]
|
||||||
|
subs r12, r12, r2
|
||||||
|
it le
|
||||||
|
bxle lr
|
||||||
|
|
||||||
|
push {r4-r9, lr}
|
||||||
|
ldm r0!, {r6, r7}
|
||||||
|
ldm r1, {r8, r9}
|
||||||
|
subs r12, r12, #1
|
||||||
|
beq 2f
|
||||||
|
1:
|
||||||
|
mul r4, r6, r8
|
||||||
|
mul r5, r7, r8
|
||||||
|
mla r4, r7, r9, r4
|
||||||
|
ldm r0, {r6, r7}
|
||||||
|
add_sh r6, r6, r4, asr r3
|
||||||
|
mla r5, r6, r9, r5
|
||||||
|
add_sh r7, r7, r5, asr r3
|
||||||
|
stm r0!, {r6, r7}
|
||||||
|
subs r12, r12, #2
|
||||||
|
bgt 1b
|
||||||
|
it lt
|
||||||
|
poplt {r4-r9, pc}
|
||||||
|
2:
|
||||||
|
mul r4, r6, r8
|
||||||
|
mla r4, r7, r9, r4
|
||||||
|
ldr r5, [r0]
|
||||||
|
add_sh r5, r5, r4, asr r3
|
||||||
|
str r5, [r0]
|
||||||
|
pop {r4-r9, pc}
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
function ff_flac_lpc_16_arm, export=1
|
||||||
|
cmp r2, #2
|
||||||
|
blt flac_lpc_16_1_arm
|
||||||
|
beq flac_lpc_16_2_arm
|
||||||
|
|
||||||
|
ldr r12, [sp]
|
||||||
|
subs r12, r12, r2
|
||||||
|
it le
|
||||||
|
bxle lr
|
||||||
|
|
||||||
|
push {r4-r9, lr}
|
||||||
|
|
||||||
|
subs r12, r12, #1
|
||||||
|
beq 3f
|
||||||
|
1:
|
||||||
|
sub lr, r2, #2
|
||||||
|
mov r4, #0
|
||||||
|
mov r5, #0
|
||||||
|
|
||||||
|
ldr r7, [r0], #4
|
||||||
|
ldr r9, [r1], #4
|
||||||
|
2:
|
||||||
|
mla r4, r7, r9, r4
|
||||||
|
ldm r0!, {r6, r7}
|
||||||
|
mla r5, r6, r9, r5
|
||||||
|
ldm r1!, {r8, r9}
|
||||||
|
mla r4, r6, r8, r4
|
||||||
|
subs lr, lr, #2
|
||||||
|
mla r5, r7, r8, r5
|
||||||
|
bgt 2b
|
||||||
|
blt 6f
|
||||||
|
|
||||||
|
mla r4, r7, r9, r4
|
||||||
|
ldr r7, [r0], #4
|
||||||
|
mla r5, r7, r9, r5
|
||||||
|
ldr r9, [r1], #4
|
||||||
|
6:
|
||||||
|
mla r4, r7, r9, r4
|
||||||
|
ldm r0, {r6, r7}
|
||||||
|
add_sh r6, r6, r4, asr r3
|
||||||
|
mla r5, r6, r9, r5
|
||||||
|
add_sh r7, r7, r5, asr r3
|
||||||
|
stm r0!, {r6, r7}
|
||||||
|
sub r0, r0, r2, lsl #2
|
||||||
|
sub r1, r1, r2, lsl #2
|
||||||
|
|
||||||
|
subs r12, r12, #2
|
||||||
|
bgt 1b
|
||||||
|
it lt
|
||||||
|
poplt {r4-r9, pc}
|
||||||
|
3:
|
||||||
|
mov r4, #0
|
||||||
|
4:
|
||||||
|
ldr r5, [r1], #4
|
||||||
|
ldr r6, [r0], #4
|
||||||
|
mla r4, r5, r6, r4
|
||||||
|
subs r2, r2, #1
|
||||||
|
bgt 4b
|
||||||
|
ldr r5, [r0]
|
||||||
|
add_sh r5, r5, r4, asr r3
|
||||||
|
str r5, [r0]
|
||||||
|
pop {r4-r9, pc}
|
||||||
|
endfunc
|
32
libavcodec/arm/flacdsp_init_arm.c
Normal file
32
libavcodec/arm/flacdsp_init_arm.c
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
|
||||||
|
*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg 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.
|
||||||
|
*
|
||||||
|
* FFmpeg 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 FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libavcodec/flacdsp.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
|
||||||
|
int qlevel, int len);
|
||||||
|
|
||||||
|
av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt,
|
||||||
|
int bps)
|
||||||
|
{
|
||||||
|
if (bps <= 16)
|
||||||
|
c->lpc = ff_flac_lpc_16_arm;
|
||||||
|
}
|
@@ -232,9 +232,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
|||||||
if(comp == BMP_RLE4 || comp == BMP_RLE8)
|
if(comp == BMP_RLE4 || comp == BMP_RLE8)
|
||||||
memset(p->data[0], 0, avctx->height * p->linesize[0]);
|
memset(p->data[0], 0, avctx->height * p->linesize[0]);
|
||||||
|
|
||||||
if(depth == 4 || depth == 8)
|
|
||||||
memset(p->data[1], 0, 1024);
|
|
||||||
|
|
||||||
if(height > 0){
|
if(height > 0){
|
||||||
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
|
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
|
||||||
linesize = -p->linesize[0];
|
linesize = -p->linesize[0];
|
||||||
@@ -245,6 +242,9 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
if(avctx->pix_fmt == PIX_FMT_PAL8){
|
if(avctx->pix_fmt == PIX_FMT_PAL8){
|
||||||
int colors = 1 << depth;
|
int colors = 1 << depth;
|
||||||
|
|
||||||
|
memset(p->data[1], 0, 1024);
|
||||||
|
|
||||||
if(ihsize >= 36){
|
if(ihsize >= 36){
|
||||||
int t;
|
int t;
|
||||||
buf = buf0 + 46;
|
buf = buf0 + 46;
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
#include "flacdsp.h"
|
#include "flacdsp.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define SAMPLE_SIZE 16
|
#define SAMPLE_SIZE 16
|
||||||
#define PLANAR 0
|
#define PLANAR 0
|
||||||
@@ -119,4 +120,7 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt,
|
|||||||
c->decorrelate[3] = flac_decorrelate_ms_c_16p;
|
c->decorrelate[3] = flac_decorrelate_ms_c_16p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ARCH_ARM)
|
||||||
|
ff_flacdsp_init_arm(c, fmt, bps);
|
||||||
}
|
}
|
||||||
|
@@ -30,5 +30,6 @@ typedef struct FLACDSPContext {
|
|||||||
} FLACDSPContext;
|
} FLACDSPContext;
|
||||||
|
|
||||||
void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
|
void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
|
||||||
|
void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
|
||||||
|
|
||||||
#endif /* AVCODEC_FLACDSP_H */
|
#endif /* AVCODEC_FLACDSP_H */
|
||||||
|
@@ -30,9 +30,9 @@
|
|||||||
#include "msmpeg4.h"
|
#include "msmpeg4.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
static inline void gmc1_motion(MpegEncContext *s,
|
static void gmc1_motion(MpegEncContext *s,
|
||||||
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
||||||
uint8_t **ref_picture)
|
uint8_t **ref_picture)
|
||||||
{
|
{
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
int offset, src_x, src_y, linesize, uvlinesize;
|
int offset, src_x, src_y, linesize, uvlinesize;
|
||||||
@@ -116,9 +116,9 @@ static inline void gmc1_motion(MpegEncContext *s,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void gmc_motion(MpegEncContext *s,
|
static void gmc_motion(MpegEncContext *s,
|
||||||
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
||||||
uint8_t **ref_picture)
|
uint8_t **ref_picture)
|
||||||
{
|
{
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
int linesize, uvlinesize;
|
int linesize, uvlinesize;
|
||||||
@@ -174,11 +174,8 @@ static inline void gmc_motion(MpegEncContext *s,
|
|||||||
|
|
||||||
static inline int hpel_motion(MpegEncContext *s,
|
static inline int hpel_motion(MpegEncContext *s,
|
||||||
uint8_t *dest, uint8_t *src,
|
uint8_t *dest, uint8_t *src,
|
||||||
int field_based, int field_select,
|
|
||||||
int src_x, int src_y,
|
int src_x, int src_y,
|
||||||
int width, int height, int stride,
|
op_pixels_func *pix_op,
|
||||||
int h_edge_pos, int v_edge_pos,
|
|
||||||
int w, int h, op_pixels_func *pix_op,
|
|
||||||
int motion_x, int motion_y)
|
int motion_x, int motion_y)
|
||||||
{
|
{
|
||||||
int dxy;
|
int dxy;
|
||||||
@@ -189,26 +186,24 @@ static inline int hpel_motion(MpegEncContext *s,
|
|||||||
src_y += motion_y >> 1;
|
src_y += motion_y >> 1;
|
||||||
|
|
||||||
/* WARNING: do no forget half pels */
|
/* WARNING: do no forget half pels */
|
||||||
src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu?
|
src_x = av_clip(src_x, -16, s->width); //FIXME unneeded for emu?
|
||||||
if (src_x == width)
|
if (src_x == s->width)
|
||||||
dxy &= ~1;
|
dxy &= ~1;
|
||||||
src_y = av_clip(src_y, -16, height);
|
src_y = av_clip(src_y, -16, s->height);
|
||||||
if (src_y == height)
|
if (src_y == s->height)
|
||||||
dxy &= ~2;
|
dxy &= ~2;
|
||||||
src += src_y * stride + src_x;
|
src += src_y * s->linesize + src_x;
|
||||||
|
|
||||||
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
|
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
|
||||||
if( (unsigned)src_x > FFMAX(h_edge_pos - (motion_x&1) - w, 0)
|
if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 8, 0)
|
||||||
|| (unsigned)src_y > FFMAX(v_edge_pos - (motion_y&1) - h, 0)){
|
|| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&1) - 8, 0)){
|
||||||
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
|
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, 9, 9,
|
||||||
src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
|
src_x, src_y, s->h_edge_pos, s->v_edge_pos);
|
||||||
src= s->edge_emu_buffer;
|
src= s->edge_emu_buffer;
|
||||||
emu=1;
|
emu=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(field_select)
|
pix_op[dxy](dest, src, s->linesize, 8);
|
||||||
src += s->linesize;
|
|
||||||
pix_op[dxy](dest, src, stride, h);
|
|
||||||
return emu;
|
return emu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,11 +442,9 @@ static inline void obmc_motion(MpegEncContext *s,
|
|||||||
ptr[i]= ptr[MID];
|
ptr[i]= ptr[MID];
|
||||||
}else{
|
}else{
|
||||||
ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
|
ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
|
||||||
hpel_motion(s, ptr[i], src, 0, 0,
|
hpel_motion(s, ptr[i], src,
|
||||||
src_x, src_y,
|
src_x, src_y,
|
||||||
s->width, s->height, s->linesize,
|
pix_op,
|
||||||
s->h_edge_pos, s->v_edge_pos,
|
|
||||||
8, 8, pix_op,
|
|
||||||
mv[i][0], mv[i][1]);
|
mv[i][0], mv[i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,11 +547,12 @@ static inline void qpel_motion(MpegEncContext *s,
|
|||||||
/**
|
/**
|
||||||
* h263 chroma 4mv motion compensation.
|
* h263 chroma 4mv motion compensation.
|
||||||
*/
|
*/
|
||||||
static inline void chroma_4mv_motion(MpegEncContext *s,
|
static void chroma_4mv_motion(MpegEncContext *s,
|
||||||
uint8_t *dest_cb, uint8_t *dest_cr,
|
uint8_t *dest_cb, uint8_t *dest_cr,
|
||||||
uint8_t **ref_picture,
|
uint8_t **ref_picture,
|
||||||
op_pixels_func *pix_op,
|
op_pixels_func *pix_op,
|
||||||
int mx, int my){
|
int mx, int my)
|
||||||
|
{
|
||||||
int dxy, emu=0, src_x, src_y, offset;
|
int dxy, emu=0, src_x, src_y, offset;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
|
|
||||||
@@ -773,11 +767,9 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
|||||||
}else{
|
}else{
|
||||||
for(i=0;i<4;i++) {
|
for(i=0;i<4;i++) {
|
||||||
hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
|
hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
|
||||||
ref_picture[0], 0, 0,
|
ref_picture[0],
|
||||||
mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
|
mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
|
||||||
s->width, s->height, s->linesize,
|
pix_op[1],
|
||||||
s->h_edge_pos, s->v_edge_pos,
|
|
||||||
8, 8, pix_op[1],
|
|
||||||
s->mv[dir][i][0], s->mv[dir][i][1]);
|
s->mv[dir][i][0], s->mv[dir][i][1]);
|
||||||
|
|
||||||
mx += s->mv[dir][i][0];
|
mx += s->mv[dir][i][0];
|
||||||
|
@@ -48,13 +48,11 @@
|
|||||||
typedef struct NellyMoserDecodeContext {
|
typedef struct NellyMoserDecodeContext {
|
||||||
AVCodecContext* avctx;
|
AVCodecContext* avctx;
|
||||||
AVFrame frame;
|
AVFrame frame;
|
||||||
float *float_buf;
|
|
||||||
AVLFG random_state;
|
AVLFG random_state;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
float scale_bias;
|
float scale_bias;
|
||||||
DSPContext dsp;
|
DSPContext dsp;
|
||||||
FFTContext imdct_ctx;
|
FFTContext imdct_ctx;
|
||||||
FmtConvertContext fmt_conv;
|
|
||||||
DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN];
|
DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN];
|
||||||
float *imdct_out;
|
float *imdct_out;
|
||||||
float *imdct_prev;
|
float *imdct_prev;
|
||||||
@@ -124,19 +122,8 @@ static av_cold int decode_init(AVCodecContext * avctx) {
|
|||||||
|
|
||||||
ff_dsputil_init(&s->dsp, avctx);
|
ff_dsputil_init(&s->dsp, avctx);
|
||||||
|
|
||||||
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
|
s->scale_bias = 1.0/(32768*8);
|
||||||
s->scale_bias = 1.0/(32768*8);
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
|
||||||
} else {
|
|
||||||
s->scale_bias = 1.0/(1*8);
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
|
||||||
ff_fmt_convert_init(&s->fmt_conv, avctx);
|
|
||||||
s->float_buf = av_mallocz(NELLY_SAMPLES * sizeof(*s->float_buf));
|
|
||||||
if (!s->float_buf) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "error allocating float buffer\n");
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate overlap window */
|
/* Generate overlap window */
|
||||||
if (!ff_sine_128[127])
|
if (!ff_sine_128[127])
|
||||||
@@ -158,7 +145,6 @@ static int decode_tag(AVCodecContext *avctx, void *data,
|
|||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
NellyMoserDecodeContext *s = avctx->priv_data;
|
NellyMoserDecodeContext *s = avctx->priv_data;
|
||||||
int blocks, i, ret;
|
int blocks, i, ret;
|
||||||
int16_t *samples_s16;
|
|
||||||
float *samples_flt;
|
float *samples_flt;
|
||||||
|
|
||||||
blocks = buf_size / NELLY_BLOCK_LEN;
|
blocks = buf_size / NELLY_BLOCK_LEN;
|
||||||
@@ -188,18 +174,11 @@ static int decode_tag(AVCodecContext *avctx, void *data,
|
|||||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
samples_s16 = (int16_t *)s->frame.data[0];
|
|
||||||
samples_flt = (float *)s->frame.data[0];
|
samples_flt = (float *)s->frame.data[0];
|
||||||
|
|
||||||
for (i=0 ; i<blocks ; i++) {
|
for (i=0 ; i<blocks ; i++) {
|
||||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
nelly_decode_block(s, buf, samples_flt);
|
||||||
nelly_decode_block(s, buf, samples_flt);
|
samples_flt += NELLY_SAMPLES;
|
||||||
samples_flt += NELLY_SAMPLES;
|
|
||||||
} else {
|
|
||||||
nelly_decode_block(s, buf, s->float_buf);
|
|
||||||
s->fmt_conv.float_to_int16(samples_s16, s->float_buf, NELLY_SAMPLES);
|
|
||||||
samples_s16 += NELLY_SAMPLES;
|
|
||||||
}
|
|
||||||
buf += NELLY_BLOCK_LEN;
|
buf += NELLY_BLOCK_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +191,6 @@ static int decode_tag(AVCodecContext *avctx, void *data,
|
|||||||
static av_cold int decode_end(AVCodecContext * avctx) {
|
static av_cold int decode_end(AVCodecContext * avctx) {
|
||||||
NellyMoserDecodeContext *s = avctx->priv_data;
|
NellyMoserDecodeContext *s = avctx->priv_data;
|
||||||
|
|
||||||
av_freep(&s->float_buf);
|
|
||||||
ff_mdct_end(&s->imdct_ctx);
|
ff_mdct_end(&s->imdct_ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -229,6 +207,5 @@ AVCodec ff_nellymoser_decoder = {
|
|||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
|
.long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
|
||||||
AV_SAMPLE_FMT_S16,
|
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
};
|
};
|
||||||
|
@@ -186,6 +186,12 @@ ELF .size \name, . - \name
|
|||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro add_sh rd, rn, rm, sh:vararg
|
||||||
|
A add \rd, \rn, \rm, \sh
|
||||||
|
T mov \rm, \rm, \sh
|
||||||
|
T add \rd, \rn, \rm
|
||||||
|
.endm
|
||||||
|
|
||||||
.macro ldr_pre rt, rn, rm:vararg
|
.macro ldr_pre rt, rn, rm:vararg
|
||||||
A ldr \rt, [\rn, \rm]!
|
A ldr \rt, [\rn, \rm]!
|
||||||
T add \rn, \rn, \rm
|
T add \rn, \rn, \rm
|
||||||
|
Reference in New Issue
Block a user