Commit 72153419 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote branch 'qatar/master'

* qatar/master: (33 commits)
  rtpdec_qdm2: Don't try to parse data packet if no configuration is received
  ac3enc: put the counting of stereo rematrixing bits in the same place to make the code easier to understand.
  ac3enc: clean up count_frame_bits() and count_frame_bits_fixed()
  mpegvideo: make FF_DEBUG_DCT_COEFF output coeffs via av_log() instead of just via AVFrame.
  srtdec: make sure we don't write past the end of buffer
  wmaenc: improve channel count and bitrate error handling in encode_init()
  matroskaenc: make sure we don't produce invalid file with no codec ID
  matroskadec: check that pointers were initialized before accessing them
  lavf: fix function name in compute_pkt_fields2 av_dlog message
  lavf: fix av_find_best_stream when providing a wanted stream.
  lavf: fix av_find_best_stream when decoder_ret is given and using a related stream.
  ffmpeg: factorize quality calculation
  tiff: add support for SamplesPerPixel tag in tiff_decode_tag()
  tiff: Prefer enum TiffCompr over int for TiffContext.compr.
  mov: Support edit list atom version 1.
  configure: Enable libpostproc automatically if GPL code is enabled.
  Cosmetics: fix prototypes in oggdec
  oggdec: fix memleak with continuous streams.
  matroskaenc: add missing new line in av_log() call
  dnxhdenc: add AVClass in private context.
  ...

swscale changes largely rewritten by me or replaced by baptsites due to lots of bugs in ronalds code.
Above code is also just in case its not obvios to a large extended duplicates that where cherry picked
from ffmpeg.

