Skip to content

Commit

Permalink
FFmpeg adjustment.
Browse files Browse the repository at this point in the history
This commit tries to minimise the changes made on the original FFmpeg libs so it is easier to sync in the future. It also fixes some errors introduced during the last resync.

Lots of MMX code were relying on mmx.h header which was removed from ffmpeg years ago. So copy it into libmythbase so we never have to bother about this files again and modify all files using that header

There are still changes in libavcodec's PPC code, but I wouldn't dare touching it.
  • Loading branch information
jyavenard committed May 22, 2012
1 parent 133538c commit 106132b
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 50 deletions.
7 changes: 0 additions & 7 deletions mythtv/external/FFmpeg/libavcodec/aacdec.c
Expand Up @@ -712,10 +712,6 @@ static int decode_audio_specific_config(AACContext *ac,
return -1;
}

av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
m4ac->sample_rate, m4ac->sbr, m4ac->ps);

av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
m4ac->sample_rate, m4ac->sbr, m4ac->ps);
Expand Down Expand Up @@ -2597,8 +2593,6 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
av_log(avctx, AV_LOG_INFO, "audio config changed\n");
latmctx->initialized = 0;

ac->m4ac= m4ac;

esize = (bits_consumed+7) / 8;

if (avctx->extradata_size < esize) {
Expand Down Expand Up @@ -2775,7 +2769,6 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
*got_frame_ptr = 0;
return avpkt->size;
} else {
aac_decode_close(avctx);
if ((err = decode_audio_specific_config(
&latmctx->aac_ctx, avctx, &latmctx->aac_ctx.m4ac,
avctx->extradata, avctx->extradata_size*8, 1)) < 0)
Expand Down
3 changes: 0 additions & 3 deletions mythtv/external/FFmpeg/libavcodec/allcodecs.c
Expand Up @@ -405,9 +405,6 @@ void avcodec_register_all(void)
REGISTER_DECODER (LIBCELT, libcelt);
REGISTER_DECODER (LIBDIRAC, libdirac);
REGISTER_ENCODER (LIBFAAC, libfaac);
#if 0
REGISTER_DECODER (LIBFAAD_LATM, libfaad_latm);
#endif
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
Expand Down
2 changes: 0 additions & 2 deletions mythtv/external/FFmpeg/libavcodec/x86/Makefile
@@ -1,5 +1,3 @@
HEADERS += x86/mmx.h

OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o
OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
Expand Down
13 changes: 5 additions & 8 deletions mythtv/external/FFmpeg/libavcodec/x86/dsputil_mmx.c
Expand Up @@ -1953,34 +1953,31 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src,
"pmullw %%mm5, %%mm2 \n\t" // (s - dx) * dy
"pmullw %%mm4, %%mm1 \n\t" // dx * (s - dy)

"movd %1, %%mm5 \n\t"
"movd %0, %%mm4 \n\t"
"movd %4, %%mm5 \n\t"
"movd %3, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm5 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"pmullw %%mm5, %%mm3 \n\t" // src[1, 1] * dx * dy
"pmullw %%mm4, %%mm2 \n\t" // src[0, 1] * (s - dx) * dy
:
: "m"(src[stride]), "m"(src[stride+1])
);

__asm__ volatile(
"movd %2, %%mm5 \n\t"
"movd %1, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm5 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"pmullw %%mm5, %%mm1 \n\t" // src[1, 0] * dx * (s - dy)
"pmullw %%mm4, %%mm0 \n\t" // src[0, 0] * (s - dx) * (s - dy)
"paddw %3, %%mm1 \n\t"
"paddw %5, %%mm1 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"paddw %%mm1, %%mm0 \n\t"
"paddw %%mm2, %%mm0 \n\t"

"psrlw %4, %%mm0 \n\t"
"psrlw %6, %%mm0 \n\t"
"packuswb %%mm0, %%mm0 \n\t"
"movd %%mm0, %0 \n\t"

: "=m"(dst[x + y * stride])
: "m"(src[0]), "m"(src[1]),
"m"(src[stride]), "m"(src[stride + 1]),
"m"(*r4), "m"(shift2)
);
src += stride;
Expand Down
4 changes: 2 additions & 2 deletions mythtv/external/FFmpeg/libavcodec/x86/dsputil_mmx.h
Expand Up @@ -63,8 +63,8 @@ extern const xmm_reg ff_pb_F8;
extern const uint64_t ff_pb_FC;
extern const xmm_reg ff_pb_FE;

