|
|
|
@ -1146,6 +1146,7 @@ static int encode_slice(AVCodecContext *c, void *arg){ |
|
|
|
|
int x= fs->slice_x; |
|
|
|
|
int y= fs->slice_y; |
|
|
|
|
AVFrame * const p= &f->picture; |
|
|
|
|
const int ps= (c->bits_per_raw_sample>8)+1; |
|
|
|
|
|
|
|
|
|
if(f->colorspace==0){ |
|
|
|
|
const int chroma_width = -((-width )>>f->chroma_h_shift); |
|
|
|
@ -1153,12 +1154,12 @@ static int encode_slice(AVCodecContext *c, void *arg){ |
|
|
|
|
const int cx= x>>f->chroma_h_shift; |
|
|
|
|
const int cy= y>>f->chroma_v_shift; |
|
|
|
|
|
|
|
|
|
encode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0); |
|
|
|
|
encode_plane(fs, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0); |
|
|
|
|
|
|
|
|
|
encode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); |
|
|
|
|
encode_plane(fs, p->data[2] + cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1); |
|
|
|
|
encode_plane(fs, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); |
|
|
|
|
encode_plane(fs, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1); |
|
|
|
|
}else{ |
|
|
|
|
encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); |
|
|
|
|
encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + ps*x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); |
|
|
|
|
} |
|
|
|
|
emms_c(); |
|
|
|
|
|
|
|
|
@ -1475,6 +1476,7 @@ static int decode_slice(AVCodecContext *c, void *arg){ |
|
|
|
|
int height= fs->slice_height; |
|
|
|
|
int x= fs->slice_x; |
|
|
|
|
int y= fs->slice_y; |
|
|
|
|
const int ps= (c->bits_per_raw_sample>8)+1; |
|
|
|
|
AVFrame * const p= &f->picture; |
|
|
|
|
|
|
|
|
|
av_assert1(width && height); |
|
|
|
@ -1483,12 +1485,12 @@ static int decode_slice(AVCodecContext *c, void *arg){ |
|
|
|
|
const int chroma_height= -((-height)>>f->chroma_v_shift); |
|
|
|
|
const int cx= x>>f->chroma_h_shift; |
|
|
|
|
const int cy= y>>f->chroma_v_shift; |
|
|
|
|
decode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0); |
|
|
|
|
decode_plane(fs, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0); |
|
|
|
|
|
|
|
|
|
decode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); |
|
|
|
|
decode_plane(fs, p->data[2] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[2], 1); |
|
|
|
|
decode_plane(fs, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); |
|
|
|
|
decode_plane(fs, p->data[2] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[2], 1); |
|
|
|
|
}else{ |
|
|
|
|
decode_rgb_frame(fs, (uint32_t*)p->data[0] + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); |
|
|
|
|
decode_rgb_frame(fs, (uint32_t*)p->data[0] + ps*x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
emms_c(); |
|
|
|
|