MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / encode_rgb_frame

Function encode_rgb_frame

libavcodec/ffv1.c:539–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537}
538
539static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
540 int x, y, p, i;
541 const int ring_size= s->avctx->context_model ? 3 : 2;
542 int_fast16_t sample_buffer[3][ring_size][w+6], *sample[3][ring_size];
543 s->run_index=0;
544
545 memset(sample_buffer, 0, sizeof(sample_buffer));
546
547 for(y=0; y<h; y++){
548 for(i=0; i<ring_size; i++)
549 for(p=0; p<3; p++)
550 sample[p][i]= sample_buffer[p][(h+i-y)%ring_size]+3;
551
552 for(x=0; x<w; x++){
553 int v= src[x + stride*y];
554 int b= v&0xFF;
555 int g= (v>>8)&0xFF;
556 int r= (v>>16)&0xFF;
557
558 b -= g;
559 r -= g;
560 g += (b + r)>>2;
561 b += 0x100;
562 r += 0x100;
563
564// assert(g>=0 && b>=0 && r>=0);
565// assert(g<256 && b<512 && r<512);
566 sample[0][0][x]= g;
567 sample[1][0][x]= b;
568 sample[2][0][x]= r;
569 }
570 for(p=0; p<3; p++){
571 sample[p][0][-1]= sample[p][1][0 ];
572 sample[p][1][ w]= sample[p][1][w-1];
573 encode_line(s, w, sample[p], FFMIN(p, 1), 9);
574 }
575 }
576}
577
578static void write_quant_table(RangeCoder *c, int16_t *quant_table){
579 int last=0;

Callers 1

encode_frameFunction · 0.85

Calls 1

encode_lineFunction · 0.85

Tested by

no test coverage detected