comparison mpegvideo.c @ 1411:c2e63cb94d06 libavcodec

custom quant matrix encoding support
author michaelni
date Fri, 22 Aug 2003 22:18:08 +0000
parents f662e9c86cf2
children 8edad1e372d1
comparison
equal deleted inserted replaced
1410:524c904a66b8 1411:c2e63cb94d06
163 int j; 163 int j;
164 j = st->permutated[i]; 164 j = st->permutated[i];
165 if(j>end) end=j; 165 if(j>end) end=j;
166 st->raster_end[i]= end; 166 st->raster_end[i]= end;
167 } 167 }
168 }
169
170 void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
171 int i;
172
173 if(matrix){
174 put_bits(pb, 1, 1);
175 for(i=0;i<64;i++) {
176 put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]);
177 }
178 }else
179 put_bits(pb, 1, 0);
168 } 180 }
169 181
170 /* init common dct for both encoder and decoder */ 182 /* init common dct for both encoder and decoder */
171 int DCT_common_init(MpegEncContext *s) 183 int DCT_common_init(MpegEncContext *s)
172 { 184 {
810 #endif 822 #endif
811 { /* mpeg1 */ 823 { /* mpeg1 */
812 s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; 824 s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i];
813 s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; 825 s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
814 } 826 }
827 if(s->avctx->intra_matrix)
828 s->intra_matrix[j] = s->avctx->intra_matrix[i];
829 if(s->avctx->inter_matrix)
830 s->inter_matrix[j] = s->avctx->inter_matrix[i];
815 } 831 }
816 832
817 /* precompute matrix */ 833 /* precompute matrix */
818 /* for mjpeg, we do include qscale in the matrix */ 834 /* for mjpeg, we do include qscale in the matrix */
819 if (s->out_format != FMT_MJPEG) { 835 if (s->out_format != FMT_MJPEG) {