Skip to content

Commit

Permalink
Bump Major version, this commit is almost just renaming bits_per_samp…
Browse files Browse the repository at this point in the history
…le to

bits_per_coded_sample but that cannot be done seperately.
Patch by Luca Abeni
Also reset the minor version and fix the forgotton change to libfaad.
Note: The API/ABI should not be considered stable yet, there still may
be a change done here or there if some developer has some cleanup ideas and
patches!

Originally committed as revision 15262 to svn://svn.ffmpeg.org/ffmpeg/trunk
  • Loading branch information
Luca Abeni authored and michaelni committed Sep 8, 2008
1 parent 71375e0 commit dd1c8f3
Show file tree
Hide file tree
Showing 71 changed files with 206 additions and 207 deletions.
4 changes: 2 additions & 2 deletions libavcodec/8bps.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 1;
}

switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 8:
avctx->pix_fmt = PIX_FMT_PAL8;
c->planes = 1;
Expand Down Expand Up @@ -193,7 +193,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
#endif
break;
default:
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_sample);
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/alac.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
alac->context_initialized = 0;

alac->numchannels = alac->avctx->channels;
alac->bytespersample = (avctx->bits_per_sample / 8) * alac->numchannels;
alac->bytespersample = (avctx->bits_per_coded_sample / 8) * alac->numchannels;
avctx->sample_fmt = SAMPLE_FMT_S16;

return 0;
Expand Down
10 changes: 5 additions & 5 deletions libavcodec/alacenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1);

avctx->frame_size = DEFAULT_FRAME_SIZE;
avctx->bits_per_sample = DEFAULT_SAMPLE_SIZE;
avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;

if(avctx->sample_fmt != SAMPLE_FMT_S16) {
av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
Expand All @@ -384,17 +384,17 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->rc.rice_modifier = 4;

s->max_coded_frame_size = (ALAC_FRAME_HEADER_SIZE + ALAC_FRAME_FOOTER_SIZE +
avctx->frame_size*avctx->channels*avctx->bits_per_sample)>>3;
avctx->frame_size*avctx->channels*avctx->bits_per_coded_sample)>>3;

s->write_sample_size = avctx->bits_per_sample + avctx->channels - 1; // FIXME: consider wasted_bytes
s->write_sample_size = avctx->bits_per_coded_sample + avctx->channels - 1; // FIXME: consider wasted_bytes

AV_WB32(alac_extradata, ALAC_EXTRADATA_SIZE);
AV_WB32(alac_extradata+4, MKBETAG('a','l','a','c'));
AV_WB32(alac_extradata+12, avctx->frame_size);
AV_WB8 (alac_extradata+17, avctx->bits_per_sample);
AV_WB8 (alac_extradata+17, avctx->bits_per_coded_sample);
AV_WB8 (alac_extradata+21, avctx->channels);
AV_WB32(alac_extradata+24, s->max_coded_frame_size);
AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_sample); // average bitrate
AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_coded_sample); // average bitrate
AV_WB32(alac_extradata+32, avctx->sample_rate);