Conflicts:
	configure
	ffmpeg.c
	libavformat/matroskaenc.c
	libavutil/pixfmt.h
	libswscale/ppc/swscale_template.c
	libswscale/swscale.c
	libswscale/swscale_template.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/fate/h264.mak
	tests/ref/lavfi/pixdesc_le
	tests/ref/lavfi/pixfmts_copy_le
	tests/ref/lavfi/pixfmts_null_le
	tests/ref/lavfi/pixfmts_scale_le
	tests/ref/lavfi/pixfmts_vflip_le
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 410ca3bc 552a9995
......@@ -88,7 +88,7 @@ Configuration options:
--disable-avcodec disable libavcodec build
--disable-avformat disable libavformat build
--disable-swscale disable libswscale build
--enable-postproc enable GPLed postprocessing support [no]
--disable-postproc disable libpostproc build
--disable-avfilter disable video filter support [no]
--disable-pthreads disable pthreads [auto]
--enable-w32threads use Win32 threads [no]
......@@ -1497,6 +1497,7 @@ yadif_filter_deps="gpl"
# libraries
avdevice_deps="avcodec avformat"
avformat_deps="avcodec"
postproc_deps="gpl"
# programs
ffmpeg_deps="avcodec avformat swscale"
......@@ -1667,6 +1668,7 @@ enable ffprobe
enable ffserver
enable network
enable optimizations
enable postproc
enable protocols
enable static
enable stripping
......@@ -1689,7 +1691,7 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
CC_O='-o $@'
host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
host_cflags='-D_ISOC99_SOURCE -O3 -g -Wall'
host_libs='-lm'
target_path='$(CURDIR)'
......@@ -2342,7 +2344,7 @@ if test "$?" != 0; then
die "C compiler test failed."
fi
add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
add_cppflags -D_ISOC99_SOURCE
check_cflags -std=c99
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h>
......@@ -2390,7 +2392,6 @@ case $target_os in
disable symver
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
add_cppflags -D_XOPEN_SOURCE=600
;;
openbsd)
enable malloc_aligned
......@@ -2484,6 +2485,7 @@ case $target_os in
enable dos_paths
;;
linux)
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
enable dv1394
;;
irix*)
......@@ -2559,7 +2561,6 @@ die_license_disabled() {
die_license_disabled gpl libx264
die_license_disabled gpl libxavs
die_license_disabled gpl libxvid
die_license_disabled gpl postproc
die_license_disabled gpl x11grab
die_license_disabled nonfree libfaac
......
......@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* needed for usleep() */
#define _XOPEN_SOURCE 600
#include "config.h"
#include <ctype.h>
#include <string.h>
......@@ -1404,11 +1401,11 @@ static void print_report(AVFormatContext **output_files,
ti1 = 1e10;
vid = 0;
for(i=0;i<nb_ostreams;i++) {
float q= -1;
float q = -1;
ost = ost_table[i];
enc = ost->st->codec;
if(!ost->st->stream_copy && enc->coded_frame)
q= enc->coded_frame->quality/(float)FF_QP2LAMBDA;
if (!ost->st->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality/(float)FF_QP2LAMBDA;
if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
}
......@@ -1422,7 +1419,7 @@ static void print_report(AVFormatContext **output_files,
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
if(qp_hist){
int j;
int qp= lrintf(q);
int qp = lrintf(q);
if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram))
qp_histogram[qp]++;
for(j=0; j<32; j++)
......
......@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _XOPEN_SOURCE 600
#include "config.h"
#include <inttypes.h>
#include <math.h>
......
......@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _XOPEN_SOURCE 600
#include "config.h"
#if !HAVE_CLOSESOCKET
#define closesocket close
......
......@@ -791,35 +791,53 @@ static void count_frame_bits_fixed(AC3EncodeContext *s)
* no auxilliary data
*/
/* header size */
/* header */
frame_bits = 65;
frame_bits += frame_bits_inc[s->channel_mode];
/* audio blocks */
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
frame_bits += s->fbw_channels * 2 + 2; /* blksw * c, dithflag * c, dynrnge, cplstre */
if (s->channel_mode == AC3_CHMODE_STEREO) {
frame_bits++; /* rematstr */
}
frame_bits += 2 * s->fbw_channels; /* chexpstr[2] * c */
/* block switch flags */
frame_bits += s->fbw_channels;
/* dither flags */
frame_bits += s->fbw_channels;
/* dynamic range */
frame_bits++;
/* coupling strategy */
frame_bits++;
if (!blk)
frame_bits++;
/* exponent strategy */
frame_bits += 2 * s->fbw_channels;
if (s->lfe_on)
frame_bits++; /* lfeexpstr */
frame_bits++; /* baie */
frame_bits++; /* snr */
frame_bits += 2; /* delta / skip */
frame_bits++;
/* bit allocation params */
frame_bits++;
if (!blk)
frame_bits += 2 + 2 + 2 + 2 + 3;
/* snr offsets and fast gain codes */
frame_bits++;
if (!blk)
frame_bits += 6 + s->channels * (4 + 3);
/* delta bit allocation */
frame_bits++;
/* skipped data */
frame_bits++;
}
frame_bits++; /* cplinu for block 0 */
/* bit alloc info */
/* sdcycod[2], fdcycod[2], sgaincod[2], dbpbcod[2], floorcod[3] */
/* csnroffset[6] */
/* (fsnoffset[4] + fgaincod[4]) * c */
frame_bits += 2*4 + 3 + 6 + s->channels * (4 + 3);
/* auxdatae, crcrsv */
frame_bits += 2;
/* auxiliary data */
frame_bits++;
/* CRC */
frame_bits += 16;
frame_bits += 1 + 16;
s->frame_bits_fixed = frame_bits;
}
......@@ -869,6 +887,7 @@ static void count_frame_bits(AC3EncodeContext *s)
int blk, ch;
int frame_bits = 0;
/* header */
if (opt->audio_production_info)
frame_bits += 7;
if (s->bitstream_id == 6) {
......@@ -878,18 +897,22 @@ static void count_frame_bits(AC3EncodeContext *s)
frame_bits += 14;
}
/* audio blocks */
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
/* stereo rematrixing */
if (s->channel_mode == AC3_CHMODE_STEREO &&
s->blocks[blk].new_rematrixing_strategy) {
frame_bits += s->num_rematrixing_bands;
if (s->channel_mode == AC3_CHMODE_STEREO) {
frame_bits++;
if (s->blocks[blk].new_rematrixing_strategy)
frame_bits += s->num_rematrixing_bands;
}
/* bandwidth codes & gain range */
for (ch = 0; ch < s->fbw_channels; ch++) {
if (s->exp_strategy[ch][blk] != EXP_REUSE)
frame_bits += 6 + 2; /* chbwcod[6], gainrng[2] */
frame_bits += 6 + 2;
}
}
s->frame_bits = s->frame_bits_fixed + frame_bits;
}
......
......@@ -233,15 +233,16 @@ extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
extern const uint8_t ff_cavs_chroma_qp[64];
extern const uint8_t ff_cavs_scan3x3[4];
extern const uint8_t ff_cavs_partition_flags[30];
extern const int_fast8_t ff_left_modifier_l[8];
extern const int_fast8_t ff_top_modifier_l[8];
extern const int_fast8_t ff_left_modifier_c[7];
extern const int_fast8_t ff_top_modifier_c[7];
extern const int8_t ff_left_modifier_l[8];
extern const int8_t ff_top_modifier_l[8];
extern const int8_t ff_left_modifier_c[7];
extern const int8_t ff_top_modifier_c[7];
extern const cavs_vector ff_cavs_intra_mv;
extern const cavs_vector ff_cavs_un_mv;
extern const cavs_vector ff_cavs_dir_mv;
static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
static inline void modify_pred(const int8_t *mod_table, int *mode)
{
*mode = mod_table[*mode];
if(*mode < 0) {
av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
......
......@@ -497,9 +497,9 @@ static const uint8_t tc_tab[64] = {
5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
};
const int_fast8_t ff_left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7};
const int_fast8_t ff_top_modifier_l[8] = {-1, 1, 5,-1,-1, 5, 7, 7};
const int_fast8_t ff_left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
const int_fast8_t ff_top_modifier_c[7] = { 4, 1,-1,-1, 4, 6, 6};
const int8_t ff_left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
const int8_t ff_top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
const int8_t ff_left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
const int8_t ff_top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
#endif /* AVCODEC_CAVSDATA_H */
......@@ -250,7 +250,7 @@ typedef struct FFV1Context{
uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
int run_index;
int colorspace;
int_fast16_t *sample_buffer;
int16_t *sample_buffer;
int gob_count;
int packed_at_lsb;
......@@ -280,7 +280,8 @@ static av_always_inline int fold(int diff, int bits){
return diff;
}
static inline int predict(int_fast16_t *src, int_fast16_t *last){
static inline int predict(int16_t *src, int16_t *last)
{
const int LT= last[-1];
const int T= last[ 0];
const int L = src[-1];
......@@ -288,7 +289,9 @@ static inline int predict(int_fast16_t *src, int_fast16_t *last){
return mid_pred(L, L + T - LT, T);
}
static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
static inline int get_context(PlaneContext *p, int16_t *src,
int16_t *last, int16_t *last2)
{
const int LT= last[-1];
const int T= last[ 0];
const int RT= last[ 1];
......@@ -507,7 +510,10 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int
}
#if CONFIG_FFV1_ENCODER
static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
static av_always_inline int encode_line(FFV1Context *s, int w,
int16_t *sample[2],
int plane_index, int bits)
{
PlaneContext * const p= &s->plane[plane_index];
RangeCoder * const c= &s->c;
int x;
......@@ -592,7 +598,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sam
static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
int x,y,i;
const int ring_size= s->avctx->context_model ? 3 : 2;
int_fast16_t *sample[3];
int16_t *sample[3];
s->run_index=0;
memset(s->sample_buffer, 0, ring_size*(w+6)*sizeof(*s->sample_buffer));
......@@ -628,7 +634,7 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
int x, y, p, i;
const int ring_size= s->avctx->context_model ? 3 : 2;
int_fast16_t *sample[3][3];
int16_t *sample[3][3];
s->run_index=0;
memset(s->sample_buffer, 0, ring_size*3*(w+6)*sizeof(*s->sample_buffer));
......@@ -1318,7 +1324,10 @@ static av_cold int common_end(AVCodecContext *avctx){
return 0;
}
static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
static av_always_inline void decode_line(FFV1Context *s, int w,
int16_t *sample[2],
int plane_index, int bits)
{
PlaneContext * const p= &s->plane[plane_index];
RangeCoder * const c= &s->c;
int x;
......@@ -1378,7 +1387,7 @@ static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sa
static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
int x, y;
int_fast16_t *sample[2];
int16_t *sample[2];
sample[0]=s->sample_buffer +3;
sample[1]=s->sample_buffer+w+6+3;
......@@ -1387,7 +1396,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
memset(s->sample_buffer, 0, 2*(w+6)*sizeof(*s->sample_buffer));
for(y=0; y<h; y++){
int_fast16_t *temp= sample[0]; //FIXME try a normal buffer
int16_t *temp = sample[0]; //FIXME try a normal buffer
sample[0]= sample[1];
sample[1]= temp;
......@@ -1419,7 +1428,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride,
static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
int x, y, p;
int_fast16_t *sample[3][2];
int16_t *sample[3][2];
for(x=0; x<3; x++){
sample[x][0] = s->sample_buffer + x*2 *(w+6) + 3;
sample[x][1] = s->sample_buffer + (x*2+1)*(w+6) + 3;
......@@ -1431,7 +1440,7 @@ static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st
for(y=0; y<h; y++){
for(p=0; p<3; p++){
int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer
int16_t *temp = sample[p][0]; //FIXME try a normal buffer
sample[p][0]= sample[p][1];
sample[p][1]= temp;
......
......@@ -145,9 +145,9 @@
#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
static av_always_inline void row_fdct(DCTELEM * data){
int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast16_t tmp10, tmp11, tmp12, tmp13;
int_fast16_t z1, z2, z3, z4, z5, z11, z13;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5, z11, z13;
DCTELEM *dataptr;
int ctr;
......@@ -209,9 +209,9 @@ static av_always_inline void row_fdct(DCTELEM * data){
GLOBAL(void)
fdct_ifast (DCTELEM * data)
{
int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast16_t tmp10, tmp11, tmp12, tmp13;
int_fast16_t z1, z2, z3, z4, z5, z11, z13;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5, z11, z13;
DCTELEM *dataptr;
int ctr;
......@@ -275,9 +275,9 @@ fdct_ifast (DCTELEM * data)
GLOBAL(void)
fdct_ifast248 (DCTELEM * data)
{
int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast16_t tmp10, tmp11, tmp12, tmp13;
int_fast16_t z1;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1;
DCTELEM *dataptr;
int ctr;
......
......@@ -181,9 +181,9 @@
static av_always_inline void row_fdct(DCTELEM * data){
int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast32_t tmp10, tmp11, tmp12, tmp13;
int_fast32_t z1, z2, z3, z4, z5;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5;
DCTELEM *dataptr;
int ctr;
......@@ -259,9 +259,9 @@ static av_always_inline void row_fdct(DCTELEM * data){
GLOBAL(void)
ff_jpeg_fdct_islow (DCTELEM * data)
{
int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast32_t tmp10, tmp11, tmp12, tmp13;
int_fast32_t z1, z2, z3, z4, z5;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5;
DCTELEM *dataptr;
int ctr;
......@@ -345,9 +345,9 @@ ff_jpeg_fdct_islow (DCTELEM * data)
GLOBAL(void)
ff_fdct248_islow (DCTELEM * data)
{
int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int_fast32_t tmp10, tmp11, tmp12, tmp13;
int_fast32_t z1;
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1;
DCTELEM *dataptr;
int ctr;
......
......@@ -25,9 +25,6 @@
* @author Adam Thayer (krevnik@comcast.net)
*/
/* needed for mkstemp() */
#define _XOPEN_SOURCE 600
#include <xvid.h>
#include <unistd.h>
#include "avcodec.h"
......
......@@ -38,7 +38,7 @@ typedef struct TiffContext {
AVFrame picture;
int width, height;
unsigned int bpp;
unsigned int bpp, bppcount;
int le;
enum TiffCompr compr;
int invert;
......@@ -214,6 +214,55 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
return 0;
}
static int init_image(TiffContext *s)
{
int i, ret;
uint32_t *pal;
switch (s->bpp * 10 + s->bppcount) {
case 11:
s->avctx->pix_fmt = PIX_FMT_MONOBLACK;
break;
case 81:
s->avctx->pix_fmt = PIX_FMT_PAL8;
break;
case 243:
s->avctx->pix_fmt = PIX_FMT_RGB24;
break;
case 161:
s->avctx->pix_fmt = PIX_FMT_GRAY16BE;
break;
case 324:
s->avctx->pix_fmt = PIX_FMT_RGBA;
break;
case 483:
s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE;
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, bppcount=%d)\n",
s->bpp, s->bppcount);
return AVERROR_INVALIDDATA;
}
if (s->width != s->avctx->width || s->height != s->avctx->height) {
if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
return ret;
avcodec_set_dimensions(s->avctx, s->width, s->height);
}
if (s->picture.data[0])
s->avctx->release_buffer(s->avctx, &s->picture);
if ((ret = s->avctx->get_buffer(s->avctx, &s->picture)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
if (s->bpp == 8 && s->picture.data[1]){
/* make default grayscale pal */
pal = (uint32_t *) s->picture.data[1];
for (i = 0; i < 256; i++)
pal[i] = i * 0x010101;
}
return 0;
}
static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
{
......@@ -267,6 +316,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
s->height = value;
break;
case TIFF_BPP:
s->bppcount = count;
if(count > 4){
av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
return -1;
......@@ -286,46 +336,16 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
s->bpp = -1;
}
}
switch(s->bpp*10 + count){
case 11:
s->avctx->pix_fmt = PIX_FMT_MONOBLACK;
break;
case 81:
s->avctx->pix_fmt = PIX_FMT_PAL8;
break;
case 243:
s->avctx->pix_fmt = PIX_FMT_RGB24;
break;
case 161:
s->avctx->pix_fmt = PIX_FMT_GRAY16BE;
break;
case 324:
s->avctx->pix_fmt = PIX_FMT_RGBA;
break;
case 483:
s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE;
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
return -1;
}
if(s->width != s->avctx->width || s->height != s->avctx->height){
if(av_image_check_size(s->width, s->height, 0, s->avctx))
return -1;
avcodec_set_dimensions(s->avctx, s->width, s->height);
}
if(s->picture.data[0])
s->avctx->release_buffer(s->avctx, &s->picture);
if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
if(s->bpp == 8){
/* make default grayscale pal */
pal = (uint32_t *) s->picture.data[1];
for(i = 0; i < 256; i++)
pal[i] = i * 0x010101;
}
break;
case TIFF_SAMPLES_PER_PIXEL:
if (count != 1) {
av_log(s->avctx, AV_LOG_ERROR,
"Samples per pixel requires a single value, many provided\n");
return AVERROR_INVALIDDATA;
}
if (s->bppcount == 1)
s->bpp *= value;
s->bppcount = value;
break;
case TIFF_COMPR:
s->compr = value;
......@@ -468,7 +488,7 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame *picture = data;
AVFrame * const p= (AVFrame*)&s->picture;
const uint8_t *orig_buf = buf, *end_buf = buf + buf_size;
int id, le, off;
int id, le, off, ret;
int i, j, entries;
int stride, soff, ssize;
uint8_t *dst;
......@@ -509,21 +529,9 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
/* now we have the data and may start decoding */
if(!p->data[0]){
s->bpp = 1;
avctx->pix_fmt = PIX_FMT_MONOBLACK;
if(s->width != s->avctx->width || s->height != s->avctx->height){
if(av_image_check_size(s->width, s->height, 0, s->avctx))
return -1;
avcodec_set_dimensions(s->avctx, s->width, s->height);
}
if(s->picture.data[0])
s->avctx->release_buffer(s->avctx, &s->picture);
if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
}
if ((ret = init_image(s)) < 0)
return ret;
if(s->strips == 1 && !s->stripsize){
av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");
s->stripsize = buf_size - s->stripoff;
......
......@@ -53,9 +53,7 @@ unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n)
// reasonable to check redundantly.
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
{
uint_fast32_t exit_at_level[33] = {
404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint32_t exit_at_level[33] = { 404 };
unsigned i, j, p, code;
......@@ -106,7 +104,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
#ifdef V_DEBUG
av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]);
init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
init_get_bits(&gb, (uint8_t *)&codes[p], bits[p]);
for (i = 0; i < bits[p]; ++i)
av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
av_log(NULL, AV_LOG_INFO, "\n");
......@@ -206,7 +204,7 @@ static void render_line(int x0, int y0, int x1, int y1, float *buf)
}
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint_fast16_t *y_list, int *flag,
uint16_t *y_list, int *flag,
int multiplier, float *out, int samples)
{
int lx, ly, i;
......
......@@ -30,17 +30,17 @@ extern const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8];
extern const int64_t ff_vorbis_channel_layouts[9];
typedef struct {
uint_fast16_t x;
uint_fast16_t sort;
uint_fast16_t low;
uint_fast16_t high;
uint16_t x;
uint16_t sort;
uint16_t low;
uint16_t high;
} vorbis_floor1_entry;
void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint_fast16_t * y_list, int * flag,
uint16_t *y_list, int *flag,
int multiplier, float * out, int samples);
void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
......
This diff is collapsed.
......@@ -674,7 +674,7 @@ static float get_floor_average(vorbis_enc_floor * fc, float *coeffs, int i)
}
static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc,
float *coeffs, uint_fast16_t *posts, int samples)
float *coeffs, uint16_t *posts, int samples)
{
int range = 255 / fc->multiplier + 1;
int i;
......@@ -706,7 +706,7 @@ static int render_point(int x0, int y0, int x1, int y1, int x)
}
static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
PutBitContext *pb, uint_fast16_t *posts,
PutBitContext *pb, uint16_t *posts,
float *floor, int samples)
{
int range = 255 / fc->multiplier + 1;
......@@ -1010,7 +1010,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
for (i = 0; i < venc->channels; i++) {
vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]];
uint_fast16_t posts[MAX_FLOOR_VALUES];
uint16_t posts[MAX_FLOOR_VALUES];
floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
}
......
......@@ -24,10 +24,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _BSD_SOURCE 1
#define _NETBSD_SOURCE
#define _XOPEN_SOURCE 600
#include "libavformat/avformat.h"
#if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
# include <dev/bktr/ioctl_meteor.h>
......
......@@ -35,8 +35,6 @@
* and Edouard Gomez <ed.gomez@free.fr>.
*/
#define _XOPEN_SOURCE 600
#include "config.h"
#include "libavformat/avformat.h"
#include <time.h>
......
......@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
......
......@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
......
......@@ -19,9 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* needed for usleep() */
#define _XOPEN_SOURCE 600
#include <unistd.h>
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "os_support.h"
......
......@@ -109,7 +109,7 @@ typedef struct MOVStreamContext {
unsigned int keyframe_count;
int *keyframes;
int time_scale;
int time_offset; ///< time offset of the first edit list entry
int64_t time_offset; ///< time offset of the first edit list entry
int current_sample;
unsigned int bytes_per_frame;
unsigned int samples_per_frame;
......
......@@ -616,7 +616,7 @@ static int mkv_write_tracks(AVFormatContext *s)
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_SUBTITLE);
if (!native_id) {
av_log(s, AV_LOG_ERROR, "Subtitle codec %d is not supported.\n", codec->codec_id);
return AVERROR(EINVAL);
return AVERROR(ENOSYS);
}
break;
default:
......
......@@ -2166,13 +2166,13 @@ free_and_return:
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
MOVStreamContext *sc;
int i, edit_count;
int i, edit_count, version;
if (c->fc->nb_streams < 1)
return 0;
sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
avio_r8(pb); /* version */
version = avio_r8(pb); /* version */
avio_rb24(pb); /* flags */
edit_count = avio_rb32(pb); /* entries */
......@@ -2180,9 +2180,15 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return -1;
for(i=0; i<edit_count; i++){
int time;
int duration = avio_rb32(pb); /* Track duration */
time = avio_rb32(pb); /* Media time */
int64_t time;
int64_t duration;
if (version == 1) {
duration = avio_rb64(pb);
time = avio_rb64(pb);
} else {
duration = avio_rb32(pb); /* segment duration */
time = avio_rb32(pb); /* media time */
}
avio_rb32(pb); /* Media rate */
if (i == 0 && time >= -1) {
sc->time_offset = time != -1 ? time : -duration;
......
......@@ -56,8 +56,7 @@ static const struct ogg_codec * const ogg_codecs[] = {
};
//FIXME We could avoid some structure duplication
static int
ogg_save (AVFormatContext * s)
static int ogg_save(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
struct ogg_state *ost =
......@@ -81,8 +80,7 @@ ogg_save (AVFormatContext * s)
return 0;
}
static int
ogg_restore (AVFormatContext * s, int discard)
static int ogg_restore(AVFormatContext *s, int discard)
{
struct ogg *ogg = s->priv_data;
AVIOContext *bc = s->pb;
......@@ -110,8 +108,7 @@ ogg_restore (AVFormatContext * s, int discard)
return 0;
}
static int
ogg_reset (struct ogg * ogg)
static int ogg_reset(struct ogg *ogg)
{
int i;
......@@ -135,8 +132,7 @@ ogg_reset (struct ogg * ogg)
return 0;
}
static const struct ogg_codec *
ogg_find_codec (uint8_t * buf, int size)
static const struct ogg_codec *ogg_find_codec(uint8_t *buf, int size)
{
int i;
......@@ -148,8 +144,7 @@ ogg_find_codec (uint8_t * buf, int size)
return NULL;
}
static int
ogg_new_stream (AVFormatContext * s, uint32_t serial)
static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
{
struct ogg *ogg = s->priv_data;
......@@ -166,17 +161,18 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial)
os->buf = av_malloc(os->bufsize);
os->header = -1;
st = av_new_stream (s, idx);
if (!st)
return AVERROR(ENOMEM);
if (new_avstream) {
st = av_new_stream(s, idx);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000);
av_set_pts_info(st, 64, 1, 1000000);
}
return idx;
}
static int
ogg_new_buf(struct ogg *ogg, int idx)
static int ogg_new_buf(struct ogg *ogg, int idx)
{
struct ogg_stream *os = ogg->streams + idx;
uint8_t *nb = av_malloc(os->bufsize);
......@@ -192,8 +188,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
return 0;
}
static int
ogg_read_page (AVFormatContext * s, int *str)
static int ogg_read_page(AVFormatContext *s, int *str)
{
AVIOContext *bc = s->pb;
struct ogg *ogg = s->priv_data;
......@@ -251,8 +246,10 @@ ogg_read_page (AVFormatContext * s, int *str)
}
ogg->curidx = -1;
ogg->nstreams = 0;
idx = ogg_new_stream(s, serial, 0);
} else {
idx = ogg_new_stream(s, serial, 1);
}
idx = ogg_new_stream (s, serial);
if (idx < 0)
return -1;
}
......@@ -308,8 +305,8 @@ ogg_read_page (AVFormatContext * s, int *str)
return 0;
}
static int
ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpos)
static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
int64_t *fpos)
{
struct ogg *ogg = s->priv_data;
int idx, i;
......@@ -439,8 +436,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
return 0;
}
static int
ogg_get_headers (AVFormatContext * s)
static int ogg_get_headers(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
......@@ -456,8 +452,7 @@ ogg_get_headers (AVFormatContext * s)
return 0;
}
static int
ogg_get_length (AVFormatContext * s)
static int ogg_get_length(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
......@@ -505,9 +500,7 @@ ogg_get_length (AVFormatContext * s)
return 0;
}
static int
ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
static int ogg_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
struct ogg *ogg = s->priv_data;
int i;
......@@ -558,8 +551,7 @@ static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
return pts;
}
static int
ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct ogg *ogg;
struct ogg_stream *os;
......@@ -599,9 +591,7 @@ retry:
return psize;
}
static int
ogg_read_close (AVFormatContext * s)
static int ogg_read_close(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
......@@ -614,10 +604,8 @@ ogg_read_close (AVFormatContext * s)
return 0;
}
static int64_t
ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
int64_t pos_limit)
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *pos_arg, int64_t pos_limit)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index;
......@@ -640,7 +628,8 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
return pts;
}
static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
static int ogg_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index;
......@@ -660,24 +649,21 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
static int ogg_probe(AVProbeData *p)
{
if (p->buf[0] == 'O' && p->buf[1] == 'g' &&
p->buf[2] == 'g' && p->buf[3] == 'S' &&
p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
if (!memcmp("OggS", p->buf, 5) && p->buf[5] <= 0x7)
return AVPROBE_SCORE_MAX;
else
return 0;
return 0;
}
AVInputFormat ff_ogg_demuxer = {
"ogg",
NULL_IF_CONFIG_SMALL("Ogg"),
sizeof (struct ogg),
ogg_probe,
ogg_read_header,
ogg_read_packet,
ogg_read_close,
ogg_read_seek,
ogg_read_timestamp,
.extensions = "ogg",
.flags = AVFMT_GENERIC_INDEX,
.name = "ogg",
.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.priv_data_size = sizeof(struct ogg),
.read_probe = ogg_probe,
.read_header = ogg_read_header,
.read_packet = ogg_read_packet,
.read_close = ogg_read_close,
.read_seek = ogg_read_seek,
.read_timestamp = ogg_read_timestamp,
.extensions = "ogg",
.flags = AVFMT_GENERIC_INDEX,
};
......@@ -22,7 +22,6 @@
/* needed by inet_aton() */
#define _SVID_SOURCE
#define _DARWIN_C_SOURCE
#include "config.h"
#include "avformat.h"
......
......@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* needed for gethostname() */
#define _XOPEN_SOURCE 600
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
......
......@@ -266,6 +266,8 @@ static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
* to the decoder that it is OK to initialize. */
st->codec->codec_id = CODEC_ID_QDM2;
}
if (st->codec->codec_id == CODEC_ID_NONE)
return AVERROR(EAGAIN);
/* subpackets */
while (end - p >= 4) {
......
......@@ -25,7 +25,7 @@
*/
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
#include "avformat.h"
#include "avio_internal.h"
#include "libavutil/parseutils.h"
......
......@@ -17,10 +17,8 @@
*/
#ifdef __APPLE__
#undef _POSIX_C_SOURCE
#include <sys/sysctl.h>
#elif defined(__OpenBSD__)
#undef _POSIX_C_SOURCE
#include <sys/param.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
......
......@@ -1875,23 +1875,23 @@ static int packedCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[
return srcSliceH;
}
#define DITHER_COPY(dst, dstStride, src, srcStride, bswap)\
#define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\
uint16_t scale= dither_scale[dst_depth-1][src_depth-1];\
int shift= src_depth-dst_depth + dither_scale[src_depth-2][dst_depth-1];\
for (i = 0; i < height; i++) {\
uint8_t *dither= dithers[src_depth-9][i&7];\
for (j = 0; j < length-7; j+=8){\
dst[j+0] = (bswap(src[j+0]) + dither[0])*scale>>shift;\
dst[j+1] = (bswap(src[j+1]) + dither[1])*scale>>shift;\
dst[j+2] = (bswap(src[j+2]) + dither[2])*scale>>shift;\
dst[j+3] = (bswap(src[j+3]) + dither[3])*scale>>shift;\
dst[j+4] = (bswap(src[j+4]) + dither[4])*scale>>shift;\
dst[j+5] = (bswap(src[j+5]) + dither[5])*scale>>shift;\
dst[j+6] = (bswap(src[j+6]) + dither[6])*scale>>shift;\
dst[j+7] = (bswap(src[j+7]) + dither[7])*scale>>shift;\
dst[j+0] = dbswap((bswap(src[j+0]) + dither[0])*scale>>shift);\
dst[j+1] = dbswap((bswap(src[j+1]) + dither[1])*scale>>shift);\
dst[j+2] = dbswap((bswap(src[j+2]) + dither[2])*scale>>shift);\
dst[j+3] = dbswap((bswap(src[j+3]) + dither[3])*scale>>shift);\
dst[j+4] = dbswap((bswap(src[j+4]) + dither[4])*scale>>shift);\
dst[j+5] = dbswap((bswap(src[j+5]) + dither[5])*scale>>shift);\
dst[j+6] = dbswap((bswap(src[j+6]) + dither[6])*scale>>shift);\
dst[j+7] = dbswap((bswap(src[j+7]) + dither[7])*scale>>shift);\
}\
for (; j < length; j++)\
dst[j] = (bswap(src[j]) + dither[j&7])*scale>>shift;\
dst[j] = dbswap((bswap(src[j]) + dither[j&7])*scale>>shift);\
dst += dstStride;\
src += srcStride;\
}
......@@ -1921,42 +1921,66 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[
) {
const int src_depth = av_pix_fmt_descriptors[c->srcFormat].comp[plane].depth_minus1+1;
const int dst_depth = av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1+1;
uint16_t *srcPtr2 = (uint16_t*)srcPtr;
const uint16_t *srcPtr2 = (const uint16_t*)srcPtr;
uint16_t *dstPtr2 = (uint16_t*)dstPtr;
if (dst_depth == 8) {
if(isBE(c->srcFormat) == HAVE_BIGENDIAN){
DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, )
DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , )
} else {
DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16)
DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, )
}
} else if (src_depth == 8) {
for (i = 0; i < height; i++) {
for (j = 0; j < length; j++)
dstPtr2[j] = (srcPtr[j]<<(dst_depth-8)) |
(srcPtr[j]>>(2*8-dst_depth));
if(isBE(c->dstFormat)){
for (j = 0; j < length; j++)
AV_WB16(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |
(srcPtr[j]>>(2*8-dst_depth)));
} else {
for (j = 0; j < length; j++)
AV_WL16(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |
(srcPtr[j]>>(2*8-dst_depth)));
}
dstPtr2 += dstStride[plane]/2;
srcPtr += srcStride[plane];
}
} else if (src_depth <= dst_depth) {
for (i = 0; i < height; i++) {
if(isBE(c->dstFormat)){
for (j = 0; j < length; j++)
AV_WB16(&dstPtr2[j], (srcPtr2[j]<<(dst_depth-src_depth)) |
(srcPtr2[j]>>(2*src_depth-dst_depth)));
}else{
for (j = 0; j < length; j++)
AV_WL16(&dstPtr2[j], (srcPtr2[j]<<(dst_depth-src_depth)) |
(srcPtr2[j]>>(2*src_depth-dst_depth)));
#define COPY_UP(r,w) \
for (j = 0; j < length; j++){ \
unsigned int v= r(&srcPtr2[j]);\
w(&dstPtr2[j], (v<<(dst_depth-src_depth)) | \
(v>>(2*src_depth-dst_depth)));\
}
if(isBE(c->srcFormat)){
if(isBE(c->dstFormat)){
COPY_UP(AV_RB16, AV_WB16)
} else {
COPY_UP(AV_RB16, AV_WL16)
}
} else {
if(isBE(c->dstFormat)){
COPY_UP(AV_RL16, AV_WB16)
} else {
COPY_UP(AV_RL16, AV_WL16)
}
}
dstPtr2 += dstStride[plane]/2;
srcPtr2 += srcStride[plane]/2;
}
} else {
if(isBE(c->srcFormat) == HAVE_BIGENDIAN){
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, )
if(isBE(c->dstFormat) == HAVE_BIGENDIAN){
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , )
} else {
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16)
}
}else{
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16)
if(isBE(c->dstFormat) == HAVE_BIGENDIAN){
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, )
} else {
DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16)
}
}
}
} else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)
......
......@@ -358,6 +358,7 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV422P10BE \
)
#define is9_OR_10BPS isNBPS //for ronald
#define isBE(x) ((x)&1)
#define isPlanar8YUV(x) ( \
(x)==PIX_FMT_YUV410P \
......
......@@ -1678,6 +1678,8 @@ static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *s
);
#else
int i;
// FIXME I don't think this code is right for YUV444/422, since then h is not subsampled so
// we need to skip each second pixel. Same for BEToUV.
for (i=0; i<width; i++) {
dstU[i]= src1[2*i + 1];
dstV[i]= src2[2*i + 1];
......@@ -1827,27 +1829,29 @@ static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV,
}
// FIXME Maybe dither instead.
#define YUV_NBPS(depth) \
static inline void RENAME(yuv ## depth ## ToUV)(uint8_t *dstU, uint8_t *dstV, \
const uint16_t *srcU, const uint16_t *srcV, \
long width, uint32_t *unused) \
#define YUV_NBPS(depth, endianness, rfunc) \
static inline void endianness ## depth ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
const uint16_t *srcU, const uint16_t *srcV, \
long width, uint32_t *unused) \
{ \
int i; \
for (i = 0; i < width; i++) { \
dstU[i] = srcU[i]>>(depth-8); \
dstV[i] = srcV[i]>>(depth-8); \
dstU[i] = rfunc(&srcU[i])>>(depth-8); \
dstV[i] = rfunc(&srcV[i])>>(depth-8); \
} \
} \
\
static inline void RENAME(yuv ## depth ## ToY)(uint8_t *dstY, const uint16_t *srcY, long width, uint32_t *unused) \
static inline void endianness ## depth ## ToY_c(uint8_t *dstY, const uint16_t *srcY, long width, uint32_t *unused) \
{ \
int i; \
for (i = 0; i < width; i++) \
dstY[i] = srcY[i]>>(depth-8); \
dstY[i] = rfunc(&srcY[i])>>(depth-8); \
} \
YUV_NBPS( 9)
YUV_NBPS(10)
YUV_NBPS( 9, LE, AV_RL16)
YUV_NBPS( 9, BE, AV_RB16)
YUV_NBPS(10, LE, AV_RL16)
YUV_NBPS(10, BE, AV_RB16)
#if COMPILE_TEMPLATE_MMX
static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, enum PixelFormat srcFormat)
......@@ -2978,9 +2982,12 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
case PIX_FMT_PAL8 :
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break;
case PIX_FMT_YUV420P9 : c->chrToYV12 = (void*)RENAME(yuv9ToUV ); break;
case PIX_FMT_YUV422P10:
case PIX_FMT_YUV420P10: c->chrToYV12 = (void*)RENAME(yuv10ToUV); break;
case PIX_FMT_YUV420P9BE: c->chrToYV12 = BE9ToUV_c; break;
case PIX_FMT_YUV420P9LE: c->chrToYV12 = LE9ToUV_c; break;
case PIX_FMT_YUV422P10BE:
case PIX_FMT_YUV420P10BE: c->chrToYV12 = BE10ToUV_c; break;
case PIX_FMT_YUV422P10LE:
case PIX_FMT_YUV420P10LE: c->chrToYV12 = LE10ToUV_c; break;
case PIX_FMT_YUV420P16BE:
case PIX_FMT_YUV422P16BE:
case PIX_FMT_YUV444P16BE: c->chrToYV12 = RENAME(BEToUV); break;
......@@ -3027,9 +3034,12 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
c->lumToYV12 = NULL;
c->alpToYV12 = NULL;
switch (srcFormat) {
case PIX_FMT_YUV420P9 : c->lumToYV12 = (void*)RENAME(yuv9ToY ); break;
case PIX_FMT_YUV422P10:
case PIX_FMT_YUV420P10: c->lumToYV12 = (void*)RENAME(yuv10ToY); break;
case PIX_FMT_YUV420P9BE: c->lumToYV12 = BE9ToY_c; break;
case PIX_FMT_YUV420P9LE: c->lumToYV12 = LE9ToY_c; break;
case PIX_FMT_YUV422P10BE:
case PIX_FMT_YUV420P10BE: c->lumToYV12 = BE10ToY_c; break;
case PIX_FMT_YUV422P10LE:
case PIX_FMT_YUV420P10LE: c->lumToYV12 = LE10ToY_c; break;
case PIX_FMT_YUYV422 :
case PIX_FMT_YUV420P16BE:
case PIX_FMT_YUV422P16BE:
......
......@@ -107,15 +107,17 @@ const char *swscale_license(void)
|| (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_MONOWHITE \
|| (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \
|| (x)==PIX_FMT_YUV420P9 \
|| (x)==PIX_FMT_YUV420P10 \
|| (x)==PIX_FMT_YUV422P10 \
|| (x)==PIX_FMT_YUV422P10 \
)
int sws_isSupportedInput(enum PixelFormat pix_fmt)
......@@ -143,12 +145,14 @@ int sws_isSupportedInput(enum PixelFormat pix_fmt)
|| (x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_YUV410P \
|| (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_YUV420P9 \
|| (x)==PIX_FMT_YUV420P10 \
|| (x)==PIX_FMT_YUV422P10 \
|| (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \
......
......@@ -307,12 +307,12 @@ fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = framecrc -i $(SAMPLES)/h264-co
fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0
fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264
fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVNL_BRCM_A.264
fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p16be
fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p10le
fate-h264-conformance-hcbp2_hhi_a: CMD = framecrc -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/HCBP2_HHI_A.264
fate-h264-conformance-hcmp1_hhi_a: CMD = framecrc -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/HCMP1_HHI_A.264
fate-h264-conformance-ls_sva_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/LS_SVA_D.264
......
0, 0, 2764800, 0xf69f33f5
0, 3600, 2764800, 0x8d602e2f
0, 7200, 2764800, 0xe2111955
0, 10800, 2764800, 0xbbe76d10
0, 14400, 2764800, 0x81cbbb10
0, 18000, 2764800, 0xb5259536
0, 21600, 2764800, 0x4972ded4
0, 25200, 2764800, 0xc726c878
0, 28800, 2764800, 0xd8a2b4fc
0, 32400, 2764800, 0xaa4b80f7
0, 0, 2764800, 0xcc4df07d
0, 3600, 2764800, 0x85f9e6d4
0, 7200, 2764800, 0x23ffe90d
0, 10800, 2764800, 0xf0a6d453
0, 14400, 2764800, 0x913a6392
0, 18000, 2764800, 0xcc5f9736
0, 21600, 2764800, 0x43f9f9ce
0, 25200, 2764800, 0xc874b44e
0, 28800, 2764800, 0x83b665e6
0, 32400, 2764800, 0x5ea2e31e
0, 0, 2764800, 0x8c3e963e
0, 3600, 2764800, 0xa1b0f891
0, 7200, 2764800, 0xcd090f45
0, 10800, 2764800, 0x2df70987
0, 14400, 2764800, 0x66d22478
0, 18000, 2764800, 0x64b0ddef
0, 21600, 2764800, 0xdd86fb62
0, 25200, 2764800, 0x36fc36d4
0, 28800, 2764800, 0xee32176f
0, 32400, 2764800, 0x99c649b5
0, 0, 2764800, 0x4f710132
0, 3600, 2764800, 0x57e5b713
0, 7200, 2764800, 0xcca01477
0, 10800, 2764800, 0xa19a95cd
0, 14400, 2764800, 0x700a757d
0, 18000, 2764800, 0xd8c6f60f
0, 21600, 2764800, 0x95a1bbc7
0, 25200, 2764800, 0x0582077a
0, 28800, 2764800, 0x91595f91
0, 32400, 2764800, 0xf5fe034a
0, 0, 2764800, 0xe4289a64
0, 3600, 2764800, 0x01ea4677
0, 7200, 2764800, 0x7c1b00f4
0, 10800, 2764800, 0xf51a4695
0, 14400, 2764800, 0xe1dd8ace
0, 18000, 2764800, 0xe9fd1996
0, 21600, 2764800, 0x083ce1db
0, 25200, 2764800, 0x2c5bc489
0, 28800, 2764800, 0xb6d10e63
0, 32400, 2764800, 0x813daf47
0, 0, 2764800, 0xda69f69e
0, 3600, 2764800, 0x29ed832f
0, 7200, 2764800, 0xb3244cc4
0, 10800, 2764800, 0xe41a312c
0, 14400, 2764800, 0xac0b344b
0, 18000, 2764800, 0xc585aa20
0, 21600, 2764800, 0x0952054c
0, 25200, 2764800, 0xd1a02f87
0, 28800, 2764800, 0xfcbfe87c
0, 32400, 2764800, 0xe4e9b8a2
0, 0, 6220800, 0x26bc0f20
0, 3600, 6220800, 0x69acba0c
0, 7200, 6220800, 0x10d17202
0, 10800, 6220800, 0x790d98f1
0, 14400, 6220800, 0x71fe35c2
0, 18000, 6220800, 0xc9d345cb
0, 21600, 6220800, 0xcb4bad2e
0, 25200, 6220800, 0x01604385
0, 28800, 6220800, 0xe585bb5f
0, 32400, 6220800, 0xc9d345cb
0, 36000, 6220800, 0x2bdf0dd0
0, 39600, 6220800, 0x79794ac4
0, 43200, 6220800, 0x106afcdf
0, 46800, 6220800, 0xc9d345cb
0, 50400, 6220800, 0x106afcdf
0, 54000, 6220800, 0xc9d345cb
0, 57600, 6220800, 0x106afcdf
0, 61200, 6220800, 0xc9d345cb
0, 64800, 6220800, 0xf0b8dde0
0, 0, 6220800, 0xca2a2a5e
0, 3600, 6220800, 0x8009a65e
0, 7200, 6220800, 0x63e72b3b
0, 10800, 6220800, 0x7459a1cc
0, 14400, 6220800, 0x02191aa9
0, 18000, 6220800, 0x88dca590
0, 21600, 6220800, 0x56dd150a
0, 25200, 6220800, 0x5f56a56f
0, 28800, 6220800, 0x67ada4b7
0, 32400, 6220800, 0x88dca590
0, 36000, 6220800, 0xd3b09fe5
0, 39600, 6220800, 0x2223998c
0, 43200, 6220800, 0x5e5b2da5
0, 46800, 6220800, 0x88dca590
0, 50400, 6220800, 0x5e5b2da5
0, 54000, 6220800, 0x88dca590
0, 57600, 6220800, 0x5e5b2da5
0, 61200, 6220800, 0x88dca590
0, 64800, 6220800, 0x26e1ec8b
0, 0, 6220800, 0x77a0ee6a
0, 3600, 6220800, 0x1850d87c
0, 7200, 6220800, 0x116ac02c
0, 10800, 6220800, 0xb834fb9d
0, 14400, 6220800, 0xabfae062
0, 18000, 6220800, 0x717845a7
0, 21600, 6220800, 0xb246fc4b
0, 25200, 6220800, 0x2cf2769d
0, 28800, 6220800, 0xf8ac6a4a
0, 32400, 6220800, 0xfa278467
0, 0, 6220800, 0x1df58ce9
0, 3600, 6220800, 0x8f2859ce
0, 7200, 6220800, 0x229cc7ff
0, 10800, 6220800, 0x73e86984
0, 14400, 6220800, 0xb6d4504b
0, 18000, 6220800, 0x4e7d4883
0, 21600, 6220800, 0xbec3f0f7
0, 25200, 6220800, 0x1d9af065
0, 28800, 6220800, 0x44851549
0, 32400, 6220800, 0xfcf8728e
0, 0, 6220800, 0x738b0778
0, 3600, 6220800, 0x04821310
0, 7200, 6220800, 0x4837f3d9
0, 10800, 6220800, 0x5e246bfe
0, 14400, 6220800, 0xdb46d88c
0, 18000, 6220800, 0x74b67352
0, 21600, 6220800, 0x1cdb5be8
0, 25200, 6220800, 0x2d5e5f1e
0, 28800, 6220800, 0x429c5928
0, 32400, 6220800, 0x8e227f6c
0, 0, 6220800, 0x408daf70
0, 3600, 6220800, 0x59b254a3
0, 7200, 6220800, 0x4cf4279c
0, 10800, 6220800, 0x5c9437ae
0, 14400, 6220800, 0x986c3eb8
0, 18000, 6220800, 0x23fd883e
0, 21600, 6220800, 0x84f222fe
0, 25200, 6220800, 0xe7f91107
0, 28800, 6220800, 0xb544b31e
0, 32400, 6220800, 0x1ebdde56
0, 0, 6220800, 0x6616177e
0, 3600, 6220800, 0xf3fe7a1c
0, 7200, 6220800, 0x44f0fab6
0, 10800, 6220800, 0x109ff851
0, 14400, 6220800, 0x9501f055
0, 18000, 6220800, 0x603d6e3d
0, 21600, 6220800, 0x42126cfb
0, 25200, 6220800, 0x113169e8
0, 28800, 6220800, 0xe8f64949
0, 32400, 6220800, 0x89488caf
0, 0, 6220800, 0xf81873fe
0, 3600, 6220800, 0x7b96fbdc
0, 7200, 6220800, 0x75dbafc4
0, 10800, 6220800, 0x7524301e
0, 14400, 6220800, 0x0f3621ab
0, 18000, 6220800, 0xa5e25b35
0, 21600, 6220800, 0x063a8116
0, 25200, 6220800, 0x48ebc8ff
0, 28800, 6220800, 0x1f635df8
0, 32400, 6220800, 0xe282c8bd
......@@ -27,9 +27,11 @@ uyvy422 adcf64516a19fce44df77082bdb16291
yuv410p 2d9225153c83ee1132397d619d94d1b3
yuv411p 8b298af3e43348ca1b11eb8a3252ac6c
yuv420p eba2f135a08829387e2f698ff72a2939
yuv420p10be 7605e266c088d0fcf68c7b27c3ceff5f
yuv420p10le 4228ee628c6deec123a13b9784516cc7
yuv420p16be 16c009a235cd52b74791a895423152a3
yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc
yuv420p9be ce880fa07830e5297c22acf6e20555ce
yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
yuv422p c9bba4529821d796a6ab09f6a5fd355a
yuv422p10le d0607c260a45c973e6639f4e449730ad
......
......@@ -27,9 +27,11 @@ uyvy422 adcf64516a19fce44df77082bdb16291
yuv410p 2d9225153c83ee1132397d619d94d1b3
yuv411p 8b298af3e43348ca1b11eb8a3252ac6c
yuv420p eba2f135a08829387e2f698ff72a2939
yuv420p10be 7605e266c088d0fcf68c7b27c3ceff5f
yuv420p10le 4228ee628c6deec123a13b9784516cc7
yuv420p16be 16c009a235cd52b74791a895423152a3
yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc
yuv420p9be ce880fa07830e5297c22acf6e20555ce
yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
yuv422p c9bba4529821d796a6ab09f6a5fd355a
yuv422p10le d0607c260a45c973e6639f4e449730ad
......
......@@ -27,9 +27,11 @@ uyvy422 adcf64516a19fce44df77082bdb16291
yuv410p 2d9225153c83ee1132397d619d94d1b3
yuv411p 8b298af3e43348ca1b11eb8a3252ac6c
yuv420p eba2f135a08829387e2f698ff72a2939
yuv420p10be 7605e266c088d0fcf68c7b27c3ceff5f
yuv420p10le 4228ee628c6deec123a13b9784516cc7
yuv420p16be 16c009a235cd52b74791a895423152a3
yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc
yuv420p9be ce880fa07830e5297c22acf6e20555ce
yuv420p9le 16543fda8f87d94a6cf857d2e8d4461a
yuv422p c9bba4529821d796a6ab09f6a5fd355a
yuv422p10le d0607c260a45c973e6639f4e449730ad
......
......@@ -27,9 +27,11 @@ uyvy422 314bd486277111a95d9369b944fa0400
yuv410p 7df8f6d69b56a8dcb6c7ee908e5018b5
yuv411p 1143e7c5cc28fe0922b051b17733bc4c
yuv420p fdad2d8df8985e3d17e73c71f713cb14
yuv420p10be 6d335e75b553da590135cf8bb999610c
yuv420p10le d510ddbabefd03ef39ec943fcb51b709
yuv420p16be 29a0265764530070f5cd3251cc01f66a
yuv420p16le 6f3a265b084a78baec229238d9f7945f
yuv420p9be ec4983b7a949c0472110a7a2c58e278a
yuv420p9le c136dce5913a722eee44ab72cff664b2
yuv422p 918e37701ee7377d16a8a6c119c56a40
yuv422p10le aeb0ef08a883f43429ca9d886d8fc095
......
......@@ -27,9 +27,11 @@ uyvy422 ffbd36720c77398d9a0d03ce2625928f
yuv410p 7bfb39d7afb49d6a6173e6b23ae321eb
yuv411p 4a90048cc3a65fac150e53289700efe1
yuv420p 2e6d6062e8cad37fb3ab2c433b55f382
yuv420p10be df97d20b3b4a10c174d4360552c4160d
yuv420p10le 4b5249208602b941332945c926f80ae9
yuv420p16be 539076782902664a8acf381bf4f713e8
yuv420p16le 0f609e588e5a258644ef85170d70e030
yuv420p9be be40ec975fb2873891643cbbbddbc3b0
yuv420p9le 7e606310d3f5ff12badf911e8f333471
yuv422p d7f5cb44d9b0210d66d6a8762640ab34
yuv422p10le 11b57f2bd9661024153f3973b9090cdb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment