Merge remote-tracking branch 'qatar/master'
* qatar/master: apedec: check bits <= 32. cavs: Remove unused code. oggenc: fix condition when not to flush due to keyframe granule. oggenc: add pagesize option to set preferred page size libspeexdec: set frame size in libspeex_decode_init() smacker audio: sign-extend the initial 16-bit predicted value Conflicts: libavcodec/apedec.c libavcodec/libspeexdec.c libavformat/oggenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
2f7bd3b516
@ -425,8 +425,8 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
|
|||||||
x = range_decode_bits(ctx, 16);
|
x = range_decode_bits(ctx, 16);
|
||||||
x |= (range_decode_bits(ctx, tmpk - 16) << 16);
|
x |= (range_decode_bits(ctx, tmpk - 16) << 16);
|
||||||
} else {
|
} else {
|
||||||
av_log(ctx->avctx, AV_LOG_ERROR, "too many bits\n");
|
av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
x += overflow << tmpk;
|
x += overflow << tmpk;
|
||||||
} else {
|
} else {
|
||||||
|
@ -324,11 +324,12 @@ void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
|
static inline void mc_dir_part(AVSContext *h,Picture *pic,
|
||||||
int chroma_height,int delta,int list,uint8_t *dest_y,
|
int chroma_height,int delta,int list,uint8_t *dest_y,
|
||||||
uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset,
|
uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset,
|
||||||
int src_y_offset,qpel_mc_func *qpix_op,
|
int src_y_offset,qpel_mc_func *qpix_op,
|
||||||
h264_chroma_mc_func chroma_op,cavs_vector *mv){
|
h264_chroma_mc_func chroma_op,cavs_vector *mv)
|
||||||
|
{
|
||||||
MpegEncContext * const s = &h->s;
|
MpegEncContext * const s = &h->s;
|
||||||
const int mx= mv->x + src_x_offset*8;
|
const int mx= mv->x + src_x_offset*8;
|
||||||
const int my= mv->y + src_y_offset*8;
|
const int my= mv->y + src_y_offset*8;
|
||||||
@ -360,9 +361,6 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps?
|
qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps?
|
||||||
if(!square){
|
|
||||||
qpix_op[luma_xy](dest_y + delta, src_y + delta, h->l_stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(emu){
|
if(emu){
|
||||||
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
|
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
|
||||||
@ -379,11 +377,12 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
|
|||||||
chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7);
|
chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta,
|
static inline void mc_part_std(AVSContext *h,int chroma_height,int delta,
|
||||||
uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr,
|
uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr,
|
||||||
int x_offset, int y_offset,qpel_mc_func *qpix_put,
|
int x_offset, int y_offset,qpel_mc_func *qpix_put,
|
||||||
h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg,
|
h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg,
|
||||||
h264_chroma_mc_func chroma_avg, cavs_vector *mv){
|
h264_chroma_mc_func chroma_avg, cavs_vector *mv)
|
||||||
|
{
|
||||||
qpel_mc_func *qpix_op= qpix_put;
|
qpel_mc_func *qpix_op= qpix_put;
|
||||||
h264_chroma_mc_func chroma_op= chroma_put;
|
h264_chroma_mc_func chroma_op= chroma_put;
|
||||||
|
|
||||||
@ -395,7 +394,7 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
|
|||||||
|
|
||||||
if(mv->ref >= 0){
|
if(mv->ref >= 0){
|
||||||
Picture *ref= &h->DPB[mv->ref];
|
Picture *ref= &h->DPB[mv->ref];
|
||||||
mc_dir_part(h, ref, square, chroma_height, delta, 0,
|
mc_dir_part(h, ref, chroma_height, delta, 0,
|
||||||
dest_y, dest_cb, dest_cr, x_offset, y_offset,
|
dest_y, dest_cb, dest_cr, x_offset, y_offset,
|
||||||
qpix_op, chroma_op, mv);
|
qpix_op, chroma_op, mv);
|
||||||
|
|
||||||
@ -405,7 +404,7 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
|
|||||||
|
|
||||||
if((mv+MV_BWD_OFFS)->ref >= 0){
|
if((mv+MV_BWD_OFFS)->ref >= 0){
|
||||||
Picture *ref= &h->DPB[0];
|
Picture *ref= &h->DPB[0];
|
||||||
mc_dir_part(h, ref, square, chroma_height, delta, 1,
|
mc_dir_part(h, ref, chroma_height, delta, 1,
|
||||||
dest_y, dest_cb, dest_cr, x_offset, y_offset,
|
dest_y, dest_cb, dest_cr, x_offset, y_offset,
|
||||||
qpix_op, chroma_op, mv+MV_BWD_OFFS);
|
qpix_op, chroma_op, mv+MV_BWD_OFFS);
|
||||||
}
|
}
|
||||||
@ -413,28 +412,28 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
|
|||||||
|
|
||||||
void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) {
|
void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) {
|
||||||
if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
|
if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
|
||||||
mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
|
mc_part_std(h, 8, 0, h->cy, h->cu, h->cv, 0, 0,
|
||||||
h->cdsp.put_cavs_qpel_pixels_tab[0],
|
h->cdsp.put_cavs_qpel_pixels_tab[0],
|
||||||
h->s.dsp.put_h264_chroma_pixels_tab[0],
|
h->s.dsp.put_h264_chroma_pixels_tab[0],
|
||||||
h->cdsp.avg_cavs_qpel_pixels_tab[0],
|
h->cdsp.avg_cavs_qpel_pixels_tab[0],
|
||||||
h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
|
h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
|
||||||
}else{
|
}else{
|
||||||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0,
|
mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 0, 0,
|
||||||
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
||||||
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
|
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
|
||||||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0,
|
mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 4, 0,
|
||||||
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
||||||
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
|
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
|
||||||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4,
|
mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 0, 4,
|
||||||
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
||||||
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
|
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
|
||||||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4,
|
mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 4, 4,
|
||||||
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
h->cdsp.put_cavs_qpel_pixels_tab[1],
|
||||||
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
h->s.dsp.put_h264_chroma_pixels_tab[1],
|
||||||
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
h->cdsp.avg_cavs_qpel_pixels_tab[1],
|
||||||
|
@ -661,7 +661,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
}
|
}
|
||||||
if(bits) { //decode 16-bit data
|
if(bits) { //decode 16-bit data
|
||||||
for(i = stereo; i >= 0; i--)
|
for(i = stereo; i >= 0; i--)
|
||||||
pred[i] = av_bswap16(get_bits(&gb, 16));
|
pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);
|
||||||
for(i = 0; i <= stereo; i++)
|
for(i = 0; i <= stereo; i++)
|
||||||
*samples++ = pred[i];
|
*samples++ = pred[i];
|
||||||
for(; i < unp_size / 2; i++) {
|
for(; i < unp_size / 2; i++) {
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "libavutil/crc.h"
|
#include "libavutil/crc.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/random_seed.h"
|
#include "libavutil/random_seed.h"
|
||||||
#include "libavcodec/xiph.h"
|
#include "libavcodec/xiph.h"
|
||||||
#include "libavcodec/bytestream.h"
|
#include "libavcodec/bytestream.h"
|
||||||
@ -69,18 +70,22 @@ typedef struct {
|
|||||||
int pref_size; ///< preferred page size (0 => fill all segments)
|
int pref_size; ///< preferred page size (0 => fill all segments)
|
||||||
} OGGContext;
|
} OGGContext;
|
||||||
|
|
||||||
|
#define OFFSET(x) offsetof(OGGContext, x)
|
||||||
|
#define PARAM AV_OPT_FLAG_ENCODING_PARAM
|
||||||
|
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
{ "oggpagesize", "Set preferred Ogg page size.",
|
{ "oggpagesize", "Set preferred Ogg page size.",
|
||||||
offsetof(OGGContext, pref_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM},
|
offsetof(OGGContext, pref_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM},
|
||||||
|
{ "pagesize", "preferred page size in bytes",
|
||||||
|
OFFSET(pref_size), AV_OPT_TYPE_INT, { 0 }, 0, MAX_PAGE_SIZE, PARAM },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const AVClass ogg_muxer_class = {
|
static const AVClass ogg_muxer_class = {
|
||||||
"Ogg muxer",
|
.class_name = "Ogg muxer",
|
||||||
av_default_item_name,
|
.item_name = av_default_item_name,
|
||||||
options,
|
.option = options,
|
||||||
LIBAVUTIL_VERSION_INT,
|
.version = LIBAVUTIL_VERSION_INT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -209,8 +214,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
|
|||||||
// them as such, otherwise seeking will not work correctly at the very
|
// them as such, otherwise seeking will not work correctly at the very
|
||||||
// least with old libogg versions.
|
// least with old libogg versions.
|
||||||
// Do not try to flush header packets though, that will create broken files.
|
// Do not try to flush header packets though, that will create broken files.
|
||||||
if (st->codec->codec_id == CODEC_ID_THEORA &&
|
if (st->codec->codec_id == CODEC_ID_THEORA && !header &&
|
||||||
!header &&
|
|
||||||
(ogg_granule_to_timestamp(oggstream, granule) >
|
(ogg_granule_to_timestamp(oggstream, granule) >
|
||||||
ogg_granule_to_timestamp(oggstream, oggstream->last_granule) + 1 ||
|
ogg_granule_to_timestamp(oggstream, oggstream->last_granule) + 1 ||
|
||||||
ogg_key_granule(oggstream, granule))) {
|
ogg_key_granule(oggstream, granule))) {
|
||||||
@ -241,8 +245,8 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
|
|||||||
if (i == total_segments)
|
if (i == total_segments)
|
||||||
page->granule = granule;
|
page->granule = granule;
|
||||||
|
|
||||||
if(page->segments_count == 255 ||
|
if (!header && (page->segments_count == 255 ||
|
||||||
(ogg->pref_size > 0 && page->size >= ogg->pref_size)) {
|
(ogg->pref_size > 0 && page->size >= ogg->pref_size))) {
|
||||||
ogg_buffer_page(s, oggstream);
|
ogg_buffer_page(s, oggstream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user