extern const double __attribute__((visibility("hidden"))) ff_pd_1[2];
extern const double __attribute__((visibility("hidden"))) ff_pd_2[2];
extern const double ff_pd_1[2];
extern const double ff_pd_2[2];

#define LOAD4(stride,in,a,b,c,d)\
"movq 0*"#stride"+"#in", "#a"\n\t"\
Expand Down
2 changes: 1 addition & 1 deletion mythtv/external/FFmpeg/libavformat/mpegts.h
Expand Up @@ -98,7 +98,7 @@ typedef struct {
* @param desc_list_end End of buffer
* @return <0 to stop processing
*/
int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type,
int ff_old_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type,
const uint8_t **pp, const uint8_t *desc_list_end,
Mp4Descr *mp4_descr, int mp4_descr_count, int pid,
MpegTSContext *ts);
Expand Down
11 changes: 4 additions & 7 deletions mythtv/external/FFmpeg/libavformat/utils.c
Expand Up @@ -39,7 +39,7 @@
#include "libavutil/parseutils.h"
#include "riff.h"
#include "audiointerleave.h"
#include "mpegts.h"
#include "mpegts-mythtv.h"
#include "url.h"
#include <sys/time.h>
#include <time.h>
Expand Down Expand Up @@ -1022,7 +1022,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
// Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly.
if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){
av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts);
pkt->pts= AV_NOPTS_VALUE;
pkt->dts= AV_NOPTS_VALUE;
}

if (pkt->duration == 0) {
Expand Down Expand Up @@ -1283,8 +1283,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
AVStream *st;
AVPacket cur_pkt;

cur_pkt.data = NULL;
cur_pkt.size = 0;
av_destruct_packet_nofree(&cur_pkt);
av_init_packet(&cur_pkt);

/* read next packet */
ret = ff_read_packet(s, &cur_pkt);
Expand Down Expand Up @@ -2520,7 +2520,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)

count = 0;
read_size = 0;

