Replace all remaining occurances of step/depth_minus1 and offset_plus1

This commit is contained in:
Hendrik Leppkes 2015-09-08 17:10:48 +02:00
parent 151aa2ebff
commit 5d8e836d0e
42 changed files with 105 additions and 105 deletions

View File

@ -2722,7 +2722,7 @@ static void ffprobe_show_pixel_formats(WriterContext *w)
for (i = 0; i < pixdesc->nb_components; i++) {
writer_print_section_header(w, SECTION_ID_PIXEL_FORMAT_COMPONENT);
print_int("index", i + 1);
print_int("bit_depth", pixdesc->comp[i].depth_minus1 + 1);
print_int("bit_depth", pixdesc->comp[i].depth);
writer_print_section_footer(w);
}
writer_print_section_footer(w);

View File

@ -39,7 +39,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
s->big_endian = !!(desc->flags & AV_PIX_FMT_FLAG_BE);
s->bits_per_component = desc->comp[0].depth_minus1 + 1;
s->bits_per_component = desc->comp[0].depth;
s->num_components = desc->nb_components;
s->descriptor = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? 51 : 50;
s->planar = !!(desc->flags & AV_PIX_FMT_FLAG_PLANAR);

View File

@ -359,7 +359,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
FFV1Context *fs = *(void **)arg;
FFV1Context *f = fs->avctx->priv_data;
int width, height, x, y, ret;
const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step_minus1 + 1;
const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step;
AVFrame * const p = f->cur;
int i, si;

View File

@ -1123,7 +1123,7 @@ static int encode_slice(AVCodecContext *c, void *arg)
int x = fs->slice_x;
int y = fs->slice_y;
const AVFrame *const p = f->picture.f;
const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step_minus1 + 1;
const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step;
int ret;
RangeCoder c_bak = fs->c;
const uint8_t *planes[3] = {p->data[0] + ps*x + y*p->linesize[0],

View File

@ -238,7 +238,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->bps = desc->comp[0].depth_minus1 + 1;
s->bps = desc->comp[0].depth;
s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2;
s->chroma = desc->nb_components > 2;
s->alpha = !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA);

View File

@ -201,20 +201,20 @@ static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components,
switch (components) {
case 4:
match = match && desc->comp[3].depth_minus1 + 1 >= bpc &&
match = match && desc->comp[3].depth >= bpc &&
(log2_chroma_wh >> 14 & 3) == 0 &&
(log2_chroma_wh >> 12 & 3) == 0;
case 3:
match = match && desc->comp[2].depth_minus1 + 1 >= bpc &&
match = match && desc->comp[2].depth >= bpc &&
(log2_chroma_wh >> 10 & 3) == desc->log2_chroma_w &&
(log2_chroma_wh >> 8 & 3) == desc->log2_chroma_h;
case 2:
match = match && desc->comp[1].depth_minus1 + 1 >= bpc &&
match = match && desc->comp[1].depth >= bpc &&
(log2_chroma_wh >> 6 & 3) == desc->log2_chroma_w &&
(log2_chroma_wh >> 4 & 3) == desc->log2_chroma_h;
case 1:
match = match && desc->comp[0].depth_minus1 + 1 >= bpc &&
match = match && desc->comp[0].depth >= bpc &&
(log2_chroma_wh >> 2 & 3) == 0 &&
(log2_chroma_wh & 3) == 0 &&
(desc->flags & AV_PIX_FMT_FLAG_PAL) == pal8 * AV_PIX_FMT_FLAG_PAL;

View File

@ -204,7 +204,7 @@ static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *i
int index, x, y, c;
int adjust[4];
for (x = 0; x < image->numcomps; x++)
adjust[x] = FFMAX(FFMIN(desc->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0) + desc->comp[x].shift;
adjust[x] = FFMAX(FFMIN(desc->comp[x].depth - image->comps[x].prec, 8), 0) + desc->comp[x].shift;
for (y = 0; y < picture->height; y++) {
index = y * picture->width;
@ -241,7 +241,7 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {
int index, x, y;
int adjust[4];
for (x = 0; x < image->numcomps; x++)
adjust[x] = FFMAX(FFMIN(desc->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0) + desc->comp[x].shift;
adjust[x] = FFMAX(FFMIN(desc->comp[x].depth - image->comps[x].prec, 8), 0) + desc->comp[x].shift;
for (index = 0; index < image->numcomps; index++) {
comp_data = image->comps[index].data;

View File

@ -2158,7 +2158,7 @@ fail:
return ret;
the_end:
is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step_minus1;
is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step > 1;
if (AV_RB32(s->upscale_h)) {
int p;

View File

@ -311,7 +311,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
for (i = 0; i < s->bpp_tab_size; i++)
bpp_tab[i] = desc->comp[i].depth_minus1 + 1;
bpp_tab[i] = desc->comp[i].depth;
if (s->compr == TIFF_DEFLATE ||
s->compr == TIFF_ADOBE_DEFLATE ||

View File

@ -700,7 +700,7 @@ void avpriv_color_frame(AVFrame *frame, const int c[4])
int bytes = is_chroma ? FF_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
int height = is_chroma ? FF_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
for (y = 0; y < height; y++) {
if (desc->comp[0].depth_minus1 >= 8) {
if (desc->comp[0].depth >= 9) {
for (x = 0; x<bytes; x++)
((uint16_t*)dst)[x] = c[p];
}else
@ -2705,7 +2705,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
"%s", enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
av_get_pix_fmt_name(enc->pix_fmt));
if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE &&
enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1)
enc->bits_per_raw_sample < av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth)
av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample);
if (enc->color_range != AVCOL_RANGE_UNSPECIFIED)
av_strlcatf(detail, sizeof(detail), "%s, ",

View File

@ -42,7 +42,7 @@ void ff_llviddsp_init_x86(LLVidDSPContext *c, AVCodecContext *avctx)
c->diff_int16 = ff_diff_int16_mmx;
}
if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc->comp[0].depth_minus1<15) {
if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc->comp[0].depth<16) {
c->add_hfyu_median_pred_int16 = ff_add_hfyu_median_pred_int16_mmxext;
c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_mmxext;
}

View File

@ -733,8 +733,8 @@ static av_cold void opengl_fill_color_map(OpenGLContext *opengl)
return;
#define FILL_COMPONENT(i) { \
shift = desc->comp[i].depth_minus1 >> 3; \
opengl->color_map[(i << 2) + ((desc->comp[i].offset_plus1 - 1) >> shift)] = 1.0; \
shift = (desc->comp[i].depth - 1) >> 3; \
opengl->color_map[(i << 2) + (desc->comp[i].offset >> shift)] = 1.0; \
}
memset(opengl->color_map, 0, sizeof(opengl->color_map));

View File

@ -172,15 +172,15 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
for (i = 0; i < desc->nb_components; i++) {
c = &desc->comp[i];
/* for now, only 8-bits formats */
if (c->depth_minus1 != 8 - 1)
if (c->depth != 8)
return AVERROR(ENOSYS);
if (c->plane >= MAX_PLANES)
return AVERROR(ENOSYS);
/* strange interleaving */
if (pixelstep[c->plane] != 0 &&
pixelstep[c->plane] != c->step_minus1 + 1)
pixelstep[c->plane] != c->step)
return AVERROR(ENOSYS);
pixelstep[c->plane] = c->step_minus1 + 1;
pixelstep[c->plane] = c->step;
if (pixelstep[c->plane] >= 8)
return AVERROR(ENOSYS);
nb_planes = FFMAX(nb_planes, c->plane + 1);
@ -196,7 +196,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
draw->vsub[1] = draw->vsub[2] = draw->vsub_max = desc->log2_chroma_h;
for (i = 0; i < ((desc->nb_components - 1) | 1); i++)
draw->comp_mask[desc->comp[i].plane] |=
1 << (desc->comp[i].offset_plus1 - 1);
1 << desc->comp[i].offset;
return 0;
}

View File

@ -269,7 +269,7 @@ static int config_input(AVFilterLink *inlink)
s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
s->planewidth[0] = s->planewidth[3] = inlink->w;
depth = desc->comp[0].depth_minus1 + 1;
depth = desc->comp[0].depth;
if (depth == 8)
s->filter_slice = filter_slice8;
else

View File

@ -464,7 +464,7 @@ static int config_output(AVFilterLink *outlink)
s->hsub = pix_desc->log2_chroma_w;
s->vsub = pix_desc->log2_chroma_h;
is_16bit = pix_desc->comp[0].depth_minus1 == 15;
is_16bit = pix_desc->comp[0].depth == 16;
s->nb_planes = av_pix_fmt_count_planes(toplink->format);
if (s->tblend)

View File

@ -124,7 +124,7 @@ static int query_formats(AVFilterContext *ctx)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if (!(desc->flags & (AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_PAL)) &&
(desc->flags & AV_PIX_FMT_FLAG_PLANAR || desc->nb_components == 1) &&
(!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN || desc->comp[0].depth_minus1 == 7))
(!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN || desc->comp[0].depth == 8))
ff_add_format(&formats, fmt);
}
@ -351,7 +351,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int w[4] = { inlink->w, cw, cw, inlink->w };
int h[4] = { in->height, ch, ch, in->height };
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
const int depth = desc->comp[0].depth_minus1 + 1;
const int depth = desc->comp[0].depth;
const int pixsize = (depth+7)/8;
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);

View File

@ -103,7 +103,7 @@ static av_cold int config_output(AVFilterLink *outlink)
outlink->time_base = avctx->inputs[0]->time_base;
for (i = 0; i < 4; ++i)
ctx->co[i] = desc->comp[i].offset_plus1 - 1;
ctx->co[i] = desc->comp[i].offset;
return 0;
}

View File

@ -97,7 +97,7 @@ static int config_input(AVFilterLink *inlink)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
s->nb_comp = desc->nb_components;
s->bpp = (desc->comp[0].depth_minus1 + 1) >> 3;
s->bpp = desc->comp[0].depth >> 3;
s->step = (av_get_padded_bits_per_pixel(desc) >> 3) / s->bpp;
s->linesize = inlink->w * s->step;
ff_fill_rgba_map(s->rgba_map, inlink->format);

View File

@ -144,7 +144,7 @@ static int config_input(AVFilterLink *inlink)
av_image_fill_max_pixsteps(s->max_pixsteps, NULL, desc);
if (s->limit < 1.0)
s->limit *= (1 << (desc->comp[0].depth_minus1 + 1)) - 1;
s->limit *= (1 << desc->comp[0].depth) - 1;
s->x1 = inlink->w - 1;
s->y1 = inlink->h - 1;

View File

@ -223,12 +223,12 @@ static int config_input(AVFilterLink *inlink)
s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
s->planewidth[0] = s->planewidth[3] = inlink->w;
s->deband = desc->comp[0].depth_minus1 > 7 ? deband_16_c : deband_8_c;
s->deband = desc->comp[0].depth > 8 ? deband_16_c : deband_8_c;
s->thr[0] = ((1 << (desc->comp[0].depth_minus1 + 1)) - 1) * s->threshold[0];
s->thr[1] = ((1 << (desc->comp[1].depth_minus1 + 1)) - 1) * s->threshold[1];
s->thr[2] = ((1 << (desc->comp[2].depth_minus1 + 1)) - 1) * s->threshold[2];
s->thr[3] = ((1 << (desc->comp[3].depth_minus1 + 1)) - 1) * s->threshold[3];
s->thr[0] = ((1 << desc->comp[0].depth) - 1) * s->threshold[0];
s->thr[1] = ((1 << desc->comp[1].depth) - 1) * s->threshold[1];
s->thr[2] = ((1 << desc->comp[2].depth) - 1) * s->threshold[2];
s->thr[3] = ((1 << desc->comp[3].depth) - 1) * s->threshold[3];
s->x_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->x_pos));
s->y_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->y_pos));

View File

@ -239,7 +239,7 @@ static int config_input(AVFilterLink *inlink)
dm->hsub = pix_desc->log2_chroma_w;
dm->vsub = pix_desc->log2_chroma_h;
dm->depth = pix_desc->comp[0].depth_minus1 + 1;
dm->depth = pix_desc->comp[0].depth;
max_value = (1 << dm->depth) - 1;
dm->scthresh = (int64_t)(((int64_t)max_value * w * h * dm->scthresh_flt) / 100);
dm->dupthresh = (int64_t)(((int64_t)max_value * dm->blockx * dm->blocky * dm->dupthresh_flt) / 100);

View File

@ -111,17 +111,17 @@ static int query_formats(AVFilterContext *ctx)
avff = ctx->inputs[0]->in_formats;
desc = av_pix_fmt_desc_get(avff->formats[0]);
depth = desc->comp[0].depth_minus1;
depth = desc->comp[0].depth;
be = desc->flags & AV_PIX_FMT_FLAG_BE;
for (i = 1; i < avff->nb_formats; i++) {
desc = av_pix_fmt_desc_get(avff->formats[i]);
if (depth != desc->comp[0].depth_minus1 ||
if (depth != desc->comp[0].depth ||
be != (desc->flags & AV_PIX_FMT_FLAG_BE)) {
return AVERROR(EAGAIN);
}
}
if (depth == 7)
if (depth == 8)
out_pixfmts = out8_pixfmts;
else if (be)
out_pixfmts = out16be_pixfmts;
@ -152,7 +152,7 @@ static int config_input(AVFilterLink *inlink)
if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
return ret;
s->depth = (desc->comp[0].depth_minus1 + 1) >> 3;
s->depth = desc->comp[0].depth >> 3;
s->step = av_get_padded_bits_per_pixel(desc) >> 3;
s->is_packed = !(desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
(desc->nb_components > 1);

View File

@ -177,25 +177,25 @@ static int query_formats(AVFilterContext *ctx)
avff = ctx->inputs[0]->in_formats;
desc = av_pix_fmt_desc_get(avff->formats[0]);
rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
bits = desc->comp[0].depth_minus1;
bits = desc->comp[0].depth;
for (i = 1; i < avff->nb_formats; i++) {
desc = av_pix_fmt_desc_get(avff->formats[i]);
if ((rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB)) ||
(bits != desc->comp[0].depth_minus1))
(bits != desc->comp[0].depth))
return AVERROR(EAGAIN);
}
if (rgb && bits == 7)
if (rgb && bits == 8)
out_pix_fmts = levels_out_rgb8_pix_fmts;
else if (rgb && bits == 8)
out_pix_fmts = levels_out_rgb9_pix_fmts;
else if (rgb && bits == 9)
out_pix_fmts = levels_out_rgb9_pix_fmts;
else if (rgb && bits == 10)
out_pix_fmts = levels_out_rgb10_pix_fmts;
else if (bits == 7)
out_pix_fmts = levels_out_yuv8_pix_fmts;
else if (bits == 8)
out_pix_fmts = levels_out_yuv8_pix_fmts;
else if (bits == 9)
out_pix_fmts = levels_out_yuv9_pix_fmts;
else // if (bits == 9)
else // if (bits == 10)
out_pix_fmts = levels_out_yuv10_pix_fmts;
ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->in_formats);
@ -227,7 +227,7 @@ static int config_input(AVFilterLink *inlink)
h->desc = av_pix_fmt_desc_get(inlink->format);
h->ncomp = h->desc->nb_components;
h->histogram_size = 1 << (h->desc->comp[0].depth_minus1 + 1);
h->histogram_size = 1 << h->desc->comp[0].depth;
h->mult = h->histogram_size / 256;
switch (inlink->format) {

View File

@ -275,7 +275,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (!idet->csp)
idet->csp = av_pix_fmt_desc_get(link->format);
if (idet->csp->comp[0].depth_minus1 / 8 == 1){
if (idet->csp->comp[0].depth > 8){
idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit;
if (ARCH_X86)
ff_idet_init_x86(idet, 1);

View File

@ -213,7 +213,7 @@ static int config_props(AVFilterLink *inlink)
s->var_values[VAR_W] = inlink->w;
s->var_values[VAR_H] = inlink->h;
s->is_16bit = desc->comp[0].depth_minus1 > 7;
s->is_16bit = desc->comp[0].depth > 8;
switch (inlink->format) {
case AV_PIX_FMT_YUV410P:
@ -251,14 +251,14 @@ static int config_props(AVFilterLink *inlink)
case AV_PIX_FMT_YUVA420P16LE:
case AV_PIX_FMT_YUVA422P16LE:
case AV_PIX_FMT_YUVA444P16LE:
min[Y] = 16 * (1 << (desc->comp[0].depth_minus1 - 7));
min[U] = 16 * (1 << (desc->comp[1].depth_minus1 - 7));
min[V] = 16 * (1 << (desc->comp[2].depth_minus1 - 7));
min[Y] = 16 * (1 << (desc->comp[0].depth - 8));
min[U] = 16 * (1 << (desc->comp[1].depth - 8));
min[V] = 16 * (1 << (desc->comp[2].depth - 8));
min[A] = 0;
max[Y] = 235 * (1 << (desc->comp[0].depth_minus1 - 7));
max[U] = 240 * (1 << (desc->comp[1].depth_minus1 - 7));
max[V] = 240 * (1 << (desc->comp[2].depth_minus1 - 7));
max[A] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1;
max[Y] = 235 * (1 << (desc->comp[0].depth - 8));
max[U] = 240 * (1 << (desc->comp[1].depth - 8));
max[V] = 240 * (1 << (desc->comp[2].depth - 8));
max[A] = (1 << desc->comp[3].depth) - 1;
break;
default:
min[0] = min[1] = min[2] = min[3] = 0;
@ -294,7 +294,7 @@ static int config_props(AVFilterLink *inlink)
s->var_values[VAR_MAXVAL] = max[color];
s->var_values[VAR_MINVAL] = min[color];
for (val = 0; val < (1 << (desc->comp[0].depth_minus1 + 1)); val++) {
for (val = 0; val < (1 << desc->comp[0].depth); val++) {
s->var_values[VAR_VAL] = val;
s->var_values[VAR_CLIPVAL] = av_clip(val, min[color], max[color]);
s->var_values[VAR_NEGVAL] =

View File

@ -121,7 +121,7 @@ static int query_formats(AVFilterContext *ctx)
s->outdesc = av_pix_fmt_desc_get(s->out_fmt);
for (i = 0; av_pix_fmt_desc_get(i); i++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
if (desc->comp[0].depth_minus1 == s->outdesc->comp[0].depth_minus1 &&
if (desc->comp[0].depth == s->outdesc->comp[0].depth &&
av_pix_fmt_count_planes(i) == desc->nb_components)
ff_add_format(&formats, i);
}
@ -227,7 +227,7 @@ static int config_output(AVFilterLink *outlink)
inputp->nb_planes = av_pix_fmt_count_planes(inlink->format);
for (j = 0; j < inputp->nb_planes; j++)
inputp->depth[j] = indesc->comp[j].depth_minus1 + 1;
inputp->depth[j] = indesc->comp[j].depth;
in[i].time_base = inlink->time_base;
in[i].sync = 1;
@ -245,10 +245,10 @@ static int config_output(AVFilterLink *outlink)
input, plane);
goto fail;
}
if (s->outdesc->comp[i].depth_minus1 + 1 != inputp->depth[plane]) {
if (s->outdesc->comp[i].depth != inputp->depth[plane]) {
av_log(ctx, AV_LOG_ERROR, "output plane %d depth %d does not "
"match input %d plane %d depth %d\n",
i, s->outdesc->comp[i].depth_minus1 + 1,
i, s->outdesc->comp[i].depth,
input, plane, inputp->depth[plane]);
goto fail;
}

View File

@ -137,7 +137,7 @@ static int query_formats(AVFilterContext *ctx)
for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if (desc->flags & AV_PIX_FMT_FLAG_PLANAR && !((desc->comp[0].depth_minus1 + 1) & 7))
if (desc->flags & AV_PIX_FMT_FLAG_PLANAR && !(desc->comp[0].depth & 7))
ff_add_format(&formats, fmt);
}

View File

@ -251,10 +251,10 @@ static int config_input_ref(AVFilterLink *inlink)
return AVERROR(EINVAL);
}
s->max[0] = (1 << (desc->comp[0].depth_minus1 + 1)) - 1;
s->max[1] = (1 << (desc->comp[1].depth_minus1 + 1)) - 1;
s->max[2] = (1 << (desc->comp[2].depth_minus1 + 1)) - 1;
s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1;
s->max[0] = (1 << desc->comp[0].depth) - 1;
s->max[1] = (1 << desc->comp[1].depth) - 1;
s->max[2] = (1 << desc->comp[2].depth) - 1;
s->max[3] = (1 << desc->comp[3].depth) - 1;
s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0;
s->comps[0] = s->is_rgb ? 'r' : 'y' ;
@ -274,9 +274,9 @@ static int config_input_ref(AVFilterLink *inlink)
s->average_max += s->max[j] * s->planeweight[j];
}
s->dsp.sse_line = desc->comp[0].depth_minus1 > 7 ? sse_line_16bit : sse_line_8bit;
s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit;
if (ARCH_X86)
ff_psnr_init_x86(&s->dsp, desc->comp[0].depth_minus1 + 1);
ff_psnr_init_x86(&s->dsp, desc->comp[0].depth);
return 0;
}

View File

@ -331,7 +331,7 @@ static int config_input(AVFilterLink *inlink)
SPPContext *s = inlink->dst->priv;
const int h = FFALIGN(inlink->h + 16, 16);
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
const int bps = desc->comp[0].depth_minus1 + 1;
const int bps = desc->comp[0].depth;
av_opt_set_int(s->dct, "bits_per_sample", bps, 0);
avcodec_dct_init(s->dct);
@ -359,7 +359,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int qp_stride = 0;
const int8_t *qp_table = NULL;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
const int depth = desc->comp[0].depth_minus1 + 1;
const int depth = desc->comp[0].depth;
/* if we are not in a constant user quantizer mode and we don't want to use
* the quantizers from the B-frames (B-frames often have a higher QP), we

View File

@ -56,10 +56,10 @@ static int is_planar_yuv(const AVPixFmtDescriptor *desc)
if (desc->flags & ~(AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA) ||
desc->nb_components < 3 ||
(desc->comp[1].depth_minus1 != desc->comp[2].depth_minus1))
(desc->comp[1].depth != desc->comp[2].depth))
return 0;
for (i = 0; i < desc->nb_components; i++) {
if (desc->comp[i].offset_plus1 != 1 ||
if (desc->comp[i].offset != 0 ||
desc->comp[i].shift != 0 ||
desc->comp[i].plane != i)
return 0;

View File

@ -187,7 +187,7 @@ static int config_input(AVFilterLink *inlink)
static int config_output(AVFilterLink *outlink)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
const int depth = desc->comp[0].depth_minus1 + 1;
const int depth = desc->comp[0].depth;
VectorscopeContext *s = outlink->src->priv;
s->intensity = s->fintensity * ((1 << depth) - 1);

View File

@ -1172,7 +1172,7 @@ static int config_input(AVFilterLink *inlink)
s->desc = av_pix_fmt_desc_get(inlink->format);
s->ncomp = s->desc->nb_components;
s->bits = s->desc->comp[0].depth_minus1 + 1;
s->bits = s->desc->comp[0].depth;
s->max = 1 << s->bits;
s->intensity = s->fintensity * (s->max - 1);

View File

@ -62,7 +62,7 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
{
int cpu_flags = av_get_cpu_flags();
int bit_depth = (!yadif->csp) ? 8
: yadif->csp->comp[0].depth_minus1 + 1;
: yadif->csp->comp[0].depth;
if (bit_depth >= 15) {
#if ARCH_X86_32

View File

@ -117,7 +117,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if (img->split_planes) {
int ysize = codec->width * codec->height;
int usize = FF_CEIL_RSHIFT(codec->width, desc->log2_chroma_w) * FF_CEIL_RSHIFT(codec->height, desc->log2_chroma_h);
if (desc->comp[0].depth_minus1 >= 8) {
if (desc->comp[0].depth >= 9) {
ysize *= 2;
usize *= 2;
}

View File

@ -2058,7 +2058,7 @@ static int mxf_write_header(AVFormatContext *s)
sc->color_siting = 0xFF;
if (pix_desc) {
sc->component_depth = pix_desc->comp[0].depth_minus1 + 1;
sc->component_depth = pix_desc->comp[0].depth;
sc->h_chroma_sub_sample = 1 << pix_desc->log2_chroma_w;
}
switch (ff_choose_chroma_location(s, st)) {

View File

@ -2103,7 +2103,7 @@ int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
for (c = 0; c < pixdesc->nb_components; c++) {
const AVComponentDescriptor *comp = &pixdesc->comp[c];
int s = c == 1 || c == 2 ? 0 : log2_pixels;
steps[comp->plane] = (comp->step_minus1 + 1) << s;
steps[comp->plane] = comp->step << s;
}
for (c = 0; c < 4; c++)
bits += steps[c];
@ -2207,19 +2207,19 @@ void ff_check_pixfmt_descriptors(void){
for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
const AVComponentDescriptor *c = &d->comp[j];
if(j>=d->nb_components) {
av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1);
av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
continue;
}
if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
av_assert0(c->step_minus1 >= c->depth_minus1);
av_assert0(c->step >= c->depth);
} else {
av_assert0(8*(c->step_minus1+1) >= c->depth_minus1+1);
av_assert0(8*c->step >= c->depth);
}
if (!strncmp(d->name, "bayer_", 6))
continue;
av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
av_assert0(tmp[0] == 0 && tmp[1] == 0);
tmp[0] = tmp[1] = (1<<(c->depth_minus1 + 1)) - 1;
tmp[0] = tmp[1] = (1<<c->depth) - 1;
av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
}
}
@ -2286,8 +2286,8 @@ static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
*min = INT_MAX, *max = -INT_MAX;
for (i = 0; i < desc->nb_components; i++) {
*min = FFMIN(desc->comp[i].depth_minus1+1, *min);
*max = FFMAX(desc->comp[i].depth_minus1+1, *max);
*min = FFMIN(desc->comp[i].depth, *min);
*max = FFMAX(desc->comp[i].depth, *max);
}
return 0;
}
@ -2325,8 +2325,8 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
for (i = 0; i < nb_components; i++) {
int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : dst_desc->comp[i].depth_minus1;
if (src_desc->comp[i].depth_minus1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
loss |= FF_LOSS_DEPTH;
score -= 65536 >> depth_minus1;
}
@ -2376,7 +2376,7 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
break;
}
if(loss & FF_LOSS_COLORSPACE)
score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth_minus1, src_desc->comp[0].depth_minus1);
score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
if (dst_color == FF_COLOR_GRAY &&
src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {

View File

@ -28,20 +28,20 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
int nb_components = desc->nb_components;
int plane, x, y;
int plane_count = isGray(c->srcFormat) ? 1 : 3;
int sixteen_bits = desc->comp[0].depth_minus1 >= 8;
unsigned off = 1<<desc->comp[0].depth_minus1;
unsigned shift = desc->comp[0].depth_minus1 + 1;
int sixteen_bits = desc->comp[0].depth >= 9;
unsigned off = 1<<(desc->comp[0].depth - 1);
unsigned shift = desc->comp[0].depth;
unsigned max = (1<<shift) - 1;
int target_table[2][3];
for (plane = 0; plane < plane_count; plane++) {
int a = 0, b = 0;
if (c->alphablend == SWS_ALPHA_BLEND_CHECKERBOARD) {
a = (1<<desc->comp[0].depth_minus1)/2;
b = 3*(1<<desc->comp[0].depth_minus1)/2;
a = (1<<(desc->comp[0].depth - 1))/2;
b = 3*(1<<(desc->comp[0].depth-1))/2;
}
target_table[0][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<desc->comp[0].depth_minus1 : a;
target_table[1][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<desc->comp[0].depth_minus1 : b;
target_table[0][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<(desc->comp[0].depth - 1) : a;
target_table[1][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<(desc->comp[0].depth - 1) : b;
}
av_assert0(plane_count == nb_components - 1);
@ -125,7 +125,7 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
}
}
} else {
int alpha_pos = desc->comp[plane_count].offset_plus1 - 1;
int alpha_pos = desc->comp[plane_count].offset;
int w = c->srcW;
for (y = srcSliceY; y < srcSliceH; y++) {
if (sixteen_bits) {

View File

@ -2076,13 +2076,13 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
if (desc->comp[0].depth == 9) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
} else if (desc->comp[0].depth_minus1 == 9) {
} else if (desc->comp[0].depth == 10) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
} else if (desc->comp[0].depth_minus1 == 11) {
} else if (desc->comp[0].depth == 12) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
} else if (desc->comp[0].depth_minus1 == 13) {
} else if (desc->comp[0].depth == 14) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
} else

View File

@ -90,7 +90,7 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW,
int bits = desc->comp[0].depth - 1;
int sh = bits - 4;
if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth_minus1<15)
if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16)
sh= 9;
for (i = 0; i < dstW; i++) {
@ -116,7 +116,7 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW,
int sh = desc->comp[0].depth - 1;
if(sh<15)
sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : desc->comp[0].depth_minus1;
sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
for (i = 0; i < dstW; i++) {
int j;

View File

@ -554,7 +554,7 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[],
int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] };
const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);
const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat);
int bpc = dst_format->comp[0].depth_minus1 + 1;
int bpc = dst_format->comp[0].depth;
int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;
int swap = 0;
if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||
@ -725,7 +725,7 @@ static int planarRgb16ToRgb16Wrapper(SwsContext *c, const uint8_t *src[],
int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);
const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat);
int bits_per_sample = src_format->comp[0].depth_minus1 + 1;
int bits_per_sample = src_format->comp[0].depth;
int swap = 0;
if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||
!HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE)

View File

@ -1691,7 +1691,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
// try to avoid drawing green stuff between the right end and the stride end
for (i = 0; i < c->vChrBufSize; i++)
if(desc_dst->comp[0].depth_minus1 == 15){
if(desc_dst->comp[0].depth == 16){
av_assert0(c->dstBpc > 14);
for(j=0; j<dst_stride/2+1; j++)
((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18;

View File

@ -434,7 +434,7 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c)
} else if (c->srcBpc == 12) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
ff_hscale12to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth_minus1<15)) { \
} else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \
hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
ff_hscale14to19_ ## filtersize ## _ ## opt1; \
} else { /* c->srcBpc == 16 */ \