|
@@ -179,8 +179,8 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
|
|
|
{
|
|
|
s->coded_width = width;
|
|
|
s->coded_height = height;
|
|
|
- s->width = -((-width ) >> s->lowres);
|
|
|
- s->height = -((-height) >> s->lowres);
|
|
|
+ s->width = FF_CEIL_RSHIFT(width, s->lowres);
|
|
|
+ s->height = FF_CEIL_RSHIFT(height, s->lowres);
|
|
|
}
|
|
|
|
|
|
#if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMX
|
|
@@ -573,8 +573,9 @@ void avpriv_color_frame(AVFrame *frame, const int c[4])
|
|
|
for (p = 0; p<desc->nb_components; p++) {
|
|
|
uint8_t *dst = frame->data[p];
|
|
|
int is_chroma = p == 1 || p == 2;
|
|
|
- int bytes = -((-frame->width) >> (is_chroma ? desc->log2_chroma_w : 0));
|
|
|
- for (y = 0; y<-((-frame->height) >> (is_chroma ? desc->log2_chroma_h : 0)); y++){
|
|
|
+ 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) {
|
|
|
for (x = 0; x<bytes; x++)
|
|
|
((uint16_t*)dst)[x] = c[p];
|
|
@@ -623,8 +624,8 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
|
|
|
|
|
|
switch (avctx->codec->type) {
|
|
|
case AVMEDIA_TYPE_VIDEO:
|
|
|
- frame->width = FFMAX(avctx->width , -((-avctx->coded_width )>>avctx->lowres));
|
|
|
- frame->height = FFMAX(avctx->height, -((-avctx->coded_height)>>avctx->lowres));
|
|
|
+ frame->width = FFMAX(avctx->width, FF_CEIL_RSHIFT(avctx->coded_width, avctx->lowres));
|
|
|
+ frame->height = FFMAX(avctx->height, FF_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
|
|
|
if (frame->format < 0)
|
|
|
frame->format = avctx->pix_fmt;
|
|
|
if (!frame->sample_aspect_ratio.num)
|