// Set relevant extradata fields
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/apedec.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
return -1;
}
if (avctx->bits_per_sample != 16) {
if (avctx->bits_per_coded_sample != 16) {
av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "libavutil/avutil.h"

#define LIBAVCODEC_VERSION_MAJOR 51
#define LIBAVCODEC_VERSION_MINOR 71
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 0
#define LIBAVCODEC_VERSION_MICRO 0

#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/cinepak.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
s->sega_film_skip_bytes = -1; /* uninitialized state */

// check for paletted data
if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) {
if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
s->palette_video = 0;
avctx->pix_fmt = PIX_FMT_YUV420P;
} else {
Expand Down
8 changes: 4 additions & 4 deletions libavcodec/cscd.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,19 @@ static av_cold int decode_init(AVCodecContext *avctx) {
if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) {
return 1;
}
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
case 24: avctx->pix_fmt = PIX_FMT_BGR24; break;
case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
default:
av_log(avctx, AV_LOG_ERROR,
"CamStudio codec error: invalid depth %i bpp\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
return 1;
}
c->bpp = avctx->bits_per_sample;
c->bpp = avctx->bits_per_coded_sample;
c->pic.data[0] = NULL;
c->linelen = avctx->width * avctx->bits_per_sample / 8;
c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
c->height = avctx->height;
c->decomp_size = c->height * c->linelen;
c->decomp_buf = av_malloc(c->decomp_size + LZO_OUTPUT_PADDING);
Expand Down
16 changes: 8 additions & 8 deletions libavcodec/huffyuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ s->bgr32=1;
//if(avctx->extradata)
// printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size);
if(avctx->extradata_size){
if((avctx->bits_per_sample&7) && avctx->bits_per_sample != 12)
if((avctx->bits_per_coded_sample&7) && avctx->bits_per_coded_sample != 12)
s->version=1; // do such files exist at all?
else
s->version=2;
Expand All @@ -507,15 +507,15 @@ s->bgr32=1;
s->predictor= method&63;
s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1];
if(s->bitstream_bpp==0)
s->bitstream_bpp= avctx->bits_per_sample&~7;
s->bitstream_bpp= avctx->bits_per_coded_sample&~7;
interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;

if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0)
return -1;
}else{
switch(avctx->bits_per_sample&7){
switch(avctx->bits_per_coded_sample&7){
case 1:
s->predictor= LEFT;
s->decorrelate= 0;
Expand All @@ -526,7 +526,7 @@ s->bgr32=1;
break;
case 3:
s->predictor= PLANE;
s->decorrelate= avctx->bits_per_sample >= 24;
s->decorrelate= avctx->bits_per_coded_sample >= 24;
break;
case 4:
s->predictor= MEDIAN;
Expand All @@ -537,7 +537,7 @@ s->bgr32=1;
s->decorrelate= 0;
break;
}
s->bitstream_bpp= avctx->bits_per_sample & ~7;
s->bitstream_bpp= avctx->bits_per_coded_sample & ~7;
s->context= 0;

if(read_old_huffman_tables(s) < 0)
Expand Down Expand Up @@ -569,7 +569,7 @@ s->bgr32=1;

alloc_temp(s);

// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced);
// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);

return 0;
}
Expand Down Expand Up @@ -626,7 +626,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
avctx->bits_per_sample= s->bitstream_bpp;
avctx->bits_per_coded_sample= s->bitstream_bpp;
s->decorrelate= s->bitstream_bpp >= 24;
s->predictor= avctx->prediction_method;
s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
Expand Down Expand Up @@ -717,7 +717,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->stats[i][j]= 0;
}

// printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced);
// printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);

alloc_temp(s);

Expand Down
18 changes: 9 additions & 9 deletions libavcodec/imgresample.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct SwsContext {
enum PixelFormat src_pix_fmt, dst_pix_fmt;
};

struct ImgReSampleContext {
typedef struct ImgReSampleContext {
int iwidth, iheight, owidth, oheight;
int topBand, bottomBand, leftBand, rightBand;
int padtop, padbottom, padleft, padright;
Expand All @@ -62,7 +62,7 @@ struct ImgReSampleContext {
DECLARE_ALIGNED_8(int16_t, h_filters[NB_PHASES][NB_TAPS]); /* horizontal filters */
DECLARE_ALIGNED_8(int16_t, v_filters[NB_PHASES][NB_TAPS]); /* vertical filters */
uint8_t *line_buf;
};
} ImgReSampleContext;

void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type);

Expand Down Expand Up @@ -424,13 +424,6 @@ static void component_resample(ImgReSampleContext *s,
}
}

ImgReSampleContext *img_resample_init(int owidth, int oheight,
int iwidth, int iheight)
{
return img_resample_full_init(owidth, oheight, iwidth, iheight,
0, 0, 0, 0, 0, 0, 0, 0);
}

ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
int iwidth, int iheight,
int topBand, int bottomBand,
Expand Down Expand Up @@ -484,6 +477,13 @@ ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
return NULL;
}

ImgReSampleContext *img_resample_init(int owidth, int oheight,
int iwidth, int iheight)
{
return img_resample_full_init(owidth, oheight, iwidth, iheight,
0, 0, 0, 0, 0, 0, 0, 0);
}

void img_resample(ImgReSampleContext *s,
AVPicture *output, const AVPicture *input)
{
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/lclenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
case PIX_FMT_BGR24:
c->imgtype = IMGTYPE_RGB24;
c->decomp_size = avctx->width * avctx->height * 3;
avctx->bits_per_sample= 24;
avctx->bits_per_coded_sample= 24;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Input pixel format %s not supported\n", avcodec_get_pix_fmt_name(avctx->pix_fmt));
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/libfaad.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ static av_cold int faac_decode_init(AVCodecContext *avctx)
faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle);

