A computer-implemented method for data processing in a band offset mode of sample adaptive offset, comprising: acquiring a target reconstructed image, and dividing the target reconstructed image into a plurality of non-overlapping coding tree blocks; traversing all reconstructed pixels in each coding tree block, calculating, in a sequence, a band value of each traversed reconstructed pixel, and calculating, in the sequence, a residual value between each traversed reconstructed pixel and a corresponding original pixel; storing, in the sequence, the calculated band value of each reconstructed pixel in a first array, and storing, in the sequence, the calculated residual value between each reconstructed pixel and the corresponding original pixel in a second array; determining whether m consecutive band values in the first array belong to a same band, wherein m is an integer greater than or equal to 2; in response to determining that the m consecutive band values in the first array belong to the same band, calculating, at once based on the residual values in the second array of m reconstructed pixels corresponding to the m consecutive band values, a first cumulative residual value of the m reconstructed pixels corresponding to the m consecutive band values, and calculating a first cumulative number of the m reconstructed pixels; adding the first cumulative residual value to a sum variable of said same band, and adding the first cumulative number to a count variable of said same band; and performing a pixel compensation on the target reconstructed image based on the sum variable and the count variable; characterized in that: in response to determining that the m consecutive band values in the first array do not belong to the same band, further determining whether n consecutive band values of the m consecutive band values belong to the same band, wherein n < m and n is an integer greater than or equal to 2; in response to determining that the n consecutive band values belong to the same band, calculating, at once based on the residual values in the second array of n reconstructed pixels corresponding to the n consecutive band values, a second cumulative residual value of the n reconstructed pixels, and calculating a second cumulative number of the n reconstructed pixels; and adding the second cumulative residual value to the sum variable of said same band, and adding the second cumulative number to the count variable of said same band. acquiring a target reconstructed image, and dividing the target reconstructed image into a plurality of non-overlapping coding tree blocks; traversing all reconstructed pixels in each coding tree block, calculating, in a sequence, a band value of each traversed reconstructed pixel, and calculating, in the sequence, a residual value between each traversed reconstructed pixel and a corresponding original pixel; storing, in the sequence, the calculated band value of each reconstructed pixel in a first array, and storing, in the sequence, the calculated residual value between each reconstructed pixel and the corresponding original pixel in a second array; determining whether m consecutive band values in the first array belong to a same band, wherein m is an integer greater than or equal to 2; in response to determining that the m consecutive band values in the first array belong to the same band, calculating, at once based on the residual values in the second array of m reconstructed pixels corresponding to the m consecutive band values, a first cumulative residual value of the m reconstructed pixels corresponding to the m consecutive band values, and calculating a first cumulative number of the m reconstructed pixels; adding the first cumulative residual value to a sum variable of said same band, and adding the first cumulative number to a count variable of said same band; and performing a pixel compensation on the target reconstructed image based on the sum variable and the count variable; characterized in that: in response to determining that the m consecutive band values in the first array do not belong to the same band, further determining whether n consecutive band values of the m consecutive band values belong to the same band, wherein n < m and n is an integer greater than or equal to 2; in response to determining that the n consecutive band values belong to the same band, calculating, at once based on the residual values in the second array of n reconstructed pixels corresponding to the n consecutive band values, a second cumulative residual value of the n reconstructed pixels, and calculating a second cumulative number of the n reconstructed pixels; and adding the second cumulative residual value to the sum variable of said same band, and adding the second cumulative number to the count variable of said same band. in response to determining that the m consecutive band values in the first array do not belong to the same band, further determining whether n consecutive band values of the m consecutive band values belong to the same band, wherein n < m and n is an integer greater than or equal to 2; in response to determining that the n consecutive band values belong to the same band, calculating, at once based on the residual values in the second array of n reconstructed pixels corresponding to the n consecutive band values, a second cumulative residual value of the n reconstructed pixels, and calculating a second cumulative number of the n reconstructed pixels; and adding the second cumulative residual value to the sum variable of said same band, and adding the second cumulative number to the count variable of said same band.