libeplayer3-arm: insert original blank lines from exteplayer3.git, for better merge

Origin commit data
------------------
Branch: master
Commit: 65de063d1e
Author: max_10 <max_10@gmx.de>
Date: 2018-04-10 (Tue, 10 Apr 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
max_10
2018-04-10 11:31:57 +02:00
parent d3d225ac35
commit 01d1fb6b28
79 changed files with 2070 additions and 117 deletions

View File

@@ -41,6 +41,7 @@ typedef struct _CONVCTX
M4V_VOL vol;
} CONVCTX;
typedef struct
{
uint8 *out_buf;
@@ -64,6 +65,7 @@ static const uint8 ff_mpeg4_c_dc_scale_table[32] =
0, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25
};
static void copy_vol(PICTURE *flv_pic, M4V_VOL *vol)
{
vol->width = flv_pic->width;
@@ -74,9 +76,11 @@ static void copy_vol(PICTURE *flv_pic, M4V_VOL *vol)
static void copy_vop(PICTURE *flv_pic, M4V_VOP *vop, CONVCTX *c)
{
vop->qscale = flv_pic->qscale;
vop->time = c->frame % 30;
vop->icount = (c->icounter + 29) / 30;
vop->intra_dc_threshold = 99;
if (flv_pic->picture_type == FLV_I_TYPE)
{
vop->picture_type = M4V_I_TYPE;
@@ -91,13 +95,16 @@ static void copy_vop(PICTURE *flv_pic, M4V_VOP *vop, CONVCTX *c)
static void copy_microblock(MICROBLOCK *flv_mb, M4V_MICROBLOCK *m4v_mb)
{
int i;
m4v_mb->dquant = flv_mb->dquant;
memcpy(m4v_mb->block, flv_mb->block, sizeof(m4v_mb->block)); // !!!!!!!
m4v_mb->intra = flv_mb->intra;
m4v_mb->skip = flv_mb->skip;
m4v_mb->mv_type = flv_mb->mv_type;
memcpy(m4v_mb->mv_x, flv_mb->mv_x, sizeof(m4v_mb->mv_x)); // !!!!!!
memcpy(m4v_mb->mv_y, flv_mb->mv_y, sizeof(m4v_mb->mv_y)); // !!!!!!
// dc rescale
if (m4v_mb->intra)
{
@@ -106,6 +113,7 @@ static void copy_microblock(MICROBLOCK *flv_mb, M4V_MICROBLOCK *m4v_mb)
m4v_mb->block[i].block[0] *= 8;
m4v_mb->block[i].block[0] /= ff_mpeg4_y_dc_scale_table[m4v_mb->qscale];
}
for (i = 4; i < 6; i++)
{
m4v_mb->block[i].block[0] *= 8;
@@ -126,7 +134,9 @@ static int write_pad_not_coded_frames(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BW *bw
vop.icount = (c->icounter + 29) / 30;
m4v_encode_vop_header(bw, &vop, VOL_TIME_BITS, 1);
m4v_stuffing(bw);
flash_bw(bw);
// write frame
if (pub_ctx->write_packet_cb(pub_ctx->usr_data,
0,
@@ -136,10 +146,13 @@ static int write_pad_not_coded_frames(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BW *bw
{
return -1;
}
clear_bw(bw);
c->frame++;
c->icounter++;
}
return 0;
}
@@ -151,9 +164,12 @@ static int write_m4v_picture_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, B
int x, y;
int mb_width = (flvpic->width + 15) / 16;
int mb_height = (flvpic->height + 15) / 16;
memset(&vop, 0, sizeof(vop));
copy_vop(flvpic, &vop, c);
m4v_encode_vop_header(bw, &vop, VOL_TIME_BITS, 0);
// transcode flv to mpeg4
for (y = 0; y < mb_height; y++)
{
@@ -161,6 +177,7 @@ static int write_m4v_picture_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, B
{
memset(&mb, 0, sizeof(mb));
memset(&m4v_mb, 0, sizeof(m4v_mb));
if (vop.picture_type == M4V_I_TYPE)
{
mb.intra = 1;
@@ -180,8 +197,10 @@ static int write_m4v_picture_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, B
}
}
}
m4v_stuffing(bw);
flash_bw(bw);
// write frame
if (pub_ctx->write_packet_cb(pub_ctx->usr_data,
vop.picture_type == M4V_I_TYPE,
@@ -191,19 +210,25 @@ static int write_m4v_picture_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, B
{
return -1;
}
c->frame++;
c->icounter++;
return 0;
}
static int write_m4v_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, BW *bw, uint32 time)
{
PICTURE picture;
memset(&picture, 0, sizeof(picture));
init_dcpred(&c->vol.dcpred);
if (decode_picture_header(br, &picture) < 0) return -1;
if (c->width != picture.width || c->height != picture.height) return -1; //size changed..
copy_vol(&picture, &c->vol);
if (picture.picture_type == FLV_I_TYPE)
{
c->icounter = 0;
@@ -212,10 +237,12 @@ static int write_m4v_frame(flv2mpeg4_CTX *pub_ctx, CONVCTX *c, BR *br, BW *bw, u
{
if (write_pad_not_coded_frames(pub_ctx, c, bw, time) < 0) return -1;
}
if (write_m4v_picture_frame(pub_ctx, c, br, bw, &picture, time) < 0)
{
return -1;
}
return 0;
}
@@ -235,16 +262,23 @@ int flv2mpeg4_prepare_extra_data(flv2mpeg4_CTX *ctx)
CTX *p = ctx->priv;
BW bw;
CONVCTX *c = &(p->conv);
M4V_VOP vop;
memset(&vop, 0, sizeof(vop));
init_bw(&bw, p->out_buf, PACKETBUFFER_SIZE);
c->vol.width = c->width;
c->vol.height = c->height;
c->vol.time_bits = VOL_TIME_BITS; // 0-31
m4v_encode_m4v_header(&bw, &c->vol, 0);
m4v_stuffing(&bw);
flash_bw(&bw);
alloc_dcpred(&c->vol.dcpred, (c->width + 15) / 16, (c->height + 15) / 16);
return ctx->write_extradata_cb(ctx->usr_data, c->width, c->height, 200 * 1000, bw.buf, bw.pos);
}
@@ -265,20 +299,26 @@ flv2mpeg4_CTX *flv2mpeg4_init_ctx(void *priv_data, int width, int height, flv2mp
pub_ctx->priv = malloc(sizeof(CTX));
memset(pub_ctx->priv, 0x0, sizeof(CTX));
CTX *ctx = pub_ctx->priv;
ctx->conv.width = width;
ctx->conv.height = height;
ctx->out_buf = malloc(PACKETBUFFER_SIZE);
memset(ctx->out_buf, 0x0, PACKETBUFFER_SIZE);
memset(&(ctx->vol), 0x0, sizeof(ctx->vol));
return pub_ctx;
}
void flv2mpeg4_release_ctx(flv2mpeg4_CTX **pub_ctx)
{
CTX *ctx = (*pub_ctx)->priv;
free_dcpred(&ctx->conv.vol.dcpred);
free(ctx->out_buf);
free(ctx);
free(*pub_ctx);
*pub_ctx = NULL;
}