if (faac_cfg) {
switch (avctx->bits_per_sample) {
case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_sample); break;
switch (avctx->bits_per_coded_sample) {
case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_coded_sample); break;
default:
case 16:
#ifdef FAAD2_VERSION
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/msrle.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
return -1;
}

switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 8:
msrle_decode_pal8(s);
break;
Expand All @@ -273,7 +273,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
break;
default:
av_log(avctx, AV_LOG_ERROR, "Don't know how to decode depth %u.\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
}

*data_size = sizeof(AVFrame);
Expand Down
8 changes: 4 additions & 4 deletions libavcodec/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
break;
}

avctx->bits_per_sample = av_get_bits_per_sample(avctx->codec->id);
avctx->block_align = avctx->channels * avctx->bits_per_sample/8;
avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
avctx->coded_frame= avcodec_alloc_frame();
avctx->coded_frame->key_frame= 1;

Expand Down Expand Up @@ -354,7 +354,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
if (CODEC_ID_PCM_DVD == avctx->codec_id)
/* 2 samples are interleaved per block in PCM_DVD */
sample_size = avctx->bits_per_sample * 2 / 8;
sample_size = avctx->bits_per_coded_sample * 2 / 8;

n = avctx->channels * sample_size;

Expand Down Expand Up @@ -470,7 +470,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
case CODEC_ID_PCM_DVD:
dst_int32_t = data;
n /= avctx->channels;
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 20:
while (n--) {
c = avctx->channels;
Expand Down
8 changes: 4 additions & 4 deletions libavcodec/qtrle.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
QtrleContext *s = avctx->priv_data;

s->avctx = avctx;
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
avctx->pix_fmt = PIX_FMT_MONOWHITE;
Expand Down Expand Up @@ -412,7 +412,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)

default:
av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
break;
}

Expand Down Expand Up @@ -466,7 +466,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
}
row_ptr = s->frame.linesize[0] * start_line;

switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
qtrle_decode_1bpp(s, stream_ptr, row_ptr, height);
Expand Down Expand Up @@ -504,7 +504,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,

default:
av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/qtrleenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Unsupported colorspace.\n");
break;
}
avctx->bits_per_sample = s->pixel_size*8;
avctx->bits_per_coded_sample = s->pixel_size*8;

s->rlecode_table = av_mallocz(s->avctx->width);
s->skip_table = av_mallocz(s->avctx->width);
Expand Down
10 changes: 5 additions & 5 deletions libavcodec/rawdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
RawVideoContext *context = avctx->priv_data;

if (avctx->codec_tag == MKTAG('r','a','w',' '))
avctx->pix_fmt = findPixelFormat(pixelFormatBpsMOV, avctx->bits_per_sample);
avctx->pix_fmt = findPixelFormat(pixelFormatBpsMOV, avctx->bits_per_coded_sample);
else if (avctx->codec_tag)
avctx->pix_fmt = findPixelFormat(ff_raw_pixelFormatTags, avctx->codec_tag);
else if (avctx->bits_per_sample)
avctx->pix_fmt = findPixelFormat(pixelFormatBpsAVI, avctx->bits_per_sample);
else if (avctx->bits_per_coded_sample)
avctx->pix_fmt = findPixelFormat(pixelFormatBpsAVI, avctx->bits_per_coded_sample);

context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
context->buffer = av_malloc(context->length);
Expand All @@ -89,7 +89,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
}

static void flip(AVCodecContext *avctx, AVPicture * picture){
if(!avctx->codec_tag && avctx->bits_per_sample && picture->linesize[2]==0){
if(!avctx->codec_tag && avctx->bits_per_coded_sample && picture->linesize[2]==0){
picture->data[0] += picture->linesize[0] * (avctx->height-1);
picture->linesize[0] *= -1;
}
Expand All @@ -108,7 +108,7 @@ static int raw_decode(AVCodecContext *avctx,
frame->top_field_first = avctx->coded_frame->top_field_first;

//4bpp raw in avi and mov (yes this is ugly ...)
if(avctx->bits_per_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
int i;
for(i=256*2; i+1 < context->length>>1; i++){
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/shorten.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header
avctx->sample_rate = get_le32(&hb);
avctx->bit_rate = get_le32(&hb) * 8;
avctx->block_align = get_le16(&hb);
avctx->bits_per_sample = get_le16(&hb);
avctx->bits_per_coded_sample = get_le16(&hb);

if (avctx->bits_per_sample != 16) {
if (avctx->bits_per_coded_sample != 16) {
av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample\n");
return -1;
}
Expand Down

0 comments on commit dd1c8f3

Please sign in to comment.