/**
* @file intrax8.c
- * @brief IntraX8 (J-Frame) sub-decoder, used by wmv2 and vc1
+ * @brief IntraX8 (J-Frame) subdecoder, used by WMV2 and VC-1
*/
#include "avcodec.h"
i==20-21 r=0-1 l=2 ;r=i& %00001
i==22 r=0 l=3 ;r=i& %00000
l=lut_l[i/2]={0,0,0,0,0,0,0,0,1,1,2,3}[i>>1];// 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000
-t=lut_mask[l]={0x0f,0x03,0x01,0x00}[l]; as i<256 the higher bits doesn't matter */
+t=lut_mask[l]={0x0f,0x03,0x01,0x00}[l]; as i<256 the higher bits do not matter */
l=(0xE50000>>(i&(0x1E)))&3;/*0x1E or (~1) or ((i>>1)<<1)*/
t=(0x01030F>>(l<<3));
w->flat_dc=0;
if(range < quant || range < 3){
w->orient=0;
- if(range < 3){//yep you read right, idct error of +-1 may break decoding!
+ if(range < 3){//yep you read right, a +-1 idct error may break decoding!
w->flat_dc=1;
sum+=9;
w->predicted_dc = (sum*6899)>>17;//((1<<17)+9)/(8+8+1+2)=6899
w->orient = 0;
return;
}
- //no edge cases.
+ //no edge cases
b= w->prediction_table[2*s->mb_x + !(s->mb_y&1) ];//block[x ][y-1]
a= w->prediction_table[2*s->mb_x-2 + (s->mb_y&1) ];//block[x-1][y ]
c= w->prediction_table[2*s->mb_x-2 + !(s->mb_y&1) ];//block[x-1][y-1]
w->est_run = FFMIN(b,a);
- /*this condition has nothing to do with w->edges, even if it looks similar
- it would triger if e.g. x=3;y=2;
- I guess somebody wrote something wrong and it became standard */
+ /* This condition has nothing to do with w->edges, even if it looks
+ similar it would trigger if e.g. x=3;y=2;
+ I guess somebody wrote something wrong and it became standard. */
if( (s->mb_x & s->mb_y) != 0 ) w->est_run=FFMIN(c,w->est_run);
w->est_run>>=2;
static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*
//not s->linesize as this would be wrong for field pics
-//not that IntraX8 have interlace support ;)
+//not that IntraX8 has interlacing support ;)
const int linesize = s->current_picture.linesize[0];
const int uvlinesize= s->current_picture.linesize[1];
/**
* Decode single IntraX8 frame.
* The parent codec must fill s->loopfilter and s->gb (bitstream).
- * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function
+ * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.
* The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.
* This function does not use MPV_decode_mb().
* lowres decoding is theoretically impossible.
* @param w pointer to IntraX8Context
- * @param dquant doubled quantizer, it would be odd in case of vc1 halfpq==1
- * @param quant_offset offset away from zero.
+ * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
+ * @param quant_offset offset away from zero
*/
//FIXME extern uint8_t wmv3_dc_scale_table[32];
int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_offset){
x8_get_prediction_chroma(w);
/*when setting up chroma, no vlc is read,
- so no error condition could be reached*/
+ so no error condition can be reached*/
x8_setup_spatial_predictor(w,1);
if(x8_decode_intra_mb(w,1)) goto error;
/**
* @file intrax8dsp.c
- *@brief IntraX8 frame sub-decoder image manipulation routines
- *
+ *@brief IntraX8 frame subdecoder image manipulation routines
*/
#include "dsputil.h"
#define area6 (8+8+1+16)
/**
- Collect statistics and prepare the edge pixels required by the other spacial compensation functions.
+ Collect statistics and prepare the edge pixels required by the other spatial compensation functions.
* @param src pointer to the beginning of the processed block
- * @param dst pointer to emu_edge, edge pixels are stored in way other compensation routines use.
+ * @param dst pointer to emu_edge, edge pixels are stored the way other compensation routines do.
* @param linesize byte offset between 2 vertical pixels in the source image
- * @param range pointer to the variable where the range of edge pixels is to be stored (max-min values)
- * @param psum pointer to the variable where the sum of edge pixels is to be stored
- * @param edges informs this routine that the block is on image border, so it have to interpolate the missing edge pixels.
- and some of the edge pixels should be interpolated, flag have following meaning:
+ * @param range pointer to the variable where the edge pixel range is to be stored (max-min values)
+ * @param psum pointer to the variable where the edge pixel sum is to be stored
+ * @param edges Informs this routine that the block is on an image border, so it has to interpolate the missing edge pixels.
+ and some of the edge pixels should be interpolated, the flag has the following meaning:
1 - mb_x==0 - first block in the row, interpolate area #1,#2,#3;
2 - mb_y==0 - first row, interpolate area #3,#4,#5,#6;
note: 1|2 - mb_x==mb_y==0 - first block, use 0x80 value for all areas;
- 4 - mb_x>= (mb_width-1) last block on the row, interpolate area #5;
+ 4 - mb_x>= (mb_width-1) last block in the row, interpolate area #5;
*/
static void x8_setup_spacial_compensation(uint8_t *src, uint8_t *dst, int linesize,
int * range, int * psum, int edges){
}
memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block
}
-//now calc the stuff we need
+ //now calculate the stuff we need
if(edges&3){//mb_x==0 || mb_y==0){
int avg=(sum+4)>>3;
if(edges&1){ //(mb_x==0) {//implies mb_y!=0
}
sum+=avg*9;
}else{
- uint8_t c=*(src-1-linesize);//the edge pixel,in the top line and left column
+ uint8_t c=*(src-1-linesize);//the edge pixel, in the top line and left column
dst[area3]=c;
sum+=c;
//edge pixel is not part of min/max
(FFABS(p2-p3) <= ql) +
(FFABS(p3-p4) <= ql) +
(FFABS(p4-p5) <= ql);
- if(t>0){//you need at least 1 to be able to reach total score of 6.
+ if(t>0){//You need at least 1 to be able to reach a total score of 6.
t+=
(FFABS(p5-p6) <= ql) +
(FFABS(p6-p7) <= ql) +