for(;;) {
if (ff_check_interrupt(&ic->interrupt_callback)){
ret= AVERROR_EXIT;
Expand Down Expand Up @@ -3686,7 +3685,6 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,

/**
* Interleave an AVPacket correctly so it can be muxed.
*
* @param out the interleaved packet will be output here
* @param in the input packet
* @param flush 1 if no further packets are available as input and all
Expand Down Expand Up @@ -4012,7 +4010,6 @@ uint64_t ff_ntp_time(void)
int av_get_frame_filename(char *buf, int buf_size,
const char *path, int number)
{
struct tm time_r;
const char *p;
char *q, buf1[20], c;
int nd, len, percentd_found;
Expand Down
1 change: 0 additions & 1 deletion mythtv/external/FFmpeg/libavutil/internal.h
Expand Up @@ -39,7 +39,6 @@
#include "timer.h"
#include "cpu.h"
#include "dict.h"
#include "intmath.h"

struct AVDictionary {
int count;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/external/FFmpeg/libswscale/Makefile
@@ -1,7 +1,7 @@
include $(SUBDIR)../config.mak

NAME = swscale
FFLIBS = avcodec avutil
FFLIBS = avutil

HEADERS = swscale.h

Expand Down
2 changes: 0 additions & 2 deletions mythtv/external/FFmpeg/libswscale/utils.c
Expand Up @@ -49,8 +49,6 @@
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"

#include "libavutil/cpu.h"

unsigned swscale_version(void)
{
av_assert0(LIBSWSCALE_VERSION_MICRO >= 100);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/adjust/filter_adjust.c
Expand Up @@ -19,7 +19,7 @@

#include "libavutil/mem.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"

static const mmx_t mm_cpool[] = {
{ w: {1, 1, 1, 1} },
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/crop/filter_crop.c
Expand Up @@ -23,7 +23,7 @@
#include "libavcodec/dsputil.h"

#ifdef MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

//static const char FILTER_NAME[] = "crop";
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/denoise3d/filter_denoise3d.c
Expand Up @@ -29,7 +29,7 @@
#define ABS(A) ( (A) > 0 ? (A) : -(A) )

#ifdef MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
static const mmx_t mz = { 0x0LL };
#endif

Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/greedyhdeint/color.c
Expand Up @@ -36,7 +36,7 @@
#include "color.h"

#if HAVE_MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

void (*yv12_to_yuy2)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/greedyhdeint/filter_greedyhdeint.c
Expand Up @@ -64,7 +64,7 @@ static unsigned int GreedyMotionSense = MOTIONSENSE_DEFAULT;


#ifdef MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"

static const mmx_t mm_cpool[] =
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/kerneldeint/filter_kerneldeint.c
Expand Up @@ -25,7 +25,7 @@
#define CLAMP(A,L,U) ((A)>(U)?(U):((A)<(L)?(L):(A)))

#if HAVE_MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#define THRESHOLD 12
static const mmx_t mm_lthr = { w:{ -THRESHOLD, -THRESHOLD,
-THRESHOLD, -THRESHOLD} };
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/linearblend/filter_linearblend.c
Expand Up @@ -9,7 +9,7 @@
#endif

#if HAVE_MMX || HAVE_AMD3DNOW
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

#include "../mm_arch.h"
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/quickdnr/filter_quickdnr.c
Expand Up @@ -26,7 +26,7 @@
#include "libavcodec/dsputil.h"

#ifdef MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

//Regular filter
Expand Down
2 changes: 1 addition & 1 deletion mythtv/filters/yadif/filter_yadif.c
Expand Up @@ -45,7 +45,7 @@

#include "../mm_arch.h"
#if HAVE_MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

#include "aclib.h"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/RTjpegN.h
Expand Up @@ -52,7 +52,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#endif

#ifdef MMX
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
#endif

/* Format definitions */
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/blend.c
Expand Up @@ -2,7 +2,7 @@

#ifdef MMX

#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"

static const mmx_t mm_cpool[] =
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/libmythtv.pro
Expand Up @@ -82,7 +82,7 @@ using_valgrind:DEFINES += USING_VALGRIND

# mmx macros from avlib
contains( HAVE_MMX, yes ) {
HEADERS += ../../external/FFmpeg/libavcodec/x86/mmx.h ../../external/FFmpeg/libavcodec/dsputil.h
HEADERS += ../libmythbase/ffmpeg-mmx.h ../../external/FFmpeg/libavcodec/dsputil.h
}

QMAKE_CLEAN += $(TARGET) $(TARGETA) $(TARGETD) $(TARGET0) $(TARGET1) $(TARGET2)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/osdchromakey.cpp
Expand Up @@ -17,7 +17,7 @@

#ifdef MMX
extern "C" {
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/util-opengl.cpp
Expand Up @@ -7,7 +7,7 @@

#ifdef MMX
extern "C" {
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
}

static mmx_t mmx_1s = {0xffffffffffffffffLL};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/visualisations/goom/mmx.h
@@ -1,7 +1,7 @@
#ifndef GOOM_MMX_H

#include <mythconfig.h>
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"

#define MM_MMX 0x0001 /* standard MMX */
#define MM_3DNOW 0x0004 /* AMD 3DNOW */
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/yuv2rgb.cpp
Expand Up @@ -33,7 +33,7 @@

#if HAVE_MMX
extern "C" {
#include "libavcodec/x86/mmx.h"
#include "ffmpeg-mmx.h"
}
#define CPU_MMXEXT 0
#define CPU_MMX 1
Expand Down

0 comments on commit 106132b

Please sign in to comment.