Compare commits

..

No commits in common. "3cc1dc335821ef0c8cf351aa850f46965f55c26b" and "43abd1ced9424d7f9ff340d1fe01b3a43411b849" have entirely different histories.

6 changed files with 30 additions and 19 deletions

View File

@ -76,9 +76,7 @@ typedef struct OGGPageList {
typedef struct OGGContext {
const AVClass *class;
OGGPageList *page_list;
#if LIBAVFORMAT_VERSION_MAJOR < 63
int pref_size; ///< preferred page size (0 => fill all segments)
#endif
int64_t pref_duration; ///< preferred page duration (0 => fill all segments)
int serial_offset;
} OGGContext;
@ -89,12 +87,10 @@ typedef struct OGGContext {
static const AVOption options[] = {
{ "serial_offset", "serial number offset",
OFFSET(serial_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, PARAM },
#if LIBAVFORMAT_VERSION_MAJOR < 63
{ "oggpagesize", "Set preferred Ogg page size.",
OFFSET(pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, PARAM | AV_OPT_FLAG_DEPRECATED },
{ "pagesize", "preferred page size in bytes",
OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM | AV_OPT_FLAG_DEPRECATED },
#endif
OFFSET(pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, PARAM},
{ "pagesize", "preferred page size in bytes (deprecated)",
OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM },
{ "page_duration", "preferred page duration, in microseconds",
OFFSET(pref_duration), AV_OPT_TYPE_INT64, { .i64 = 1000000 }, 0, INT64_MAX, PARAM },
{ NULL },
@ -266,12 +262,8 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
if (page->segments_count == 255) {
ogg_buffer_page(s, oggstream);
} else if (!header) {
#if LIBAVFORMAT_VERSION_MAJOR < 63
if ((ogg->pref_size > 0 && page->size >= ogg->pref_size) ||
(ogg->pref_duration > 0 && next - start >= ogg->pref_duration)) {
#else
if (ogg->pref_duration > 0 && next - start >= ogg->pref_duration) {
#endif
ogg_buffer_page(s, oggstream);
}
}
@ -485,6 +477,9 @@ static int ogg_init(AVFormatContext *s)
OGGStreamContext *oggstream = NULL;
int i, j;
if (ogg->pref_size)
av_log(s, AV_LOG_WARNING, "The pagesize option is deprecated\n");
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
unsigned serial_num = i + ogg->serial_offset;

View File

@ -93,6 +93,21 @@ bool ff_sws_pixel_type_is_int(SwsPixelType type)
return false;
}
SwsPixelType ff_sws_pixel_type_to_uint(SwsPixelType type)
{
if (!type)
return type;
switch (ff_sws_pixel_type_size(type)) {
case 8: return SWS_PIXEL_U8;
case 16: return SWS_PIXEL_U16;
case 32: return SWS_PIXEL_U32;
}
av_unreachable("Invalid pixel type!");
return SWS_PIXEL_NONE;
}
/* biased towards `a` */
static AVRational av_min_q(AVRational a, AVRational b)
{

View File

@ -39,6 +39,7 @@ typedef enum SwsPixelType {
const char *ff_sws_pixel_type_name(SwsPixelType type);
int ff_sws_pixel_type_size(SwsPixelType type) av_const;
bool ff_sws_pixel_type_is_int(SwsPixelType type) av_const;
SwsPixelType ff_sws_pixel_type_to_uint(SwsPixelType type) av_const;
typedef enum SwsOpType {
SWS_OP_INVALID = 0,

View File

@ -287,10 +287,10 @@ DECL_PATTERN(expand32)
SWS_LOOP
for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
x32[i] = (uint32_t)x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
y32[i] = (uint32_t)y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
z32[i] = (uint32_t)z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
w32[i] = (uint32_t)w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
x32[i] = x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
y32[i] = y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
z32[i] = z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
w32[i] = w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
}
CONTINUE(u32block_t, x32, y32, z32, w32);

View File

@ -616,8 +616,8 @@ static void normalize_clear(SwsOp *op)
if (!op->c.q4[i].den)
continue;
switch (ff_sws_pixel_type_size(op->type)) {
case 1: c.u32 = 0x1010101U * priv.u8[i]; break;
case 2: c.u32 = (uint32_t)priv.u16[i] << 16 | priv.u16[i]; break;
case 1: c.u32 = 0x1010101 * priv.u8[i]; break;
case 2: c.u32 = priv.u16[i] << 16 | priv.u16[i]; break;
case 4: c.u32 = priv.u32[i]; break;
}

View File

@ -438,7 +438,7 @@ static AVRational rndq(SwsPixelType t)
{
const unsigned num = rnd();
if (ff_sws_pixel_type_is_int(t)) {
const unsigned mask = UINT_MAX >> (32 - ff_sws_pixel_type_size(t) * 8);
const unsigned mask = (1 << (ff_sws_pixel_type_size(t) * 8)) - 1;
return (AVRational) { num & mask, 1 };
} else {
const unsigned den = rnd();
@ -588,7 +588,7 @@ static void check_convert(void)
.convert.to = o,
});
} else if (isize > osize || !ff_sws_pixel_type_is_int(i)) {
uint32_t range = UINT32_MAX >> (32 - osize * 8);
uint32_t range = (1 << osize * 8) - 1;
CHECK_COMMON_RANGE(name, range, i, o, {
.op = SWS_OP_CONVERT,
.type = i,