Skip to content
Permalink
Browse files

Removed unneeded patched from FFMPEG code

These all were either disabled lines or related to the HD100
specific changes (EM8622 related).
  • Loading branch information...
Narflex committed Nov 16, 2016
1 parent 65976db commit f1285ff57262974b04569597dda861767d940349
@@ -2670,8 +2670,6 @@ enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore -lm
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib

# disable oggivorbis decoder if it's not available
disabled oggivorbis_decoder || check_header ivorbiscodec.h || disable oggivorbis_decoder

# libdc1394 check
if enabled libdc1394; then
@@ -233,7 +233,7 @@ static int nb_frames_dup = 0;
static int nb_frames_drop = 0;
static int input_sync;
static uint64_t limit_filesize = 0;
static int force_fps = 0;
static int force_fps = 0;
static int force_interlaced = -1;

static int pgmyuv_compatibility_hack=0;
@@ -1526,22 +1526,22 @@ static void do_video_out(AVFormatContext *s,
static int saw_key_frame = 0; // FIXME: I don't like embedded static vars...
int average, variance;

//fprintf(stderr, "pic info: type %d, qual %d, keyframe %d, skf %d\n", in_picture->pict_type, in_picture->quality, in_picture->key_frame, saw_key_frame);
// pict_type will be zero but key_frame will be one sometimes due to FFMPEG indicating a keyframe incorrectly on the first frame
// In that case we need to wait until the next real keyframe is present
// We also only take frames on I/P frames, and never on B frames to start
if (!saw_key_frame && in_picture->key_frame && !in_picture->pict_type)
{
//fprintf(stderr, "pic info: type %d, qual %d, keyframe %d, skf %d\n", in_picture->pict_type, in_picture->quality, in_picture->key_frame, saw_key_frame);
// pict_type will be zero but key_frame will be one sometimes due to FFMPEG indicating a keyframe incorrectly on the first frame
// In that case we need to wait until the next real keyframe is present
// We also only take frames on I/P frames, and never on B frames to start
if (!saw_key_frame && in_picture->key_frame && !in_picture->pict_type)
{
saw_key_frame = 1;
return;
}
if (saw_key_frame == 1 && !in_picture->key_frame)
return;
if (!saw_key_frame && in_picture->pict_type != FF_I_TYPE && in_picture->pict_type != FF_P_TYPE)
return;
}
if (saw_key_frame == 1 && !in_picture->key_frame)
return;
if (!saw_key_frame && in_picture->pict_type != FF_I_TYPE && in_picture->pict_type != FF_P_TYPE)
return;
saw_key_frame = 2;

// With avfilters we now have the output picture already scaled/cropped so we need to do the tests against

// With avfilters we now have the output picture already scaled/cropped so we need to do the tests against
// that image instead of the input image
if (!calc_pixel_stats(ost, in_picture, &average, &variance))
{
@@ -1663,10 +1663,10 @@ static void do_video_out(AVFormatContext *s,

big_picture= *final_picture;
/* better than nothing: use input picture interlaced
settings */
settings */
if (force_interlaced == -1)
big_picture.interlaced_frame = in_picture->interlaced_frame;
else
big_picture.interlaced_frame = in_picture->interlaced_frame;
else
big_picture.interlaced_frame = force_interlaced;
if(avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
if(top_field_first == -1)
@@ -1814,9 +1814,9 @@ static void print_report(AVFormatContext **output_files,

frame_number = ost->frame_number;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d%c fps=%3d q=%3.1f ",
frame_number,
enc->coded_frame->interlaced_frame ?
(enc->coded_frame->top_field_first?'t':'b'):'p',
frame_number,
enc->coded_frame->interlaced_frame ?
(enc->coded_frame->top_field_first?'t':'b'):'p',
(t>1)?(int)(frame_number/t+0.5) : 0,
!ost->st->stream_copy ?
enc->coded_frame->quality/(float)FF_QP2LAMBDA : -1);
@@ -1979,8 +1979,7 @@ static int output_packet(AVInputStream *ist, int ist_index,

ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_picture, &avpkt);
//if (got_picture) fprintf(stderr, " -- got picture, pts = %lld\n", picture.pts);
ist->st->quality= picture.quality;
ist->st->quality= picture.quality;
if (ret < 0)
goto fail_decode;
if (!got_picture) {
@@ -2083,16 +2082,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
if (ost->source_index == ist_index) {
os = output_files[ost->file_index];

#if 0
if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO && pkt && ist)
fprintf(stderr, " -- video pts = %lld, picture pts = %lld, pkt pts = %lld\n", av_rescale(ist->pts, 90000, AV_TIME_BASE), picture.pts, pkt->pts);
if (ost->st->codec->codec_type == CODEC_TYPE_AUDIO && pkt && ist)
fprintf(stderr, " -- audio pts = %lld, pkt pts = %lld\n", av_rescale(ist->pts, 90000, AV_TIME_BASE), pkt->pts);
printf("%d: got pts=%0.3f %0.3f\n", i,
(double)pkt->pts / AV_TIME_BASE,
((double)ist->pts / AV_TIME_BASE) -
((double)ost->st->pts.val * ost->st->time_base.num / ost->st->time_base.den));
#endif
/* set the input output pts pairs */
//ost->sync_ipts = (double)(ist->pts + input_files_ts_offset[ist->file_index] - start_time)/ AV_TIME_BASE;

@@ -3295,11 +3284,11 @@ static void opt_qscale(const char *arg)
fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
av_exit(1);
}
}

static void opt_force_interlaced(const char *arg)
{
force_interlaced = atoi(arg);
}

static void opt_force_interlaced(const char *arg)
{
force_interlaced = atoi(arg);
}

static void opt_top_field_first(const char *arg)
@@ -4704,7 +4693,7 @@ static const OptionDef options[] = {
{ "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
#endif
{ "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
{ "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
{ "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
{ "interlace", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_force_interlaced}, "progressive=0/interlaced=1/auto=-1", "" },
{ "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
{ "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
@@ -50,7 +50,6 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
mpeg4audio.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o
OBJS-$(CONFIG_AC3DUMMY_DECODER) += ac3decdummy.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o ac3tab.o ac3.o
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o
@@ -374,7 +373,6 @@ OBJS-$(CONFIG_VORBIS_DECODER) += vorbis_dec.o vorbis.o \
vorbis_data.o xiph.o
OBJS-$(CONFIG_VORBIS_ENCODER) += vorbis_enc.o vorbis.o \
vorbis_data.o
OBJS-$(CONFIG_OGGIVORBIS_DECODER) += oggivorbis.o
OBJS-$(CONFIG_VP3_DECODER) += vp3.o vp3dsp.o
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56dsp.o \
vp3dsp.o cabac.o
@@ -217,9 +217,6 @@ void avcodec_register_all(void)
/* audio codecs */
REGISTER_ENCDEC (AAC, aac);
REGISTER_ENCDEC (AC3, ac3);
#ifdef EM8622
REGISTER_DECODER (AC3DUMMY, ac3);
#endif
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER (ALS, als);
REGISTER_DECODER (AMRNB, amrnb);
@@ -361,9 +358,6 @@ void avcodec_register_all(void)
REGISTER_DECODER (LIBSPEEX, libspeex);
REGISTER_ENCODER (LIBTHEORA, libtheora);
REGISTER_ENCODER (LIBVORBIS, libvorbis);
#ifdef EM8622
REGISTER_DECODER (OGGIVORBIS, oggivorbis);
#endif
REGISTER_ENCDEC (LIBVPX, libvpx);
REGISTER_ENCODER (LIBX264, libx264);
REGISTER_ENCODER (LIBXVID, libxvid);
@@ -49,7 +49,7 @@ int av_new_packet(AVPacket *pkt, int size)
{
uint8_t *data= NULL;
if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
data = av_mallocUncached(size + FF_INPUT_BUFFER_PADDING_SIZE);
data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (data){
memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}else
@@ -78,11 +78,11 @@ int av_dup_packet(AVPacket *pkt)
/* We duplicate the packet and don't forget to add the padding again. */
if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
return AVERROR(ENOMEM);
data = av_mallocUncached(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!data) {
return AVERROR(ENOMEM);
}
av_memcpy(data, pkt->data, pkt->size);
memcpy(data, pkt->data, pkt->size);
memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
pkt->data = data;
pkt->destruct = av_destruct_packet;
@@ -956,7 +956,7 @@ static int decode_blockcode(int code, int levels, int *values)
if (code == 0)
return 0;
else {
// av_log(NULL, AV_LOG_ERROR, "ERROR: block code look-up failed\n");
av_log(NULL, AV_LOG_ERROR, "ERROR: block code look-up failed\n");
return -1;
}
}
@@ -1266,7 +1266,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
int i;
int16_t *samples = data;
DCAContext *s = avctx->priv_data;
int channels;
int channels;
uint32_t mrk=0;


@@ -1286,8 +1286,8 @@ static int dca_decode_frame(AVCodecContext * avctx,
//set AVCodec values with parsed data
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
// JFT, so we only look at 1 frame when looking for DTS-HD/DTS-MA
avctx->frame_size = s->sample_blocks*32;
// JFT, so we only look at 1 frame when looking for DTS-HD/DTS-MA
avctx->frame_size = s->sample_blocks*32;

for (i = 0; i < (s->sample_blocks / 8); i++) {
dca_decode_block(s, 0, i);
@@ -1300,7 +1300,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);

while(get_bits_left(&s->gb) >= 32) {
uint32_t bits = get_bits_long(&s->gb, 32);
uint32_t bits = get_bits_long(&s->gb, 32);

switch(bits) {
case 0x5a5a5a5a: {
@@ -1339,11 +1339,11 @@ static int dca_decode_frame(AVCodecContext * avctx,
av_log(avctx, AV_LOG_DEBUG, "Possible X96 extension found at %d bits\n", get_bits_count(&s->gb));
av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", get_bits(&s->gb, 12)+1);
av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4));
break;

break;

case DCA_HD_MARKER:
avctx->codec_id=CODEC_ID_DTS_MA;
break;
avctx->codec_id=CODEC_ID_DTS_MA;
break;
}

skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
@@ -1424,7 +1424,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
for (i = 0; i < 2 * s->lfe * 4; i++) {
s->lfe_data[i] = s->lfe_data[i + lfe_samples];
}


return buf_size;
}

@@ -94,12 +94,7 @@ static const int huff_quad_vlc_tables_sizes[2] = {
};
/* computed from band_size_long */
static uint16_t band_index_long[9][23];
#ifdef EM8622
#define TABLE_4_3_SIZE (8191 + 16)*4
#include "mp3table.h"
#else
#include "mpegaudio_tablegen.h"
#endif
/* intensity stereo coef table */
static INTFLOAT is_table[2][16];
static INTFLOAT is_table_lsf[2][2][16];
@@ -318,28 +313,13 @@ static int int_pow(int i, int *exp_ptr)
}
#endif

#ifdef EM8622
#include <sys/time.h>

static long long inittime=0;

static long long get_timebase()
{
struct timeval tm;
gettimeofday(&tm, 0);
return tm.tv_sec * 1000000LL + (tm.tv_usec);
}
#endif

static av_cold int decode_init(AVCodecContext * avctx)
{
MPADecodeContext *s = avctx->priv_data;
static int init=0;
int i, j, k;

#ifdef EM8622
long long startinittime = get_timebase();
#endif

s->avctx = avctx;
s->apply_window_mp3 = apply_window_mp3_c;
@@ -437,7 +417,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
/* compute n ^ (4/3) and store it in mantissa/exp format */

int_pow_init();
#ifndef EM8622
mpegaudio_tableinit();

for (i = 0; i < 4; i++)
@@ -453,15 +432,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
division_tabs[i][j] = val1 + (val2 << 4) + (val3 << 8);
}

#else
// Linking problem...
{
double f, fm;
int e, m;
f=1.0f;
fm = frexp(f, &e);
}
#endif

for(i=0;i<7;i++) {
float f;
@@ -547,10 +517,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
}

init = 1;
#ifdef EM8622
#undef fprintf
fprintf(stderr,"mp3 init time %lld\n",get_timebase()-startinittime);
#endif
}

if (avctx->codec_id == CODEC_ID_MP3ADU)

0 comments on commit f1285ff

Please sign in to comment.
You can’t perform that action at this time.